Standard Library
● Intermediate4 minSpec 14
Every standard-library module, with a page each: its types, methods and functions, their definitions and examples, and the files that declare them.
A module is used with use std.name. Some parts are built into the compiler and runtime; the rest is written in Kavach, in stdlib/, with contracts and examples like any other code.
| Module | Spec | Written in Kavach |
|---|---|---|
| std.fs | 14.3 | fs.kav: the FsError union file operations fail with, FileInfo, and FileWriter, a file written piece by piece (spec 14.3) |
| std.time | 14.4 | digits.kav: the digits and offsets of times as text; time.kav: Duration (5.seconds), Date, Time, DateTime, Weekday; clocks, sleeping and intervals come from the runtime (spec 14.4) |
| std.math | 14.5 | math.kav: gcd, lcm, factorial, is_prime, mean |
| std.io and std.cli | 14.6 | cli.kav: StopHold and cli.on_stop(grace), a hold on the program's stop (spec 5.8, decision 0088); arguments, exit and parse are built into the compiler and runtime (spec 14.6) |
| std.test | 14.7 | test.kav: Sample, for types that make their own generated values, and Gen, the seeded choices they make them from (spec 14.7); the numbers come from the runtime |
| std.regex | 14.8 | Nothing: the compiler and runtime give it all |
| std.text and std.collections | 14.9 | text.kav: padding, words, capitalizing, truncating, blank textcollections.kav: chunks, zip, unique items, counting, flattening |
| std.random | 14.15 | random.kav: whole numbers in a range, floats, picks, shuffles and bytes, from the operating system's secure generator, seeded under kavach test (spec 14.15) |
| std.log | 14.12 | log.kav: log events are records the program defines; levels and the console sink, written in Kavach (spec 14.12) |
| std.term | 14.13 | term.kav: colors and styles for the terminal, off when output is not a terminal; progress bars; prompts (spec 14.13) |
| std.crypto | 14.19 | crypto.kav: the CryptoError union; hashes, HMAC, passwords (Argon2id), signatures and AES-GCM come from ring and argon2 in the runtime (spec 14.19, decision 0093) |
| std.base64 | 14.20 | base64.kav: the Base64Error union; encoding and decoding are built into the runtime (runtime/core/src/base64.rs, spec 14.20) |
| std.compress | 14.21 | compress.kav: Format, its levels and names, CompressError, and encode/decode over the runtime's encode_bytes/decode_bytes (runtime/core/src/compress.rs, spec 14.21) |
| std.json | 2.12 | json.kav: the Json and JsonError types and reading a Json, written in Kavach; every program has them. Parsing and writing are in the compiler and runtime (spec 2.12) |
| std.tasks | 9.4 | tasks.kav: Taken<T>, what a channel's take() gives (spec 9.4, decision 0097); every program that uses a channel gets it, and tasks and channels themselves are built in |
| std.net | 14.10 | net.kav: the NetError union and the ClientCert record; TCP, UDP and QUIC come from the runtime (spec 14.10). HTTP is in http/ |
| std.http | 14.11 | http.kav: HTTP/1.1 and HTTP/2 clients and servers, and HTTP/3 clients, on std.net, written in Kavach, with typed JSON calls and sessions that keep a connection open (spec 14.11); server.kav: the server http.serve runs, each client held to its ServeLimits (decision 0087); multipart.kav: forms read part by part (http.form, decision 0090); upgrade.kav: WebSockets and server-sent events (decision 0092); message.kav: reading HTTP/1.1 messages, chunked bodies too, and where each ends; h2.kav: HTTP/2 requests and responses, whole or piece by piece; h2wire.kav: its frames, streams and flow control; hpack.kav: HTTP/2 header compression; h3.kav: HTTP/3 requests over QUIC, with QPACK (decision 0022) |
| std.grpc | 14.14 | grpc.kav: gRPC clients and servers from Kavach types; frames.kav: message prefixes and status trailers; protobuf.kav: Protocol Buffers from a type's JSON Schema, written in Kavach on std.http.h2 (spec 14.14, decision 0027) |
| std.ai | 8.4 | ai.kav: AiError, what ask<T> fails with, and Model, the model and settings (effort, tokens, thinking, instructions, stop text, timeout, retries, address and key, extra request fields) an ask uses; the model call is in the runtime (spec 8.4) |
| std.agents | 14.16 | agents.kav: ApprovalRequest, ApprovalError, and waiting and answer, which answer agents' approval requests in code, behind Approvals; the requests are found and answered by the runtime, as is call_key (spec 14.16) |
| std.clipboard | 14.17 | clipboard.kav: the ClipboardError union; reading and writing the clipboard come from the runtime, behind Clipboard (spec 14.17) |
| std.devices | 14.18 | devices.kav: SerialPort, its methods, and DeviceError; ports are opened, read and written by the runtime, behind Serial (spec 14.18) |
| std.window | 14.22 | window.kav: AppWindow and its methods, Event, WindowError, over the runtime's windows by number (runtime/window, spec 14.22, decision 0104) |
| std.process | 14.23 | process.kav: Child and its methods, Output, Exit, Finished, ProcessError, and run/start over the runtime's children by number (runtime/process, spec 14.23, decision 0105) |
| std.gpu | 14.24 | gpu.kav: Screen, Frame and GpuError, drawing into a window over the runtime's screens and frames by number (runtime/gpu/src/draw.rs, spec 14.24, decision 0106) |
| std.literals | 10.15 | literals.kav: LiteralProblem, what a tag's checker gives for a tagged literal (spec 10.15, decision 0100) |
One page for each form
std.fs →std.time →std.math →std.io and std.cli →std.test →std.regex →std.text and std.collections →std.random →std.log →std.term →std.crypto →std.base64 →std.compress →std.json →std.tasks →std.net →std.http →std.grpc →std.ai →std.agents →std.clipboard →std.devices →std.window →std.process →std.gpu →std.literals →