#[repr(transparent)]pub struct Out<'a, T: 'a + ?Sized> { /* private fields */ }Expand description
Out reference (&'a out T).
An out reference is similar to a mutable reference, but it may point to uninitialized memory. An out reference may be used to initialize the pointee or represent a data buffer.
&'a out T can be converted from:
&'a mut MaybeUninit<T>and&'a mut MaybeUninit<[T]>, where theTmay be uninitialized.&'a mut Tand&'a mut [T], where theTis initialized and Copy.
It is not allowed to corrupt or de-initialize the pointee, which may cause unsoundness.
Any reads through an out reference may read uninitialized value(s).
Implementations§
source§impl<'a, T: ?Sized> Out<'a, T>
impl<'a, T: ?Sized> Out<'a, T>
source§impl<'a, T> Out<'a, T>
impl<'a, T> Out<'a, T>
sourcepub fn from_mut(data: &'a mut T) -> Selfwhere
T: Copy,
pub fn from_mut(data: &'a mut T) -> Selfwhere
T: Copy,
Forms an Out<'a, T>.
sourcepub fn from_uninit(data: &'a mut MaybeUninit<T>) -> Self
pub fn from_uninit(data: &'a mut MaybeUninit<T>) -> Self
Forms an Out<'a, T> from an uninitialized value.
sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns an unsafe mutable pointer to the value.
source§impl<'a, T> Out<'a, [T]>
impl<'a, T> Out<'a, [T]>
sourcepub fn from_slice(slice: &'a mut [T]) -> Selfwhere
T: Copy,
pub fn from_slice(slice: &'a mut [T]) -> Selfwhere
T: Copy,
Forms an Out<'a, [T]>.
sourcepub fn from_uninit_slice(slice: &'a mut [MaybeUninit<T>]) -> Self
pub fn from_uninit_slice(slice: &'a mut [MaybeUninit<T>]) -> Self
Forms an Out<'a, [T]> from an uninitialized slice.
sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns an unsafe mutable pointer to the slice’s buffer.