pub unsafe trait PinInit<T, E = Infallible>: Sized {
    unsafe fn __pinned_init(self, place: *mut T) -> Result<(), E>;
}
Expand description

An initializer for T.

Safety

The PinInit::__pinned_init function

  • 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.

Required Methods

Initializes place.

Safety

place is a valid pointer to uninitialized memory. The caller does not touch place when Err is returned, they are only permitted to deallocate. The place will not move, i.e. it will be pinned.

Implementors