Skip to main content

raw_try_init

Function raw_try_init 

Source
pub unsafe fn raw_try_init<T, E>(
    slot: *mut T,
    init: impl PinInit<T, E>,
) -> Result<(), E>
Expand description

Fallibly initializes slot with an initializer.

ยงSafety

  • slot is a valid pointer to uninitialized memory.
  • the caller does not touch slot when Err is returned, they are only permitted to deallocate.
  • slot will not move until it is dropped, i.e. it will be pinned. If init implements Init<T, E>, this requirement is cancelled and it may be moved.