Function std::ptr::write [] [src]

pub unsafe fn write<T>(dst: *mut T, src: T)

Overwrites a memory location with the given value without reading or dropping the old value.


This operation is marked unsafe because it accepts a raw pointer.

It does not drop the contents of dst. This is safe, but it could leak allocations or resources, so care must be taken not to overwrite an object that should be dropped.

This is appropriate for initializing uninitialized memory, or overwriting memory that has previously been read from.