Function core::ptr::read [] [src]

pub unsafe fn read<T>(src: *const T) -> T

Reads the value from src`srcwithout moving it. This leaves the memory in` without moving it. This leaves the memory in src`src` unchanged.

Safety

Beyond accepting a raw pointer, this is unsafe because it semantically moves the value out of src`srcwithout preventing further usage of` without preventing further usage of src`src. If`. If T`Tis not` is not Copy`Copy, then care must be taken to ensure that the value at`, then care must be taken to ensure that the value at src`srcis not used before the data is overwritten again (e.g. with` is not used before the data is overwritten again (e.g. with write`write,`, zero_memory`zero_memory, or`, or copy_memory`copy_memory). Note that`). Note that *src = foo`*src = foocounts as a use because it will attempt to drop the value previously at` counts as a use because it will attempt to drop the value previously at *src`*src`.