pub struct Out<'a, T>where
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 theT
may be uninitialized.&'a mut T
and&'a mut [T]
, where theT
is 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> Out<'a, T>where
T: ?Sized,
impl<'a, T> Out<'a, T>where
T: ?Sized,
source§impl<'a, T> Out<'a, T>
impl<'a, T> Out<'a, T>
sourcepub fn from_uninit(data: &'a mut MaybeUninit<T>) -> Out<'a, T>
pub fn from_uninit(data: &'a mut MaybeUninit<T>) -> Out<'a, T>
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]) -> Out<'a, [T]>where
T: Copy,
pub fn from_slice(slice: &'a mut [T]) -> Out<'a, [T]>where
T: Copy,
Forms an Out<'a, [T]>
.
sourcepub fn from_uninit_slice(slice: &'a mut [MaybeUninit<T>]) -> Out<'a, [T]>
pub fn from_uninit_slice(slice: &'a mut [MaybeUninit<T>]) -> Out<'a, [T]>
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.