Module std::ptr

Unsafe pointer utility functions

Modules

externfnpointers

Traits

RawPtr

Functions

array_each

Given a null-pointer-terminated **T (pointer to an array of pointers), iterate through each *T, passing to the provided callback function

array_each_with_len

Given a **T (pointer to an array of pointers), iterate through each *T, up to the provided len, passing to the provided callback function

buf_len

Return the offset of the first null pointer in buf.

copy_memory

Copies data from one location to another.

copy_nonoverlapping_memory

Copies data from one location to another.

is_not_null

Returns true if the pointer is not equal to the null pointer.

is_null

Returns true if the pointer is equal to the null pointer.

mut_null

Create an unsafe mutable null pointer

mut_offset

Calculate the offset from a mut pointer. The count must be in bounds or otherwise the loads of this address are undefined.

null

Create an unsafe null pointer

offset

Calculate the offset from a pointer

position

Return the first offset i such that f(buf[i]) == true.

read_and_zero_ptr

Reads the value from *src and nulls it out. This currently prevents destructors from executing.

read_ptr

Reads the value from *src and returns it. Does not copy *src.

replace_ptr

Replace the value at a mutable location with a new one, returning the old value, without deinitialising or copying either one.

set_memory

Invokes memset on the specified pointer, setting count * size_of::<T>() bytes of memory starting at dst to c.

swap_ptr

Swap the values at two mutable locations of the same type, without deinitialising or copying either one.

to_mut_unsafe_ptr

Transform a mutable region pointer - &mut T - to a mutable unsafe pointer - *mut T.

to_unsafe_ptr

Transform a region pointer - &T - to an unsafe pointer - *T.

zero_memory

Zeroes out count * size_of::<T> bytes of memory at dst