diff options
| author | Thomas Wickham <mackwic@gmail.com> | 2016-01-31 12:26:15 +0100 |
|---|---|---|
| committer | Thomas Wickham <mackwic@gmail.com> | 2016-01-31 12:26:15 +0100 |
| commit | a0cd46554d850d99f985be911215ac41978533a2 (patch) | |
| tree | d129215a66ee6f929843ae4816d78ea7f6445b0a /src/libcore | |
| parent | 6cda8e4eaac843471dd33d93d9d5cc892d29cc4c (diff) | |
| download | rust-a0cd46554d850d99f985be911215ac41978533a2.tar.gz rust-a0cd46554d850d99f985be911215ac41978533a2.zip | |
Doc:std::convert: disambiguate traits and keywords
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/convert.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index f67bfe34e8f..c207ad16595 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -17,13 +17,13 @@ //! Like many traits, these are often used as bounds for generic functions, to //! support arguments of multiple types. //! -//! - Use `as` for reference-to-reference conversions -//! - Use `into` when you want to consume the value -//! - `from` is the more flexible way, which can convert values and references +//! - Impl the `As*` traits for reference-to-reference conversions +//! - Impl the `Into` trait when you want to consume the value in the conversion +//! - The `From` trait is the most flexible, usefull for values _and_ references conversions //! //! As a library writer, you should prefer implementing `From<T>` rather than //! `Into<U>`, as `From` provides greater flexibility and offer the equivalent `Into` -//! implementation for free thanks to a blanket implementation in the standard library. +//! implementation for free, thanks to a blanket implementation in the standard library. //! //! **Note: these traits must not fail**. If the conversion can fail, you must use a dedicated //! method which return an `Option<T>` or a `Result<T, E>`. @@ -103,7 +103,7 @@ pub trait AsMut<T: ?Sized> { /// /// Library writer should not implement directly this trait, but should prefer the implementation /// of the `From` trait, which offer greater flexibility and provide the equivalent `Into` -/// implementation for free thanks to a blanket implementation in the standard library. +/// implementation for free, thanks to a blanket implementation in the standard library. /// /// # Examples /// @@ -119,7 +119,7 @@ pub trait AsMut<T: ?Sized> { /// is_hello(s); /// ``` /// -/// #Generic Impls +/// # Generic Impls /// /// - `From<T> for U` implies `Into<U> for T` /// - `into()` is reflexive, which means that `Into<T> for T` is implemented |
