pub struct Guard<'a, T, const N: usize, const REVERSE: bool = false, P = ()> { /* private fields */ }Expand description
Exclusive initialization of one caller-owned array.
Implementations§
Source§impl<'a, T, const N: usize, const REVERSE: bool> Guard<'a, T, N, REVERSE>
impl<'a, T, const N: usize, const REVERSE: bool> Guard<'a, T, N, REVERSE>
Sourcepub fn new(entries: &'a mut MaybeUninit<[T; N]>) -> Self
pub fn new(entries: &'a mut MaybeUninit<[T; N]>) -> Self
Initializes in array order; REVERSE selects reverse release of an abandoned prefix.
Sourcepub fn try_map<'source, U, V, E>(
entries: &'a mut [MaybeUninit<U>; N],
source: &'source Prefix<'_, '_, V, N>,
map: impl FnMut(&'source V) -> Result<Option<T>, E>,
) -> Result<Self, (Self, E)>
pub fn try_map<'source, U, V, E>( entries: &'a mut [MaybeUninit<U>; N], source: &'source Prefix<'_, '_, V, N>, map: impl FnMut(&'source V) -> Result<Option<T>, E>, ) -> Result<Self, (Self, E)>
Maps an admitted source into at most one value per initialized position. On failure, the caller retains the initialized prefix for rollback.
Source§impl<'a, T, const N: usize, const REVERSE: bool> Guard<'a, T, N, REVERSE, Vacant>
impl<'a, T, const N: usize, const REVERSE: bool> Guard<'a, T, N, REVERSE, Vacant>
Sourcepub fn get<'b, U>(&self, values: &'b [U; N]) -> &'b U
pub fn get<'b, U>(&self, values: &'b [U; N]) -> &'b U
Selects the same bounded position in another complete array.
Sourcepub fn get_mut<'b, U>(&self, values: &'b mut [U; N]) -> &'b mut U
pub fn get_mut<'b, U>(&self, values: &'b mut [U; N]) -> &'b mut U
Retains exclusive access to the same bounded position.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, const N: usize, const REVERSE: bool = false, P = ()> !UnwindSafe for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> Freeze for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> RefUnwindSafe for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> Send for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> Sync for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> Unpin for Guard<'a, T, N, REVERSE, P>
impl<'a, T, const N: usize, const REVERSE: bool, P> UnsafeUnpin for Guard<'a, T, N, REVERSE, P>
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