Standard Library
Built-in Modules
Section titled “Built-in Modules”Zap ships with a standard library that covers the most common programming
tasks. Every module is available via import std.<name>.
| Module | Description |
|---|---|
std.io |
Console input/output, file reading/writing |
std.math |
Mathematical functions and constants |
std.strings |
String manipulation and formatting |
std.collections |
Lists, maps, sets, and iteration utilities |
std.fs |
Filesystem operations (paths, dirs, file metadata) |
std.net |
HTTP client, TCP/UDP sockets |
std.json |
JSON parsing and serialisation |
std.time |
Date, time, and duration handling |
std.testing |
Built-in test runner and assertions |
Note: The standard library is under active development. Some modules listed here may be incomplete or experimental.
Example Usage
Section titled “Example Usage”import std.io { read_file }import std.json { parse }
fn main() { let content = read_file("config.json").unwrap() let config = parse(content).unwrap() print(config["name"])}Conventions
Section titled “Conventions”- All standard library modules live under the
stdnamespace. - Functions that can fail return
Result[T, Error]rather than throwing. - Collection types implement common traits like
IterableandDisplay.