Module

std::ptr

source

Re-exported from core::ptr.

Raw pointer operations.

Re-exports

NonNullRe-export of a builtin.
load_volatileRe-export of a builtin.
store_volatileRe-export of a builtin.

Types

NonNullMethods of the builtin type NonNull.

Functions

nullThe null *T.
is_nullWhether p is null.
offsetThe address count elements of T past base: integer arithmetic on the address, since pointers have none of their own.

Function declarations

fn nullsource

forall T.
fn null() -> *T { ... }

The null *T. Safe: it carries no authority, and reading or writing through it, as through any raw pointer, needs its own unsafe.

fn is_nullsource

forall T.
fn is_null(p: *T) -> bool { ... }

Whether p is null.

fn offsetsource

forall T.
unsafe fn offset(base: *T, count: usize) -> *T { ... }

The address count elements of T past base: integer arithmetic on the address, since pointers have none of their own. Caller: the result stays inside the block base points into; nothing checks it, and every use of the result relies on it.