pub struct Ref<'a, T: 'a + ?Sized> { /* private fields */ }Expand description
A lightweight wrapper around a non-null pointer for a shared reference.
The wrappers are useful when you need a pointer instead of a reference while not degrading usage
and keeping its provenance. For instance, if you make the Ref from a mutable reference, the
fact the type is made from “mutable” won’t be lost, which is an information which some tools,
such as miri, used for finding pointer safety violations.
Implementations§
Trait Implementations§
impl<'a, T: 'a + ?Sized> Copy for Ref<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Ref<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for Ref<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> !Send for Ref<'a, T>
impl<'a, T> !Sync for Ref<'a, T>
impl<'a, T> Unpin for Ref<'a, T>where
T: ?Sized,
impl<'a, T> UnsafeUnpin for Ref<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for Ref<'a, T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more