Vex Standard Library
The standard library supplies reusable building blocks for Vex applications. Most algorithms are written in Vex; platform services and selected providers use native boundaries. Each module documents its imports, ownership, error behavior and supported surface. Consult the module's layout and integration requirements when connecting packages.
New to the library? Follow your first standard-library workflow to parse an input, transform it and add a test. For coding assistants, use the documentation exports and Vex skill.
Formatting is deliberately not a separate std/fmt package. Use $format, $print, and $println, the built-in Display/Debug contracts, or strings.StringBuilder for reusable caller-owned construction. This keeps format parsing, diagnostics, and allocation policy in one canonical stack.
Core Modules
| Module | Purpose |
|---|---|
| CLI | Commands, arguments and flags |
| Collections | Deques, stacks, priority heaps and indexed lists |
| Compression | Bounded LZ4, Zstandard, Gzip, Zlib and Brotli codecs |
| Context | Cooperative cancellation, deadlines and metadata |
| Contracts | Conversion, collection and packed-data protocols |
| Crypto | Hashing, authenticated encryption, signatures and key derivation |
| Database | Owning synchronous SQLite access and optional native providers |
| Encoding | Checked text/binary encoding and reusable output |
| Errors | Typed errors, causal chains and aggregation |
| Filter | Predicate filtering and mask-based compaction |
| File system | Files, paths, metadata, mappings and directory traversal |
| Geographic coordinates | Geographic distances, bearings, routes, bounds and polygon operations |
| Hash | Non-cryptographic hashing and explicit hash builders |
| HTTP | Client, parser and Fiber server APIs with explicit protocol boundaries |
| I/O | Readers, writers, buffering and stream adapters |
| Logging | Structured fields, loggers and sinks |
| Networking | TCP/UDP sockets and typed address/resolver APIs |
| Randomness | Explicit reproducible streams and unbiased distributions |
| Regex | Pattern compilation, matching and borrowed match ranges |
| Semver | Semantic versions and version requirements |
| Serde | Structured codecs and owning dynamic trees for six formats |
| Sort | Ordering with explicit comparator and stability choices |
| String conversion | Checked parsing and numeric formatting |
| Strings | Reusable string construction and string utilities |
| System | Processes, environment and platform services |
| Testing | Assertions, test context and benchmark context |
| Time | Monotonic elapsed time, wall time, durations and calendars |
| TLS | TLS primitives and the documented transport/verification surface |
| Unicode | Character properties, casing, normalization and segmentation |
| URL | URI parsing/resolution and strict percent/form codecs |
Builtin numeric namespaces
Math, Bit, and Crypto are compiler namespaces rather than packages. They require no import. The Crypto namespace contains low-level primitives; the crypto package supplies complete algorithms.
Images, media, compute and language tools
| Family | Guide |
|---|---|
| Image processing | Vips: owning pixels, transforms, filters, rows and codec providers |
| Video and audio | Media: frame layouts, PCM/WAV, containers and codec components |
| Real-time protocols | WebRTC: SDP, ICE, RTP/RTCP, media queues and protection boundaries |
| Numeric kernels | ML: normalization, activations, linear algebra and attention |
| Model execution | Inference: model loading, generation and backend selection |
| Developer tooling | Language tools: the ide/* package family |
These guides distinguish complete entry points from lower-level components, document required native providers, and show how to connect ownership and buffer layouts across package boundaries.
Choosing an API
Prefer owning values when data must outlive its input, borrowed views while an owner remains live, and reusable-output APIs for repeated work. A pointer, Span, or RawBuf parameter carries additional lifetime and capacity obligations; it is not an automatic zero-allocation or safety guarantee.
Use checked parse/decode entry points for external data and set resource limits where the API provides them. Preserve typed errors until the application boundary so callers can distinguish malformed input, exhaustion, cancellation and I/O failure. The standard-library guide explains the prelude/package boundary and routes common tasks to these references.