Struct pinned_init::InitClosure
source · [−]pub struct InitClosure<F, T, E>(_, _);Expand description
A closure initializer.
Implementations
sourceimpl<T, E, F> InitClosure<F, T, E>where
F: FnOnce(*mut T) -> Result<(), E>,
impl<T, E, F> InitClosure<F, T, E>where
F: FnOnce(*mut T) -> Result<(), E>,
sourcepub const unsafe fn from_closure(f: F) -> Self
pub const unsafe fn from_closure(f: F) -> Self
Creates a new Init from the given closure
Safety
The closure
- returns
Ok(())iff it initialized every field of place, - returns
Err(err)iff it encountered an error and then cleaned place, this means:- place can be deallocated without UB ocurring,
- place does not need to be dropped,
- place is not partially initialized.
- place may move after initialization
Trait Implementations
Auto Trait Implementations
impl<F, T, E> RefUnwindSafe for InitClosure<F, T, E>where
F: RefUnwindSafe,
impl<F, T, E> Send for InitClosure<F, T, E>where
F: Send,
impl<F, T, E> Sync for InitClosure<F, T, E>where
F: Sync,
impl<F, T, E> Unpin for InitClosure<F, T, E>where
F: Unpin,
impl<F, T, E> UnwindSafe for InitClosure<F, T, E>where
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more