@@ -101,7 +101,7 @@ pub const fn identity<T>(x: T) -> T { x }
101
101
/// Used to do a cheap reference-to-reference conversion.
102
102
/// This trait is similar to [`AsMut`] which is used for converting between mutable references.
103
103
/// If you need to do a costly conversion it is better to implement [`From`] with type
104
- /// ```&T`` ` or write a custom function.
104
+ /// `&T ` or write a custom function.
105
105
///
106
106
///
107
107
/// `AsRef` is very similar to, but serves a slightly different purpose than [`Borrow`]:
@@ -126,8 +126,8 @@ pub const fn identity<T>(x: T) -> T { x }
126
126
/// # Examples
127
127
///
128
128
/// By using trait bounds we can accept arguments of different types as long as they can be
129
- /// converted a the specified type ```T`` `.
130
- /// For example: By creating a generic function that takes an ``` AsRef<str>`` ` we express that we
129
+ /// converted a the specified type `T `.
130
+ /// For example: By creating a generic function that takes an `AsRef<str>` we express that we
131
131
/// want to accept all references that can be converted to &str as an argument.
132
132
/// Since both [`String`] and `&str` implement `AsRef<str>` we can accept both as input argument.
133
133
///
@@ -155,7 +155,7 @@ pub trait AsRef<T: ?Sized> {
155
155
/// Used to do a cheap mutable-to-mutable reference conversion.
156
156
/// This trait is similar to [`AsRef`] but used for converting between mutable
157
157
/// references. If you need to do a costly conversion it is better to
158
- /// implement [`From`] with type ``` &mut T`` ` or write a custom function.
158
+ /// implement [`From`] with type `&mut T` or write a custom function.
159
159
///
160
160
/// **Note: This trait must not fail**. If the conversion can fail, use a
161
161
/// dedicated method which returns an [`Option<T>`] or a [`Result<T, E>`].
@@ -171,11 +171,11 @@ pub trait AsRef<T: ?Sized> {
171
171
///
172
172
/// # Examples
173
173
///
174
- /// Using ``` AsMut`` ` as trait bound for a generic function we can accept all mutable references
175
- /// that can be converted to type ``` &mut T``` . Because [`Box<T>`] implements ``` AsMut<T>`` ` we can
176
- /// write a function ``` add_one``` that takes all arguments that can be converted to ``` &mut u64`` `.
177
- /// Because [`Box<T>`] implements ``` AsMut<T>``` ``` add_one`` ` accepts arguments of type
178
- /// ``` &mut Box<u64>`` ` as well:
174
+ /// Using `AsMut` as trait bound for a generic function we can accept all mutable references
175
+ /// that can be converted to type `&mut T`. Because [`Box<T>`] implements `AsMut<T>` we can
176
+ /// write a function `add_one`that takes all arguments that can be converted to `&mut u64`.
177
+ /// Because [`Box<T>`] implements `AsMut<T>` ` add_one` accepts arguments of type
178
+ /// `&mut Box<u64>` as well:
179
179
/// ```
180
180
/// fn add_one<T: AsMut<u64>>(num: &mut T) {
181
181
/// *num.as_mut() += 1;
@@ -236,20 +236,20 @@ pub trait AsMut<T: ?Sized> {
236
236
/// }
237
237
/// ```
238
238
///
239
- /// It is important to understand that ``` Into`` ` does not provide a [`From`] implementation
240
- /// (as [`From`] does with ``` Into`` `). Therefore, you should always try to implement [`From`]
239
+ /// It is important to understand that `Into` does not provide a [`From`] implementation
240
+ /// (as [`From`] does with `Into`). Therefore, you should always try to implement [`From`]
241
241
/// and then fall back to `Into` if [`From`] can't be implemented.
242
- /// Prefer using ``` Into``` over ``` From``` when specifying trait bounds on a generic function
243
- /// to ensure that types that only implement ``` Into`` ` can be used as well.
242
+ /// Prefer using `Into` over [` From`] when specifying trait bounds on a generic function
243
+ /// to ensure that types that only implement `Into` can be used as well.
244
244
///
245
245
/// # Examples
246
246
///
247
247
/// [`String`] implements `Into<Vec<u8>>`:
248
248
///
249
249
/// In order to express that we want a generic function to take all arguments that can be
250
- /// converted to a specified type ```T``` , we can use a trait bound of ``` Into<T>`` `.
251
- /// For example: The function ``` is_hello`` ` takes all arguments that can be converted into a
252
- /// ``` Vec<u8>`` `.
250
+ /// converted to a specified type `T` , we can use a trait bound of `Into<T>`.
251
+ /// For example: The function `is_hello` takes all arguments that can be converted into a
252
+ /// `Vec<u8>`.
253
253
///
254
254
/// ```
255
255
/// fn is_hello<T: Into<Vec<u8>>>(s: T) {
@@ -312,13 +312,13 @@ pub trait Into<T>: Sized {
312
312
/// assert_eq!(string, other_string);
313
313
/// ```
314
314
///
315
- /// While performing error handling it is often useful to implement ``` From`` `
315
+ /// While performing error handling it is often useful to implement `From`
316
316
/// for your own error type. By converting underlying error types to our own custom error type
317
317
/// that encapsulates the underlying error type, we can return a single error type
318
318
/// without losing information on the underlying cause. The '?' operator automatically converts
319
- /// the underlying error type to our custom error type by calling ``` Into<CliError>::into`` `
320
- /// which is automatically provided when implementing ``` From`` `.
321
- /// The compiler then infers which implementation of ``` Into`` ` should be used.
319
+ /// the underlying error type to our custom error type by calling `Into<CliError>::into`
320
+ /// which is automatically provided when implementing `From`.
321
+ /// The compiler then infers which implementation of `Into` should be used.
322
322
///
323
323
/// ```
324
324
/// use std::fs;
0 commit comments