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. Full inventory:
Surface · package docs/STD.md / docs/SURFACE.md §D.
import std/vec;
import std/map;
import std/string;
Core collections & helpers (0.9.74)
| Module | Role |
|---|---|
vec | Growable vectors · set / no-grow slot writes |
string | Compare / concat / builder helpers |
map | Map<string,i32> + *_ss for Map<string,string> |
set | Set facade over map (presence = 1) |
buf | Growable Buf + Bytes view |
box / pair | Generic ownership / pair helpers |
math | abs min max clamp … |
fmt | Integer / tag formatting helpers |
io | Lines + file I/O (effects { io }) |
queue | Bounded queue (needs lib/ring_queue) |
pool | Typed Id id-pool (needs lib/id_pool) |
fx_defaults | Arena size / defaults helpers |
Capability / guest / net
| Module | Role |
|---|---|
cap | FsCap / OutCap / AllocCap / FuelCap / NetCap |
guest | begin/end/mint/alloc/burn/net · pair with host/cap |
io_cap | Cap-scoped file I/O |
net | TCP dial under NetCap · dial_tls always fails in this package |
HTTPS GET is a separate product CLI (fxfetch) that links Mbed TLS — not language-package TLS. See fxfetch.
Structured concurrency
Link host/concur. Facades:
nursery · chan · select · mailbox ·
supervise · sync. Prefer spawn_i32 / await_i32
(no lexer keywords nursery/spawn/await).
std/async is a deprecated stub.
Path, files, encoding, data, time
path · strutil · encoding · fs · fs_walk ·
log · json · json_validate · json_full ·
sqlite · http (llhttp parse-only) · time · env
Some modules need extra host units (host/std_*, cJSON, SQLite amalgamation).
Testing
testing (asserts) · proptest (property helpers) — used by fx test / fx fuzz.
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
No-grow Vec slot writes: v = vec.set(v, i, x) or v[i] = x under
effects { mut } (same semantics; does not grow capacity).
Vec
- Facade:
vec.new/push/get/set/len - Reads:
v[i]orget/vec_get - Writes: no-grow
v[i]=x/vec_set· grow still viapush - Note: thin
std/vec.getis oriented to everydayi32; prefer builtins for other elements
Map and set
Map<string, i32>+Map<string, string>(map_new_ss/*_ss)map_add_i32: existing key = slot add; miss = insert- Dense iterate:
map_nth_*(table order, not insertion order) map_getreturnsResult<…>· miss is an error · composes with?
Caveats
std/queueneedslib/ring_queue.fx.fx new(simple) stages it.std/poolneedslib/id_pool.fx. Handles are typedId.- Language-package
dial_tlsalways fails; TCP dial works under NetCap.