fixup! docs: Improve AsRef / AsMut docs on blanket impls
Fixed examples in sections "Generic Implementations" of `AsRef`'s and `AsMut`'s doc comments, which failed tests.
This commit is contained in:
parent
551d921de0
commit
9f68e3ef1b
@ -150,6 +150,14 @@ pub const fn identity<T>(x: T) -> T {
|
|||||||
/// follows:
|
/// follows:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # use core::ops::Deref;
|
||||||
|
/// # struct SomeType;
|
||||||
|
/// # impl Deref for SomeType {
|
||||||
|
/// # type Target = [u8];
|
||||||
|
/// # fn deref(&self) -> &[u8] {
|
||||||
|
/// # &[]
|
||||||
|
/// # }
|
||||||
|
/// # }
|
||||||
/// impl<T> AsRef<T> for SomeType
|
/// impl<T> AsRef<T> for SomeType
|
||||||
/// where
|
/// where
|
||||||
/// T: ?Sized,
|
/// T: ?Sized,
|
||||||
@ -245,6 +253,19 @@ pub trait AsRef<T: ?Sized> {
|
|||||||
/// implementation of `AsMut` as follows:
|
/// implementation of `AsMut` as follows:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # use core::ops::{Deref, DerefMut};
|
||||||
|
/// # struct SomeType;
|
||||||
|
/// # impl Deref for SomeType {
|
||||||
|
/// # type Target = [u8];
|
||||||
|
/// # fn deref(&self) -> &[u8] {
|
||||||
|
/// # &[]
|
||||||
|
/// # }
|
||||||
|
/// # }
|
||||||
|
/// # impl DerefMut for SomeType {
|
||||||
|
/// # fn deref_mut(&mut self) -> &mut [u8] {
|
||||||
|
/// # &mut []
|
||||||
|
/// # }
|
||||||
|
/// # }
|
||||||
/// impl<T> AsMut<T> for SomeType
|
/// impl<T> AsMut<T> for SomeType
|
||||||
/// where
|
/// where
|
||||||
/// <SomeType as Deref>::Target: AsMut<T>,
|
/// <SomeType as Deref>::Target: AsMut<T>,
|
||||||
|
Loading…
Reference in New Issue
Block a user