native.mem
Raw allocation operations. Each call requires an unsafe block.
All modules · Writing docstrings
func alloc(capacity: Int): RawPtrRequires an unsafe block.
Allocates an empty raw slot array with at least capacity storage.
func free(raw: RawPtr): NilRequires an unsafe block.
Releases a raw allocation; using an invalid or already-freed handle errors.
func read(raw: RawPtr, index: Int)Requires an unsafe block.
Reads a slot, returning nil when index is beyond the current length; freed handles error.
func write(raw: RawPtr, index: Int, value): NilRequires an unsafe block.
Writes a slot, extending intervening positions with nil; freed handles error.
capacity
Section titled “capacity”func capacity(raw: RawPtr): IntRequires an unsafe block.
Returns allocation capacity; freed handles error.
func len(raw: RawPtr): IntRequires an unsafe block.
Returns initialized slot count; freed handles error.
bin_from_raw
Section titled “bin_from_raw”func bin_from_raw(raw: RawPtr, len: Int): BinRequires an unsafe block.
Reads exactly len Byte slots into a Bin; errors on freed handles, non-Byte values, or bounds.