Skip to main content

OptionReplaceWithFn

Type Alias OptionReplaceWithFn 

Source
pub type OptionReplaceWithFn = unsafe extern "C" fn(option: PtrMut, value: *mut u8);
Expand description

Replace an existing option with a new value. Pass a null pointer to set the option to None.

§Safety

The option parameter must point to aligned, initialized memory of the correct type. The old value will be dropped. If replacing with Some, value is moved out of (with core::ptr::read) — it should be deallocated afterwards but NOT dropped. Note: value must be PtrMut (not PtrConst) because ownership is transferred and the value may be dropped later, which requires mutable access.