17
17
//! Like many traits, these are often used as bounds for generic functions, to
18
18
//! support arguments of multiple types.
19
19
//!
20
- //! - Use `as` for reference-to-reference conversions
21
- //! - Use `into` when you want to consume the value
22
- //! - `from` is the more flexible way, which can convert values and references
20
+ //! - Impl the `As*` traits for reference-to-reference conversions
21
+ //! - Impl the `Into` trait when you want to consume the value in the conversion
22
+ //! - The `From` trait is the most flexible, usefull for values _and_ references conversions
23
23
//!
24
24
//! As a library writer, you should prefer implementing `From<T>` rather than
25
25
//! `Into<U>`, as `From` provides greater flexibility and offer the equivalent `Into`
26
- //! implementation for free thanks to a blanket implementation in the standard library.
26
+ //! implementation for free, thanks to a blanket implementation in the standard library.
27
27
//!
28
28
//! **Note: these traits must not fail**. If the conversion can fail, you must use a dedicated
29
29
//! method which return an `Option<T>` or a `Result<T, E>`.
@@ -103,7 +103,7 @@ pub trait AsMut<T: ?Sized> {
103
103
///
104
104
/// Library writer should not implement directly this trait, but should prefer the implementation
105
105
/// of the `From` trait, which offer greater flexibility and provide the equivalent `Into`
106
- /// implementation for free thanks to a blanket implementation in the standard library.
106
+ /// implementation for free, thanks to a blanket implementation in the standard library.
107
107
///
108
108
/// # Examples
109
109
///
@@ -119,7 +119,7 @@ pub trait AsMut<T: ?Sized> {
119
119
/// is_hello(s);
120
120
/// ```
121
121
///
122
- /// #Generic Impls
122
+ /// # Generic Impls
123
123
///
124
124
/// - `From<T> for U` implies `Into<U> for T`
125
125
/// - `into()` is reflexive, which means that `Into<T> for T` is implemented
0 commit comments