write_fixed

Function write_fixed 

Source
pub unsafe fn write_fixed<T: AsFixedSizeBytes + StableType>(
    ptr: StablePtr,
    it: &mut T,
)
Expand description

Writes a StableType value implementing AsFixedSizeBytes trait to stable memory.

This function creates an intermediate buffer of AsFixedSizeBytes::SIZE bytes, serializes the value into that buffer, writes the buffer into stable memory and then sets the stable drop flag of the value to off position.

§Safety

Make sure you’re writing to a valid memory block. All kinds of bad things can happen. This function manages stable memory ownership, this value won’t be stable-dropped after it goes out of scope. Make sure you treat it accordingly.