struct Ptr
source · line 10public struct Ptr<T : value> : Equals<Ptr<T>>
- Supertype
Equals<Ptr<T>>
A typed native data address. Unsafe users must ensure valid lifetime, alignment, bounds, and access permissions; pointer values do not own or root their pointees.
function cast
source · line 33@NoGC
@Unsafe
@Intrinsic("ptr_cast")
public fun <U : value> cast(): Ptr<U>
Reinterprets the same address with another pointee type. The caller must establish the new type's alignment and access validity.
type parameter U
source · line 36U : value
function store
source · line 60@NoGC
@Unsafe
@Intrinsic("ptr_store")
public fun store(value: T): Unit
Writes a value at this address or the specified element offset. The caller must provide writable, properly aligned storage.
parameter value
source · line 63value: T
function minus
source · line 85@NoGC
@Unsafe
@Intrinsic("ptr_minus")
public operator fun minus(offset: Long): Ptr<T>
Moves backward by offset elements of T, not bytes. It does not check allocation bounds.
parameter offset
source · line 88offset: Long
function toULong
source · line 24@NoGC
@Unsafe
@Intrinsic("ptr_to_ulong")
public fun toULong(): ULong
Returns the address as an unsigned integer without extending the pointee's lifetime.
function plus
source · line 77@NoGC
@Unsafe
@Intrinsic("ptr_plus")
public operator fun plus(offset: Long): Ptr<T>
Moves forward by offset elements of T, not bytes. It does not check allocation bounds.
parameter offset
source · line 80offset: Long
function load
source · line 51@NoGC
@Unsafe
@Intrinsic("ptr_load_offset")
public fun load(offset: Long): T
Reads a value at this address or the specified element offset. The caller must provide readable, properly aligned initialized storage.
parameter offset
source · line 54offset: Long
function equals
source · line 14public override operator fun equals(other: Ptr<T>): Boolean
- Overrides
equals· Equals
Compares the stored addresses without dereferencing either pointer.
parameter other
source · line 14other: Ptr<T>
type parameter T
source · line 10T : value
function store
source · line 69@NoGC
@Unsafe
@Intrinsic("ptr_store_offset")
public fun store(offset: Long, value: T): Unit
Writes a value at this address or the specified element offset. The caller must provide writable, properly aligned storage.
parameter offset
source · line 72offset: Long
parameter value
source · line 72value: T
function load
source · line 42@NoGC
@Unsafe
@Intrinsic("ptr_load")
public fun load(): T
Reads a value at this address or the specified element offset. The caller must provide readable, properly aligned initialized storage.