Repository navigation
v0.2.0
Added
-
heap.Bump(.{ ... }): a single-threaded bump arena over chunks from a
child allocator, with the chunk sizes fixed at comptime.allocator()hands
out anAllocatorwith no atomics,freeis a no-op, anddeinitreleases
every chunk.reset(.retain_capacity)keeps the chunks for the next job, and
a request abovemax_chunkgets a chunk of its own size. The type'sState
holds only the chunk list and the cursor, for a struct that stores an arena
and gets copied. -
jsonc: read JSON with//and/* */comments and a trailing comma.
scrubandscrubInPlaceblank the comments and the comma to spaces and
keep every byte offset, sostd.jsonparses the copy and reports the
caller's line and column.parseFromSlicereturns a value that owns the
scrubbed copy. -
dotenv.parse: a.envparser with one documented grammar. Keys match
[A-Za-z_][A-Za-z0-9_]*, anexportprefix is accepted, and comments and
the three quoting forms follow one set of rules. Key and value slices are
borrowed from the caller's source, except the escape bytes of a
double-quoted value, which go into a caller-owned scratch buffer. A bad line
returnsErrorand fills theDiagnosticsthe caller passed;lineText
returns that line. Duplicate keys are kept in order andDoc.getreturns the
last. No variable expansion. -
lru.Custom,lru.Auto, andlru.String: a fixed-capacity LRU cache.
getandpeek;putreturns the replaced value or the evicted entry;
remove,popLru,popMru, an iterator, andclear. No allocator and no
eviction callback. -
fmt.parseBool: the boolean spellings of Go'sstrconv.ParseBool(1,
t,T,TRUE,true,True, and the false set). Returns null for
anything else. -
sort.radix: a stable LSD radix sort for signed and unsigned integers,
with a caller-owned scratch slice.sort.nthandsort.selectpartition a
slice around the n-th element with a 3-way quickselect and a depth fallback. -
once.Cellandonce.Lazy: a value set at most once, withget,
getOrInit,getOrTryInit,set, andtake.once.SyncCelland
once.SyncLazyadd an atomic fast path and anIo.Mutexfor the first
initialization. -
prefix_map.Map: a compressed radix tree over byte strings, withgetand
getLongestPrefix. Build at comptime withinitComptime, or at runtime with
initanddeinit. A duplicate key is a compile error at comptime and
error.DuplicateKeyat runtime. -
enums.Openandenums.Closed: turn a comptime list of byte strings into
an enum, then switch on the tags.Openis non-exhaustive with an unnamed
miss value and anelsearm.Closedadds a named fallback tag and is
exhaustive.enums.stringToEnummatches enum field names like
std.meta.stringToEnum, with fixed-length loads. -
set.Custom,set.Auto, andset.Stringexposecapacity, the bound
every other fixed-capacity container already publishes. -
btreeandlrugaininit: a value with a default-initialized
context, besideempty(undefined context) andinitContext(caller's
context).priority_queuekeepsemptyandinitContext, because its
usual context isvoid, which has no default to initialize.
lru.PutResult.emptyis the result of a put that replaced and evicted
nothing.
Changed
-
Public structs no longer accept a bare
.{}. A value type names its
constructor (init,empty,zero, ordefault) and requires every
field, sobtree.Iterator,slot_ring.Lease,stdio.Stream,
time.RateLimit,jsonc.Diagnostics, andlru.PutResultlost their
field defaults. A struct literal must now set every field; use the
constructor. Options bags (jsonc.Options,dotenv.ParseOptions) keep
their defaults, runtime or comptime: a call site overrides one knob and
leaves the rest. -
net.Ip4.parsetakes a fixed-window SWAR fast path for canonical dotted
quads. On a 1M-address random corpus the fast path measured 6.8 ns per
address against 15.2 ns for the std parser. Results, the error set, and
non-canonical behavior are unchanged; anything the fast path rejects goes
through the std parser. -
dotenv.parsereturnsError!Docinstead of aResultunion with.doc
and.diagnosticarms. A failed parse fills a caller-ownedDiagnostics
throughParseOptions.diagnostics, which gained the column of the offending
byte. A successful parse leaves that value untouched.