# Tangu Standard Library Reference (v0.35.0)

Browse the Prelude and 83 active modules (1405 exported symbols).

## Prelude & core built-ins

Special forms, universal sequence accessors, core types, arithmetic/bitwise operators, and derivable traits available without imports.

- [`/prelude`](https://tangu.dev/stdlib-prelude.md) (260 symbols) — Core Tangu prelude: special forms, type constructors, collections, sequence accessors, arithmetic & logical operators, string & byte utilities, stream I/O traits, and test assertions available without imports.

## Collections & iteration

Lazy iterator combinators (/iter), sets (/set), sorted and unordered maps, vectors (/vec), graphs (/graph), and ring buffers.

- [`/iter`](https://tangu.dev/stdlib/iter.md) (22 symbols) — Lazy iterator combinators and reductions (map, filter, fold, reduce, zip, take, skip, chunk, flatten, group-by, partition).
- [`/set`](https://tangu.dev/stdlib/set.md) (11 symbols) — Unordered hash set algebraic operations: union, intersection, difference, symmetric-difference, subset?, and superset?.
- [`/map`](https://tangu.dev/stdlib/map.md) (3 symbols) — Map projection and transformation helpers (pick, extend, union) complementing prelude Map intrinsics.
- [`/sorted-map`](https://tangu.dev/stdlib/sorted-map.md) (14 symbols) — B-Tree backed ordered map (Sorted-Map) maintaining keys in ascending sorted order.
- [`/unordered-map`](https://tangu.dev/stdlib/unordered-map.md) (12 symbols) — Explicit hash map container (Unordered-Map) with entry iteration and key/value views.
- [`/circular-buffer`](https://tangu.dev/stdlib/circular-buffer.md) (7 symbols) — Fixed-capacity ring buffer (Circular-Buffer) supporting O(1) push/pop and wraparound iteration.
- [`/vec`](https://tangu.dev/stdlib/vec.md) (6 symbols) — 2D, 3D, and 4D Euclidean vector math (Vec2, Vec3, Vec4): dot product, cross product, normalization, and distance.
- [`/func`](https://tangu.dev/stdlib/func.md) (3 symbols) — Higher-order function utilities including partial application, currying, composition, and memoization.
- [`/graph`](https://tangu.dev/stdlib/graph.md) (55 symbols) — Directed and undirected graph data structures (Graph) with node/edge mutation and traversal helpers.

## Text, strings & localization

String manipulation (/string), regular expressions (/regex), CommonMark (/text/cmark), HTML escaping, and ICU4X (/i18n).

- [`/string`](https://tangu.dev/stdlib/string.md) (26 symbols) — UTF-8 string utilities for case conversion, trimming, padding, searching, and slugification.
- [`/regex`](https://tangu.dev/stdlib/regex.md) (9 symbols) — Compiled regular expressions (Regex) with matching, capture extraction, replacement, and splitting.
- [`/text`](https://tangu.dev/stdlib/text.md) (1 symbols) — Human-readable text formatting, title/sentence capitalization, and line wrapping utilities.
- [`/text/case`](https://tangu.dev/stdlib/text/case.md) (10 symbols) — Identifier case conversions across camelCase, PascalCase, snake_case, SCREAMING_SNAKE_CASE, and kebab-case.
- [`/text/cmark`](https://tangu.dev/stdlib/text/cmark.md) (1 symbols) — CommonMark and GitHub Flavored Markdown compiler (to-html) supporting tables, strikethrough, and task lists.
- [`/i18n`](https://tangu.dev/stdlib/i18n.md) (42 symbols) — Unicode CLDR internationalization powered by ICU4X: locale-aware numbers, currencies, dates, plurals, collation, and grapheme segmentation.
- [`/i18n/context`](https://tangu.dev/stdlib/i18n/context.md) (16 symbols) — Dynamic locale scoping and translated message lookup context (t, with-locale) for multilingual applications.
- [`/html`](https://tangu.dev/stdlib/html.md) (4 symbols) — HTML entity escaping, attribute sanitization, and tag stripping for safe user-generated content.

## System, filesystem & I/O

Filesystem operations (/fs), buffered I/O (/io), path manipulation (/path), processes (/process), OS threads (/thread), and coroutines (/coro).

- [`/fs`](https://tangu.dev/stdlib/fs.md) (38 symbols) — Filesystem operations: reading, writing, copying, moving, recursive tree listing, glob matching, and path canonicalization.
- [`/io`](https://tangu.dev/stdlib/io.md) (19 symbols) — Buffered and standard stream I/O (Buf-Reader, Buf-Writer, Stdin, Stdout, Stderr, read-line, write-line, flush, and ask).
- [`/path`](https://tangu.dev/stdlib/path.md) (14 symbols) — Cross-platform lexical path manipulation: dirname-of, file-name, extension-of, stem-of, join, and normalize.
- [`/os`](https://tangu.dev/stdlib/os.md) (8 symbols) — Host operating system, CPU architecture, hostname, and environment introspection.
- [`/os/well-known`](https://tangu.dev/stdlib/os/well-known.md) (20 symbols) — Cross-platform XDG / OS standard directories (config-dir, cache-dir, data-dir, home-dir, download-dir).
- [`/process`](https://tangu.dev/stdlib/process.md) (19 symbols) — Subprocess execution (run, spawn), environment variables (env, env-vars), working directory, and exit statuses.
- [`/runtime`](https://tangu.dev/stdlib/runtime.md) (4 symbols) — Multi-threaded Tokio async runtime construction and blocking entry points (Async-Runtime, run, block-on).
- [`/thread`](https://tangu.dev/stdlib/thread.md) (4 symbols) — OS thread spawning, parallel execution, sleeping, and synchronization.
- [`/coro`](https://tangu.dev/stdlib/coro.md) (7 symbols) — Cooperative coroutines (spawn, await, await-all, sleep) and typed channels (channel, send, recv) backed by Tokio.
- [`/tracing`](https://tangu.dev/stdlib/tracing.md) (12 symbols) — Structured diagnostic logging (trace, debug, info, warn, error) with pluggable observer sinks.
- [`/panic`](https://tangu.dev/stdlib/panic.md) (3 symbols) — Diverging development and assertion helpers (todo!, unimplemented!, unreachable!).

## Data, codecs & validation

JSON (/codec/json) and CBOR (/codec/cbor) codecs, URI encoding (/codec/uri), CSV tables (/csv), Base64 (/base64), and validation.

- [`/codec/json`](https://tangu.dev/stdlib/codec/json.md) (5 symbols) — Fast bidirectional JSON serialization (encode, decode, from-json) and derivable To-JSON / From-JSON support.
- [`/codec/cbor`](https://tangu.dev/stdlib/codec/cbor.md) (2 symbols) — Compact Concise Binary Object Representation (CBOR, RFC 8949) encoder and decoder for Tangu values.
- [`/codec/uri`](https://tangu.dev/stdlib/codec/uri.md) (3 symbols) — Percent-encoding and application/x-www-form-urlencoded query-string serialization.
- [`/csv`](https://tangu.dev/stdlib/csv.md) (3 symbols) — RFC 4180 CSV parser and serializer supporting tuple rows and header-mapped records.
- [`/base64`](https://tangu.dev/stdlib/base64.md) (3 symbols) — RFC 4648 standard and URL-safe Base64 encoding and decoding for strings and byte slabs.
- [`/validation`](https://tangu.dev/stdlib/validation.md) (7 symbols) — Declarative Struct field constraint validation (#{:min-len ... :format :email ...}) returning ValidationErrors.
- [`/glue/date-util`](https://tangu.dev/stdlib/glue/date-util.md) (5 symbols) — Business-day calendar helpers for workdays, weekends, and nth-weekday offset calculations.
- [`/glue/fs-util`](https://tangu.dev/stdlib/glue/fs-util.md) (4 symbols) — High-level directory tree copying, filename sanitization, and parent directory initialization.
- [`/glue/gen-util`](https://tangu.dev/stdlib/glue/gen-util.md) (1 symbols) — Code generation banner and header formatting helpers.

## Time, date & scheduling

High-precision clocks, civil dates, time zones, durations (/chrono), Gregorian calendars (/calendar/gregorian), and cron schedules (/cron).

- [`/chrono`](https://tangu.dev/stdlib/chrono.md) (72 symbols) — High-precision clocks (Steady-Clock), civil dates/times (Date, Time, Date-Time), UTC Instants, IANA Zoned-Date-Time, and Duration/Span arithmetic powered by jiff.
- [`/calendar/gregorian`](https://tangu.dev/stdlib/calendar/gregorian.md) (14 symbols) — Pure Gregorian calendar arithmetic: leap years, days in month, weekday indices, and date comparison.
- [`/cron`](https://tangu.dev/stdlib/cron.md) (4 symbols) — Standard 5-field cron expression parsing, validation, and schedule matching (Cron, is-matching?, is-matching-now?).

## Web, HTTP & full-stack apps

HTTP client/server (/http/*), full-stack web apps (/web/app/*), OpenAPI/sitemap generation, Web Push, and WebSockets.

- [`/http`](https://tangu.dev/stdlib/http.md) (18 symbols) — Shared HTTP method, status code, content-type, and request/response inspection predicates.
- [`/http/client`](https://tangu.dev/stdlib/http/client.md) (15 symbols) — Async and sync HTTP/HTTPS client with connection pooling, headers, timeouts, and streaming bodies.
- [`/http/client/json`](https://tangu.dev/stdlib/http/client/json.md) (1 symbols) — Convenience helpers for sending JSON HTTP requests and decoding structured responses (post-json).
- [`/http/server`](https://tangu.dev/stdlib/http/server.md) (17 symbols) — High-performance Axum/Tokio HTTP/1.1 & HTTP/2 server supporting static serving, SSE, multipart forms, and WebSockets.
- [`/web/app`](https://tangu.dev/stdlib/web/app.md) (93 symbols) — Core full-stack web application primitives: cookies, flash messages, query/form params, responses, and trie router.
- [`/web/app/server`](https://tangu.dev/stdlib/web/app/server.md) (1 symbols) — Opinionated HTTP server launcher reading HOST and PORT from process environment variables.
- [`/web/app/handlers`](https://tangu.dev/stdlib/web/app/handlers.md) (7 symbols) — Composable HTTP request handlers: chain-handlers, route-map, route-fs, route-graph, handle-html, handle-css, handle-not-found.
- [`/web/app/middleware`](https://tangu.dev/stdlib/web/app/middleware.md) (29 symbols) — Production HTTP middlewares: CSRF, CORS, session, rate limiting, security headers, auth, tracing, and scripts injection.
- [`/web/app/forms`](https://tangu.dev/stdlib/web/app/forms.md) (20 symbols) — HTML form binding, type coercion, CSRF token fields (<csrf-field>), and field validation errors (<form-error>).
- [`/web/app/session`](https://tangu.dev/stdlib/web/app/session.md) (12 symbols) — Cookie-backed and server-side session state management.
- [`/web/app/graph`](https://tangu.dev/stdlib/web/app/graph.md) (6 symbols) — Filesystem-driven application route graph (App-Graph) for breadcrumbs, navigation trails, and static site crawling.
- [`/web/app/graph/sitemap`](https://tangu.dev/stdlib/web/app/graph/sitemap.md) (5 symbols) — XML and plain-text sitemap generators and HTTP handlers constructed from an App-Graph.
- [`/web/app/graph/openapi`](https://tangu.dev/stdlib/web/app/graph/openapi.md) (3 symbols) — Automatic OpenAPI 3.1 specification generator from /web/app route graphs and Struct schemas.
- [`/web/push`](https://tangu.dev/stdlib/web/push.md) (2 symbols) — RFC 8291 Web Push payload encryption and VAPID key generation.
- [`/websocket/client`](https://tangu.dev/stdlib/websocket/client.md) (5 symbols) — WebSocket client supporting text and binary frames, ping/pong, and graceful close.

## CLI, terminal, markup & browser DOM

CLI routers (/cli), TTY & ANSI control (/tty, /ansi), color math (/color), SHTML/CSS compilers (/repr/html, /repr/css), and JS Web APIs.

- [`/cli`](https://tangu.dev/stdlib/cli.md) (9 symbols) — Declarative command-line argument and subcommand router DSL (action, query, cmd, scope, mount) with automatic help output.
- [`/tty`](https://tangu.dev/stdlib/tty.md) (4 symbols) — Terminal capability detection, dimensions, raw mode controls, and interactive prompt helpers.
- [`/ansi`](https://tangu.dev/stdlib/ansi.md) (15 symbols) — ANSI terminal escape sequences for foreground/background styling, 256-color/RGB output, and text weights.
- [`/color`](https://tangu.dev/stdlib/color.md) (25 symbols) — Color space conversions (hex, RGB, HSL, OKLCH), WCAG contrast ratios, and tonal palette operations.
- [`/repr/html`](https://tangu.dev/stdlib/repr/html.md) (8 symbols) — SHTML (#shtml / #html) node renderer, attribute/class utilities, and template formatter (format-html).
- [`/repr/css`](https://tangu.dev/stdlib/repr/css.md) (2 symbols) — CSS AST compiler and nested stylesheet formatter (format-css, scss->css) powering #css blocks.
- [`/repr/js/dom`](https://tangu.dev/stdlib/repr/js/dom.md) (97 symbols) — Typed Browser DOM and Document/Element interop bindings when compiling Tangu to JavaScript.
- [`/repr/js/web`](https://tangu.dev/stdlib/repr/js/web.md) (58 symbols) — Typed Web Platform API bindings (fetch, Storage, History, Workers, URL, WebSocket) for the JavaScript target.

## PostgreSQL & SQLite databases

Connection pools, read/write replica routing, strong vs eventual consistency queries (/postgres/client), and embedded SQLite (/sqlite/client).

- [`/postgres/client`](https://tangu.dev/stdlib/postgres/client.md) (25 symbols) — Pooled PostgreSQL client with primary/replica routing, strong consistency reads (query-strong, query-one-strong), and ACID transactions.
- [`/sqlite/client`](https://tangu.dev/stdlib/sqlite/client.md) (26 symbols) — Synchronous embedded SQLite connection pool with parameterized queries, row maps, and closure transactions (begin).

## Security, hashing & cryptography

SHA-256, HMAC & AEAD (/crypto), ECDSA/RSA signatures (/crypto/ecdsa, /crypto/rsa), fast hashes (/hash), JWT (/jwt), and UUIDs (/uuid).

- [`/crypto`](https://tangu.dev/stdlib/crypto.md) (8 symbols) — Cryptographic hashing (SHA-256), HMAC authentication, AES-GCM/AEAD helpers, CSPRNG tokens, and constant-time equality.
- [`/crypto/ecdsa`](https://tangu.dev/stdlib/crypto/ecdsa.md) (1 symbols) — Elliptic Curve Digital Signature Algorithm (ECDSA) P-256 key generation, signing, and signature verification.
- [`/crypto/rsa`](https://tangu.dev/stdlib/crypto/rsa.md) (1 symbols) — RSA public/private key parsing, PKCS#1/PSS signing, and cryptographic signature verification.
- [`/hash`](https://tangu.dev/stdlib/hash.md) (4 symbols) — Fast non-cryptographic hash algorithms: AHash, FNV-1a, SipHash-1-3, and XXHash64.
- [`/jwt`](https://tangu.dev/stdlib/jwt.md) (2 symbols) — JSON Web Token (JWT) HS256 signing and verification (sign-jwt, verify-jwt).
- [`/uuid`](https://tangu.dev/stdlib/uuid.md) (6 symbols) — RFC 9562 UUIDv4 (random) and UUIDv7 (time-ordered) generation and validation.

## Mathematics, SIMD & image codecs

Transcendental math (/math), statistics, 4x4 matrices (/mat), portable SIMD vectors (/simd), PRNGs (/rng), and AVIF/JPEG/PNG/WebP codecs.

- [`/math`](https://tangu.dev/stdlib/math.md) (3 symbols) — Mathematical constants (pi, e, phi) complementing the prelude math intrinsics.
- [`/num`](https://tangu.dev/stdlib/num.md) (2 symbols) — Numeric interpolation (lerp) and rounding-to-multiple utilities.
- [`/statistics`](https://tangu.dev/stdlib/statistics.md) (17 symbols) — Descriptive and rolling statistics: mean, weighted-mean, variance, standard deviation, change metrics, and moving averages.
- [`/mat`](https://tangu.dev/stdlib/mat.md) (10 symbols) — 4x4 floating-point matrix math (Mat4) for 3D transforms, projections, rotations, and inversions.
- [`/simd`](https://tangu.dev/stdlib/simd.md) (40 symbols) — Portable 128-bit SIMD vector types (F32x4, F64x2, I32x4, I64x2, U8x16) with lane-parallel arithmetic.
- [`/rng`](https://tangu.dev/stdlib/rng.md) (7 symbols) — Pseudo-random number generation for bounded integers, floats, booleans, and collection sampling.
- [`/image`](https://tangu.dev/stdlib/image.md) (4 symbols) — In-memory raster Image decoding/encoding with format detection, cropping, and high-quality resizing.
- [`/image/avif`](https://tangu.dev/stdlib/image/avif.md) (6 symbols) — AVIF image decoder and encoder for files and byte slabs.
- [`/image/jpeg`](https://tangu.dev/stdlib/image/jpeg.md) (6 symbols) — JPEG image decoder and encoder with configurable quality for files and byte slabs.
- [`/image/png`](https://tangu.dev/stdlib/image/png.md) (6 symbols) — Lossless PNG image decoder and encoder for files and byte slabs.
- [`/image/webp`](https://tangu.dev/stdlib/image/webp.md) (6 symbols) — WebP image decoder and encoder for files and byte slabs.
