pub unsafe fn replace<T>(dst: *mut T, src: T) -> TExpand description
Moves src into the pointed dst, returning the previous dst value.
Neither value is dropped.
This function is semantically equivalent to mem::replace except that it
operates on raw pointers instead of references. When references are
available, mem::replace should be preferred.
§Safety
Behavior is undefined if any of the following conditions are violated:
-
dstmust be valid for both reads and writes. -
dstmust be properly aligned. -
dstmust point to a properly initialized value of typeT.
Note that even if T has size 0, the pointer must be non-null and properly aligned.