Standard Library Overview
The Zyra Standard Library provides zero-overhead, cross-platform primitives for common programming tasks across Native Rust and JavaScript ESM compilation targets.
Zero-Import Dot-Notation Namespacing
Starting in Zyra v2.2.0 and expanded in v2.3.0, all standard library modules support zero-import dot-notation namespacing. You can invoke standard functions directly using module.verb() syntax without writing explicit import headers.
def main(): Int {
// Access collections, JSON, regex, logging, HTTP, DB, concurrency, and I/O without imports
const m = map.new()
map.set(m, "Content-Type", "application/json")
const payload = json.parse("{\"status\": \"ok\", \"count\": 42}")
const count = json.get(payload, "count")
const numbers = vec.sort([40, 10, 30, 20])
log.info("Sorted vector: {vec.join(numbers, \", \")}")
return 0
}
Subpackages Index
| Subpackage | Namespace | Description |
|---|---|---|
| Environment | env |
Environment variable getter/setter, CLI args, and zyra.env parser |
| Path Resolution | path |
Cross-platform path joins, extensions, and directory resolution |
| Math and Random | math, random |
Square roots, absolute values, rounding, and pseudo-random numbers |
| String Utilities | str |
Substring splitting, case conversions, and pattern replacements |
| Process Management | process |
Shell command execution and process termination controls |
| File I/O and Watcher | io |
Multi-format file reader/writer, directory globbing, and file watcher |
| Time and Clock | time |
ISO-8601 timestamps, epoch clocks, thread sleeping, duration measuring, and formatting |
| Cryptography | crypto |
SHA-256/MD5 digests, Base64, UUIDv4, HMAC-SHA256, and JWT tokens |
| Networking and HTTP | http |
HTTP client with interceptor pipeline and embedded HTTP server |
| JSON Parser & AST | json |
Structured JSON parsing, path-based querying, and serialization |
| Regular Expressions | regex |
Pattern matching, substring capture, search-and-replace, and splitting |
| Worker & Task Pool | pool |
Multi-threaded task scheduling, parallel mapping, and synchronization |
| Concurrency & Channels | chan, spawn |
CSP-style message channels and thread spawning |
| Key-Value Store | db |
Embedded persistent key-value store with atomic disk persistence |
| In-Memory Map | map |
Thread-safe in-memory hash maps and dictionaries |
| Vector Utilities | vec |
Vector sorting, filtering, deduplication, reversing, and slicing |
| URL & Query Parser | url |
URL component extraction and query parameter parsing |
| Logging Framework | log |
Structured multi-level logging with console and file sinks |
| CSV & TSV Processing | csv |
RFC-4180 CSV & TSV parsing, keyed headers, and serialization |
| Semantic Versioning | semver |
SemVer 2.0.0 parsing, comparison, range evaluation, and bumping |
| Mathematical Set | set |
Thread-safe set data structure with union, intersection, and difference |
| Diff & Similarity | diff |
Unified diff lines, Levenshtein distance, and similarity ratio |
| UUID Generation | uuid |
RFC-9562 timestamp-ordered UUIDv7 and random UUIDv4 |
| Distributed Event Bus | bus |
Wildcard pub/sub broker with bounded history and handles |
| Schema Validation | schema |
Declarative object, primitive, and JSON constraint validation |
| Binary Protocol Codec | bin |
Endian-aware format-string pack and unpack |
| Terminal UI Prompts | tui |
Interactive CLI prompts with headless fallback |
Design Principles
- Target Parity: Every standard library primitive is implemented natively on Rust compilation targets and JavaScript ESM compilation targets.
- Zero Boilerplate: No header imports or complex configuration required for common tasks.
- Safety and Integrity: Platform security, memory safety, and thread safety built in.