Standard Library Overview
The Shape standard library provides modules for common programming tasks. Modules are organized into native (Rust-backed), core (pure Shape), math, and domain libraries.
Native Modules
Section titled “Native Modules”These modules are implemented in Rust and provide high-performance operations:
| Module | Description |
|---|---|
| io | File I/O, path operations, networking, and process management |
| file | File reading and writing utilities (text) |
| json | JSON parsing and serialization with Json enum + typed deserialization |
| csv | CSV parsing, records, and serialization |
| msgpack | MessagePack binary serialization (hex + bytes variants) |
| toml | TOML parsing and serialization |
| yaml | YAML parsing and serialization (single and multi-document) |
| xml | XML parsing and serialization |
| http | Async HTTP client (GET, POST/PUT text/bytes/json, DELETE) |
| time | Monotonic timing, async sleep, benchmark, wall-clock millis |
| env | Environment variables, args, cwd, OS / arch info |
| regex | Regular expression matching, replacement, splitting |
| crypto | SHA-1/256/512, MD5, HMAC, base64/hex, Ed25519 signatures |
| unicode | Normalization, category lookup, grapheme clusters |
| compress | Data compression (gzip, zstd, deflate) |
| archive | Archive creation and extraction (tar, zip) |
| parallel | Data-parallel array operations (planned; bindings not yet wired) |
| math | Math primitives: bare global builtins + std::core::math constants and trig |
Core Modules
Section titled “Core Modules”Written in Shape, these provide essential data structures, scientific primitives, and utilities:
| Module | Description |
|---|---|
| state | Content-addressed VM state capture / resume / hash / diff / patch |
| snapshot | Suspension-point snapshot primitive |
| math | Statistical functions (sum, mean, std, variance, percentile, zscore) |
| random | Random number generation (ChaCha8 PRNG) |
| distributions | Statistical distributions: samplers, PDFs, CDFs |
| stochastic | Stochastic processes (Brownian, GBM, OU, random walk) |
| monte_carlo | Monte Carlo runner with variance-reduction methods |
| ode | ODE integrators (Euler, RK4, RK45 adaptive) |
| collections | Advanced collection types |
| set | Unordered collection of unique elements |
| log | Structured logging with level filtering |
| testing | Unit test assertions |
| property_testing | Property-based / QuickCheck-style testing |
| rolling | Rolling-window aggregations on numeric arrays |
| remote | @remote annotation and remote function execution |
| transport | Distributed transport interface (TCP, QUIC) |
Math Sub-Modules
Section titled “Math Sub-Modules”Specialized math libraries under std::math:::
| Module | Description |
|---|---|
| linalg | Vector operations on Array<number> (dot, cross, norm, normalize, scale, add, sub) |
| interpolation | Bilinear and trilinear grid interpolation |
| optimize | Nelder-Mead simplex minimizer |
| rotation | 3D rotation math (Euler angles, matrices, composition) |
Domain Libraries
Section titled “Domain Libraries”Specialized libraries for specific application domains:
| Module | Description |
|---|---|
| finance | Financial data types, risk metrics, indicators, backtesting |
| physics | Newtonian mechanics, collision detection |
| iot | IoT device monitoring, anomaly detection |
| simulation | Generic simulation framework (also lives at std::core::simulation) |