struct Ptr
pub struct Ptr<T>
A pointer to a T in memory C manages, never null: T * where a C function takes or returns
one.
A value of it comes from C, from alloc or from an array's asPtr(), and goes back to C. A
pointer C may return as null is a ?Ptr<T>, none for null. What it points at is read and
written in an unsafe block, and only where T is what C holds — integers, floats, bool,
char, a pointer, a @Layout(C) struct.
Methods
pub fn read(): T
Returns the T it points at. Unsafe: the memory is the program's word.
pub fn write(value: T): void
Writes value where it points. Unsafe: the memory is the program's word.
pub fn offset(n: int): Ptr<T>
Returns the pointer n values of T further on, or back for a negative n. Unsafe:
nothing says the memory goes on.
pub fn cast<U>(): Ptr<U>
Returns the same address as a pointer to a U. Unsafe: nothing says a U lies there.