Appendix E — Standard library modules
Part IX (chapters 32–37) toured the standard library by use. This appendix is a reference, one page per module, gathering what each does, which ops it offers and what it does not do. It is not a place to read from the start but a place to open when needed.
Module pages share one shape. The head gives the source file, layer and capabilities received, followed by what the module does, its ops at a glance, how to use it, design and boundaries, and what is not built. The maturity each module writes (experimental, incubating, standard) is authoritatively in the source head and the development repository’s ledger and moves between editions, so it is not copied here. The conventions every module follows — the caller’s buffer, failure as a value, all or nothing, ownership that must be settled — are in chapter 32.
Module names may differ from file names. What use looks for is the module declaration in the file (lib/str.low is strings, lib/alloc.low is allocs). Cross-module names are always called qualified (strings.find), and a frequently used one can get an alias with use codec as c ..
| Module | In one line |
|---|---|
strings | String view operations — cut, find, compare |
strbuf | Owned string buffer and null-terminated cstr |
fmt | Formatting assembled into the caller’s buffer |
utf8 | UTF-8 code point iteration and validation |
utf16 | UTF-16 surrogate arithmetic |
unicode | Unicode property tables — extracted mechanically |
codec | Hex · base64 |
regex | Pike VM regular expressions without backtracking |
term | The pure half of a terminal renderer — ANSI assembly · screen diff · width |
sortlib | In-place quicksort for u64 |
sortgen | Generic sort — the type brings the comparison |
searchlib | Binary search over sorted slices |
hashmap | u64 → u64 open addressing |
strmap | Byte string → u64 hash map |
vecs | Growing byte vector |
spsc | Lock-free single-producer single-consumer ring buffer |
hash | Hash-map slots (FNV-1a) · damage detection (CRC-32) · SHA-256 |
math | Floating-point maths — close instead of == |
random | Separates reproducible sequences from OS entropy by name |
hmac | HMAC-SHA256 · HKDF — who sent it |
chacha | ChaCha20 stream — not safe alone |
poly | Poly1305 — a fresh key per message |
aead | ChaCha20-Poly1305 seal and open — cryptography starts here |
x25519 | Key agreement |
aes | AES-128 block cipher — usually wrong used alone |
gcm | AES-128-GCM — never repeat a nonce |
bigint | Big-number modular arithmetic |
rsa | RSASSA-PSS verification |
p256 | NIST P-256 curve and ECDSA verification |
p384 | NIST P-384 curve and ECDSA verification — the public web’s intermediates |
ecdsa | ECDSA P-256 signing — nonce derived without randomness |
ed25519 | Ed25519 signature verification |
der | Minimal DER parser — extracts public keys only |
pem | Unwrapping PEM envelopes |
x509 | Reading X.509 certificates — offsets and lengths only |
verify | Certificate signatures and one link of a chain |
tls13 | TLS 1.3 parts — key schedule · records · transcript · Finished |
tlssrv | Server TLS handshake and application data records |
tlscli | Client TLS 1.3 handshake — the caller checks certificates |
http | HTTP/1.1 request parser — its heart is rejection |
soa | A trial of laying structs out as per-field arrays |
Table 50.1 — L0 — pure computation (effects none · the caller’s buffer)
| Module | In one line |
|---|---|
allocs | Allocator trait · bump allocators · two default allocators |
pool | Generational-handle block pool |
shard | Tokens splitting storage into non-overlapping pieces |
budget | Bit budgets for handles and retiring generations |
wire | Fields in one word — a mask carries position and width |
flags | Named on/off settings in one word |
segarena | Fixed-size segment arena |
pagecache | Page ids and pin tokens |
growvec | Growing byte vector — short name for vecgen.vec u8 |
vecgen | Generic growing vector vec t |
mapgen | Generic hash map table k v |
nodelist | Fixed-size intrusive list |
segview | Cursor, total length and flattening for scattered views |
lifemode | lifemode · lifeatom — when a value ends |
Table 50.2 — L1 — storage (needs the allocation capability or borrowed bytes)
| Module | In one line |
|---|---|
io | Stream reading over slices |
outbuf | Buffered output — forgetting to flush is rejected |
files | Files and directories — forgetting to close is rejected |
tty | Terminal input — raw mode · reading keys · pure key parsing |
net | Sockets — TCP loopback · in-process connection pairs |
clock | Time and deadlines — monotonic and wall clocks |
trust | Finding a trusted root in the trust store — the bundle is streamed |
Table 50.3 — L2 — host (needs capabilities)
The cryptographic modules are stacked in layers towards TLS 1.3; that order and the top that does not exist yet are in chapter 36.