Skip to content
Systems programming for what’s next.
— Vex

Standard Library ​

Vex's standard library. Prelude (auto-imported) plus explicitly imported packages.

For a practical learning sequence, start with your first standard-library workflow, then return here to distinguish prelude names from package imports.

Prelude (Auto-Imported) ​

These are available everywhere without import:

Collections ​

TypeDescription
Vec<T>Dynamic array bound to its construction-time allocator region
Map<K, V>Hash map (SwissTable)
Set<T>Hash set
stringOwning string with inline storage for small values
strBorrowed string view

Smart Pointers ​

TypeDescription
Box<T>Compiler-managed heap ownership; sharing and thread safety are inferred automatically
Ptr<T>Typed pointer
Span<T>Non-owning pointer-and-length view; checked access does not validate its lifetime
RawBufRaw byte buffer
LayoutChecked allocation size and alignment
MemCanonical low-level allocation and byte-operation namespace
LimitsTarget-aware compile-time integer minimum and maximum values

Error & Optionality ​

TypeDescription
Result<T, E>Operations that can fail
Option<T>Values that may not exist
Range<T>Range expressions
Complex<T>Complex numbers

Packages (Import Required) ​

Memory primitives are deliberately absent from this list: there is no std/mem package. Low-level code uses the prelude Mem.* boundary; most code uses owning types such as Box, Vec, or string.

Use each package's documented path, for example import { File } from "fs";. A heading such as “standard library” is not an instruction to prepend std/ to every import. Math, Bit, and Crypto are builtin namespaces; they do not require imports. The crypto package is distinct from the Crypto builtin namespace.

Choose a package by the task and data ownership you need. Each linked guide shows its imports, examples and specific input/output contracts.

AreaGuide
Command-line programsCLI, system, logging
Data structures and orderingCollections, sort, filter
Errors and cancellationErrors, context
Files and pathsFile system
Byte streams and compressionI/O, compression
Structured dataSerde: JSON, TOML, YAML, CSV, CBOR and MessagePack
Text and parsingStrings, strconv, Unicode, encoding
TCP and UDPNetworking
Web protocolsHTTP, URL, TLS, WebRTC
Regular expressionsRegex
Hashes, secrets and random valuesHash, crypto, randomness
Database accessDatabase
TimeTime
Locations and routesGeo
Images, video and audioVips, media
Numeric/model computationML, inference
Version requirementsSemver
Reusable protocols and testsContracts, testing
Build language toolsIDE packages

The standard library index lists the package families. Import paths come from the individual module guides, including focused submodule imports when a program needs only a parser, codec or transform.

Compose packages around ownership ​

A file-processing command can parse arguments with cli, read bounded input with fs, decode structured data with serde, sort records with sort and write its result through io. Keep parse and I/O errors typed until the CLI boundary. Use context when cancellation/deadline state must follow an operation.

For media work, vips operates on image pixels, media on explicit frame/audio layouts, and webrtc on encoded packets and presentation timing. Conversion between packages may copy into a new owner; it is not automatically a pointer transfer. The image/media guides show that boundary directly.

Next Steps ​

Released under the MIT License.