Module ptr
Source - addr_of
- Creates a
const
raw pointer to a place, without creating an intermediate reference. - addr_of_mut
- Creates a
mut
raw pointer to a place, without creating an intermediate reference.
- NonNull
*mut T
but non-zero and covariant.- AlignmentExperimental
- A type storing a
usize
which is a power of two, and thus
represents a possible alignment in the Rust abstract machine. - DynMetadataExperimental
- The metadata for a
Dyn = dyn SomeTrait
trait object type.
- PointeeExperimental
- Provides the pointer metadata type of any pointed-to type.
- addr_eq
- Compares the addresses of the two pointers for equality,
ignoring any metadata in fat pointers.
- copy⚠Deprecated
- Copies
count * size_of::<T>()
bytes from src
to dst
. The source
and destination may overlap. - copy_nonoverlapping⚠Deprecated
- Copies
count * size_of::<T>()
bytes from src
to dst
. The source
and destination must not overlap. - dangling
- Creates a new pointer that is dangling, but non-null and well-aligned.
- dangling_mut
- Creates a new pointer that is dangling, but non-null and well-aligned.
- drop_in_place⚠
- Executes the destructor (if any) of the pointed-to value.
- eq
- Compares raw pointers for equality.
- fn_addr_eq
- Compares the addresses of the two function pointers for equality.
- from_mut
- Converts a mutable reference to a raw pointer.
- from_ref
- Converts a reference to a raw pointer.
- hash
- Hash a raw pointer.
- null
- Creates a null raw pointer.
- null_mut
- Creates a null mutable raw pointer.
- read⚠
- Reads the value from
src
without moving it. This leaves the
memory in src
unchanged. - read_unaligned⚠
- Reads the value from
src
without moving it. This leaves the
memory in src
unchanged. - read_volatile⚠
- Performs a volatile read of the value from
src
without moving it. This
leaves the memory in src
unchanged. - replace⚠
- Moves
src
into the pointed dst
, returning the previous dst
value. - slice_from_raw_parts
- Forms a raw slice from a pointer and a length.
- slice_from_raw_parts_mut
- Forms a raw mutable slice from a pointer and a length.
- swap⚠
- Swaps the values at two mutable locations of the same type, without
deinitializing either.
- swap_nonoverlapping⚠
- Swaps
count * size_of::<T>()
bytes between the two regions of memory
beginning at x
and y
. The two regions must not overlap. - with_exposed_provenance
- Converts an address back to a pointer, picking up some previously ‘exposed’
provenance.
- with_exposed_provenance_mut
- Converts an address back to a mutable pointer, picking up some previously ‘exposed’
provenance.
- without_provenance
- Creates a pointer with the given address and no provenance.
- without_provenance_mut
- Creates a pointer with the given address and no provenance.
- write⚠
- Overwrites a memory location with the given value without reading or
dropping the old value.
- write_bytes⚠Deprecated
- Sets
count * size_of::<T>()
bytes of memory starting at dst
to
val
. - write_unaligned⚠
- Overwrites a memory location with the given value without reading or
dropping the old value.
- write_volatile⚠
- Performs a volatile write of a memory location with the given value without
reading or dropping the old value.
- from_raw_partsExperimental
- Forms a (possibly-wide) raw pointer from a data pointer and metadata.
- from_raw_parts_mutExperimental
- Performs the same functionality as
from_raw_parts
, except that a
raw *mut
pointer is returned, as opposed to a raw *const
pointer. - metadataExperimental
- Extracts the metadata component of a pointer.