RawPtr¶
No import is needed.
A non-owning address for unmanaged values. Copies never retain storage. Allocation is uninitialized unless alloc_zeroed is requested. Initialize values before reading. Raw operations require @unsafe and do not check bounds. Only base pointers returned by RawPtr allocation methods may be freed or resized. Foreign allocations require their original deallocator. Reallocation returns a new handle and invalidates every old alias. Null and zero-byte allocations carry address zero; freeing null is a no-op.
RawPtr¶
An address carries no owning token or length. Reads require initialized storage of T; copies remain valid only as long as the underlying allocation does.
null¶
Returns a null pointer with address zero.
is_null¶
Returns whether the pointer address is zero.
address¶
Returns the numeric address without dereferencing it.
operator¶
Returns whether both pointers have the same numeric address.
from_address¶
Creates a pointer from an address. The caller must ensure alignment, validity, and lifetime before dereferencing.
cast¶
Reinterprets the address as U; the caller must ensure the new alignment and layout are valid.
offset¶
Moves by elements values of T. The caller must keep the resulting pointer within valid storage before dereferencing.
byte_offset¶
Moves the address by bytes. The caller must ensure alignment and valid storage before dereferencing.
read¶
Reads an initialized T from the address. The address must be valid and aligned.
write¶
Writes value to the address. The destination must be valid, writable, and aligned for T.
this¶
Accesses the value at element offset index. The caller must ensure valid, aligned storage and initialize it before reading.
this¶
Accesses the value at element offset index. The caller must ensure valid, aligned storage and initialize it before reading.
alloc¶
Allocates uninitialized storage for count values of T. Initialize it before reading and release the base pointer with free when finished.
alloc_zeroed¶
Allocates zero-filled storage for count values. The caller must release the allocation when finished.
alloc_aligned¶
Allocates storage for count values with the requested power-of-two alignment. Release it with free.
realloc¶
Resizes an independently allocated base pointer, preserving the common prefix. Use the returned pointer and discard all old aliases.
free¶
Releases this allocation. Every other pointer into the allocation becomes invalid.
copy_to¶
Copies count initialized values into dst. Both ranges must be valid and must not overlap.
move_to¶
Copies count initialized values into dst, allowing overlapping ranges. Both ranges must be valid.
fill_bytes¶
Fills byte_count writable bytes with value. The caller must ensure the range is valid.