Module core::ptr [] [src]

Raw, unsafe pointers, *const T`*const T, and`, and *mut T`*mut T`

See also the pointer primitive types.

Reexports

pub use intrinsics::copy_nonoverlapping;
pub use intrinsics::copy;
pub use intrinsics::write_bytes;

Structs

Unique [Unstable]

A wrapper around a raw *mut T`*mut Tthat indicates that the possessor of this wrapper owns the referent. This in turn implies that theUniqueis` is Send`Send/`/Sync`Syncif` if T`Tis` is Send`Send/`/Sync`Sync, unlike a raw*mut T(which conveys no particular ownership semantics). It also implies that the referent of the pointer should not be modified without a unique path to theUniquereference. Useful for building abstractions likeVecor` or Box<T>`Box`, which internally use raw pointers to manage the memory that they own.

Functions

null

Creates a null raw pointer.

null_mut

Creates a null mutable raw pointer.

read

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

replace

Replaces the value at dest`destwith` with src`src`, returning the old value, without dropping either.

swap

Swaps the values at two mutable locations of the same type, without deinitialising either. They may overlap, unlike mem::swap which is otherwise equivalent.

write

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

read_and_drop [Unstable]

Variant of read_and_zero that writes the specific drop-flag byte (which may be more appropriate than zero).

read_and_zero [Deprecated]

Reads the value from src`src` and nulls it out without dropping it.