pub trait InitMaybeUninit<T> {
// Required method
fn try_init_with<I, E>(&mut self, init: I) -> Result<&mut T, E>
where I: Init<T, E>;
// Provided methods
fn init_with<I>(&mut self, init: I) -> &mut T
where I: Init<T> { ... }
fn init_zeroed(&mut self) -> &mut T
where T: Zeroable { ... }
}Expand description
An extension trait that allows safe initialization of
MaybeUninit<T> memory.
Required Methods§
Sourcefn try_init_with<I, E>(&mut self, init: I) -> Result<&mut T, E>where
I: Init<T, E>,
fn try_init_with<I, E>(&mut self, init: I) -> Result<&mut T, E>where
I: Init<T, E>,
Try to initialize Self with the given fallible in-place initializer.
Provided Methods§
Sourcefn init_with<I>(&mut self, init: I) -> &mut Twhere
I: Init<T>,
fn init_with<I>(&mut self, init: I) -> &mut Twhere
I: Init<T>,
Initialize Self with the given in-place initializer.
Sourcefn init_zeroed(&mut self) -> &mut Twhere
T: Zeroable,
fn init_zeroed(&mut self) -> &mut Twhere
T: Zeroable,
Initialize Self with all-zeroes
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".