Stdlib Reference
The documented surface for core modules: io, fs, os, json, math, bytes, strings, and collections.
I/O, OS, and files
These modules cover the examples that touch the outside world.
io.print,io.println, andio.eprintlnwrite values.fs.readandfs.writereturnResultbecause disk access can fail.os.argsexposes command-line arguments.os.envreturnsOption<str>because environment variables can be absent.os.exitreturns!because the process does not continue.
Math, bytes, and JSON
These modules are small, focused pieces of vocabulary used heavily in examples.
mathexposesf64functions and constants.bytes.to_hexis useful for binary protocols and diagnostics.- Hex and base64 decoding return
Resultbecause input can be malformed. json.decode::<T>turns external data into typed values and can fail.
String methods
String helpers should make text examples clear while preserving byte-level honesty.
lencounts bytes.charsgives character-level iteration.split_oncereturnsOption<(str, str)>.parse::<T>returnsResult<T>because text may not represent the requested type.
Collection methods
Collection APIs should reveal ownership and failure modes through their signatures.
- Mutation methods require mutable access.
- Lookup methods use
Optionwhen absence is normal. - Higher-order methods make data transforms readable.
- Methods that preserve order should say so when order matters.