docs / std

Standard library (std/)

Ordinary fx modules. Import them like any other library. They are not the C runtime and not the compiler. Linking still uses zspec when you allocate through the usual paths.

import std/vec;
import std/map;
import std/string;

Modules in 0.7.1

ModuleRole
vecGrowable vectors
stringCompare / concat / builder helpers
mapMap<string, i32> dictionary
setSet facade over map (presence = 1)
box / pairGeneric ownership / pair helpers
mathabs min max clamp
fmtInteger / tag formatting helpers
ioLines + minimal file I/O (effects { io })
queueBounded queue facade (see caveat below)
fx_defaultsSmall defaults-related constants/helpers

Value-threading

Growing operations return an updated handle. Always reassign:

v = vec.push(v, 40);           // or vec_push(v, 40)
m = map.insert(m, "w", 30);    // or map_insert(...)
b = string.append(b, "hi");    // builder path

Vec

String and StrBuilder

Map and set

import std/map;
using core;

fn main() -> Result<i32, core_Err> effects { alloc, mut } {
    region r = arena(4096);
    let m0: Map<string, i32> = map.new();
    let m1 = map.insert(m0, "answer", 42);
    let v = map.get(m1, "answer")?;
    return Ok(v);
}

IO and fmt

Math, box, pair

Caveats

Growth

The stdlib is intentionally small in 0.7.1. Later packages may add richer collections, paths, JSON, time/RNG, and testing helpers, still as explicit, allocator-aware fx code.

Language · Regions · Reference