FromRef docs
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo clippy (1.65) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.

This commit is contained in:
AF 2023-09-25 01:18:52 +00:00
parent 48e7fb7047
commit d74c46bc06

View File

@ -71,7 +71,11 @@ impl<A, E, I: Stream> StreamResultExt<A, E> for Result<(A, I), E> {
} }
} }
/// [`From`] for references (of any lifetime).
pub trait FromRef<T: ?Sized>: for<'a> From<&'a T> { pub trait FromRef<T: ?Sized>: for<'a> From<&'a T> {
/// [`From::from(&'a T)`] but without specific `'a`.
///
/// [`From::from(&'a T)`]: From::from
fn from_ref(value: &T) -> Self { fn from_ref(value: &T) -> Self {
Self::from(value) Self::from(value)
} }