Import with #import "std/temp".

Temp :: struct { bytes: Vec(u8); }
TempBegin :: () -> Temp
TempMark :: (arena: *Temp) -> s64
TempSlice :: (arena: *Temp, count: s64) -> []u8

Allocate initialized scratch at the end of the arena. An empty slice means either a zero-size request or a rejected negative/overflow/allocation request.

TempText :: (arena: *Temp, value: string) -> string

Copy text into the arena and return a borrowed UTF-8 view.

TempReset :: (arena: *Temp, mark: s64) -> bool

Release everything at and after mark. Replacing the allocation deliberately retires its checked-pointer generation; retaining Vec capacity here would let a stale pointer silently name later scratch on the engine/native backends.

TempEnd :: (arena: *Temp)

Source ↗ · All modules