The Hew standard library provides core types, data structures, networking, encoding, and utilities.
This file is the canonical index of shipped stdlib modules in this repository. Module links below go to the public .hew surface that Hew programs import.
For the curated language-only playground snippets, start with ../examples/playground/manifest.json and ../examples/README.md. Use this README when you need the canonical index of shipped std::* modules.
println, print, sleep_ms, exit, and panic are ordinary function calls auto-imported into every Hew file — no ! suffix, no special syntax.
fn main() {
print("count: ");
println(42);
}
All other standard library modules require an explicit import at the top of the file:
import std::fs;
import std::encoding::json;
fn main() {
let raw = fs.read("data.json");
println(json.parse(raw));
}
- CLI, files, and OS —
std::io,std::fs,std::path,std::os,std::process - Collections and scans —
std::vec,std::deque,std::collections::hashset,std::iter,std::sort - Streams and coordination —
std::stream,std::channel::channel,std::semaphore - Data formats and wire protocols —
std::encoding::json,std::encoding::yaml,std::encoding::toml,std::encoding::csv,std::encoding::xml,std::encoding::wire - Networking —
std::net,std::net::http,std::net::dns,std::net::tls,std::net::quic,std::net::url - Testing and perf —
std::testing,std::bench
Every shipped module under std/ should appear here.
| Module | Import | Use for |
|---|---|---|
builtins |
(auto-imported) | println, print, sleep_ms, exit, and panic |
string |
std::string |
String conversion and manipulation utilities |
fmt |
std::fmt |
Number formatting, padding, and repetition helpers |
option |
std::option |
Helper functions for common Option<T> patterns |
result |
std::result |
Helper functions for common Result<T, E> patterns |
math |
std::math |
Integer helpers, float ops, and common constants |
| Module | Import | Use for |
|---|---|---|
io |
std::io |
stdin, stdout, and stderr helpers |
fs |
std::fs |
File system operations |
path |
std::path |
File path and glob utilities |
os |
std::os |
Operating system interfaces |
process |
std::process |
Process execution |
| Module | Import | Use for |
|---|---|---|
vec |
std::vec |
Utility helpers for Vec<T> |
deque |
std::deque |
Double-ended queue operations |
hashset |
std::collections::hashset |
Hash set collection |
iter |
std::iter |
Map/filter/fold-style helpers for Vec<T> |
sort |
std::sort |
Sorting and reversing vector helpers |
stream |
std::stream |
Typed Stream<T>/Sink<T> pipes and file streams |
channel |
std::channel::channel |
Bounded MPSC channels |
semaphore |
std::semaphore |
Counting semaphore for concurrency control |
| Module | Import | Use for |
|---|---|---|
base64 |
std::encoding::base64 |
Base64 encoding and decoding |
compress |
std::encoding::compress |
Compression and decompression |
csv |
std::encoding::csv |
CSV parsing |
hex |
std::encoding::hex |
Hexadecimal encoding and decoding |
json |
std::encoding::json |
JSON parsing and manipulation |
markdown |
std::encoding::markdown |
Markdown to HTML conversion |
msgpack |
std::encoding::msgpack |
MessagePack serialization |
protobuf |
std::encoding::protobuf |
Protocol Buffers message construction |
toml |
std::encoding::toml |
TOML parsing and generation |
wire |
std::encoding::wire |
Hew wire format encoding and decoding |
xml |
std::encoding::xml |
XML parsing and manipulation |
yaml |
std::encoding::yaml |
YAML parsing and generation |
| Module | Import | Use for |
|---|---|---|
crypto |
std::crypto::crypto |
Cryptographic hashing and utilities |
encrypt |
std::crypto::encrypt |
Symmetric encryption and decryption |
jwt |
std::crypto::jwt |
JSON Web Token encoding and validation |
password |
std::crypto::password |
Password hashing and verification |
| Module | Import | Use for |
|---|---|---|
net |
std::net |
TCP listeners and connections |
dns |
std::net::dns |
DNS hostname resolution |
http |
std::net::http |
HTTP server and request/response handling |
http_client |
std::net::http::http_client |
Outbound HTTP request helpers (request, request_string, get, post) |
ipnet |
std::net::ipnet |
IP address and CIDR utilities |
mime |
std::net::mime |
MIME type detection |
quic |
std::net::quic |
QUIC transport for internode messaging |
smtp |
std::net::smtp |
SMTP client for sending email |
tls |
std::net::tls |
TLS client connections |
url |
std::net::url |
URL parsing |
websocket |
std::net::websocket |
WebSocket client and server support |
| Module | Import | Use for |
|---|---|---|
regex |
std::text::regex |
Regular expression matching |
semver |
std::text::semver |
Semantic version parsing and comparison |
datetime |
std::time::datetime |
Date and time operations |
cron |
std::time::cron |
Cron expression parsing and scheduling |
log |
std::misc::log |
Structured logging |
uuid |
std::misc::uuid |
UUID generation and validation |
| Module | Import | Use for |
|---|---|---|
testing |
std::testing |
Assertion helpers for Hew tests |
bench |
std::bench |
Benchmark harness for measuring function performance |
Each stdlib module includes:
.hewsurface -- Declares the public API (types, traits, functions) that Hew programs import, including Hew-native wrappers that can lift raw native status codes/messages intoResultand enum surfaces likeIoErrorhew.toml-- Package metadata for the module- Rust crate (
src/lib.rs, when present) -- Either exports native#[no_mangle] pub extern "C" fnsymbols or remains as a placeholder static library to keep the workspace andhew-libbuild graph intact
Implementation strategy varies by module:
- Some modules are implemented entirely in Hew, with the Rust crate retained only as a build placeholder
- Some modules, such as
std::math, expose a Hew surface that codegen lowers directly to compiler intrinsics/MLIR ops, again leaving the Rust crate as a placeholder - Modules that need native capabilities still use their Rust crates for the final linked implementation
The compiler resolves import std::* paths against the HEW_STD directory and links any corresponding native static libraries required by the build graph at compile time, whether they provide runtime FFI symbols or act only as placeholders.