Module std::ptr 1.0.0[−][src]
Manually manage memory through raw pointers.
See also the pointer primitive types.
Safety
Many functions in this module take raw pointers as arguments and dereference them. For this to be safe, these pointers must be valid. A valid pointer is one that satisfies all of the following conditions:
- The pointer is not null.
- The pointer is not dangling (it does not point to memory which has been freed).
- The pointer satisfies LLVM's pointer aliasing rules.
Valid pointers are not necessarily properly aligned. However, most functions
require their arguments to be properly aligned, and will explicitly state
this requirement in the Safety
section. Notable exceptions to this are
read_unaligned
and write_unaligned
.
Structs
NonNull |
|
Functions
copy⚠ |
Copies |
copy_nonoverlapping⚠ |
Copies |
drop_in_place⚠ |
Executes the destructor (if any) of the pointed-to value. |
eq |
Compare raw pointers for equality. |
null |
Creates a null raw pointer. |
null_mut |
Creates a null mutable raw pointer. |
read⚠ |
Reads the value from |
read_unaligned⚠ |
Reads the value from |
read_volatile⚠ |
Performs a volatile read of the value from |
replace⚠ |
Moves |
swap⚠ |
Swaps the values at two mutable locations of the same type, without deinitializing either. |
swap_nonoverlapping⚠ |
Swaps |
write⚠ |
Overwrites a memory location with the given value without reading or dropping the old value. |
write_bytes⚠ |
Sets |
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. |