--- name: stdlib description: Use Zero standard library modules and target-gated capabilities. --- # Zero Standard Library Use this for common library calls, memory helpers, hosted I/O, or target-capability guidance. ## Import ```zero use std.mem use std.parse ``` Call functions with their module path, such as `std.mem.len(value)`. ## Target-Neutral Helpers - `std.mem`: spans, byte copy/fill, non-owned scalar item copy/fill/search/compare, scalar item slicing, chunking, cursor helpers, length, safe indexed `get`, fixed-buffer allocation, byte buffers, and caller-owned vectors. - `std.collections`: fixed-capacity push/pop, deque front/back operations, first/last access, indexed insert/replace/remove, unique insert, append, clear, truncate, fill, reverse, rotate, live-prefix and set/map views, `FixedSet`, `FixedDeque`, `FixedRingBuffer`, and `FixedMap` storage wrappers, set/map/ring-buffer capacity state, count, contains, value removal, swap, swap-remove, move-to-front, and parallel key/value map helpers over caller-owned array or allocator-returned span storage plus explicit lengths. - `std.search`: generic scalar index search plus typed min/max, lower-bound, upper-bound, and binary-search helpers. - `std.sort`: in-place insertion, stable, unstable, swap, rotate, reverse, partition, sorted dedupe, and sortedness helpers for ascending and descending `i32`, `u32`, and `usize` storage. - `std.ascii`: ASCII byte predicates, case conversion, and digit value helpers. - `std.fmt`: caller-buffer and fixed-writer formatting for booleans, 32-bit and 64-bit integer text, integer bases, signs, and padding. - `std.text`: ASCII and UTF-8 byte-backed text validation. - `std.unicode`: strict UTF-8 codepoint decode/encode iteration, cursor status helpers, and codepoint-class helpers; pair with `std.text.utf8Valid`/`std.text.utf8Len` for whole-span validation and counting. - `std.math`: fixed-width min/max/clamp, checked and saturating integer arithmetic, GCD/LCM, powers, modular power, roots, combinatorics, primality, and divisor routines. - `std.path`: target-neutral lexical path basename, dirname, extension, stem, component, abs, join, normalize, and relative helpers. - `std.codec`: endian reads/writes, unsigned and signed varints, base32/base64/hex encode/decode, CRC helpers, and byte checksums. - `std.csv`: allocation-free CSV validation, record scanning, field decoding, and fixed-arity writers. - `std.parse`: byte scanners plus decimal, radix, prefix integer width, bool, duration, and byte-size parsers returning `Maybe`. - `std.regex`: compile-once and one-shot regular expression matching/search/split/replace for a documented ECMA-262-leaning subset (literals, classes, anchors, word boundaries, greedy quantifiers, alternation, groups); unsupported constructs fail with structured status codes and offsets. - `std.inet`: target-neutral IPv4/IPv6/hostname literal validation and parsing; no network capability needed. - `std.time`: duration construction, conversion, comparison, elapsed-window helpers, hosted sleep, RFC 3339 date/time validation and epoch parsing, and target-gated clock helpers. - `std.rand`: explicit deterministic random sources, random bits, unbiased bounded/range helpers, target entropy helpers, and caller-buffer entropy IDs. - `std.crypto`: small hashes, SHA-256 digest writers, fixed-width hash text, byte-oriented crypto helpers, and caller-buffer IDs. - `std.json`: explicit-buffer JSON validation, structured status/location diagnostics, object/array cursor lookup, typed scalar decode, parsing, and string/object writing helpers. - `std.toml`: no-allocation TOML validation, shallow/dotted field lookup, and typed scalar decode helpers. - `std.url`: target-neutral URL splitting, percent/query/form encoding and decoding, query/form lookup, and query append helpers. - `std.str`: byte-span string helpers, including non-overlapping reverse, copy/concat/repeat/replace, prefix/suffix, split, fields, lines, trim, and word counts. - `std.io`: buffered reader/writer surfaces, cursor writes, line scanning, and byte copy over caller-owned storage. - `std.testing`: Bool-returning helpers for test blocks and byte-output checks. - `std.term`: ANSI terminal style, cursor, clear, alternate-screen sequence helpers, target-neutral key-byte decoding, and hosted TTY/size/raw-mode/input helpers. - `std.log`: explicit-buffer JSON Lines record formatting. Prefer `Maybe` return checks over assuming an operation succeeded. ## Hosted Capabilities These modules depend on host or runtime capabilities: - `std.args`: process arguments - `std.cli`: command-line flag, option, and typed option helpers over process arguments - `std.env`: process environment lookup, comparisons, and typed fallback parsing - `std.fs`: hosted filesystem, explicit `Fs` or `owned` handles, and file-level byte helpers - `std.net`: bootstrap network handles - `std.http`: HTTP request/response helpers and loopback listeners - `std.proc`: process execution and exit-status helpers - `std.pty`: hosted pseudoterminal child processes - `World.out` and `World.err`: program output capabilities Non-host targets may reject these APIs with target diagnostics. Inspect target facts before cross-building: ```sh zero targets zero check --target linux-musl-x64 [graph-input] zero inspect --target linux-musl-x64 [graph-input] ``` Add `--json` only when a tool needs exact target facts or diagnostics. ## Memory Pattern ```zero use std.mem pub fn main(world: World) -> Void raises { let bytes: Span = std.mem.span("zero") if std.mem.len(bytes) == 4 { check world.out.write("memory ok\n") } } ``` For writable buffers, use caller-owned fixed arrays and `MutSpan`: ```zero pub fn main() -> Void { var storage: [8]u8 = [0, 0, 0, 0, 0, 0, 0, 0] let writable: MutSpan = storage let copied: usize = std.mem.copy(writable, std.mem.span("zero")) } ``` For non-byte scalar item storage, use the generic item helpers. Current direct targets support `Bool`, `u8`, `u16`, `usize`, `i32`, `u32`, `i64`, and `u64` elements for these helpers. ```zero pub fn main() -> Void { var values: [4]i32 = [1, 2, 3, 4] var scratch: [4]i32 = [0, 0, 0, 0] let copied: usize = std.mem.copyItems(scratch, values) let prefix: Span = std.mem.prefix(scratch, 2) let suffix: Span = std.mem.suffix(scratch, 2) let before: Span = std.mem.splitBefore(scratch, 3) let after: Span = std.mem.splitAfter(scratch, 3) let middle: Span = std.mem.slice(scratch, 1, 2) let chunk: Span = std.mem.chunk(scratch, 1_usize, 2_usize) let sliding: Span = std.mem.window(scratch, 1_usize, 2_usize) let cursor: usize = std.mem.advance(scratch, 0_usize, 2_usize) let rest: Span = std.mem.remaining(scratch, cursor) expect copied == 4 && std.mem.contains(prefix, 1) && std.mem.compareI32(prefix, suffix) < 0 && std.mem.len(suffix) == 2 && std.mem.len(before) == 2 && std.mem.len(after) == 1 && std.mem.len(middle) == 2 && std.mem.len(chunk) == 2 && std.mem.len(sliding) == 2 && std.mem.len(rest) == 2 } ``` Fixed-capacity collection helpers keep storage and length explicit: ```zero pub fn main() -> Void { var values: [4]i32 = [0, 0, 0, 0] var len: usize = 0 len = std.collections.push(values, len, 3) len = std.collections.push(values, len, 1) len = std.collections.setInsert(values, len, 5) len = std.collections.insertAt(values, len, 1_usize, 4) let replaced: Bool = std.collections.replaceAt(values, len, 1_usize, 9) let swapped: Bool = std.collections.swapAt(values, len, 0_usize, 1_usize) let reversed: Bool = std.collections.reverse(values, len) let filled: Bool = std.collections.fill(values, 2_usize, 7) let rotated_left: Bool = std.collections.rotateLeft(values, len, 1_usize) let rotated_right: Bool = std.collections.rotateRight(values, len, 1_usize) len = std.collections.removeAt(values, len, 2_usize) let last: Maybe = std.collections.last(values, len) len = std.collections.dequePushFront(values, len, 2) let front: Maybe = std.collections.dequeFront(values, len) len = std.collections.dequePopFront(values, len) let back_len: usize = std.collections.dequePopBack(values, len) len = std.collections.truncate(values, len, 3) let set_live: Span = std.collections.setView(values, len) let set_remaining: usize = std.collections.setRemaining(values, len) let live: Span = std.collections.view(values, len) var fixed_storage: [4]i32 = [1, 2, 0, 0] var fixed_set: FixedSet = std.collections.fixedSet(fixed_storage, 2_usize) let fixed_inserted: Bool = std.collections.fixedSetInsert(&mut fixed_set, 3) let fixed_removed: Bool = std.collections.fixedSetRemove(&mut fixed_set, 1) let fixed_live: Span = std.collections.fixedSetView(&fixed_set) var fixed_deque_storage: [4]i32 = [0, 0, 0, 0] var fixed_deque: FixedDeque = std.collections.fixedDeque(fixed_deque_storage, 0_usize) let fixed_deque_back_pushed: Bool = std.collections.fixedDequePushBack(&mut fixed_deque, 2) let fixed_deque_front_pushed: Bool = std.collections.fixedDequePushFront(&mut fixed_deque, 1) let fixed_deque_front: Maybe = std.collections.fixedDequeFront(&fixed_deque) let fixed_deque_popped: Maybe = std.collections.fixedDequePopBack(&mut fixed_deque) var fixed_ring_storage: [4]i32 = [0, 0, 0, 0] var fixed_ring: FixedRingBuffer = std.collections.fixedRingBuffer(fixed_ring_storage, 0_usize, 0_usize) let fixed_ring_back_pushed: Bool = std.collections.fixedRingBufferPushBack(&mut fixed_ring, 2) let fixed_ring_front_pushed: Bool = std.collections.fixedRingBufferPushFront(&mut fixed_ring, 1) let fixed_ring_front: Maybe = std.collections.fixedRingBufferFront(&fixed_ring) let fixed_ring_popped: Maybe = std.collections.fixedRingBufferPopBack(&mut fixed_ring) var fixed_keys: [3]u8 = [1_u8, 2_u8, 0_u8] var fixed_scores: [3]u16 = [10_u16, 20_u16, 0_u16] var fixed_map: FixedMap = std.collections.fixedMap(fixed_keys, fixed_scores, 2_usize) let fixed_map_added: Bool = std.collections.fixedMapPut(&mut fixed_map, 3_u8, 30_u16) let fixed_map_score: Maybe = std.collections.fixedMapGet(&fixed_map, 3_u8) var keys: [3]u8 = [1_u8, 2_u8, 0_u8] var scores: [3]u16 = [10_u16, 20_u16, 0_u16] var map_len: usize = 2 map_len = std.collections.mapPut(keys, scores, map_len, 3_u8, 30_u16) let has_score: Bool = std.collections.mapContains(keys, map_len, 3_u8) let score: Maybe = std.collections.mapGet(keys, scores, map_len, 3_u8) let live_keys: Span = std.collections.mapKeys(keys, map_len) let live_scores: Span = std.collections.mapValues(keys, scores, map_len) expect replaced && swapped && reversed && filled && rotated_left && rotated_right && std.collections.clear(values, len) == 0 && std.collections.setClear(values, len) == 0 && std.collections.pop(values, len) == 2 && last.has && last.value == 5 && front.has && front.value == 2 && back_len == 2 && std.collections.setContains(values, len, 5) && set_remaining == 1 && std.mem.len(set_live) == 3 && std.mem.len(live) == 3 && fixed_inserted && fixed_removed && std.mem.len(fixed_live) == 2 && std.collections.fixedSetRemaining(&fixed_set) == 2 && std.collections.fixedSetLen(&fixed_set) == 2 && fixed_deque_back_pushed && fixed_deque_front_pushed && fixed_deque_front.has && fixed_deque_front.value == 1 && fixed_deque_popped.has && fixed_deque_popped.value == 2 && fixed_map_added && fixed_map_score.has && fixed_map_score.value == 30_u16 && map_len == 3 && std.collections.mapRemaining(keys, scores, map_len) == 0 && std.collections.mapIsFull(keys, scores, map_len) && std.collections.mapClear(keys, scores, map_len) == 0 && has_score && score.has && score.value == 30_u16 && std.mem.len(live_keys) == 3 && std.mem.len(live_scores) == 3 } ``` For byte-oriented dynamic storage, request mutable byte spans explicitly with `std.mem.allocBytes`. The fixed collection wrappers can use those returned spans as backing storage: ```zero pub fn main() -> Void { var key_storage: [4]u8 = [0_u8; 4] var value_storage: [4]u8 = [0_u8; 4] var key_alloc: FixedBufAlloc = std.mem.fixedBufAlloc(key_storage) var value_alloc: FixedBufAlloc = std.mem.fixedBufAlloc(value_storage) let keys_maybe: Maybe> = std.mem.allocBytes(key_alloc, 4_usize) let values_maybe: Maybe> = std.mem.allocBytes(value_alloc, 4_usize) if keys_maybe.has && values_maybe.has { var map: FixedMap = std.collections.fixedMap(keys_maybe.value, values_maybe.value, 0_usize) let ok: Bool = std.collections.fixedMapPut(&mut map, 7_u8, 42_u8) let value: Maybe = std.collections.fixedMapGet(&map, 7_u8) expect ok && value.has && value.value == 42_u8 } } ``` Use `std.sort` and `std.search` for common scalar algorithms instead of hand-rolling loops: ```zero pub fn main() -> Void { var values: [5]i32 = [5, 1, 4, 2, 3] std.sort.stableI32(values) expect std.sort.isSortedI32(values) std.sort.unstableI32(values) expect std.sort.isSortedI32(values) std.sort.reverseI32(values) expect std.sort.isSortedDescI32(values) let swapped: Bool = std.sort.swapI32(values, 0_usize, 4_usize) expect swapped std.sort.rotateLeftI32(values, 2_usize) expect values[0] == 3 std.sort.rotateRightI32(values, 2_usize) expect values[0] == 1 std.sort.insertionDescI32(values) expect std.sort.isSortedDescI32(values) std.sort.stableDescI32(values) expect std.sort.isSortedDescI32(values) std.sort.unstableDescI32(values) expect std.sort.isSortedDescI32(values) std.sort.insertionI32(values) expect std.search.binaryI32(values, 4) == 3 expect std.search.containsSortedI32(values, 4) expect std.search.upperBoundI32(values, 4) == 4 expect std.search.countSortedI32(values, 4) == 1 std.sort.insertionDescI32(values) expect std.search.binaryDescI32(values, 4) == 1 expect std.search.containsSortedDescI32(values, 4) expect std.search.upperBoundDescI32(values, 4) == 2 expect std.search.countSortedDescI32(values, 4) == 1 let high_len: usize = std.sort.partitionDescI32(values, 3) expect high_len == 2 let minimum: Maybe = std.search.minI32(values) expect minimum.has && minimum.value == 1 expect std.search.maxIndexI32(values) == 0 } ``` String helpers are byte-oriented and allocation-free. `std.str.reverse` writes into caller storage and requires that destination storage does not overlap the input text: ```zero pub fn main() -> Void { var reversed: [4]u8 = [0, 0, 0, 0] let out: Maybe> = std.str.reverse(reversed, "zero") if out.has { expect std.mem.eql(out.value, "orez") } } ``` Use `std.parse` and `std.fmt` instead of hand-rolled decimal loops in ordinary CLIs and examples: ```zero pub fn main() -> Void { let parsed: Maybe = std.parse.parseI32("-42") var out: [12]u8 = [0_u8; 12] if parsed.has { let formatted: Maybe> = std.fmt.i32(out, parsed.value) expect formatted.has && std.mem.eql(formatted.value, "-42") } } ``` Use codec, JSON, and URL helpers for common wire-format work instead of hand-rolled loops: ```zero pub fn main() -> Void { var decoded: [4]u8 = [0_u8; 4] let text: Maybe> = std.codec.base64Decode(decoded, "emVybw==") let input: Span = "{\"count\":42,\"ok\":true}" let count: Maybe = std.json.u32(input, "count") var url_buf: [48]u8 = [0_u8; 48] var param_buf: [16]u8 = [0_u8; 16] let param: Maybe> = std.url.writeQueryParam(param_buf, "q", "zero lang") var url: Maybe> = null if param.has { url = std.url.appendQuery(url_buf, "https://example.com/path", param.value) } expect text.has && count.has && url.has } ``` Use `std.math` checked helpers when overflow is a normal input outcome: ```zero pub fn main() -> Void { let value: Maybe = std.math.checkedMulU32(6_u32, 7_u32) if value.has { expect value.value == 42_u32 } expect std.math.sqrtFloorU32(99) == 9 } ``` Keep random sources explicit and durations typed: ```zero pub fn main() -> Void { var rng: RandSource = std.rand.seed(7_u32) let first: u32 = std.rand.nextU32(&mut rng) let bit: Bool = std.rand.nextBool(&mut rng) let bounded: Maybe = std.rand.nextBelow(&mut rng, 10_u32) let ranged: Maybe = std.rand.rangeU32(&mut rng, 40_u32, 50_u32) let delay: Duration = std.time.add(std.time.ms(250), std.time.seconds(1)) expect first == 1025555898_u32 && bit && bounded.has && ranged.has && std.time.asMsFloor(delay) == 1250 } ``` Use `std.testing` inside `expect` when the comparison shape matters to readers or agents: ```zero test "output shape" { expect std.testing.equalBytes("zero", "zero") expect std.testing.containsBytes("zerolang", "lang") expect std.testing.jsonPathEquals("{\"service\":{\"ok\":true}}", "service.ok", "true") } ``` Use `std.log` as a caller-buffer formatter, then write the resulting span through an explicit output capability: ```zero pub fn main(world: World) -> Void raises { var storage: [128]u8 = [0_u8; 128] var field_storage: [64]u8 = [0_u8; 64] let field: Maybe> = std.log.stringField(field_storage, "event", "startup") if field.has { let entry: Maybe> = std.log.messageField(storage, std.log.levelInfo(), "started", field.value) if entry.has { check world.out.write(entry.value) } } } ``` ## Function Signatures This catalog is generated from the compiler's standard-library signature table. Use these names exactly; helpers with `T` are generic over the concrete span or item type inferred from the call. Fetch one module's section instead of this whole catalog with `zero skills get stdlib --topic `, for example `zero skills get stdlib --topic std.time`. ### std.args ```text len() -> usize get(arg0: usize) -> Maybe has(arg0: usize) -> Bool getOr(arg0: usize, arg1: String) -> String find(arg0: String) -> Maybe valueAfter(arg0: String) -> Maybe parseU32(arg0: usize) -> Maybe ``` ### std.ascii ```text digitValue(arg0: u8) -> Maybe hexValue(arg0: u8) -> Maybe isAlnum(arg0: u8) -> Bool isAlpha(arg0: u8) -> Bool isDigit(arg0: u8) -> Bool isHexDigit(arg0: u8) -> Bool isLower(arg0: u8) -> Bool isUpper(arg0: u8) -> Bool isWhitespace(arg0: u8) -> Bool toLower(arg0: u8) -> u8 toUpper(arg0: u8) -> u8 ``` ### std.cli ```text argEquals(arg0: usize, arg1: String) -> Bool command() -> Maybe commandOr(arg0: String) -> String commandEquals(arg0: String) -> Bool argOr(arg0: usize, arg1: String) -> String argU32Or(arg0: usize, arg1: u32) -> u32 hasFlag(arg0: String) -> Bool optionValue(arg0: String) -> Maybe optionValueOr(arg0: String, arg1: String) -> String optionU32(arg0: String) -> Maybe successExitCode() -> i32 usageExitCode() -> i32 isHelp(arg0: Span) -> Bool needsHelp() -> Bool commandIn2(arg0: Span, arg1: Span, arg2: Span) -> Bool commandIn3(arg0: Span, arg1: Span, arg2: Span, arg3: Span) -> Bool formatUsage(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> formatCommand(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> formatOption(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> formatSection(arg0: MutSpan, arg1: Span) -> Maybe> formatHelpRow(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> formatHelpRowCustom(arg0: MutSpan, arg1: Span, arg2: Span, arg3: usize, arg4: usize) -> Maybe> formatHelpRowWithWidth(arg0: MutSpan, arg1: Span, arg2: Span, arg3: usize) -> Maybe> formatHelp(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> formatError(arg0: MutSpan, arg1: Span) -> Maybe> formatUnknownCommand(arg0: MutSpan, arg1: Span) -> Maybe> formatMissingOperand(arg0: MutSpan, arg1: Span) -> Maybe> formatInvalidOption(arg0: MutSpan, arg1: Span) -> Maybe> ``` ### std.codec ```text crc32(arg0: String) -> u32 crc32Bytes(arg0: Span) -> u32 encodedVarintLen(arg0: u32) -> usize encodedVarintLen64(arg0: u64) -> usize encodedSignedVarintLen(arg0: i32) -> usize encodedSignedVarintLen64(arg0: i64) -> usize hexDecodedLen(arg0: Span) -> Maybe hexDecode(arg0: MutSpan, arg1: Span) -> Maybe> base32EncodedLen(arg0: usize) -> usize base32Encode(arg0: MutSpan, arg1: Span) -> Maybe> base32DecodedLen(arg0: Span) -> Maybe base32Decode(arg0: MutSpan, arg1: Span) -> Maybe> base32RawEncodedLen(arg0: usize) -> usize base32RawEncode(arg0: MutSpan, arg1: Span) -> Maybe> base32RawDecodedLen(arg0: Span) -> Maybe base32RawDecode(arg0: MutSpan, arg1: Span) -> Maybe> base64DecodedLen(arg0: Span) -> Maybe base64Decode(arg0: MutSpan, arg1: Span) -> Maybe> base64RawEncodedLen(arg0: usize) -> usize base64RawEncode(arg0: MutSpan, arg1: Span) -> Maybe> base64RawDecodedLen(arg0: Span) -> Maybe base64RawDecode(arg0: MutSpan, arg1: Span) -> Maybe> base64UrlEncodedLen(arg0: usize) -> usize base64UrlEncode(arg0: MutSpan, arg1: Span) -> Maybe> base64UrlDecodedLen(arg0: Span) -> Maybe base64UrlDecode(arg0: MutSpan, arg1: Span) -> Maybe> readU16Le(arg0: Span) -> Maybe readU16Be(arg0: Span) -> Maybe readU32Le(arg0: Span) -> Maybe readU32Be(arg0: Span) -> Maybe readU64Le(arg0: Span) -> Maybe readU64Be(arg0: Span) -> Maybe writeU16Le(arg0: MutSpan, arg1: u16) -> Maybe> writeU16Be(arg0: MutSpan, arg1: u16) -> Maybe> writeU32Le(arg0: MutSpan, arg1: u32) -> Maybe> writeU32Be(arg0: MutSpan, arg1: u32) -> Maybe> writeU64Le(arg0: MutSpan, arg1: u64) -> Maybe> writeU64Be(arg0: MutSpan, arg1: u64) -> Maybe> varintEncode(arg0: MutSpan, arg1: u32) -> Maybe> varintDecode(arg0: Span) -> Maybe varintEncode64(arg0: MutSpan, arg1: u64) -> Maybe> varintDecode64(arg0: Span) -> Maybe signedVarintEncode(arg0: MutSpan, arg1: i32) -> Maybe> signedVarintDecode(arg0: Span) -> Maybe signedVarintEncode64(arg0: MutSpan, arg1: i64) -> Maybe> signedVarintDecode64(arg0: Span) -> Maybe base64EncodedLen(arg0: usize) -> usize base64Encode(arg0: MutSpan, arg1: Span) -> Maybe hexEncode(arg0: MutSpan, arg1: Span) -> Maybe utf8Valid(arg0: Span) -> Bool urlEncode(arg0: MutSpan, arg1: String) -> Maybe ``` ### std.collections ```text append(storage: MutSpan, len: usize, values: Span) -> usize clear(storage: Span, len: usize) -> usize contains(storage: Span, len: usize, value: T) -> Bool count(storage: Span, len: usize, value: T) -> usize dequeBack(storage: Span, len: usize) -> Maybe dequeFront(storage: Span, len: usize) -> Maybe dequePopBack(storage: Span, len: usize) -> usize dequePopFront(storage: MutSpan, len: usize) -> usize dequePushBack(storage: MutSpan, len: usize, value: T) -> usize dequePushFront(storage: MutSpan, len: usize, value: T) -> usize fill(storage: MutSpan, len: usize, value: T) -> Bool first(storage: Span, len: usize) -> Maybe fixedDeque(storage: MutSpan, len: usize) -> FixedDeque fixedDequeBack(deque: ref>) -> Maybe fixedDequeClear(deque: mutref>) -> usize fixedDequeFront(deque: ref>) -> Maybe fixedDequeIsFull(deque: ref>) -> Bool fixedDequeLen(deque: ref>) -> usize fixedDequePopBack(deque: mutref>) -> Maybe fixedDequePopFront(deque: mutref>) -> Maybe fixedDequePushBack(deque: mutref>, value: T) -> Bool fixedDequePushFront(deque: mutref>, value: T) -> Bool fixedDequeRemaining(deque: ref>) -> usize fixedDequeTruncate(deque: mutref>, newLen: usize) -> usize fixedDequeView(deque: ref>) -> Span fixedRingBuffer(storage: MutSpan, head: usize, len: usize) -> FixedRingBuffer fixedRingBufferBack(ring: ref>) -> Maybe fixedRingBufferCapacity(ring: ref>) -> usize fixedRingBufferClear(ring: mutref>) -> usize fixedRingBufferFront(ring: ref>) -> Maybe fixedRingBufferGet(ring: ref>, index: usize) -> Maybe fixedRingBufferIsFull(ring: ref>) -> Bool fixedRingBufferLen(ring: ref>) -> usize fixedRingBufferPopBack(ring: mutref>) -> Maybe fixedRingBufferPopFront(ring: mutref>) -> Maybe fixedRingBufferPushBack(ring: mutref>, value: T) -> Bool fixedRingBufferPushFront(ring: mutref>, value: T) -> Bool fixedRingBufferRemaining(ring: ref>) -> usize fixedRingBufferTruncate(ring: mutref>, newLen: usize) -> usize fixedMap(keys: MutSpan, values: MutSpan, len: usize) -> FixedMap fixedMapClear(map: mutref>) -> usize fixedMapContains(map: ref>, key: K) -> Bool fixedMapGet(map: ref>, key: K) -> Maybe fixedMapIndex(map: ref>, key: K) -> usize fixedMapIsFull(map: ref>) -> Bool fixedMapKeys(map: ref>) -> Span fixedMapLen(map: ref>) -> usize fixedMapPut(map: mutref>, key: K, value: V) -> Bool fixedMapRemaining(map: ref>) -> usize fixedMapRemove(map: mutref>, key: K) -> Bool fixedMapTruncate(map: mutref>, newLen: usize) -> usize fixedMapValues(map: ref>) -> Span fixedSet(storage: MutSpan, len: usize) -> FixedSet fixedSetClear(set: mutref>) -> usize fixedSetContains(set: ref>, value: T) -> Bool fixedSetInsert(set: mutref>, value: T) -> Bool fixedSetIsFull(set: ref>) -> Bool fixedSetLen(set: ref>) -> usize fixedSetRemaining(set: ref>) -> usize fixedSetRemove(set: mutref>, value: T) -> Bool fixedSetTruncate(set: mutref>, newLen: usize) -> usize fixedSetView(set: ref>) -> Span insertAt(storage: MutSpan, len: usize, index: usize, value: T) -> usize insertUnique(storage: MutSpan, len: usize, value: T) -> usize isFull(storage: Span, len: usize) -> Bool last(storage: Span, len: usize) -> Maybe mapClear(keys: Span, values: Span, len: usize) -> usize mapContains(keys: Span, len: usize, key: K) -> Bool mapGet(keys: Span, values: Span, len: usize, key: K) -> Maybe mapIndex(keys: Span, len: usize, key: K) -> usize mapIsFull(keys: Span, values: Span, len: usize) -> Bool mapKeys(keys: Span, len: usize) -> Span mapPut(keys: MutSpan, values: MutSpan, len: usize, key: K, value: V) -> usize mapRemaining(keys: Span, values: Span, len: usize) -> usize mapRemove(keys: MutSpan, values: MutSpan, len: usize, key: K) -> usize mapTruncate(keys: Span, values: Span, len: usize, newLen: usize) -> usize mapValues(keys: Span, values: Span, len: usize) -> Span moveToFront(storage: MutSpan, len: usize, index: usize) -> usize pop(storage: Span, len: usize) -> usize push(storage: MutSpan, len: usize, value: T) -> usize remaining(storage: Span, len: usize) -> usize replaceAt(storage: MutSpan, len: usize, index: usize, value: T) -> Bool removeAt(storage: MutSpan, len: usize, index: usize) -> usize removeValue(storage: MutSpan, len: usize, value: T) -> usize removeSwap(storage: MutSpan, len: usize, index: usize) -> usize reverse(storage: MutSpan, len: usize) -> Bool rotateLeft(storage: MutSpan, len: usize, count: usize) -> Bool rotateRight(storage: MutSpan, len: usize, count: usize) -> Bool setClear(storage: Span, len: usize) -> usize setContains(storage: Span, len: usize, value: T) -> Bool setInsert(storage: MutSpan, len: usize, value: T) -> usize setIsFull(storage: Span, len: usize) -> Bool setRemaining(storage: Span, len: usize) -> usize setRemove(storage: MutSpan, len: usize, value: T) -> usize setTruncate(storage: Span, len: usize, newLen: usize) -> usize setView(storage: Span, len: usize) -> Span swapAt(storage: MutSpan, len: usize, left: usize, right: usize) -> Bool truncate(storage: Span, len: usize, newLen: usize) -> usize view(storage: Span, len: usize) -> Span ``` ### std.crypto ```text hash32(arg0: Span) -> u32 hmac32(arg0: Span, arg1: Span) -> u32 constantTimeEql(arg0: Span, arg1: Span) -> Bool secureRandomU32() -> u32 fixedHex32(arg0: MutSpan, arg1: u32) -> Maybe> hashHex32(arg0: MutSpan, arg1: Span) -> Maybe> hmacHex32(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> stableId32(arg0: MutSpan, arg1: Span) -> Maybe> randomId32(arg0: MutSpan) -> Maybe> sha256(arg0: MutSpan, arg1: Span) -> Maybe> sha256Hex(arg0: MutSpan, arg1: Span) -> Maybe> hmacSha256(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> hmacSha256Hex(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> ``` ### std.csv ```text valid(arg0: Span) -> Bool recordCount(arg0: Span) -> Maybe record(arg0: Span, arg1: usize) -> Maybe> fieldCount(arg0: Span) -> Maybe field(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe> encodedFieldLen(arg0: Span) -> usize writeField(arg0: MutSpan, arg1: Span) -> Maybe> writeRecord2(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeRecord3(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> ``` ### std.diag ```text column(arg0: Span, arg1: usize) -> usize formatLocation(arg0: MutSpan, arg1: Span, arg2: usize, arg3: usize) -> Maybe> formatOffsetLocation(arg0: MutSpan, arg1: Span, arg2: Span, arg3: usize) -> Maybe> line(arg0: Span, arg1: usize) -> usize lineEnd(arg0: Span, arg1: usize) -> usize lineStart(arg0: Span, arg1: usize) -> usize lineText(arg0: Span, arg1: usize) -> Span rangeLen(arg0: Span, arg1: usize, arg2: usize) -> usize rangeText(arg0: Span, arg1: usize, arg2: usize) -> Span ``` ### std.env ```text get(arg0: String) -> Maybe has(arg0: String) -> Bool getOr(arg0: String, arg1: String) -> String equals(arg0: String, arg1: String) -> Bool parseBool(arg0: String) -> Maybe parseBoolOr(arg0: String, arg1: Bool) -> Bool parseI32(arg0: String) -> Maybe parseI32Or(arg0: String, arg1: i32) -> i32 parseU32(arg0: String) -> Maybe parseU32Or(arg0: String, arg1: u32) -> u32 parseUsize(arg0: String) -> Maybe parseUsizeOr(arg0: String, arg1: usize) -> usize ``` ### std.fmt ```text bool(arg0: MutSpan, arg1: Bool) -> Maybe> hexLowerU32(arg0: MutSpan, arg1: u32) -> Maybe> i32(arg0: MutSpan, arg1: i32) -> Maybe> i32Base(arg0: MutSpan, arg1: i32, arg2: u32) -> Maybe> i32Sign(arg0: MutSpan, arg1: i32) -> Maybe> i64(arg0: MutSpan, arg1: i64) -> Maybe> i64Base(arg0: MutSpan, arg1: i64, arg2: u32) -> Maybe> i64Sign(arg0: MutSpan, arg1: i64) -> Maybe> padLeft(arg0: MutSpan, arg1: Span, arg2: usize, arg3: u8) -> Maybe> padRight(arg0: MutSpan, arg1: Span, arg2: usize, arg3: u8) -> Maybe> u32(arg0: MutSpan, arg1: u32) -> Maybe> u32Base(arg0: MutSpan, arg1: u32, arg2: u32) -> Maybe> u64(arg0: MutSpan, arg1: u64) -> Maybe> u64Base(arg0: MutSpan, arg1: u64, arg2: u32) -> Maybe> usize(arg0: MutSpan, arg1: usize) -> Maybe> usizeBase(arg0: MutSpan, arg1: usize, arg2: u32) -> Maybe> writeBool(arg0: mutref, arg1: Bool) -> Bool writeI32(arg0: mutref, arg1: i32) -> Bool writeI32Sign(arg0: mutref, arg1: i32) -> Bool writeI64(arg0: mutref, arg1: i64) -> Bool writeI64Sign(arg0: mutref, arg1: i64) -> Bool writeSpan(arg0: mutref, arg1: Span) -> Bool writeU32(arg0: mutref, arg1: u32) -> Bool writeU64(arg0: mutref, arg1: u64) -> Bool writeUsize(arg0: mutref, arg1: usize) -> Bool ``` ### std.fs ```text host() -> Fs open(arg0: Fs, arg1: String) -> Maybe> openOrRaise(arg0: Fs, arg1: String) -> owned raises [NotFound, TooLarge, Io] create(arg0: Fs, arg1: String) -> Maybe> createOrRaise(arg0: Fs, arg1: String) -> owned raises [NotFound, TooLarge, Io] read(arg0: String, arg1: MutSpan) -> usize readOrRaise(arg0: mutref, arg1: MutSpan) -> usize raises [NotFound, TooLarge, Io] write(arg0: String, arg1: String) -> usize writeAll(arg0: mutref, arg1: Span) -> Bool writeAllOrRaise(arg0: mutref, arg1: Span) -> Void raises [NotFound, TooLarge, Io] fileLenOrRaise(arg0: mutref) -> usize raises [NotFound, TooLarge, Io] readAll(allocator: Alloc, fs: Fs, path: String, max: usize) -> Maybe> readAllOrRaise(allocator: Alloc, fs: Fs, path: String, max: usize) -> owned raises [NotFound, TooLarge, Io] exists(arg0: String) -> Bool readBytes(arg0: String, arg1: MutSpan) -> Maybe readBytesAt(arg0: String, arg1: usize, arg2: MutSpan) -> Maybe writeBytes(arg0: String, arg1: Span) -> Maybe appendBytes(arg0: String, arg1: Span) -> Maybe isDir(arg0: String) -> Bool makeDir(arg0: String) -> Bool removeDir(arg0: String) -> Bool remove(arg0: String) -> Bool rename(arg0: String, arg1: String) -> Bool dirEntryCount(arg0: String) -> Maybe dirEntryName(arg0: MutSpan, arg1: String, arg2: usize) -> Maybe> tempName(arg0: MutSpan, arg1: String) -> Maybe atomicWrite(arg0: String, arg1: String, arg2: Span) -> Bool fileLen(arg0: mutref) -> Maybe close(arg0: mutref) -> Void readFile(arg0: Fs, arg1: String, arg2: MutSpan) -> Maybe writeFile(arg0: Fs, arg1: String, arg2: Span) -> Bool appendFile(arg0: Fs, arg1: String, arg2: Span) -> Bool readFileBytes(arg0: Fs, arg1: String, arg2: MutSpan) -> Maybe> readFileEquals(arg0: Fs, arg1: String, arg2: MutSpan, arg3: Span) -> Bool copyFile(arg0: String, arg1: String, arg2: MutSpan) -> Bool fileSize(arg0: Fs, arg1: String) -> Maybe isFile(arg0: String) -> Bool ensureDir(arg0: String) -> Bool ``` `readBytes` and `readFile` fill the caller buffer and return the TOTAL file size (snprintf convention): a value above `len(buffer)` means the buffer holds only the first `len(buffer)` bytes, so compare the result against the buffer length instead of assuming the whole file arrived. `readFileBytes` returns `null` when the file exceeds the buffer. Process files larger than your buffer with `readBytesAt`: loop `offset += len(buffer)` until `offset` reaches the returned total, taking `min(len(buffer), total - offset)` valid bytes per chunk. ### std.http ```text parseMethod(arg0: String) -> HttpMethod client(arg0: Net) -> HttpClient server(arg0: Net, arg1: Address) -> HttpServer listen(arg0: World, arg1: u16) -> Void raises [Io] fetch(arg0: HttpClient, arg1: Span, arg2: MutSpan, arg3: Duration) -> HttpResult resultOk(arg0: HttpResult) -> Bool resultStatus(arg0: HttpResult) -> u16 resultBodyLen(arg0: HttpResult) -> usize resultError(arg0: HttpResult) -> HttpError errorNone() -> HttpError errorInvalidUrl() -> HttpError errorUnsupportedProtocol() -> HttpError errorDns() -> HttpError errorConnect() -> HttpError errorTls() -> HttpError errorTimeout() -> HttpError errorTooLarge() -> HttpError errorProviderUnavailable() -> HttpError errorIo() -> HttpError errorInvalidRequest() -> HttpError errorName(arg0: HttpError) -> String responseLen(arg0: Span) -> usize responseHeadersLen(arg0: Span) -> usize responseBodyOffset(arg0: Span) -> usize headerValue(arg0: Span, arg1: Span) -> HttpHeaderValue headerFound(arg0: HttpHeaderValue) -> Bool headerOffset(arg0: HttpHeaderValue) -> usize headerLen(arg0: HttpHeaderValue) -> usize tlsBoundary() -> String statusReason(arg0: u16) -> String statusIsInformational(arg0: u16) -> Bool statusIsSuccess(arg0: u16) -> Bool statusIsRedirect(arg0: u16) -> Bool statusIsClientError(arg0: u16) -> Bool statusIsServerError(arg0: u16) -> Bool writeRequest(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeMethodRequest(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeGetRequest(arg0: MutSpan, arg1: Span) -> Maybe> writeHeadRequest(arg0: MutSpan, arg1: Span) -> Maybe> writeDeleteRequest(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonRequest(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeJsonMethodRequest(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writePostJsonRequest(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writePutJsonRequest(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writePatchJsonRequest(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeResponse(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeJsonResponse(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeResponseWithHeader(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeResponseWithHeaders(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeJsonResponseWithHeader(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeJsonResponseWithHeaders(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeJsonResponseWithCookie(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeJsonError(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeCorsPreflight(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeCorsJsonResponse(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeTextResponse(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeTextOk(arg0: MutSpan, arg1: Span) -> Maybe> writeHtmlResponse(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeHtmlOk(arg0: MutSpan, arg1: Span) -> Maybe> writeRedirect(arg0: MutSpan, arg1: u16, arg2: Span) -> Maybe> writeFound(arg0: MutSpan, arg1: Span) -> Maybe> writeSeeOther(arg0: MutSpan, arg1: Span) -> Maybe> writeMovedPermanently(arg0: MutSpan, arg1: Span) -> Maybe> writePermanentRedirect(arg0: MutSpan, arg1: Span) -> Maybe> contentTypeForPath(arg0: Span) -> String writeStaticResponse(arg0: MutSpan, arg1: u16, arg2: Span, arg3: Span) -> Maybe> writeJsonOk(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonCreated(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonBadRequest(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonUnauthorized(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonForbidden(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonNotFound(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonMethodNotAllowed(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonConflict(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonUnprocessable(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonTooManyRequests(arg0: MutSpan, arg1: Span) -> Maybe> writeJsonInternalServerError(arg0: MutSpan, arg1: Span) -> Maybe> writeNoContent(arg0: MutSpan) -> Maybe> writeRequestWithHeader(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeRequestWithHeaders(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeJsonRequestWithHeader(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeJsonRequestWithHeaders(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> requestMethodName(arg0: Span) -> Maybe> requestTarget(arg0: Span) -> Maybe> requestPath(arg0: Span) -> Maybe> pathSegmentCount(arg0: Span) -> usize pathSegment(arg0: Span, arg1: usize) -> Maybe> pathMatchesPattern(arg0: Span, arg1: Span) -> Bool pathParam(arg0: Span, arg1: Span, arg2: Span) -> Maybe> requestPathSegmentCount(arg0: Span) -> usize requestPathSegment(arg0: Span, arg1: usize) -> Maybe> requestQuery(arg0: Span) -> Maybe> requestQueryValue(arg0: Span, arg1: Span) -> Maybe> requestHeader(arg0: Span, arg1: Span) -> Maybe> requestBearerToken(arg0: Span) -> Maybe> requestCookie(arg0: Span, arg1: Span) -> Maybe> requestContentLength(arg0: Span) -> Maybe requestContentType(arg0: Span) -> Maybe> requestAccepts(arg0: Span, arg1: Span) -> Bool requestAcceptsJson(arg0: Span) -> Bool requestBody(arg0: Span) -> Maybe> requestBodyWithin(arg0: Span, arg1: usize) -> Maybe> requestHasJsonContentType(arg0: Span) -> Bool requestJsonBodyWithin(arg0: Span, arg1: usize) -> Maybe> requestJsonField(arg0: Span, arg1: Span, arg2: usize) -> Maybe> requestMatches(arg0: Span, arg1: Span, arg2: Span) -> Bool methodAllowed(arg0: Span, arg1: Span) -> Bool requestMethodAllowed(arg0: Span, arg1: Span) -> Bool requestMethodIs(arg0: Span, arg1: Span) -> Bool requestIsGet(arg0: Span, arg1: Span) -> Bool requestIsHead(arg0: Span, arg1: Span) -> Bool requestIsOptions(arg0: Span, arg1: Span) -> Bool requestIsPost(arg0: Span, arg1: Span) -> Bool requestIsPut(arg0: Span, arg1: Span) -> Bool requestIsPatch(arg0: Span, arg1: Span) -> Bool requestIsDelete(arg0: Span, arg1: Span) -> Bool requestPathStartsWith(arg0: Span, arg1: Span) -> Bool requestPathTailAfter(arg0: Span, arg1: Span) -> Maybe> requestRouteMatches(arg0: Span, arg1: Span, arg2: Span) -> Bool requestRouteMethodAllowed(arg0: Span, arg1: Span, arg2: Span) -> Bool requestPathParam(arg0: Span, arg1: Span, arg2: Span) -> Maybe> headerBlockSafe(arg0: Span) -> Bool headerBytes(arg0: Span, arg1: HttpHeaderValue) -> Maybe> responseBody(arg0: Span, arg1: HttpResult) -> Maybe> responseBodyBytes(arg0: Span) -> Maybe> responseBodyEquals(arg0: Span, arg1: Span) -> Bool responseStatus(arg0: Span) -> Maybe responseStatusIs(arg0: Span, arg1: u16) -> Bool responseHeader(arg0: Span, arg1: Span) -> Maybe> responseContentType(arg0: Span) -> Maybe> responseRedirectLocation(arg0: Span) -> Maybe> responseMatches(arg0: Span, arg1: u16, arg2: Span, arg3: Span) -> Bool testRequest(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> testJsonRequest(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> ``` ### std.io ```text bufferedReader(arg0: MutSpan) -> BufferedReader bufferedWriter(arg0: MutSpan) -> BufferedWriter readerCapacity(arg0: ref) -> usize writerCapacity(arg0: ref) -> usize copy(arg0: MutSpan, arg1: Span) -> usize copyN(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe copyBuffer(arg0: mutref, arg1: mutref, arg2: MutSpan) -> usize copyReaderN(arg0: mutref, arg1: mutref, arg2: usize, arg3: MutSpan) -> Maybe discard(arg0: mutref, arg1: MutSpan) -> usize errorCapacity() -> u32 errorEof() -> u32 errorIo() -> u32 errorName(arg0: u32) -> String errorNone() -> u32 errorPermission() -> u32 errorShortRead() -> u32 errorShortWrite() -> u32 errorTimeout() -> u32 fixedReader(arg0: Span, arg1: usize) -> FixedReader fixedReaderCursor(arg0: ref) -> usize fixedReaderDone(arg0: ref) -> Bool fixedReaderLen(arg0: ref) -> usize fixedReaderLimit(arg0: ref, arg1: usize) -> FixedReader fixedReaderRead(arg0: mutref, arg1: MutSpan) -> usize fixedReaderReadAll(arg0: mutref, arg1: MutSpan) -> Maybe> fixedReaderReadAt(arg0: ref, arg1: usize, arg2: MutSpan) -> Maybe fixedReaderReadByte(arg0: mutref) -> Maybe fixedReaderReadExact(arg0: mutref, arg1: MutSpan) -> Bool fixedReaderReadLine(arg0: mutref) -> Maybe> fixedReaderReadUntilDelimiter(arg0: mutref, arg1: u8) -> Maybe> fixedReaderRemaining(arg0: ref) -> usize fixedReaderSeek(arg0: mutref, arg1: usize) -> Bool fixedWriter(arg0: MutSpan, arg1: usize) -> FixedWriter fixedWriterCapacity(arg0: ref) -> usize fixedWriterClear(arg0: mutref) -> usize fixedWriterCursor(arg0: ref) -> usize fixedWriterRemaining(arg0: ref) -> usize fixedWriterSeek(arg0: mutref, arg1: usize) -> Bool fixedWriterTruncate(arg0: mutref, arg1: usize) -> usize fixedWriterView(arg0: ref) -> Span fixedWriterWrite(arg0: mutref, arg1: Span) -> Bool fixedWriterWriteAll(arg0: mutref, arg1: Span) -> Bool fixedWriterWriteAt(arg0: mutref, arg1: usize, arg2: Span) -> Bool fixedWriterWriteByte(arg0: mutref, arg1: u8) -> Bool multiRead(arg0: mutref, arg1: mutref, arg2: MutSpan) -> usize read(arg0: Span, arg1: usize, arg2: MutSpan) -> Maybe readAll(arg0: Span, arg1: MutSpan) -> Maybe> readAt(arg0: Span, arg1: usize, arg2: MutSpan) -> Maybe readByte(arg0: Span, arg1: usize) -> Maybe readExact(arg0: Span, arg1: usize, arg2: MutSpan) -> Maybe readLine(arg0: Span, arg1: usize) -> Maybe> readLineStart(arg0: Span, arg1: usize) -> usize readUntilDelimiter(arg0: Span, arg1: usize, arg2: u8) -> Maybe> readUntilDelimiterStart(arg0: Span, arg1: usize, arg2: u8) -> usize teeRead(arg0: mutref, arg1: mutref, arg2: MutSpan) -> Maybe writeByte(arg0: MutSpan, arg1: usize, arg2: u8) -> Maybe writeAll(arg0: MutSpan, arg1: usize, arg2: Span) -> Maybe writeAt(arg0: MutSpan, arg1: usize, arg2: Span) -> Maybe writeSpan(arg0: MutSpan, arg1: usize, arg2: Span) -> Maybe written(arg0: Span, arg1: usize) -> Span remaining(arg0: Span, arg1: usize) -> usize nextLine(arg0: Span, arg1: usize) -> Maybe> nextLineStart(arg0: Span, arg1: usize) -> usize countLines(arg0: Span) -> usize ``` ### std.inet ```text isIpv4(text: Span) -> Bool parseIpv4(text: Span) -> Maybe writeIpv4(buffer: MutSpan, value: u32) -> Maybe> isIpv4Unspecified(value: u32) -> Bool isIpv4Loopback(value: u32) -> Bool isIpv4Private(value: u32) -> Bool isIpv4LinkLocal(value: u32) -> Bool isIpv4Multicast(value: u32) -> Bool isIpv6(text: Span) -> Bool parseIpv6(buffer: MutSpan, text: Span) -> Maybe> isIp(text: Span) -> Bool parseIp(buffer: MutSpan, text: Span) -> Maybe> isIpv6Unspecified(bytes: Span) -> Bool isIpv6Loopback(bytes: Span) -> Bool isIpv6Multicast(bytes: Span) -> Bool isIpv6LinkLocal(bytes: Span) -> Bool isIpv6Private(bytes: Span) -> Bool isIpv6UniqueLocal(bytes: Span) -> Bool isIpv6MappedIpv4(bytes: Span) -> Bool ipv6MappedIpv4(bytes: Span) -> Maybe isHostname(text: Span) -> Bool ``` Internet address literal helpers, kept separate from `std.net` so they stay usable on targets without the Net capability. `isIpv4`/`parseIpv4` accept strict dotted quads (four 0-255 octets, no leading zeros; the parse packs big-endian), and `writeIpv4` writes a packed value back to dotted-quad text. IPv4 classification helpers cover unspecified, loopback, RFC 1918 private, link-local, and multicast ranges. `isIpv6`/`parseIpv6` accept RFC 4291 forms including `::` compression and embedded IPv4, writing 16 network-order bytes into the caller buffer. IPv6 helpers classify unspecified, loopback, multicast, link-local, unique-local/private, and IPv4-mapped addresses; `parseIp` accepts either family and writes 4 or 16 network-order bytes. `isHostname` enforces RFC 1123: dot-separated labels of 1-63 alphanumeric/hyphen bytes, no leading/trailing hyphens, 253 bytes total. ### std.json ```text validate(arg0: String) -> Bool validateBytes(arg0: Span) -> Bool parse(allocator: Alloc, text: String) -> Maybe parseBytes(allocator: Alloc, bytes: Span) -> Maybe streamTokens(arg0: String) -> usize streamTokensBytes(arg0: Span) -> usize writeString(arg0: MutSpan, arg1: String) -> Maybe decodeBoundary() -> String errorNone() -> u32 errorInvalid() -> u32 errorTrailing() -> u32 errorName(arg0: u32) -> String errorExpected(arg0: u32) -> String validateError(arg0: Span) -> u32 errorOffset(arg0: Span) -> usize errorLine(arg0: Span) -> usize errorColumn(arg0: Span) -> usize field(arg0: Span, arg1: Span) -> Maybe> objectFieldCount(arg0: Span) -> Maybe objectKey(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe> objectValue(arg0: Span, arg1: usize) -> Maybe> arrayCount(arg0: Span) -> Maybe arrayValue(arg0: Span, arg1: usize) -> Maybe> path(arg0: Span, arg1: Span) -> Maybe> pathString(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> pathU32(arg0: Span, arg1: Span) -> Maybe pathBool(arg0: Span, arg1: Span) -> Maybe stringDecode(arg0: MutSpan, arg1: Span) -> Maybe> string(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> u32(arg0: Span, arg1: Span) -> Maybe bool(arg0: Span, arg1: Span) -> Maybe writeStringBytes(arg0: MutSpan, arg1: Span) -> Maybe> writeObject1String(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeObject1U32(arg0: MutSpan, arg1: Span, arg2: u32) -> Maybe> writeObject1Bool(arg0: MutSpan, arg1: Span, arg2: Bool) -> Maybe> writeFieldRaw(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeFieldString(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeFieldU32(arg0: MutSpan, arg1: Span, arg2: u32) -> Maybe> writeFieldBool(arg0: MutSpan, arg1: Span, arg2: Bool) -> Maybe> writeObject2Fields(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeObject2StringField(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> writeObject2U32Field(arg0: MutSpan, arg1: Span, arg2: u32, arg3: Span) -> Maybe> writeObject2BoolField(arg0: MutSpan, arg1: Span, arg2: Bool, arg3: Span) -> Maybe> writeArray2Strings(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeArray2U32(arg0: MutSpan, arg1: u32, arg2: u32) -> Maybe> writeArray2Bools(arg0: MutSpan, arg1: Bool, arg2: Bool) -> Maybe> ``` ### std.toml ```text validate(arg0: String) -> Bool validateBytes(arg0: Span) -> Bool field(arg0: Span, arg1: Span) -> Maybe> stringDecode(arg0: MutSpan, arg1: Span) -> Maybe> string(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> u32(arg0: Span, arg1: Span) -> Maybe i32(arg0: Span, arg1: Span) -> Maybe bool(arg0: Span, arg1: Span) -> Maybe arrayCount(arg0: Span) -> Maybe arrayValue(arg0: Span, arg1: usize) -> Maybe> arrayString(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe> arrayU32(arg0: Span, arg1: usize) -> Maybe arrayI32(arg0: Span, arg1: usize) -> Maybe arrayBool(arg0: Span, arg1: usize) -> Maybe writeKeyValueString(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeKeyValueU32(arg0: MutSpan, arg1: Span, arg2: u32) -> Maybe> writeKeyValueBool(arg0: MutSpan, arg1: Span, arg2: Bool) -> Maybe> writeTableHeader(arg0: MutSpan, arg1: Span) -> Maybe> ``` ### std.log ```text message(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> keyValue(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> levelDebug() -> String levelInfo() -> String levelWarn() -> String levelError() -> String stringField(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> messageField(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> redacted(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> ``` ### std.term ```text reset() -> String bold() -> String dim() -> String underline() -> String inverse() -> String fgDefault() -> String fgBlack() -> String fgRed() -> String fgGreen() -> String fgYellow() -> String fgBlue() -> String fgMagenta() -> String fgCyan() -> String fgWhite() -> String bgDefault() -> String bgBlack() -> String bgRed() -> String bgGreen() -> String bgYellow() -> String bgBlue() -> String bgMagenta() -> String bgCyan() -> String bgWhite() -> String clearScreen() -> String clearScreenDown() -> String clearScreenUp() -> String clearLine() -> String clearLineRight() -> String clearLineLeft() -> String cursorHome() -> String cursorTo(arg0: MutSpan, arg1: usize, arg2: usize) -> Maybe> cursorUp(arg0: MutSpan, arg1: usize) -> Maybe> cursorDown(arg0: MutSpan, arg1: usize) -> Maybe> cursorRight(arg0: MutSpan, arg1: usize) -> Maybe> cursorLeft(arg0: MutSpan, arg1: usize) -> Maybe> saveCursor() -> String restoreCursor() -> String hideCursor() -> String showCursor() -> String enterAltScreen() -> String leaveAltScreen() -> String enterBracketedPaste() -> String leaveBracketedPaste() -> String enterMouseCapture() -> String leaveMouseCapture() -> String keyNone() -> u32 keyEscape() -> u32 keyEnter() -> u32 keyTab() -> u32 keyBackspace() -> u32 keyCtrlA() -> u32 keyCtrlC() -> u32 keyCtrlD() -> u32 keyCtrlE() -> u32 keyCtrlK() -> u32 keyCtrlL() -> u32 keyCtrlN() -> u32 keyCtrlP() -> u32 keyCtrlR() -> u32 keyCtrlU() -> u32 keyCtrlW() -> u32 keyArrowUp() -> u32 keyArrowDown() -> u32 keyArrowRight() -> u32 keyArrowLeft() -> u32 keyDelete() -> u32 keyHome() -> u32 keyEnd() -> u32 keyPageUp() -> u32 keyPageDown() -> u32 keyInsert() -> u32 keyShiftTab() -> u32 keyF1() -> u32 keyF2() -> u32 keyF3() -> u32 keyF4() -> u32 keyF5() -> u32 keyF6() -> u32 keyF7() -> u32 keyF8() -> u32 keyF9() -> u32 keyF10() -> u32 keyF11() -> u32 keyF12() -> u32 keyPasteStart() -> u32 keyPasteEnd() -> u32 keyCode(arg0: Span) -> u32 keyByteLen(arg0: Span) -> usize stdinIsTty() -> Bool stdoutIsTty() -> Bool widthOr(arg0: usize) -> usize heightOr(arg0: usize) -> usize enterRawMode() -> Bool leaveRawMode() -> Bool readInput(arg0: MutSpan) -> Maybe ``` `std.term.readInput(buffer)` fills the caller buffer with currently available stdin bytes without blocking. It returns `null` when no bytes are available, the buffer is empty, or the hosted input source cannot be read. ### std.math ```text absI32(arg0: i32) -> u32 absI64(arg0: i64) -> u64 binomialU32(arg0: u32, arg1: u32) -> Maybe checkedAddI32(arg0: i32, arg1: i32) -> Maybe checkedAddU32(arg0: u32, arg1: u32) -> Maybe checkedAddUsize(arg0: usize, arg1: usize) -> Maybe checkedLcmU32(arg0: u32, arg1: u32) -> Maybe checkedMulI32(arg0: i32, arg1: i32) -> Maybe checkedMulU32(arg0: u32, arg1: u32) -> Maybe checkedMulUsize(arg0: usize, arg1: usize) -> Maybe checkedPowU32(arg0: u32, arg1: u32) -> Maybe checkedSubI32(arg0: i32, arg1: i32) -> Maybe checkedSubU32(arg0: u32, arg1: u32) -> Maybe checkedSubUsize(arg0: usize, arg1: usize) -> Maybe clampI32(arg0: i32, arg1: i32, arg2: i32) -> i32 clampI64(arg0: i64, arg1: i64, arg2: i64) -> i64 clampU32(arg0: u32, arg1: u32, arg2: u32) -> u32 clampU64(arg0: u64, arg1: u64, arg2: u64) -> u64 clampUsize(arg0: usize, arg1: usize, arg2: usize) -> usize divisorCountU32(arg0: u32) -> u32 factorialU32(arg0: u32) -> Maybe gcdU32(arg0: u32, arg1: u32) -> u32 isEvenU32(arg0: u32) -> Bool isOddU32(arg0: u32) -> Bool isPrimeU32(arg0: u32) -> Bool lcmU32(arg0: u32, arg1: u32) -> u32 maxI32(arg0: i32, arg1: i32) -> i32 maxI64(arg0: i64, arg1: i64) -> i64 maxU32(arg0: u32, arg1: u32) -> u32 maxU64(arg0: u64, arg1: u64) -> u64 maxUsize(arg0: usize, arg1: usize) -> usize minI32(arg0: i32, arg1: i32) -> i32 minI64(arg0: i64, arg1: i64) -> i64 minU32(arg0: u32, arg1: u32) -> u32 minU64(arg0: u64, arg1: u64) -> u64 minUsize(arg0: usize, arg1: usize) -> usize modPowU32(arg0: u32, arg1: u32, arg2: u32) -> u32 powU32(arg0: u32, arg1: u32) -> u32 properDivisorSumU32(arg0: u32) -> u32 saturatingAddI32(arg0: i32, arg1: i32) -> i32 saturatingAddU32(arg0: u32, arg1: u32) -> u32 saturatingAddUsize(arg0: usize, arg1: usize) -> usize saturatingMulI32(arg0: i32, arg1: i32) -> i32 saturatingMulU32(arg0: u32, arg1: u32) -> u32 saturatingMulUsize(arg0: usize, arg1: usize) -> usize saturatingSubI32(arg0: i32, arg1: i32) -> i32 saturatingSubU32(arg0: u32, arg1: u32) -> u32 saturatingSubUsize(arg0: usize, arg1: usize) -> usize sqrtFloorU32(arg0: u32) -> u32 ``` ### std.mem ```text copy(arg0: MutSpan, arg1: Span) -> usize copyItems(dst: MutSpan, src: Span) -> usize fill(arg0: MutSpan, arg1: u8) -> usize fillItems(dst: MutSpan, value: T) -> usize eql(arg0: String, arg1: String) -> Bool span(arg0: String) -> Span contains(items: Span, value: T) -> Bool compareI32(arg0: Span, arg1: Span) -> i32 compareU8(arg0: Span, arg1: Span) -> i32 compareBytes(arg0: Span, arg1: Span) -> i32 compareU32(arg0: Span, arg1: Span) -> i32 compareUsize(arg0: Span, arg1: Span) -> i32 startsWith(items: Span, prefix: Span) -> Bool endsWith(items: Span, suffix: Span) -> Bool splitBefore(items: Span, delimiter: T) -> Span splitAfter(items: Span, delimiter: T) -> Span isEmpty(items: Span) -> Bool chunkCount(items: Span, chunkSize: usize) -> usize chunk(items: Span, chunkIndex: usize, chunkSize: usize) -> Span windowCount(items: Span, windowSize: usize) -> usize window(items: Span, windowIndex: usize, windowSize: usize) -> Span advance(items: Span, cursor: usize, count: usize) -> usize cursorDone(items: Span, cursor: usize) -> Bool remaining(items: Span, cursor: usize) -> Span cursorChunk(items: Span, cursor: usize, count: usize) -> Span prefix(items: Span, len: usize) -> Span dropPrefix(items: Span, len: usize) -> Span suffix(items: Span, len: usize) -> Span dropSuffix(items: Span, len: usize) -> Span slice(items: Span, start: usize, len: usize) -> Span len(items: Span) -> usize get(items: Span, index: usize) -> Maybe eqlBytes(left: Span, right: Span) -> Bool nullAlloc() -> NullAlloc fixedBufAlloc(arg0: MutSpan) -> FixedBufAlloc arena(arg0: MutSpan) -> FixedBufAlloc pageAlloc() -> PageAlloc generalAlloc() -> GeneralAlloc allocBytes(allocator: Alloc, len: usize) -> Maybe> byteBuf(allocator: Alloc, capacity: usize) -> Maybe> vec(arg0: MutSpan) -> Vec vecPush(arg0: mutref, arg1: u8) -> Bool vecBytes(arg0: ref) -> Span vecGet(arg0: ref, arg1: usize) -> Maybe vecSet(arg0: mutref, arg1: usize, arg2: u8) -> Bool vecClear(arg0: mutref) -> usize vecPop(arg0: mutref) -> Bool vecTruncate(arg0: mutref, arg1: usize) -> usize vecRemoveSwap(arg0: mutref, arg1: usize) -> Bool vecIndex(arg0: ref, arg1: u8) -> usize vecContains(arg0: ref, arg1: u8) -> Bool vecInsertUnique(arg0: mutref, arg1: u8) -> Bool vecRemoveValue(arg0: mutref, arg1: u8) -> Bool vecLen(arg0: ref) -> usize vecCapacity(arg0: ref) -> usize vecRemaining(arg0: ref) -> usize vecIsEmpty(arg0: ref) -> Bool vecIsFull(arg0: ref) -> Bool bufBytes(arg0: ref) -> MutSpan bufLen(arg0: ref) -> usize reset(arg0: mutref) -> Void capacity(arg0: FixedBufAlloc) -> usize ``` ### std.net ```text host() -> Net address(arg0: String, arg1: u16) -> Address dnsName(arg0: Address) -> String connect(arg0: Net, arg1: Address) -> Maybe listen(arg0: Net, arg1: Address) -> Maybe withTimeout(arg0: Address, arg1: Duration) -> Address localhost(arg0: u16) -> Address loopback(arg0: u16) -> Address ``` ### std.parse ```text isAsciiDigit(arg0: Span) -> Bool isAsciiAlpha(arg0: Span) -> Bool isIdentifierStart(arg0: Span) -> Bool isWhitespace(arg0: Span) -> Bool scanDigits(arg0: Span) -> usize scanIdentifier(arg0: Span) -> usize scanUntilByte(arg0: Span, arg1: u8) -> usize scanWhitespace(arg0: Span) -> usize tokenAscii(arg0: Span) -> Span parseBool(arg0: Span) -> Maybe parseByteSize(arg0: Span) -> Maybe parseDuration(arg0: Span) -> Maybe parseI32(arg0: Span) -> Maybe parseI32Base(arg0: Span, arg1: u32) -> Maybe parseI32Prefix(arg0: Span) -> Maybe parseI64(arg0: Span) -> Maybe parseI64Base(arg0: Span, arg1: u32) -> Maybe parseI64Prefix(arg0: Span) -> Maybe parseU8(arg0: Span) -> Maybe parseU16(arg0: Span) -> Maybe parseU32(arg0: Span) -> Maybe parseU32Base(arg0: Span, arg1: u32) -> Maybe parseU32Prefix(arg0: Span) -> Maybe parseU64(arg0: Span) -> Maybe parseU64Base(arg0: Span, arg1: u32) -> Maybe parseU64Prefix(arg0: Span) -> Maybe parseUsize(arg0: Span) -> Maybe parseUsizeBase(arg0: Span, arg1: u32) -> Maybe parseUsizePrefix(arg0: Span) -> Maybe ``` ### std.path ```text basename(arg0: String) -> String dirname(arg0: String) -> String extension(arg0: String) -> String stem(arg0: String) -> String splitDir(arg0: String) -> String splitBase(arg0: String) -> String componentCount(arg0: String) -> usize component(arg0: String, arg1: usize) -> Maybe isAbs(arg0: String) -> Bool abs(arg0: MutSpan, arg1: String, arg2: String) -> Maybe join(arg0: MutSpan, arg1: String, arg2: String) -> Maybe normalize(arg0: MutSpan, arg1: String) -> Maybe relative(arg0: MutSpan, arg1: String, arg2: String) -> Maybe ``` ### std.proc ```text spawn(arg0: String) -> ProcStatus spawnInherit(arg0: String) -> ProcStatus spawnInheritArgs(arg0: String, arg1: Span, arg2: String, arg3: Span) -> ProcStatus exitCode(arg0: ProcStatus) -> i32 succeeded(arg0: ProcStatus) -> Bool failed(arg0: ProcStatus) -> Bool runOk(arg0: String) -> Bool runCode(arg0: String) -> i32 capture(arg0: String, arg1: MutSpan) -> Maybe captureArgs(arg0: String, arg1: Span, arg2: MutSpan) -> Maybe captureFiles(arg0: String, arg1: String, arg2: String) -> ProcStatus captureFilesArgs(arg0: String, arg1: Span, arg2: String, arg3: String) -> ProcStatus spawnChild(arg0: String) -> ProcChild spawnChildIn(arg0: String, arg1: String) -> ProcChild spawnChildInEnv(arg0: String, arg1: String, arg2: Span) -> ProcChild spawnChildArgs(arg0: String, arg1: Span, arg2: String, arg3: Span) -> ProcChild childValid(arg0: ProcChild) -> Bool running(arg0: ProcChild) -> Bool wait(arg0: ProcChild) -> ProcStatus kill(arg0: ProcChild) -> Bool interrupt(arg0: ProcChild) -> Bool close(arg0: ProcChild) -> Bool closeStdin(arg0: ProcChild) -> Bool pid(arg0: ProcChild) -> i32 pidRunning(arg0: i32) -> Bool killPid(arg0: i32) -> Bool interruptPid(arg0: i32) -> Bool killGroupPid(arg0: i32) -> Bool interruptGroupPid(arg0: i32) -> Bool readStdout(arg0: ProcChild, arg1: MutSpan) -> Maybe readStderr(arg0: ProcChild, arg1: MutSpan) -> Maybe writeStdin(arg0: ProcChild, arg1: Span) -> Maybe ``` ### std.pty ```text spawn(arg0: String) -> ProcChild spawnIn(arg0: String, arg1: String) -> ProcChild spawnInEnv(arg0: String, arg1: String, arg2: Span) -> ProcChild spawnArgs(arg0: String, arg1: Span, arg2: String, arg3: Span) -> ProcChild valid(arg0: ProcChild) -> Bool childValid(arg0: ProcChild) -> Bool running(arg0: ProcChild) -> Bool wait(arg0: ProcChild) -> ProcStatus kill(arg0: ProcChild) -> Bool interrupt(arg0: ProcChild) -> Bool close(arg0: ProcChild) -> Bool pid(arg0: ProcChild) -> i32 read(arg0: ProcChild, arg1: MutSpan) -> Maybe write(arg0: ProcChild, arg1: Span) -> Maybe resize(arg0: ProcChild, arg1: usize, arg2: usize) -> Bool ``` `std.pty` starts hosted children attached to a pseudoterminal instead of separate stdin/stdout/stderr pipes. It returns the same `ProcChild` handle shape as `std.proc`, so `running`, `wait`, `interrupt`, `kill`, `close`, and `pid` have the same lifecycle meaning. `read` and `write` are nonblocking; `read` returns `null` when no bytes are currently available or the terminal has closed. For short-lived PTY children, drain output with `read` before `wait`; once the child exits, host PTYs may report the terminal as closed. Use PTY children for interactive programs that need terminal behavior such as line editing, prompts, color, cursor control, or terminal-size awareness. ### std.rand ```text seed(arg0: u32) -> RandSource nextU32(arg0: mutref) -> u32 nextBool(arg0: mutref) -> Bool nextBelow(arg0: mutref, arg1: u32) -> Maybe rangeU32(arg0: mutref, arg1: u32, arg2: u32) -> Maybe entropyU32() -> u32 entropySeed() -> RandSource entropyHex32(arg0: MutSpan) -> Maybe> ``` ### std.regex ```text compile(buffer: MutSpan, pattern: Span) -> Maybe> compileErrorOffset(buffer: MutSpan, pattern: Span) -> Maybe compileStatus(buffer: MutSpan, pattern: Span) -> u32 contains(pattern: Span, text: Span) -> Maybe find(pattern: Span, text: Span) -> Maybe> findCount(pattern: Span, text: Span) -> Maybe findIndex(pattern: Span, text: Span) -> Maybe findNth(pattern: Span, text: Span, index: usize) -> Maybe> findNthIndex(pattern: Span, text: Span, index: usize) -> Maybe replace(buffer: MutSpan, pattern: Span, text: Span, replacement: Span) -> Maybe> split(pattern: Span, text: Span, index: usize) -> Maybe> splitCount(pattern: Span, text: Span) -> Maybe statusName(status: u32) -> String isMatch(program: Span, text: Span) -> Bool matches(pattern: Span, text: Span) -> Maybe ``` Supported pattern subset (ECMA-262-leaning syntax, matching by codepoint, unanchored search like `RegExp.prototype.test`): literals, `.`, classes with negation, ranges, and `\d \D \w \W \s \S`, anchors `^` `$`, word boundaries `\b` `\B`, greedy quantifiers `* + ? {m} {m,} {m,n}`, alternation `|`, capturing and `(?:...)` groups (matching only). Compile once into a caller buffer, then call `isMatch` repeatedly. Unsupported constructs are compile errors with status codes: 1 backreference, 2 lookahead, 3 lookbehind, 4 named group, 5 lazy quantifier, 6 group modifier, 7 unicode property escape, 8 syntax, 9 quantifier range, 10 over buffer/2048-byte program limit, 11 pattern not UTF-8, 12 nesting depth over 32. `statusName` names a code for diagnostics. Search, split, and replace helpers use the leftmost start and longest end for each match; `split` and `splitCount` use non-empty matches as separators and ignore zero-length matches. ### std.search ```text binaryI32(arg0: Span, arg1: i32) -> usize binaryDescI32(arg0: Span, arg1: i32) -> usize binaryU32(arg0: Span, arg1: u32) -> usize binaryDescU32(arg0: Span, arg1: u32) -> usize binaryUsize(arg0: Span, arg1: usize) -> usize binaryDescUsize(arg0: Span, arg1: usize) -> usize containsSortedI32(arg0: Span, arg1: i32) -> Bool containsSortedDescI32(arg0: Span, arg1: i32) -> Bool containsSortedU32(arg0: Span, arg1: u32) -> Bool containsSortedDescU32(arg0: Span, arg1: u32) -> Bool containsSortedUsize(arg0: Span, arg1: usize) -> Bool containsSortedDescUsize(arg0: Span, arg1: usize) -> Bool countSortedI32(arg0: Span, arg1: i32) -> usize countSortedDescI32(arg0: Span, arg1: i32) -> usize countSortedU32(arg0: Span, arg1: u32) -> usize countSortedDescU32(arg0: Span, arg1: u32) -> usize countSortedUsize(arg0: Span, arg1: usize) -> usize countSortedDescUsize(arg0: Span, arg1: usize) -> usize equalRangeI32(arg0: Span, arg1: i32) -> Span equalRangeDescI32(arg0: Span, arg1: i32) -> Span equalRangeU32(arg0: Span, arg1: u32) -> Span equalRangeDescU32(arg0: Span, arg1: u32) -> Span equalRangeUsize(arg0: Span, arg1: usize) -> Span equalRangeDescUsize(arg0: Span, arg1: usize) -> Span partitionPointI32(arg0: Span, arg1: i32) -> usize partitionPointDescI32(arg0: Span, arg1: i32) -> usize partitionPointU32(arg0: Span, arg1: u32) -> usize partitionPointDescU32(arg0: Span, arg1: u32) -> usize partitionPointUsize(arg0: Span, arg1: usize) -> usize partitionPointDescUsize(arg0: Span, arg1: usize) -> usize indexOf(items: Span, value: T) -> usize lastIndexOf(items: Span, value: T) -> usize lowerBoundI32(arg0: Span, arg1: i32) -> usize lowerBoundDescI32(arg0: Span, arg1: i32) -> usize lowerBoundU32(arg0: Span, arg1: u32) -> usize lowerBoundDescU32(arg0: Span, arg1: u32) -> usize lowerBoundUsize(arg0: Span, arg1: usize) -> usize lowerBoundDescUsize(arg0: Span, arg1: usize) -> usize minI32(arg0: Span) -> Maybe minU32(arg0: Span) -> Maybe minUsize(arg0: Span) -> Maybe minIndexI32(arg0: Span) -> usize minIndexU32(arg0: Span) -> usize minIndexUsize(arg0: Span) -> usize maxI32(arg0: Span) -> Maybe maxU32(arg0: Span) -> Maybe maxUsize(arg0: Span) -> Maybe maxIndexI32(arg0: Span) -> usize maxIndexU32(arg0: Span) -> usize maxIndexUsize(arg0: Span) -> usize upperBoundI32(arg0: Span, arg1: i32) -> usize upperBoundDescI32(arg0: Span, arg1: i32) -> usize upperBoundU32(arg0: Span, arg1: u32) -> usize upperBoundDescU32(arg0: Span, arg1: u32) -> usize upperBoundUsize(arg0: Span, arg1: usize) -> usize upperBoundDescUsize(arg0: Span, arg1: usize) -> usize ``` ### std.sort ```text insertionI32(arg0: MutSpan) -> Void insertionDescI32(arg0: MutSpan) -> Void insertionU32(arg0: MutSpan) -> Void insertionDescU32(arg0: MutSpan) -> Void insertionUsize(arg0: MutSpan) -> Void insertionDescUsize(arg0: MutSpan) -> Void stableI32(arg0: MutSpan) -> Void stableU32(arg0: MutSpan) -> Void stableUsize(arg0: MutSpan) -> Void stableDescI32(arg0: MutSpan) -> Void stableDescU32(arg0: MutSpan) -> Void stableDescUsize(arg0: MutSpan) -> Void unstableI32(arg0: MutSpan) -> Void unstableU32(arg0: MutSpan) -> Void unstableUsize(arg0: MutSpan) -> Void unstableDescI32(arg0: MutSpan) -> Void unstableDescU32(arg0: MutSpan) -> Void unstableDescUsize(arg0: MutSpan) -> Void reverseI32(arg0: MutSpan) -> Void swapI32(arg0: MutSpan, arg1: usize, arg2: usize) -> Bool rotateLeftI32(arg0: MutSpan, arg1: usize) -> Void rotateRightI32(arg0: MutSpan, arg1: usize) -> Void reverseU32(arg0: MutSpan) -> Void swapU32(arg0: MutSpan, arg1: usize, arg2: usize) -> Bool rotateLeftU32(arg0: MutSpan, arg1: usize) -> Void rotateRightU32(arg0: MutSpan, arg1: usize) -> Void reverseUsize(arg0: MutSpan) -> Void swapUsize(arg0: MutSpan, arg1: usize, arg2: usize) -> Bool rotateLeftUsize(arg0: MutSpan, arg1: usize) -> Void rotateRightUsize(arg0: MutSpan, arg1: usize) -> Void isSortedI32(arg0: Span) -> Bool isSortedDescI32(arg0: Span) -> Bool isSortedU32(arg0: Span) -> Bool isSortedDescU32(arg0: Span) -> Bool isSortedUsize(arg0: Span) -> Bool isSortedDescUsize(arg0: Span) -> Bool partitionI32(arg0: MutSpan, arg1: i32) -> usize partitionDescI32(arg0: MutSpan, arg1: i32) -> usize partitionU32(arg0: MutSpan, arg1: u32) -> usize partitionDescU32(arg0: MutSpan, arg1: u32) -> usize partitionUsize(arg0: MutSpan, arg1: usize) -> usize partitionDescUsize(arg0: MutSpan, arg1: usize) -> usize isPartitionedI32(arg0: Span, arg1: i32) -> Bool isPartitionedDescI32(arg0: Span, arg1: i32) -> Bool isPartitionedU32(arg0: Span, arg1: u32) -> Bool isPartitionedDescU32(arg0: Span, arg1: u32) -> Bool isPartitionedUsize(arg0: Span, arg1: usize) -> Bool isPartitionedDescUsize(arg0: Span, arg1: usize) -> Bool selectNthI32(arg0: MutSpan, arg1: usize) -> Bool selectNthDescI32(arg0: MutSpan, arg1: usize) -> Bool selectNthU32(arg0: MutSpan, arg1: usize) -> Bool selectNthDescU32(arg0: MutSpan, arg1: usize) -> Bool selectNthUsize(arg0: MutSpan, arg1: usize) -> Bool selectNthDescUsize(arg0: MutSpan, arg1: usize) -> Bool mergeSortedI32(arg0: MutSpan, arg1: Span, arg2: Span) -> usize mergeSortedDescI32(arg0: MutSpan, arg1: Span, arg2: Span) -> usize mergeSortedU32(arg0: MutSpan, arg1: Span, arg2: Span) -> usize mergeSortedDescU32(arg0: MutSpan, arg1: Span, arg2: Span) -> usize mergeSortedUsize(arg0: MutSpan, arg1: Span, arg2: Span) -> usize mergeSortedDescUsize(arg0: MutSpan, arg1: Span, arg2: Span) -> usize dedupeSortedI32(arg0: MutSpan) -> usize dedupeSortedU32(arg0: MutSpan) -> usize dedupeSortedUsize(arg0: MutSpan) -> usize ``` ### std.str ```text contains(arg0: Span, arg1: Span) -> Bool concat(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> copy(arg0: MutSpan, arg1: Span) -> Maybe> count(arg0: Span, arg1: Span) -> usize countByte(arg0: Span, arg1: u8) -> usize eqlIgnoreAsciiCase(arg0: Span, arg1: Span) -> Bool endsWith(arg0: Span, arg1: Span) -> Bool fieldAscii(arg0: Span, arg1: usize) -> Maybe> fieldCountAscii(arg0: Span) -> usize indexOf(arg0: Span, arg1: Span) -> usize lastIndexOf(arg0: Span, arg1: Span) -> usize line(arg0: Span, arg1: usize) -> Maybe> lineCount(arg0: Span) -> usize repeat(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe> replace(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> reverse(arg0: MutSpan, arg1: Span) -> Maybe> split(arg0: Span, arg1: Span, arg2: usize) -> Maybe> splitCount(arg0: Span, arg1: Span) -> usize startsWith(arg0: Span, arg1: Span) -> Bool toLowerAscii(arg0: MutSpan, arg1: Span) -> Maybe> toUpperAscii(arg0: MutSpan, arg1: Span) -> Maybe> trimAscii(arg0: Span) -> Span trimEndAscii(arg0: Span) -> Span trimStartAscii(arg0: Span) -> Span wordCountAscii(arg0: Span) -> usize ``` ### std.testing ```text isTrue(arg0: Bool) -> Bool isFalse(arg0: Bool) -> Bool equalBool(arg0: Bool, arg1: Bool) -> Bool equalUsize(arg0: usize, arg1: usize) -> Bool equalU32(arg0: u32, arg1: u32) -> Bool equalI32(arg0: i32, arg1: i32) -> Bool equalBytes(arg0: Span, arg1: Span) -> Bool containsBytes(arg0: Span, arg1: Span) -> Bool startsWith(arg0: Span, arg1: Span) -> Bool endsWith(arg0: Span, arg1: Span) -> Bool notEqualBytes(arg0: Span, arg1: Span) -> Bool diffIndexBytes(arg0: Span, arg1: Span) -> Maybe jsonFieldEquals(arg0: Span, arg1: Span, arg2: Span) -> Bool jsonPathEquals(arg0: Span, arg1: Span, arg2: Span) -> Bool caseName(arg0: MutSpan, arg1: Span, arg2: usize) -> Maybe> ``` ### std.text ```text isAscii(arg0: Span) -> Bool utf8Len(arg0: Span) -> Maybe utf8Valid(arg0: Span) -> Bool ``` ### std.time ```text ns(arg0: i64) -> Duration us(arg0: i64) -> Duration ms(arg0: i32) -> Duration seconds(arg0: i32) -> Duration minutes(arg0: i32) -> Duration hours(arg0: i32) -> Duration zero() -> Duration add(arg0: Duration, arg1: Duration) -> Duration monotonic() -> Duration wallSeconds() -> i64 sub(arg0: Duration, arg1: Duration) -> Duration asNs(arg0: Duration) -> i64 asUsFloor(arg0: Duration) -> i64 asMsFloor(arg0: Duration) -> i32 asSecondsFloor(arg0: Duration) -> i64 min(arg0: Duration, arg1: Duration) -> Duration max(arg0: Duration, arg1: Duration) -> Duration clamp(arg0: Duration, arg1: Duration, arg2: Duration) -> Duration lessThan(arg0: Duration, arg1: Duration) -> Bool isZero(arg0: Duration) -> Bool abs(arg0: Duration) -> Duration between(arg0: Duration, arg1: Duration) -> Duration hasElapsed(arg0: Duration, arg1: Duration, arg2: Duration) -> Bool deadlineAfter(arg0: Duration, arg1: Duration) -> Duration remainingUntil(arg0: Duration, arg1: Duration) -> Duration deadlineExpired(arg0: Duration, arg1: Duration) -> Bool sleep(arg0: Duration) -> Bool isRfc3339Date(text: Span) -> Bool isRfc3339Time(text: Span) -> Bool isRfc3339DateTime(text: Span) -> Bool parseRfc3339DateTimeOr(text: Span, fallback: i64) -> i64 isLeapYear(year: u32) -> Bool daysInMonth(year: u32, month: u32) -> u32 writeDurationNs(arg0: MutSpan, arg1: Duration) -> Maybe> writeDurationMs(arg0: MutSpan, arg1: Duration) -> Maybe> writeDurationSeconds(arg0: MutSpan, arg1: Duration) -> Maybe> ``` The RFC 3339 helpers are target-neutral and validate calendar dates (leap years, days-in-month), times with fractional seconds and numeric offsets, and date-times joined by `T` or `t`. The leap-second rule is exact: seconds `60` is valid only when the time normalized by its offset equals `23:59:60` UTC, wrapping modulo 24 hours (`00:29:60+00:30` is valid; `23:59:60-01:00` is not). `parseRfc3339DateTimeOr` returns UTC epoch seconds, truncating fractions and mapping a valid leap second to the same epoch second as `:59`; it returns the fallback for invalid text. Use `writeDurationNs`, `writeDurationMs`, or `writeDurationSeconds` when a typed `Duration` needs a compact textual value in caller-owned storage. Use `deadlineAfter`, `remainingUntil`, and `deadlineExpired` to model request budgets against monotonic `Duration` instants without observing the clock inside the helper. `std.time.sleep` is hosted and returns `false` on host failure. Timer and fake-clock handles are not exposed in the current surface. ### std.unicode ```text decodeAt(text: Span, index: usize) -> Maybe decodeStatusAt(text: Span, index: usize) -> u32 widthAt(text: Span, index: usize) -> Maybe encode(buffer: MutSpan, cp: u32) -> Maybe> encodedWidth(cp: u32) -> Maybe invalidIndex(text: Span) -> usize isDigit(cp: u32) -> Bool isWord(cp: u32) -> Bool isSpace(cp: u32) -> Bool nextIndex(text: Span, index: usize) -> Maybe statusName(status: u32) -> String ``` Decoding is strict UTF-8 (overlong encodings, surrogates, values above U+10FFFF, and truncated sequences return `null`). Iterate codepoints by advancing a byte index with `nextIndex` or `widthAt`. `invalidIndex` returns the first invalid byte index or the input length, and `decodeStatusAt` plus `statusName` provide allocation-free decode diagnostics. The class helpers use ECMA-262 regex semantics by codepoint (`\d` `\w` `\s`). ### std.url ```text percentEncode(arg0: MutSpan, arg1: Span) -> Maybe> percentDecode(arg0: MutSpan, arg1: Span) -> Maybe> queryEscape(arg0: MutSpan, arg1: Span) -> Maybe> queryUnescape(arg0: MutSpan, arg1: Span) -> Maybe> scheme(arg0: Span) -> Maybe> authority(arg0: Span) -> Maybe> host(arg0: Span) -> Maybe> path(arg0: Span) -> Span query(arg0: Span) -> Maybe> fragment(arg0: Span) -> Maybe> queryValue(arg0: Span, arg1: Span) -> Maybe> queryValueDecoded(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeQueryParam(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeFormField(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> appendFormField(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> formValue(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> appendQuery(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> writeUrl(arg0: MutSpan, arg1: Span, arg2: Span, arg3: Span) -> Maybe> appendFragment(arg0: MutSpan, arg1: Span, arg2: Span) -> Maybe> ``` ## Maybe Pattern ```zero pub fn main(world: World) -> Void raises { let first: Maybe = std.args.get(1) if first.has { check world.out.write(first.value) } } ``` Use the CLI helpers for command, fallback, exact flag, and option conventions before writing a custom argument loop: ```zero pub fn main(world: World) -> Void raises { let command: String = std.cli.commandOr("help") let name: String = std.cli.argOr(2, "world") if std.mem.eql(command, "hello") { check world.out.write("hello ") check world.out.write(name) check world.out.write("\n") } } ``` Use `check maybeValue` only when absence should propagate as a failure in a fallible function. Read `maybeValue.value` only inside a visible `if maybeValue.has { ... }` guard. ## HTTP Pattern Use the request/response envelope helpers instead of hand-building byte headers when possible. `std.http.writeRequest` and `std.http.writeJsonRequest` take a start line such as `"GET /health"` or `"POST https://example.com/api"` and write into caller-owned storage. Use `std.http.writeMethodRequest`, `std.http.writeGetRequest`, and the POST/PUT/PATCH JSON request helpers when method and target are already separate values. ```zero pub fn main() -> Void { var request_buf: [128]u8 = [0_u8; 128] let request: Maybe> = std.http.writeJsonRequest(request_buf, "POST /users", "{\"id\":7}") expect request.has } ``` For API-style handlers, parse the request envelope with route helpers such as `std.http.requestIsGet`, `std.http.requestIsHead`, `std.http.requestIsOptions`, `std.http.requestIsPost`, `std.http.requestPathStartsWith`, `std.http.requestPathTailAfter`, `std.http.requestRouteMatches`, `std.http.requestPathParam`, `std.http.pathMatchesPattern`, `std.http.pathParam`, `std.http.pathSegmentCount`, `std.http.pathSegment`, `std.http.requestPathSegmentCount`, `std.http.requestPathSegment`, `std.http.requestQueryValue`, `std.http.requestHeader`, `std.http.requestContentLength`, `std.http.requestContentType`, `std.http.requestAccepts`, `std.http.requestAcceptsJson`, `std.http.requestBearerToken`, `std.http.requestCookie`, `std.http.requestHasJsonContentType`, `std.http.requestJsonBodyWithin`, and `std.http.requestJsonField`. Use `std.http.methodAllowed`, `std.http.requestMethodAllowed`, and `std.http.requestRouteMethodAllowed` for explicit handler dispatch across a comma-separated method allow list. Use path segment helpers for resource routes such as `/users/7`; they borrow zero-based, non-empty segments and ignore leading, trailing, or repeated `/`. Pattern routes match literal segments, `:name` parameters, and a trailing `*` wildcard. Prefer the status-specific JSON writers for common success responses and `std.http.writeJsonError(response, status, code)` for conventional `{"error":"code"}` failures. `writeJsonError` validates the code before writing JSON, so agents do not need to hand-build simple error bodies. The full custom body writers remain available: `std.http.writeJsonOk`, `std.http.writeJsonCreated`, `std.http.writeJsonBadRequest`, `std.http.writeJsonUnauthorized`, `std.http.writeJsonForbidden`, `std.http.writeJsonNotFound`, `std.http.writeJsonMethodNotAllowed`, `std.http.writeJsonConflict`, `std.http.writeJsonUnprocessable`, `std.http.writeJsonTooManyRequests`, and `std.http.writeJsonInternalServerError`. Use `std.http.writeNoContent` for 204 responses, `std.http.writeCorsPreflight` for `OPTIONS` preflight responses, and `std.http.writeCorsJsonResponse` when a JSON response also needs `access-control-allow-origin`. `writeCorsJsonResponse` takes a status-line fragment such as `"200 OK"` or `"422 Unprocessable Entity"`. Use `std.http.writeResponseWithHeader`, `std.http.writeJsonResponseWithHeader`, or `std.http.writeJsonResponseWithCookie` when a response needs one explicit safe header line or cookie value. Use the `WithHeaders` variants with `std.http.headerBlockSafe` for newline-separated header blocks. Use `std.http.writeRequestWithHeader`, `std.http.writeRequestWithHeaders`, `std.http.writeJsonRequestWithHeader`, or `std.http.writeJsonRequestWithHeaders` for outbound request envelopes with explicit safe headers. These writers reject headers they manage themselves: request writers reject `content-length` and `transfer-encoding`; JSON request writers also reject `content-type`; response writers reject `content-length`, `transfer-encoding`, and `connection`; JSON response writers also reject `content-type`. Use `std.http.writeTextOk` or `std.http.writeHtmlOk` for simple non-JSON responses such as health text, `robots.txt`, or a small HTML page. Use `std.http.contentTypeForPath` and `std.http.writeStaticResponse` for small static responses whose media type can come from a path suffix. Use redirect helpers such as `std.http.writeFound`, `std.http.writeSeeOther`, `std.http.writeMovedPermanently`, or `std.http.writePermanentRedirect` instead of hand-writing `Location` headers; they reject empty or control-character location values before writing. Use `std.http.responseStatus`, `std.http.responseStatusIs`, `std.http.responseHeader`, `std.http.responseContentType`, `std.http.responseRedirectLocation`, `std.http.responseBodyBytes`, `std.http.responseBodyEquals`, and `std.http.responseMatches` to inspect a local response envelope produced by the response writers. Use `std.http.testRequest` and `std.http.testJsonRequest` to build synthetic request envelopes for handler checks without opening a socket. For a runnable local API server, define a same-module handler and call `std.http.listen(world)` from `main`. The handler signature is `fn handle(request: Span, response: MutSpan) -> Maybe>`. When no port is passed, `std.http.listen(world)` starts at development port `3000` and increments by one until it finds a free loopback port. It prints the actual URL, such as `listening on http://127.0.0.1:3001`; use that printed port for local HTTP requests. Do not assume `3000`, because another local server may already be using it. When a port is explicit, `std.http.listen(world, 3000_u16)` tries exactly that port and fails with a bind diagnostic if it is occupied. ```zero pub fn main(world: World) -> Void raises { check std.http.listen(world) } fn handle(request: Span, response: MutSpan) -> Maybe> { if std.http.requestIsGet(request, "/ping") { return std.http.writeJsonOk(response, "{\"message\":\"pong\"}") } return std.http.writeJsonError(response, 404, "not_found") } ``` ```zero pub fn main() -> Void { let request: Span = "POST /users?tenant=demo\ncontent-type: application/json\n\n{\"id\":7}" var response_buf: [192]u8 = [0_u8; 192] let body: Maybe> = std.http.requestJsonBodyWithin(request, 64) let tenant: Maybe> = std.http.requestQueryValue(request, "tenant") let resource: Maybe> = std.http.requestPathSegment(request, 0) if std.http.requestIsPost(request, "/users") && resource.has && std.mem.eql(resource.value, "users") && tenant.has && body.has { let response: Maybe> = std.http.writeJsonCreated(response_buf, "{\"created\":true}") expect response.has } } ``` For browser-facing APIs, handle preflight and CORS in the response writer instead of hand-assembling headers: ```zero pub fn main() -> Void { let request: Span = "OPTIONS /users\naccess-control-request-method: POST\n\n" var response_buf: [256]u8 = [0_u8; 256] if std.http.requestIsOptions(request, "/users") { let response: Maybe> = std.http.writeCorsPreflight(response_buf, "*", "GET, POST, OPTIONS", "content-type, authorization") expect response.has } } ``` For authenticated APIs, use header-specific helpers rather than parsing `authorization` or `cookie` by hand: ```zero pub fn main() -> Void { let request: Span = "GET /me\nauthorization: Bearer token-123\ncookie: sid=abc; theme=dark\n\n" let token: Maybe> = std.http.requestBearerToken(request) let session: Maybe> = std.http.requestCookie(request, "sid") expect token.has && session.has } ``` For hosted client calls, keep the network capability explicit and read response bytes through `std.http.responseBody`. Use `std.http.headerBytes` when a header value from `std.http.headerValue` must be borrowed as a span. ## Resource Pattern Hosted file APIs can use explicit handles: ```zero pub fn main(world: World) -> Void raises { let fs: Fs = std.fs.host() var read_buf: [32]u8 = [0_u8; 32] if std.fs.writeFile(fs, ".zero/out/log.txt", "hello\n") && std.fs.appendFile(fs, ".zero/out/log.txt", "again\n") && std.fs.readFileEquals(fs, ".zero/out/log.txt", read_buf, "hello\nagain\n") { check world.out.write("wrote\n") } } ``` Owned resources are deterministic. Do not invent hidden heap, global logger, or ambient filesystem APIs.