std.base64 [core] std.base64.encode_raw pub fn encode_raw(b: List[byte]) -> str — RFC 4648 section 4 standard-alphabet base64 without padding, as age specifies. std.base64.decode_raw pub fn decode_raw(s: str) -> List[byte] ! {parse} — Strict unpadded standard base64. std.base64.encode pub fn encode(b: List[byte]) -> str — b encoded with the standard alphabet and = padding — RFC 4648 §4, the encoding every Authorization: Basic header and every PEM block uses. std.base64.url_encode pub fn url_encode(b: List[byte]) -> str — b encoded with the URL- and filename-safe alphabet (- and _ for + and /) and NO padding — RFC 4648 §5 with its padding sentence taken: = needs escaping in a query string, which is the whole point of the variant. std.base64.decode pub fn decode(s: str) -> List[byte] ! {parse} — s decoded with the standard alphabet, STRICTLY: parse unless the length is a multiple of four, the padding is exactly what the byte count requires, every other character is in the alphabet, and the unused low bits of a short final group are zero. std.base64.url_decode pub fn url_decode(s: str) -> List[byte] ! {parse} — s decoded with the URL-safe alphabet, padding optional. std.base64.decode_lenient pub fn decode_lenient(s: str) -> List[byte] ! {parse} — s decoded with the standard alphabet, forgivingly: padding may be absent or short, and a final group's unused bits may be anything. std.bech32 [core] std.bech32.Decoded pub struct Decoded { hrp: str, data: List[byte], } — A validated lowercase HRP and 5-bit data words, excluding checksum. std.bech32.encode pub fn encode(hrp: str, data: List[byte]) -> str ! {parse} — BIP-173 encoding of 5-bit data words. std.bech32.decode pub fn decode(s: str) -> Decoded ! {parse} — Validates BIP-173 syntax/case/checksum and returns lowercase HRP and 5-bit data excluding checksum. std.bech32.encode_bytes pub fn encode_bytes(hrp: str, b: List[byte]) -> str ! {parse} — Encodes bytes as MSB-first 5-bit words with zero padding, then Bech32. std.bech32.decode_bytes pub fn decode_bytes(s: str, hrp: str, n: int) -> List[byte] ! {parse} — Decodes canonical MSB-first bytes with exactly n bytes and the specified lowercase hrp. std.bytes [core] std.bytes.is_equal_fixed_work pub fn is_equal_fixed_work(a: List[byte], b: List[byte]) -> bool — Byte equality with no early exit at source level for equal lengths. std.bytes.len pub fn len(b: List[byte]) -> int — The number of bytes in b. std.bytes.is_empty pub fn is_empty(b: List[byte]) -> bool — Whether b holds no bytes. std.bytes.at pub fn at(b: List[byte], i: int) -> byte — The byte at index i. std.bytes.slice pub fn slice(b: List[byte], from: int, to: int) -> List[byte] — The bytes in [from, to), as a fresh list. std.bytes.find pub fn find(b: List[byte], needle: List[byte]) -> int ! {none} — The index of the first occurrence of needle in b; none when it does not occur. std.bytes.starts_with pub fn starts_with(b: List[byte], prefix: List[byte]) -> bool — Whether b begins with prefix; the empty prefix always does. std.bytes.ends_with pub fn ends_with(b: List[byte], suffix: List[byte]) -> bool — Whether b ends with suffix; the empty suffix always does. std.bytes.from_str pub fn from_str(s: str) -> List[byte] — s's bytes — infallible, because a valid str is always valid bytes. std.bytes.to_str pub fn to_str(b: List[byte]) -> str ! {utf8} — b as text, VALIDATED — the border post D24 demands, the one place in wolf where bytes become a str, and the reason str needs no validity check anywhere else. std.bytes.is_utf8 pub fn is_utf8(b: List[byte]) -> bool — Whether b is well-formed UTF-8 — the predicate half of to_str, and the one function here that reads the bytes as text rather than as numbers. std.cmp [core] std.cmp.Ordering pub enum Ordering { Less, Equal, Greater, } — std.cmp.Ordering.reverse pub fn reverse(self) -> Ordering — The opposite verdict: Less <-> Greater; Equal is its own reverse. std.cmp.Ordering.then pub fn then(self, other: Ordering) -> Ordering — Lexicographic composition: keep self unless it is Equal, in which case defer to other. std.cmp.Ordering.is_lt pub fn is_lt(self) -> bool — True exactly for Less. std.cmp.Ordering.is_le pub fn is_le(self) -> bool — True for Less or Equal. std.cmp.Ordering.is_eq pub fn is_eq(self) -> bool — True exactly for Equal. std.cmp.Ordering.is_ne pub fn is_ne(self) -> bool — True for anything but Equal. std.cmp.Ordering.is_ge pub fn is_ge(self) -> bool — True for Greater or Equal. std.cmp.Ordering.is_gt pub fn is_gt(self) -> bool — True exactly for Greater. std.cmp.Eq pub trait Eq { fn eq(self, other: Self) -> bool } — Equivalence. std.cmp.Ord pub trait Ord { fn cmp(self, other: Self) -> Ordering } — Total order. std.cmp.min pub fn min[T: Ord](a: T, b: T) -> T — Least of a and b under Ord; returns a on a tie (the stable choice). std.cmp.max pub fn max[T: Ord](a: T, b: T) -> T — Greatest of a and b under Ord; returns a on a tie (the stable choice). std.cmp.clamp pub fn clamp[T: Ord](v: T, lo: T, hi: T) -> T — v limited to [lo, hi]: lo when v < lo, hi when v > hi, else v. std.cmp.total_cmp pub fn total_cmp(a: f64, b: f64) -> Ordering — IEEE totalOrder over floats, monomorphic: -inf < negative reals < -0.0 < +0.0 < positive reals < +inf < NaN. std.deque [core] std.env [core] std.env.cwd pub fn cwd() -> str ! {io} — The process's working directory: the directory every relative path resolves against and every child starts in. std.env.set_cwd pub fn set_cwd(path: str) -> () ! {not_found, denied, io} — Make path the process's working directory. std.env.umask pub fn umask(mask: int) -> int ! {invalid, unsupported} — Set the process's file mode creation mask to mask, and answer the mask it replaced. std.env.pid pub fn pid() -> int — s232 ([os.proc.self]): this process's id — a shell's $$, and what a pid file holds. std.env.ppid pub fn ppid() -> int ! {unsupported} — s232 ([os.proc.self]): the id of this process's parent, NOW — a shell's $PPID. std.env.uid pub fn uid() -> int ! {unsupported} — s236 ([os.proc.ids]): this process's REAL user id — who started it (getuid). std.env.euid pub fn euid() -> int ! {unsupported} — s236 ([os.proc.ids]): this process's EFFECTIVE user id — the one the host checks when the process opens a file, signals another process or changes an owner (geteuid). std.env.gid pub fn gid() -> int ! {unsupported} — s236 ([os.proc.ids]): this process's real group id (getgid). std.env.egid pub fn egid() -> int ! {unsupported} — s236 ([os.proc.ids]): this process's effective group id (getegid) — the group a file it creates is given on most hosts. std.env.groups pub fn groups() -> List[int] ! {io, unsupported} — s236 ([os.proc.ids]): this process's SUPPLEMENTARY groups — the other groups the host counts it a member of, exactly as the host lists them (getgroups), in the host's order. std.env.args pub fn args() -> List[str] — The program's arguments, in the order the user gave them. std.env.arg pub fn arg(i: int) -> str ! {none} — The argument at i, counting from zero. std.env.arg0 pub fn arg0() -> str — The name this program was invoked by: argv[0], exactly as the invoker spelled it (a bare PATH name, an absolute path, ./prog, a symlink's own name, exec -a NAME's NAME). std.env.args_bytes pub fn args_bytes() -> List[List[byte]] — Every argument as bytes, the invocation name first: argv[0], then argv[1..] in order — so args_bytes().len is args().len + 1 whenever the invoker passed a name. std.env.get pub fn get(name: str) -> str ! {missing, utf8} — The value of the environment variable name. std.env.has pub fn has(name: str) -> bool — Whether get(name) would answer with a value. std.env.vars pub fn vars() -> List[str] — Every environment variable the host has, as K=V lines sorted by name. std.env.set pub fn set(name: str, value: str) -> () ! {invalid} — Set the environment variable name to value for this process. std.env.unset pub fn unset(name: str) -> () ! {invalid} — Remove name from this process's environment. std.env.entry_key pub fn entry_key(entry: str) -> str — The name half of a K=V line from vars(). std.env.entry_value pub fn entry_value(entry: str) -> str — The value half of a K=V line from vars(). std.errors [core] std.errors.ParseErr pub struct ParseErr { offset: int, kind: int, } — The payload of a Parse(ParseErr) row: WHERE the text stopped being a value of the wanted type, and WHICH way it failed. std.errors.Failure pub struct Failure { offset: int, cause: int, } — The payload of a coarsened row: a failure that happened at a position, remembering the kind of the precise error it came from. std.errors.parse_err pub fn parse_err(offset: int, kind: int) -> ParseErr — A ParseErr at byte offset with kind kind (the header's table). std.errors.byte_offset pub fn byte_offset(e: ParseErr) -> int — The byte offset e reports. std.errors.describe pub fn describe(e: ParseErr) -> str — One line of English for e: what went wrong and where. std.errors.describe_failure pub fn describe_failure(f: Failure) -> str — One line of English for a coarsened failure, naming its cause when it has one. std.errors.coarsen pub fn coarsen(e: ParseErr) -> Failure — e widened into a Failure: the precise parse error becomes "this operation failed here, and here is why it did" — the exemplar of §2's coarsening rule. std.fmt [core] std.fmt.pad_left pub fn pad_left(s: str, width: int) -> str — s padded on the LEFT with spaces to at least width bytes — right-alignment, the {x:>w} spec's meaning. std.fmt.pad_left_with pub fn pad_left_with(s: str, width: int, fill: str) -> str — pad_left with an explicit one-byte fill. std.fmt.pad_right pub fn pad_right(s: str, width: int) -> str — s padded on the RIGHT with spaces to at least width bytes — left-alignment, the {x: str — pad_right with an explicit one-byte fill; the assert trap on a multi-byte fill is pad_left_with's, for the same reason. std.fmt.center pub fn center(s: str, width: int) -> str — s centered in width bytes with spaces — the {x:^w} spec's meaning. std.fmt.center_with pub fn center_with(s: str, width: int, fill: str) -> str — center with an explicit one-byte fill; the assert trap on a multi-byte fill is pad_left_with's. std.fmt.to_str pub fn to_str(n: int) -> str — n in base ten — the decimal rendering of an int, sign included, no separators, no padding. std.fmt.to_str_base pub fn to_str_base(n: int, radix: int) -> str ! {base} — n in radix (2 through 36) with lowercase digits; base when the radix is outside that range. std.fmt.to_hex pub fn to_hex(n: int) -> str — n in base sixteen with lowercase digits and no 0x prefix; the sign-magnitude rendering to_str_base documents. std.fmt.to_hex_upper pub fn to_hex_upper(n: int) -> str — to_hex with uppercase digits ("FF"). std.fmt.to_oct pub fn to_oct(n: int) -> str — n in base eight, no 0o prefix. std.fmt.to_bin pub fn to_bin(n: int) -> str — n in base two, no 0b prefix and no leading zeros — the shortest binary rendering, so to_bin(1) is "1" and not a 64-bit field. std.fmt.with_sign pub fn with_sign(n: int) -> str — n in base ten with an explicit sign — "+42", "-42", and "+0" for zero. std.fmt.group pub fn group(n: int, sep: str) -> str — n in base ten with sep inserted every three digits from the right — thousands grouping, sign in front of the first group. std.fmt.parse_int pub fn parse_int(s: str) -> int ! {parse} — s parsed as a whole decimal integer; parse when it is not one. std.fmt.parse_int_base pub fn parse_int_base(s: str, radix: int) -> int ! {parse, base} — s parsed as a whole integer in radix; parse when the text is not one and base when the radix is outside 2..36 — two tags because a caller distinguishes bad data from a bad call (§2, and this module's header on the re-home). std.fmt.parse_bool pub fn parse_bool(s: str) -> bool ! {parse} — s parsed as a boolean; parse when it is neither "true" nor "false". std.fmt.truncate_to pub fn truncate_to(s: str, width: int) -> str — The longest prefix of s that is at most width BYTES long and ends on a code-point boundary; s itself when it already fits. std.fmt.decimal [core] std.fmt.decimal.to_str_fixed pub fn to_str_fixed(x: f64, prec: int) -> str — x rendered with exactly prec digits after the decimal point, the exact value rounded half-even at the last one — %.*f, done right. std.fmt.decimal.to_str_exp pub fn to_str_exp(x: f64, prec: int) -> str — x in exponential notation with exactly prec digits after the point in the mantissa — %.*e, over the exact value, rounded half-even. std.fmt.decimal.to_str pub fn to_str(x: f64) -> str — x as the SHORTEST decimal string that reads back as exactly x — the round-trip contract the sprint names, and the rendering ordinary code wants: to_str(0.1) is "0.1", not 0.1's exact 55-digit expansion, and parse_float maps it back to the same bits. std.fmt.decimal.parse_float pub fn parse_float(s: str) -> f64 ! {parse, overflow} — s parsed as an f64, correctly rounded: the result is the double nearest the exact decimal value the text denotes, ties to even. std.fs [core] std.fs.IoErrors pub error IoErrors = {not_found, denied, io} — The row fourteen signatures below carry, named once ([type.err.alias]). std.fs.File pub struct File { fd: int, } — An open file: the host descriptor this process may read from or write to, according to how it was opened. std.fs.read_text pub fn read_text(path: str) -> str ! {not_found, denied, io, utf8} — The whole contents of the file at path, decoded as UTF-8. std.fs.write_text pub fn write_text(path: str, text: str) -> () ! IoErrors — Write text to path, replacing whatever was there and creating the file if it does not exist. std.fs.append_text pub fn append_text(path: str, text: str) -> () ! IoErrors — Append text to the end of the file at path, creating it when it is absent. std.fs.read_bytes pub fn read_bytes(path: str) -> List[byte] ! IoErrors — The whole contents of the file at path, as bytes — no decode, no utf8 row, nothing refused for being data. std.fs.write_bytes pub fn write_bytes(path: str, b: List[byte]) -> () ! {not_found, denied, invalid, io} — Write b to path as bytes, replacing whatever was there and creating the file if it does not exist. std.fs.exists pub fn exists(path: str) -> bool — Does something exist at path? std.fs.is_file pub fn is_file(path: str) -> bool — Is there a regular FILE at path? std.fs.is_dir pub fn is_dir(path: str) -> bool — Is there a DIRECTORY at path? std.fs.size pub fn size(path: str) -> int ! IoErrors — The size of the file at path, in BYTES. std.fs.modified_ms pub fn modified_ms(path: str) -> int ! IoErrors — When the file at path was last modified, in MILLISECONDS from the Unix epoch — negative before it. std.fs.remove pub fn remove(path: str) -> () ! IoErrors — Remove the file at path. std.fs.copy_file pub fn copy_file(from: str, to: str) -> () ! IoErrors — Copy the BYTES of from to to, replacing to if it exists. std.fs.move_file pub fn move_file(from: str, to: str) -> () ! IoErrors — Move the file at from to to. std.fs.read_dir pub fn read_dir(path: str) -> List[str] ! {not_found, denied, utf8, io} — The entry NAMES directly inside the directory at path, SORTED. std.fs.create_dir pub fn create_dir(path: str) -> () ! {exists, not_found, denied, io} — Create ONE directory at path. std.fs.create_dir_all pub fn create_dir_all(path: str) -> () ! {denied, io} — Create the directory at path and every missing parent of it. std.fs.remove_dir pub fn remove_dir(path: str) -> () ! IoErrors — Remove the EMPTY directory at path. std.fs.remove_dir_all pub fn remove_dir_all(path: str) -> () ! IoErrors — Remove the directory at path and EVERYTHING inside it. std.fs.open pub fn open(path: str) -> File ! IoErrors — Open the file at path for READING and return its handle. std.fs.open_append pub fn open_append(path: str) -> File ! IoErrors — Open the file at path for APPENDING and return its handle, creating the file when it is absent. std.fs.create pub fn create(path: str) -> File ! {denied, io} — Create (or truncate) the file at path for WRITING and return its handle. std.fs.create_new pub fn create_new(path: str) -> File ! {exists, not_found, denied, io} — Create a NEW file at path, open for reading and writing, and fail if anything is already there: the EXCLUSIVE create, the one atomicity every tier-1 host promises ([os.fs.open]'s mode 4). std.fs.create_new_with_mode pub fn create_new_with_mode(path: str, mode: int) -> File ! { exists, not_found, denied, invalid, unsupported, io, } — create_new, with the permission bits the file has from its first instant: mode less the process's umask (env.umask), never wider for a moment — an atomic save's temporary file with the target's bits, before it is renamed over the target. std.fs.read pub fn read(mut f: File, max: int) -> str ! {eof, io, utf8} — Read up to max bytes from f, decoded as UTF-8, advancing the file's position. std.fs.read_chunk pub fn read_chunk(mut f: File, max: int) -> List[byte] ! {eof, io} — Read up to max BYTES from f, advancing the file's position — no decode, no utf8 row, no boundary to land inside. std.fs.write pub fn write(mut f: File, text: str) -> () ! {io} — Write text to f at its current position, advancing it. std.fs.write_chunk pub fn write_chunk(mut f: File, b: List[byte]) -> () ! {invalid, io} — Write the bytes b to f at its current position, advancing it. std.fs.copy_chunk pub fn copy_chunk(mut src: File, mut dst: File, max: int) -> int ! {eof, io} — One copy the host makes: at most max bytes from src's position to dst's, both advancing, and how many moved. std.fs.close pub fn close(take f: File) -> () ! {io} — Close f, consuming it. std.fs.Stat pub struct Stat { kind: int, size: int, modified_ms: int, } — What one metadata read on an open handle answers: a kind, a size and a modification time. std.fs.fstat pub fn fstat(mut f: File) -> Stat ! IoErrors — One metadata read on the open handle f. std.fs.Info pub struct Info { kind: int, size: int, modified_ms: int, have: int, mode: int, nlink: int, uid: int, gid: int, blocks: int, dev: int, ino: int, rdev: int, atime_s: int, atime_ns: int, mtime_s: int, mtime_ns: int, ctime_s: int, ctime_ns: int, btime_s: int, btime_ns: int, } — The full stat record of one path: what ls -l shows. std.fs.stat pub fn stat(path: str) -> Info ! IoErrors — The record of path, FOLLOWING a final symbolic link: what the link names. std.fs.lstat pub fn lstat(path: str) -> Info ! IoErrors — The record of path ITSELF, a symbolic link included: a link is kind 3, its size the length of its target, its times its own. std.fs.answered pub fn answered(info: Info, word: int) -> bool — Whether the host answered word word of info (Info's table); false for a word outside 0..20. std.fs.FileSystem pub struct FileSystem { have: int, block_size: int, fragment_size: int, blocks: int, free: int, available: int, files: int, free_files: int, name_max: int, flags: int, type_number: int, id: int, } — The record of a file system, what df and stat -f print: the twelve words statfs answers, named, with have saying which of them the host answered. std.fs.file_system pub fn file_system(words: List[int]) -> FileSystem — The FileSystem of statfs's words in their order, words[0] being have. std.fs.has_answer pub fn has_answer(v: FileSystem, word: int) -> bool — Whether the host answered word word of v (FileSystem's table); false for a word outside 0..12. std.fs.statfs pub fn statfs(path: str) -> FileSystem ! IoErrors — The record of the file system that holds what path names, a final symbolic link followed: what df and stat -f print, from one host call (statfs(2); macOS adds a pathconf for name_max). std.fs.read_link pub fn read_link(path: str) -> List[byte] ! {not_found, denied, invalid, io} — The target a symbolic link stores, as the host stored it: bytes, verbatim — a name need not be UTF-8 (str_from_utf8 when it is). std.fs.realpath pub fn realpath(path: str) -> str ! {io, not_found} — s248 ([os.fs.realpath]): the canonical name of path — absolute, every symbolic link followed, every . and .. taken (a .. AFTER the link before it, so l/.. is the parent of the link's TARGET), and no trailing slash: what realpath(3) resolves. std.fs.Entry pub struct Entry { kind: int, name: List[byte], } — One directory entry: its own kind (Info's codes; a link is 3, never what it names; 2 when the host gave none) and its name's bytes. std.fs.entries pub fn entries(path: str) -> List[Entry] ! IoErrors — The entries of the directory path in the order the host keeps them — NOT sorted — without . and .., each with its own kind. std.fs.stdin pub fn stdin() -> File — The process's standard input, as a File. std.fs.stdout pub fn stdout() -> File — The process's standard output, as a File — stdin's doc in every respect, for descriptor 1. std.fs.stderr pub fn stderr() -> File — The process's standard error, as a File — stdin's doc in every respect, for descriptor 2. std.fs.seek pub fn seek(mut f: File, off: int) -> int ! {invalid, io, unseekable} — Move f's position to byte off from the START of the file, and answer it. std.fs.seek_by pub fn seek_by(mut f: File, delta: int) -> int ! {invalid, io, unseekable} — Move f's position by delta bytes from where it is, and answer the new position from the start. std.fs.seek_end pub fn seek_end(mut f: File, off: int) -> int ! {invalid, io, unseekable} — Move f's position to off bytes from the END of the file — zero is the end, negative is before it — and answer it from the start. std.fs.tell pub fn tell(mut f: File) -> int ! {io, unseekable} — f's position, from the start of the file, without moving it. std.fs.read_at pub fn read_at(mut f: File, off: int, max: int) -> List[byte] ! {eof, invalid, io, unseekable} — Up to max bytes of f starting at byte off, leaving f's own position exactly where it was. std.fs.join pub fn join(base: str, name: str) -> str — base and name joined with a single /. std.fs.parent pub fn parent(path: str) -> str ! {none} — Everything in path before its last /. std.fs.file_name pub fn file_name(path: str) -> str ! {none} — The last segment of path — everything after its last /. std.fs.set_mode pub fn set_mode(path: str, mode: int) -> () ! {not_found, denied, invalid, unsupported, io} — Set the permission bits of what is at path to exactly mode. std.fs.create_private pub fn create_private(path: str) -> File ! {exists, not_found, denied, unsupported, io} — Create a NEW file at path that only its owner can read or write, open for reading and writing. std.fs.create_with_mode pub fn create_with_mode(path: str, mode: int) -> File ! { not_found, denied, invalid, unsupported, io, } — create, with the permission bits the file gets if this call creates it: mode less the process's umask (env.umask). std.fs.create_dir_mode pub fn create_dir_mode(path: str, mode: int) -> () ! { exists, not_found, denied, invalid, unsupported, io, } — create_dir, with the directory's permission bits: mode less the process's umask. std.fs.symlink pub fn symlink(target: str, path: str) -> () ! { exists, not_found, denied, invalid, unsupported, io, } — Make path a symbolic link whose target is target, stored verbatim. std.fs.link pub fn link(existing: str, path: str) -> () ! {exists, not_found, denied, cross_device, io} — Make path a second name of the file existing names. std.fs.Time pub struct Time { s: int, ns: int, } — One time set_times writes: a moment, "now", or "leave it". std.fs.time pub fn time(s: int, ns: int) -> Time — The moment s seconds and ns nanoseconds from the Unix epoch. std.fs.time_now pub fn time_now() -> Time — "Now": the HOST's clock at the set_times call, not a clock this program read ([os.fs.times]'s -1). std.fs.time_keep pub fn time_keep() -> Time — "Leave this time as it is" ([os.fs.times]'s -2): how one time is set and the other kept, with no read in between. std.fs.set_times pub fn set_times(path: str, atime: Time, mtime: Time) -> () ! {not_found, denied, invalid, io} — Set the access time and the modification time of what is at path, following a final symbolic link. std.fs.set_link_times pub fn set_link_times(path: str, atime: Time, mtime: Time) -> () ! { not_found, denied, invalid, io, } — set_times on path ITSELF: a final symbolic link's own times, its target's left alone (touch -h). std.fs.owner_keep pub fn owner_keep() -> int — The word set_owner and its kin read as "leave this id as it is". std.fs.set_owner pub fn set_owner(path: str, uid: int, gid: int) -> () ! { not_found, denied, invalid, unsupported, io, } — Set the owner and the group of what is at path, following a final symbolic link — chown. std.fs.set_link_owner pub fn set_link_owner(path: str, uid: int, gid: int) -> () ! { not_found, denied, invalid, unsupported, io, } — set_owner on path ITSELF: a final symbolic link's own owner and group, its target's left alone (chown -h). std.fs.set_file_owner pub fn set_file_owner(mut f: File, uid: int, gid: int) -> () ! {denied, invalid, unsupported, io} — Set the owner and the group of the file behind f — fchown. std.fs.set_file_mode pub fn set_file_mode(mut f: File, mode: int) -> () ! {denied, invalid, io, unsupported} — Set the permission bits of the file behind f to exactly mode: fchmod, the handle form of set_mode. std.fs.truncate pub fn truncate(mut f: File, len: int) -> () ! {invalid, io} — Make the file behind f exactly len bytes long. std.fs.sync pub fn sync(mut f: File) -> () ! {io} — s248 ([os.fs.sync]): put f's bytes and metadata on the disk before answering — fsync(2) on linux, F_FULLFSYNC on macOS (whose fsync leaves them in the drive's cache), FlushFileBuffers on windows. std.fs.sync_dir pub fn sync_dir(path: str) -> () ! {denied, invalid, io, not_found, unsupported} — s248 ([os.fs.sync]): put the directory path's entries on the disk, so that a creation, a rename or a removal in it survives a crash — the last call of sync's atomic save. std.fs.NOFOLLOW pub const NOFOLLOW: int = 16 — The flag that makes open_mode refuse a final symbolic link ([os.fs.open.nofollow], wolf 0.2.35): bit 16, added to any of the six modes — fs.open_mode(path, 3 + fs.NOFOLLOW). std.fs.DIRECTORY pub const DIRECTORY: int = 32 — The flag that makes an open refuse anything but a directory ([os.fs.open.directory], wolf 0.2.37): bit 32, added to read mode 0 or 5 of open_mode or open_at. std.fs.open_mode pub fn open_mode(path: str, mode: int) -> File ! {not_found, denied, exists, invalid, io} — Open path in one of [os.fs.open]'s six modes, by number — the moded open the named ones above are spellings of, and the only one that reaches modes 3 and 5 and the NOFOLLOW and DIRECTORY flags: - 0 read (open), 1 write, creating and truncating (create), 2 append, creating (open_append); - 3 read and write, creating, NOT truncating — an editor's in-place save, a journal reopened; - 4 the exclusive create (create_new); - 5 read without parking: a fifo or a device with no writer answers at once, a regular file is unaffected (a static-file server's open, before fstat classifies the handle). std.fs.open_dir pub fn open_dir(path: str) -> File ! {not_found, denied, invalid, io} — A held directory: path opened read-only as a directory, a final symbolic link refused (open_mode(path, DIRECTORY + NOFOLLOW)), for the …_at calls, which look a name up in the directory the handle holds whatever its path has become. std.fs.open_dir_at pub fn open_dir_at(dir: File, name: str) -> File ! {denied, invalid, io, not_found, unsupported} — The directory name in the held directory dir, opened the way open_dir opens a path: read-only, a directory or refused, a link refused. std.fs.open_at pub fn open_at(dir: File, name: str, mode: int, perm: int) -> File ! { denied, exists, invalid, io, not_found, unsupported, } — name in the held directory dir, opened in one of open_mode's six modes with its flags, a file the call creates getting perm less the umask from its first instant: openat(2), the open relative to a directory the program holds. std.fs.stat_at pub fn stat_at(dir: File, name: str) -> Info ! {denied, invalid, io, not_found, unsupported} — The record of name in the held directory dir, a final link followed: stat's twenty words as an Info, from one host call relative to the handle (statx(2) on linux, fstatat(2) elsewhere), so the record is of the name in that directory whatever its path is by now. std.fs.lstat_at pub fn lstat_at(dir: File, name: str) -> Info ! {denied, invalid, io, not_found, unsupported} — The record of name ITSELF in the held directory dir, a link included (kind 3, its own size and times): lstat relative to the handle, the question a walk asks of each entry before it opens one. std.fs.remove_at pub fn remove_at(dir: File, name: str) -> () ! {denied, invalid, io, not_found, unsupported} — Remove the name name from the held directory dir: a file, a link (never what it names) or a fifo, remove relative to the handle. std.fs.remove_dir_at pub fn remove_dir_at(dir: File, name: str) -> () ! {denied, invalid, io, not_found, unsupported} — Remove the EMPTY directory name from the held directory dir: remove_dir relative to the handle. std.fs.create_dir_at pub fn create_dir_at(dir: File, name: str, mode: int) -> () ! { denied, exists, invalid, io, not_found, unsupported, } — Make the directory name in the held directory dir, its permission bits mode less the umask from its first instant: create_dir_mode relative to the handle, one level. std.fs.symlink_at pub fn symlink_at(target: str, dir: File, name: str) -> () ! { denied, exists, invalid, io, not_found, unsupported, } — Make name in the held directory dir a symbolic link whose target is target, stored verbatim, never resolved or checked: symlink relative to the handle, the target first as there. std.fs.link_at pub fn link_at(src_dir: File, src: str, dst_dir: File, dst: str) -> () ! { cross_device, denied, exists, invalid, io, not_found, unsupported, } — Make dst in the held directory dst_dir a second name of the file src names in the held directory src_dir, a final link in src linked ITSELF (link's rule, on every host). std.fs.link_followed_at pub fn link_followed_at(src_dir: File, src: str, dst_dir: File, dst: str) -> () ! { cross_device, denied, exists, invalid, io, not_found, unsupported, } — link_at with a final link in src FOLLOWED: the new name is a second name of what the link names (AT_SYMLINK_FOLLOW). std.fs.entries_at pub fn entries_at(mut dir: File) -> List[Entry] ! {denied, invalid, io, not_found, unsupported} — The entries of the held directory dir, in entries' shape: the host's order (not sorted), no . or .., each entry its own kind and its name's bytes, a name that is not UTF-8 listed like any other. std.fs.access pub fn access(path: str, mode: int) -> () ! {denied, invalid, io, not_found, unsupported} — s254 ([os.fs.access], wolf 0.2.35): may this process do what mode asks of path, by its REAL user and group ids — access(2), a final link followed. std.fs.fstat_record pub fn fstat_record(mut f: File) -> Info ! {io} — s254 ([os.fs.fstat.record], wolf 0.2.35; ruling asked R-sc72-1): the full record of the file f HOLDS, stat's twenty words as an Info, from one metadata read on the handle (fstat(2), statx(2) on linux) — its identity (dev, ino), link count, mode, owner and nanosecond times with no path walked between the open and the question. std.fs.LOCK_SHARED pub const LOCK_SHARED: int = 1 — lock's kind 1: a shared lock, any number of which may be held at once through different opens of one file ([os.fs.lock]). std.fs.LOCK_EXCLUSIVE pub const LOCK_EXCLUSIVE: int = 2 — lock's kind 2: an exclusive lock, which no other open of the file may hold beside it, shared or exclusive ([os.fs.lock]). std.fs.lock pub fn lock(mut f: File, kind: int) -> () ! {busy, invalid, io, unsupported} — s254 ([os.fs.lock], wolf 0.2.35): an advisory lock on the file behind f, LOCK_SHARED or LOCK_EXCLUSIVE, tried once and never waited for — a conflicting lock held through ANOTHER OPEN of the file is busy (a program polls with its own deadline; a wait in the kernel would park a worker where a kill cannot reach it). std.fs.unlock pub fn unlock(mut f: File) -> () ! {io, unsupported} — s254 ([os.fs.lock], wolf 0.2.35): release the lock f's open file holds. A handle that holds none is ok on every host. std.fs.mkfifo pub fn mkfifo(path: str, perm: int) -> () ! {denied, exists, invalid, io, not_found, unsupported} — s254 ([os.fs.mkfifo], wolf 0.2.35): make a fifo named path, mkfifo(3), its permission bits perm less the process's umask (create_dir_mode's rule). std.fs.set_nonblock pub fn set_nonblock(mut f: File, on: bool) -> () ! {invalid, io, unsupported} — s254 ([os.fs.nonblock], wolf 0.2.35): set (on) or clear the non-blocking flag on the open file behind f (O_NONBLOCK). std.fs.write_some pub fn write_some(mut f: File, b: List[byte]) -> int ! {busy, invalid, io} — s254 ([os.fs.nonblock], wolf 0.2.35): ONE write of b to f, and how many bytes the host took — all of them or a first part; at least 1 for a non-empty list, 0 for an empty one (the handle still checked). std.fs.adopt pub fn adopt(fd: int) -> File ! {invalid, io, unsupported} — s253 ([os.proc.adopt], wolf 0.2.35): a descriptor this process INHERITED, as a File that owns it — prog 5>out, a supervisor's pipe, the ready descriptor a test driver hands its child. std.fs.read_into pub fn read_into(mut f: File, mut buf: List[byte], max: int) -> int ! {eof, io} — #94: read up to max bytes from f INTO buf, whose contents become the bytes read and whose storage is kept (List.reset, then a push per byte), and answer how many — C's read(2) shape, for a loop that must not grow: an editor's key reader, a pipe pump. std.hex [core] std.hex.encode pub fn encode(b: List[byte]) -> str — b as lowercase hexadecimal, two digits per byte, no separators and no 0x prefix. std.hex.encode_upper pub fn encode_upper(b: List[byte]) -> str — encode with uppercase digits ("000FFF"). std.hex.decode pub fn decode(s: str) -> List[byte] ! {parse} — s decoded from hexadecimal; parse when the length is odd or any character is not a hex digit. std.hex.encode_str pub fn encode_str(s: str) -> str — The UTF-8 bytes of s, hex-encoded — lowercase, two digits per byte, no separators, no 0x prefix. std.hex.decode_str pub fn decode_str(s: str) -> str ! {parse, utf8} — s decoded from hexadecimal and read back as text — encode_str's inverse, and the round trip §11 requires of every encoder here. std.io [core] std.io.is_terminal pub fn is_terminal(f: fs.File) -> bool ! {io} — Whether f names a terminal — the question an interactive program asks before it prompts: a shell reads with a prompt only when its input is one. std.io.write pub fn write(text: str) — Write text to standard output exactly as given — no newline, no reformatting. std.io.write_line pub fn write_line(text: str) — Write text to standard output followed by a newline. std.io.write_err pub fn write_err(text: str) — Write text to standard error exactly as given — no newline. std.io.write_err_line pub fn write_err_line(text: str) — Write text to standard error followed by a newline. std.io.input_line pub fn input_line() -> str ! {eof, io, utf8} — The next line of standard input, without its terminator. std.io.prompt pub fn prompt(text: str) -> str ! {eof, io, utf8} — Write text to standard output with no newline, then read one line of standard input. std.io.input_all pub fn input_all() -> str ! {io, utf8} — Every remaining line of standard input, joined with "\n". std.iter [x] std.iter.RangeIter pub struct RangeIter { cur: int, stop: int, } — A half-open integer range [cur, stop) stepped by next. std.iter.range_iter pub fn range_iter(start: int, stop: int) -> RangeIter — A fresh iterator over start..stop (half-open; empty when start >= stop). std.iter.range_next pub fn range_next(mut it: RangeIter) -> int ! {done} — The next element of the range, advancing the iterator; done when exhausted — the row is the end signal, consumed by else. std.iter.ListCursor pub struct ListCursor { xs: List[int], i: int, } — A cursor over an owned List[int], consumed at construction. std.iter.list_cursor pub fn list_cursor(take xs: List[int]) -> ListCursor — A fresh cursor over xs, which the cursor consumes (take — the caller is done with the list; X1 true consumption). std.iter.list_next pub fn list_next(mut c: ListCursor) -> int ! {done} — The next element of the list, advancing the cursor; done when exhausted — the row is the end signal, consumed by else. std.json [core] std.json.Value pub enum Value { Null, Bool(bool), Int(int), Num(f64), Str(str), Arr(List[Value]), Obj(Map[str, Value]), } — A JSON value. std.json.depth_limit pub fn depth_limit() -> int — The nesting depth this module reads and renders before raising deep — one number for parse, stringify and stringify_pretty, so a value that came in can always go back out. std.json.null pub fn null() -> Value — The JSON null. std.json.from_bool pub fn from_bool(b: bool) -> Value — A JSON boolean. std.json.from_int pub fn from_int(n: int) -> Value — A JSON number that is an integer, kept exact — the posture the module header describes. std.json.from_num pub fn from_num(x: f64) -> Value — A JSON number that is not (or need not be) an integer. std.json.from_str pub fn from_str(s: str) -> Value — A JSON string. std.json.from_list pub fn from_list(xs: List[Value]) -> Value — A JSON array over an already-built list of values. std.json.from_map pub fn from_map(m: Map[str, Value]) -> Value — A JSON object over an already-built map. std.json.type_name pub fn type_name(v: Value) -> str — The variant's name — "null", "bool", "int", "num", "str", "arr" or "obj". std.json.is_null pub fn is_null(v: Value) -> bool — Whether v is the JSON null. std.json.as_bool pub fn as_bool(v: Value) -> bool ! {kind} — The boolean v holds; kind when it holds something else. std.json.as_int pub fn as_int(v: Value) -> int ! {kind} — The integer v holds; kind for every other variant, Num included. std.json.as_float pub fn as_float(v: Value) -> f64 ! {kind} — The number v holds as f64; kind for every non-numeric variant. std.json.as_str pub fn as_str(v: Value) -> str ! {kind} — The string v holds, unescaped (the model stores text, not JSON source); kind otherwise. std.json.as_arr pub fn as_arr(v: Value) -> List[Value] ! {kind} — The array v holds; kind otherwise. std.json.as_obj pub fn as_obj(v: Value) -> Map[str, Value] ! {kind} — The object v holds; kind otherwise. std.json.has pub fn has(v: Value, key: str) -> bool — Whether v is an object with an entry at key. std.json.get pub fn get(v: Value, key: str) -> Value ! {kind, none} — The value at key; none when the object has no entry there, kind when v is not an object at all. std.json.at pub fn at(v: Value, i: int) -> Value ! {kind, none} — The element at i; none when i is outside the array, kind when v is not an array. std.json.keys pub fn keys(v: Value) -> List[str] ! {kind} — The keys of an object, in the map's unspecified order; kind for every other variant. std.json.len pub fn len(v: Value) -> int ! {kind} — The number of elements in an array or entries in an object; kind for every scalar. std.json.parse pub fn parse(s: str) -> Value ! {syntax, deep, overflow} — s parsed as one JSON document — the direction this module could not go for eight sprints. std.json.escape pub fn escape(s: str) -> str — s with the characters JSON forbids inside a string replaced by their escapes: " and \ by their backslash forms, and every control character below U+0020 by \b, \f, \n, \r, \t or \u00XX. std.json.unescape pub fn unescape(s: str) -> str ! {syntax} — s with JSON's escapes resolved — escape's inverse, and the function parse reads every string payload through. std.json.stringify pub fn stringify(v: Value) -> str ! {deep} — v rendered as compact JSON text — no spaces, no newlines, keys in the map's unspecified order. std.json.stringify_pretty pub fn stringify_pretty(v: Value, indent: int) -> str ! {deep} — v rendered as JSON text with indent spaces per nesting level and one entry per line — the human-readable form. std.list [core] std.list.push pub fn push[T](mut xs: List[T], v: T) — Appends v to the end of xs, growing it. std.list.pop pub fn pop[T](mut xs: List[T]) -> T ! {none} — Removes and returns the last element; none when xs is empty — the absence row, consumed by else or ?. std.list.len pub fn len[T](xs: List[T]) -> int — The number of elements in xs. std.list.is_empty pub fn is_empty[T](xs: List[T]) -> bool — Whether xs holds no elements — len(xs) == 0, spelled as the predicate callers reach for (§1). std.list.get pub fn get[T](xs: List[T], i: int) -> T ! {none} — The element at i, checked: none when i is negative or at least len(xs) — the one checked-access spelling (§1: no get_ prefix, no sentinel). std.list.set pub fn set[T](mut xs: List[T], i: int, v: T) — Replaces the element at i with v, in place. std.list.first pub fn first[T](xs: List[T]) -> T ! {none} — The first element; none when xs is empty. std.list.last pub fn last[T](xs: List[T]) -> T ! {none} — The last element; none when xs is empty. std.list.insert pub fn insert[T](mut xs: List[T], i: int, v: T) — Inserts v at i, shifting the elements from i onward one place to the right; i == len(xs) appends. std.list.remove pub fn remove[T](mut xs: List[T], i: int) -> T — Removes the element at i, shifting the rest left, and returns it. std.list.swap_remove pub fn swap_remove[T](mut xs: List[T], i: int) -> T — Removes the element at i by moving the LAST element into its slot, and returns the removed element. std.list.swap pub fn swap[T](mut xs: List[T], i: int, j: int) — Exchanges the elements at i and j, in place; i == j is a no-op. std.list.clear pub fn clear[T](mut xs: List[T]) — Empties xs, keeping it usable. std.list.truncate pub fn truncate[T](mut xs: List[T], n: int) — Shortens xs to at most n elements, dropping the tail; a n at or above len(xs) leaves it alone and a negative n empties it. std.list.reverse pub fn reverse[T](mut xs: List[T]) — Reverses xs in place. std.list.extend pub fn extend[T](mut xs: List[T], other: List[T]) — Appends every element of other to xs, in order. std.list.concat pub fn concat[T](a: List[T], b: List[T]) -> List[T] — A new list holding a's elements followed by b's; both operands are read, not consumed (to_-style allocation, §1). std.list.fill pub fn fill[T](mut xs: List[T], v: T) — Overwrites every element of xs with v, keeping its length. std.list.repeat pub fn repeat[T](xs: List[T], n: int) -> List[T] — A new list with xs's elements repeated n times; n <= 0 yields an empty list. std.list.any pub fn any[T](xs: List[T], pred: fn(T) -> bool) -> bool — Does pred hold for ANY element? std.list.all pub fn all[T](xs: List[T], pred: fn(T) -> bool) -> bool — Does pred hold for EVERY element? std.list.count_where pub fn count_where[T](xs: List[T], pred: fn(T) -> bool) -> int — How many elements satisfy pred. std.list.index_where pub fn index_where[T](xs: List[T], pred: fn(T) -> bool) -> int ! {none} — The index of the FIRST element satisfying pred; none when none does. std.list.find_where pub fn find_where[T](xs: List[T], pred: fn(T) -> bool) -> T ! {none} — The first element satisfying pred; none when none does. std.list.min_by pub fn min_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none} — The BEST element under better, where better(a, b) reads "a is better than b": the first element such that no later one beats it. std.list.max_by pub fn max_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none} — min_by under the flipped relation, named for the call sites that read better with it. std.list.is_sorted_by pub fn is_sorted_by[T](xs: List[T], le: fn(T, T) -> bool) -> bool — Is xs sorted under le, where le(a, b) reads "a may precede b"? std.list.map pub fn map[T, U](xs: List[T], f: fn(T) -> U) -> List[U] — A new list holding f(x) for every x in xs, in order; xs is read, not consumed. std.list.filter pub fn filter[T](xs: List[T], keep: fn(T) -> bool) -> List[T] — A new list holding the elements of xs for which keep holds, in their original order; xs is read, not consumed. std.list.fold pub fn fold[T, A](xs: List[T], init: A, step: fn(A, T) -> A) -> A — Combines every element of xs into one value, left to right: f(… f(f(init, x0), x1) …, xn). std.list.sum pub fn sum(xs: List[int]) -> int — The sum of xs; 0 for the empty list. std.list.enumerate pub fn enumerate[T](xs: List[T]) -> List[(int, T)] — A new list pairing each element of xs with its index, in order: (0, x0), (1, x1), …. std.list.zip pub fn zip[T, U](xs: List[T], ys: List[U]) -> List[(T, U)] — A new list pairing the elements of xs and ys position by position: (x0, y0), (x1, y1), …, as long as the SHORTER of the two, so the longer list's tail is dropped rather than trapped on. std.list.sort_by pub fn sort_by[T](mut xs: List[T], less: fn(T, T) -> bool) — Sorts xs in place, stably, under less, where less(a, b) reads "a goes before b". std.list.sorted_by pub fn sorted_by[T](xs: List[T], less: fn(T, T) -> bool) -> List[T] — sort_by's returning twin: a fresh list holding xs's elements in less's order, stably, with xs untouched. std.list.sorted pub fn sorted[T: cmp.Ord](xs: List[T]) -> List[T] — A fresh list holding xs's elements in T's own ascending order, stably, with xs untouched. std.map [core] std.map.len pub fn len[K, V](m: Map[K, V]) -> int — The number of key-value entries. std.map.is_empty pub fn is_empty[K, V](m: Map[K, V]) -> bool — Whether the map holds no entries. std.map.set pub fn set[K, V](mut m: Map[K, V], k: K, v: V) — Binds k to v, replacing any previous binding. std.map.keys pub fn keys[K, V](m: Map[K, V]) -> List[K] — Every key, in the map's unspecified-but-consistent iteration order. std.map.values pub fn values[K, V](m: Map[K, V]) -> List[V] — Every value, in the same order keys reports. std.map.pairs pub fn pairs[K, V](m: Map[K, V]) -> List[(K, V)] — Every entry as a (key, value) pair, in the map's iteration order — the shape for (k, v) in map.pairs(m) destructures. std.map.clear pub fn clear[K, V](mut m: Map[K, V]) — Empties the map, keeping it usable. std.map.extend pub fn extend[K, V](mut m: Map[K, V], other: Map[K, V]) — Copies every entry of other into m. std.map.get pub fn get[K: cmp.Eq, V](m: Map[K, V], k: K) -> V ! {none} — An independent copy of the value bound to k; none when the key is absent — the absence row, never a zero-value sentinel (§2). std.map.get_or pub fn get_or[K: cmp.Eq, V](m: Map[K, V], k: K, d: V) -> V — An independent copy of the value bound to k, or of d when the key is absent — the eager default (a lazy variant waits on closures, c05). std.map.has pub fn has[K: cmp.Eq, V](m: Map[K, V], k: K) -> bool — Whether k is bound. std.map.remove pub fn remove[K: cmp.Eq, V](mut m: Map[K, V], k: K) -> V ! {none} — Removes k's entry and returns the value it was bound to; none when the key was absent. std.map.tally pub fn tally[K: cmp.Eq](mut m: Map[K, int], k: K) -> int — Increments the count k is bound to and returns the new count, treating an absent key as zero — the wordcount idiom as a named operation instead of a defaulting index (tally[w] += 1, see the module header's filed question). std.math [core] std.math.int_max pub fn int_max() -> int — The greatest value of type int (2^63 - 1). std.math.int_min pub fn int_min() -> int — The least value of type int (-2^63). std.math.abs pub fn abs(n: int) -> int — Absolute value. std.math.signum pub fn signum(n: int) -> int — The sign of n: -1, 0 or 1. std.math.pow pub fn pow(b: int, e: int) -> int — b raised to the eth power by binary exponentiation. std.math.isqrt pub fn isqrt(n: int) -> int — The integer square root: the greatest r with r * r <= n. std.math.gcd pub fn gcd(a: int, b: int) -> int — The greatest common divisor of |a| and |b|, by Euclid. std.math.lcm pub fn lcm(a: int, b: int) -> int — The least common multiple of |a| and |b|; 0 when either is 0. std.math.div_floor pub fn div_floor(a: int, b: int) -> int — Division rounding toward negative infinity — the mathematician's quotient, unlike /, which truncates toward zero. std.math.div_ceil pub fn div_ceil(a: int, b: int) -> int — Division rounding toward positive infinity. std.math.rem_euclid pub fn rem_euclid(a: int, b: int) -> int — The Euclidean remainder: always in [0, |b|), unlike %, whose sign follows the dividend. std.math.checked_add pub fn checked_add(a: int, b: int) -> int ! {overflow} — a + b, or the overflow mark when the sum leaves int. std.math.checked_sub pub fn checked_sub(a: int, b: int) -> int ! {overflow} — a - b, or the overflow mark when the difference leaves int. std.math.checked_mul pub fn checked_mul(a: int, b: int) -> int ! {overflow} — a * b, or the overflow mark when the product leaves int. std.math.checked_div pub fn checked_div(a: int, b: int) -> int ! {div_zero} — a / b truncating toward zero, or the div_zero mark when b is 0. std.math.saturating_add pub fn saturating_add(a: int, b: int) -> int — a + b, clamped to [int_min(), int_max()] instead of trapping. std.math.saturating_sub pub fn saturating_sub(a: int, b: int) -> int — a - b, clamped to [int_min(), int_max()] instead of trapping. std.math.midpoint pub fn midpoint(a: int, b: int) -> int — The midpoint of a and b, rounded toward negative infinity, with no intermediate that can leave int — (a + b) / 2 overflows for large same-sign pairs and this does not. std.math.float [core] std.math.float.pi pub fn pi() -> f64 — π, the ratio of a circle's circumference to its diameter, rounded to the nearest f64. std.math.float.tau pub fn tau() -> f64 — τ = 2π. std.math.float.e pub fn e() -> f64 — Euler's number, the base of the natural logarithm. std.math.float.inf pub fn inf() -> f64 — Positive infinity. std.math.float.neg_inf pub fn neg_inf() -> f64 — Negative infinity. std.math.float.nan pub fn nan() -> f64 — A quiet NaN. std.math.float.epsilon pub fn epsilon() -> f64 — The difference between 1.0 and the next representable f64 (2^-52). std.math.float.f_min pub fn f_min() -> f64 — The least finite f64 — the most negative one, not the smallest positive one (that is f_min_positive, a nursery candidate this module names and does not ship). std.math.float.f_max pub fn f_max() -> f64 — The greatest finite f64. std.math.float.is_nan pub fn is_nan(x: f64) -> bool — True exactly for NaN. std.math.float.is_inf pub fn is_inf(x: f64) -> bool — True for either infinity. std.math.float.is_finite pub fn is_finite(x: f64) -> bool — True for everything that is neither NaN nor an infinity. std.math.float.is_sign_negative pub fn is_sign_negative(x: f64) -> bool — True when x carries a negative sign bit — which includes -0.0, the value x < 0.0 cannot see. std.math.float.abs pub fn abs(x: f64) -> f64 — Magnitude. std.math.float.signum pub fn signum(x: f64) -> f64 — The sign of x as a float: 1.0, -1.0, the zero itself for ±0.0 (sign preserved), and NaN for NaN. std.math.float.copysign pub fn copysign(x: f64, y: f64) -> f64 — x with the sign of y. std.math.float.trunc pub fn trunc(x: f64) -> f64 — Truncation toward zero: the integral part, with the sign of x (trunc(-0.5) is -0.0). std.math.float.floor pub fn floor(x: f64) -> f64 — The greatest integer at or below x. std.math.float.ceil pub fn ceil(x: f64) -> f64 — The least integer at or above x. std.math.float.round pub fn round(x: f64) -> f64 — Rounds to the nearest integer, halves away from zero — the schoolbook rule, not the banker's rounding IEEE arithmetic itself uses. std.math.float.fract pub fn fract(x: f64) -> f64 — The fractional part: x - trunc(x), carrying the sign of x. std.math.float.sqrt pub fn sqrt(x: f64) -> f64 — The positive square root. std.math.float.cbrt pub fn cbrt(x: f64) -> f64 — The real cube root, defined for negative arguments too (unlike powf(x, 1.0 / 3.0)). std.math.float.hypot pub fn hypot(a: f64, b: f64) -> f64 — sqrt(a*a + b*b) computed without the intermediate overflow the literal formula suffers. std.math.float.exp pub fn exp(x: f64) -> f64 — e raised to the power x. std.math.float.exp2 pub fn exp2(x: f64) -> f64 — 2.0 raised to the power x, exact at every integral x in range. std.math.float.ln pub fn ln(x: f64) -> f64 — The natural logarithm. std.math.float.log2 pub fn log2(x: f64) -> f64 — The base-2 logarithm, exact at every power of two. std.math.float.log10 pub fn log10(x: f64) -> f64 — The base-10 logarithm. std.math.float.sin pub fn sin(x: f64) -> f64 — The sine of x in radians. std.math.float.cos pub fn cos(x: f64) -> f64 — The cosine of x in radians. std.math.float.tan pub fn tan(x: f64) -> f64 — The tangent of x in radians, as sin(x) / cos(x) over one shared reduction. std.math.float.atan pub fn atan(x: f64) -> f64 — The arctangent, in [-pi/2, pi/2]. std.math.float.asin pub fn asin(x: f64) -> f64 — The arcsine, in [-pi/2, pi/2]. std.math.float.acos pub fn acos(x: f64) -> f64 — The arccosine, in [0, pi]. std.math.float.atan2 pub fn atan2(y: f64, x: f64) -> f64 — The angle of the point (x, y) from the positive x-axis, in (-pi, pi], with the quadrant taken from both signs. std.math.float.powf pub fn powf(b: f64, e: f64) -> f64 — b raised to the real power e, as exp(e * ln b) with the sign and the special cases handled first. std.math.float.to_bits pub fn to_bits(x: f64) -> int — The IEEE-754 binary64 encoding of x, read as a signed int: the sign bit lands in the sign of the result, so a negative float has a negative encoding and from_bits inverts it exactly. std.math.float.from_bits pub fn from_bits(b: int) -> f64 — The f64 whose IEEE-754 binary64 encoding, read as a signed int, is b — the inverse of to_bits on every finite value and on the infinities. std.mem [namespace] std.mem.budget [core] std.mem.budget.charged pub fn charged(r: region) -> int — The bytes charged to r's ledger — [mem.region.account.1]'s cumulative count, named. std.mem.budget.live pub fn live() -> int — The process-wide total the implementation holds for LIVE first-class and sugar regions — [mem.region.account.2], named. std.mem.budget.with_cap pub fn with_cap(n: int, f: fn()) -> () ! {exhausted} — Runs f under a region capped at n LEDGER UNITS, inside a proc, so that a breach comes back as the row exhausted instead of ending the process. std.net [core] std.net.Listener pub struct Listener { fd: int, } — A bound listener: the host socket this process accepts connections on. std.net.Socket pub struct Socket { fd: int, } — A connected socket: one end of an established stream, whichever side opened it and whichever address family carried it. std.net.listen pub fn listen(addr: str) -> Listener ! {io} — Bind a listening socket to addr and return it. std.net.port pub fn port(l: Listener) -> int ! {io} — The port l is bound to. std.net.accept pub fn accept(mut l: Listener) -> Socket ! {timeout, io} — Take the next connection from l's backlog, waiting until one arrives. std.net.connect pub fn connect(addr: str) -> Socket ! {refused, timeout, io} — Dial addr and return the connected socket. std.net.read pub fn read(mut s: Socket, max: int) -> str ! {closed, timeout, utf8, io} — Read up to max bytes from s, decoded as UTF-8, waiting for at least one byte. std.net.write pub fn write(mut s: Socket, text: str) -> () ! {closed, io} — Write all of text to s. std.net.read_bytes pub fn read_bytes(mut s: Socket, max: int) -> List[byte] ! {closed, timeout, io} — Read up to max BYTES from s as a List[byte] — the binary read. std.net.write_bytes pub fn write_bytes(mut s: Socket, b: List[byte]) -> () ! {closed, invalid, io} — Write all of b — raw bytes — to s. std.net.write_some pub fn write_some(mut s: Socket, b: List[byte]) -> int ! {busy, closed, invalid, io} — Send a prefix of b in one non-parking send, returning its byte count: at least 1 for non-empty b, 0 for empty b (the handle is still checked). std.net.set_deadline pub fn set_deadline(mut s: Socket, ms: int) -> () ! {io} — Arm (ms > 0) or clear (ms <= 0) a deadline BUDGET on s: every subsequent parking operation on this socket — read, read_bytes, write — resolves as its row's timeout tag when the budget fires first. std.net.set_listener_deadline pub fn set_listener_deadline(mut l: Listener, ms: int) -> () ! {io} — Arm (ms > 0) or clear (ms <= 0) a deadline budget on the LISTENER l: an accept whose peer never dials resolves timeout instead of blocking forever. std.net.close pub fn close(take s: Socket) -> () ! {io} — Close s, consuming it. std.net.close_listener pub fn close_listener(take l: Listener) -> () ! {io} — Close the listener l, consuming it. std.net.read_all pub fn read_all(mut s: Socket) -> str ! {timeout, utf8, io} — Every byte the peer sends until it closes, decoded as UTF-8, as one str. std.net.write_line pub fn write_line(mut s: Socket, text: str) -> () ! {closed, io} — Write text to s followed by exactly one "\n". std.net.read_lines pub fn read_lines(mut s: Socket) -> List[str] ! {timeout, utf8, io} — Every line the peer sends until it closes, terminators stripped. std.net.endpoint pub fn endpoint(host: str, port_number: int) -> str — host and port_number joined as the address string listen and connect take. std.net.loopback pub fn loopback(port_number: int) -> str — The loopback address with port_number — endpoint("127.0.0.1", n). std.net.Addr pub struct Addr { version: int, text: str, } — One address of a host: its IP version and its text — the element resolve will answer, and the part of a resolver std can fix before the call that makes one exists. std.net.ListenOpts pub struct ListenOpts { reuse_port: bool, backlog: int, } — The options listen_with takes: what a prefork server needs and nothing else. std.net.listen_opts pub fn listen_opts() -> ListenOpts — The options that make listen_with behave exactly like listen. std.net.listen_with pub fn listen_with(addr: str, opts: ListenOpts) -> Listener ! {unsupported, exists, denied, io} — Bind a listening socket to addr with opts and return it. std.net.adopt_listener pub fn adopt_listener(fd: int) -> Listener ! {unsupported, io} — Adopt a listening socket this process was HANDED rather than bound. std.net.wait pub fn wait(fds: List[int], deadline_ms: int) -> List[int] ! {io} — Which of fds can be read WITHOUT blocking, as a subset in the caller's order. std.net.writev pub fn writev(mut s: Socket, parts: List[List[byte]]) -> () ! {closed, io} — Write every part of parts to s, in order, as ONE write. std.net.nodelay pub fn nodelay(mut s: Socket, on: bool) -> () ! {io} — Set Nagle's algorithm off (on = true) or on (on = false) for s. std.net.unix [core] std.net.unix.listen pub fn listen(path: str) -> net.Listener ! {unsupported, exists, not_found, denied, io} — Bind a listening socket to the filesystem path path and return it. std.net.unix.connect pub fn connect(path: str) -> net.Socket ! {unsupported, refused, not_found, denied, io} — Dial the unix-domain socket at path and return the connected socket. std.net.unix.Credentials pub struct Credentials { pid: int, uid: int, gid: int, } — The peer's process id, effective user id and effective group id, as recorded when the Unix stream connected. std.net.unix.peer_credentials pub fn peer_credentials(s: net.Socket) -> Credentials ! {io, unsupported} — The credentials at the other end of connected s, accepted or dialed. std.ops [core] std.ops.Num pub trait Num = Add + Sub + Mul + Div + Rem + cmp.Eq + cmp.Ord — The composed bound, [type.trait.op.alias]'s own example and the one the book's chapter 5 writes: fn totalT: ops.Num -> T. std.ops.Add pub trait Add { fn add(self, other: Self) -> Self } — Addition, a + b. std.ops.Sub pub trait Sub { fn sub(self, other: Self) -> Self } — Subtraction, a - b. std.ops.Mul pub trait Mul { fn mul(self, other: Self) -> Self } — Multiplication, a * b. std.ops.Div pub trait Div { fn div(self, other: Self) -> Self } — Division, a / b. std.ops.Rem pub trait Rem { fn rem(self, other: Self) -> Self } — Remainder, a % b. std.ops.Neg pub trait Neg { fn neg(self) -> Self } — Arithmetic negation, unary -a. std.option [core] std.option.or pub fn or[T](v: T ! {none}, default: T) -> T — v's value, or default when v is absent. std.option.to_list pub fn to_list[T](v: T ! {none}) -> List[T] — v as a list: one element when present, empty when absent. std.option.exists pub fn exists[T](v: T ! {none}) -> bool — True when v is present. std.option.is_none pub fn is_none[T](v: T ! {none}) -> bool — True when v is absent — exists's complement, shipped because if option.is_none(v) reads better than if !option.exists(v) at the call sites that ask it that way round. std.os [core] std.os.cpus pub fn cpus() -> int ! {io} — The number of cores this process may actually be scheduled on. std.os.name pub fn name() -> str — s253 ([os.uname], wolf 0.2.35): the OS this program runs on, as the KERNEL answers (uname(2)'s sysname, lowercased) and not what the program was built for: linux, macos (Darwin's), freebsd, pax on PAX, and windows there (which has no uname). std.os.arch pub fn arch() -> str — s253 ([os.uname], wolf 0.2.35): the architecture this program runs on, as the kernel answers (uname(2)'s machine, lowercased), with macOS's and the BSDs' spellings of the two tier-1 architectures as linux's: x86_64 (amd64) and aarch64 (arm64). std.os.random [core] std.os.random.require_ready pub fn require_ready() -> () ! {entropy_unqualified} — Checks that this platform is admitted for the documented OS-source contract. std.os.random.bytes pub fn bytes(n: int) -> List[byte] ! {entropy_unqualified} — Exactly n OS-sourced bytes, or the named platform-admission refusal entropy_unqualified. std.os.users [core] std.os.users.User pub struct User { name: str, uid: int, gid: int, comment: str, home: str, shell: str, } — One user: a line of passwd(5), less its password field. std.os.users.Group pub struct Group { name: str, gid: int, members: List[str], } — One group: a line of group(5), less its password field. std.os.users.parse_user pub fn parse_user(line: str) -> User ! {parse} — One user line, parsed. std.os.users.parse_group pub fn parse_group(line: str) -> Group ! {parse} — One group line, parsed. std.os.users.users pub fn users(text: str) -> List[User] — Every user in text — the text of a passwd(5) file — in the file's order. std.os.users.groups pub fn groups(text: str) -> List[Group] — Every group in text — the text of a group(5) file — in the file's order. std.os.users.user_named pub fn user_named(text: str, name: str) -> User ! {none} — The FIRST user in text named name — what su name looks up. std.os.users.user_by_id pub fn user_by_id(text: str, uid: int) -> User ! {none} — The FIRST user in text whose id is uid — the name ls -l and id print for a number. std.os.users.group_named pub fn group_named(text: str, name: str) -> Group ! {none} — The FIRST group in text named name — what chgrp name looks up. std.os.users.group_by_id pub fn group_by_id(text: str, gid: int) -> Group ! {none} — The FIRST group in text whose id is gid. std.os.users.groups_of pub fn groups_of(text: str, name: str, gid: int) -> List[int] — The groups user name belongs to, by the group file's text: gid — the user's own group, from their User.gid — first, then the id of every group that lists name as a member, in the file's order, each id once. std.poll [core] std.poll.READ pub const READ: int = 1 — Interest and fact: a read or accept would not park, including an end. std.poll.WRITE pub const WRITE: int = 2 — Interest and fact: room for a byte, or a write that would fail at once. std.poll.HANGUP pub const HANGUP: int = 4 — Fact: the other end hung up, accompanied by an applicable interest. std.poll.ERROR pub const ERROR: int = 8 — Fact: a host error, accompanied by the requested interest. std.poll.Waiter pub struct Waiter { set: int, kinds: List[int], handles: List[int], interests: List[int], count: int, } — An owned waiter holding at most 256 entries, named by stable keys. std.poll.Ready pub struct Ready { key: int, facts: int, } — One ready entry: its key and READ/WRITE/HANGUP/ERROR facts. std.poll.Events pub struct Events { meaning: int, ready: List[Ready], } — Every ready entry once, in runtime order (unspecified for a set), and one meaning taken off the queue, or 0. std.poll.open pub fn open() -> Waiter ! {io} — A new empty waiter; acquire its host set lazily at add/wait. std.poll.len pub fn len(w: Waiter) -> int — The number of entries added and not removed. std.poll.close pub fn close(take w: Waiter) -> () ! {io} — Close the set, consuming w, leaving its entry handles open. std.poll.add_file pub fn add_file(mut w: Waiter, f: fs.File, interest: int) -> int ! {invalid, io, unsupported} — Add f with READ, WRITE or both; return the lowest free key, stable until removal. std.poll.add_socket pub fn add_socket(mut w: Waiter, s: net.Socket, interest: int) -> int ! {invalid, io, unsupported} — Add a TCP or Unix stream with READ, WRITE or both. std.poll.add_listener pub fn add_listener(mut w: Waiter, l: net.Listener) -> int ! {invalid, io, unsupported} — Add l with READ (a pending connection). std.poll.modify pub fn modify(mut w: Waiter, key: int, interest: int) -> () ! {invalid, io} — Change key's interest to READ, WRITE or both. std.poll.remove pub fn remove(mut w: Waiter, key: int) -> () ! {invalid, io} — Remove key before closing its handle; the key becomes free. std.poll.wait pub fn wait(mut w: Waiter, meanings: int, deadline_ms: int) -> Events ! {invalid, io, unsupported} — Wait for every ready entry and one signal meaning, together. std.pool [core] std.pool.alloc pub fn alloc[T](mut p: Pool[T], v: T) -> handle T — Reserves a slot, initializes it with v, and hands back its handle — the two-phase protocol collapsed into the one-step form callers usually want. std.pool.free pub fn free[T](mut p: Pool[T], h: handle T) — Releases h's slot. std.prelude [core] std.prelude.least pub fn least(a: int, b: int) -> int — Least of two ints; returns b when they are equal. std.prelude.greatest pub fn greatest(a: int, b: int) -> int — Greatest of two ints; returns b when they are equal. std.prelude.magnitude pub fn magnitude(n: int) -> int — Magnitude of n. std.process [core] std.process.Command pub struct Command { argv: List[str], fds: List[int], } — A program and its arguments, as the argument VECTOR the host receives. std.process.Child pub struct Child { slot: int, } — A started child process: this machine's handle on it. std.process.command pub fn command(program: str) -> Command — A Command that runs program with no arguments. std.process.from_argv pub fn from_argv(argv: List[str]) -> Command — A Command from a whole argument vector: element 0 is the program, the rest are its arguments. std.process.push_arg pub fn push_arg(mut c: Command, value: str) — Append one argument to c. std.process.argv pub fn argv(c: Command) -> List[str] — c's argument vector: the program first, then its arguments. std.process.Pipe pub struct Pipe { read: fs.File, write: fs.File, } — The two ends of a pipe: what is written to write is read from read, in order, and read answers eof once every copy of write is closed — this program's and every child's. std.process.pipe pub fn pipe() -> Pipe ! {io} — A new pipe. std.process.set_fd pub fn set_fd(mut c: Command, child: int, f: fs.File) — The child gets f as descriptor child — a shell's Nfile or N>&M, spelled as data: child is the number the CHILD sees, and f is a file this program holds (fs.open's, a pipe end, or fs.stdin()/fs.stdout()/fs.stderr() for this program's own streams). std.process.set_stdin pub fn set_stdin(mut c: Command, f: fs.File) — The child's standard input is f — set_fd(mut c, 0, f). std.process.set_stdout pub fn set_stdout(mut c: Command, f: fs.File) — The child's standard output is f — set_fd(mut c, 1, f). std.process.set_stderr pub fn set_stderr(mut c: Command, f: fs.File) — The child's standard error is f — set_fd(mut c, 2, f). std.process.close_fd pub fn close_fd(mut c: Command, child: int) — Descriptor child is CLOSED in the child — a shell's N<&-. std.process.start pub fn start(c: Command) -> Child ! {unsupported, invalid, not_found, denied, io} — Start c and return the handle of the child, WITHOUT waiting for it. std.process.start_with pub fn start_with(c: Command, inherit: List[net.Listener]) -> Child ! { unsupported, not_found, denied, io, } — Start c with inherit handed down to the child, and answer the child's handle WITHOUT waiting for it — the PARENT half of descriptor inheritance, whose child half is std.net.adopt_listener. std.process.start_job pub fn start_job(c: Command, group: int, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, } — s219 ([os.proc.job]): start c as a job. group -1 leaves the child in this process's group, 0 makes it the leader of a new group (whose id is pid(child)), a positive id joins that group — a pipeline's later stages join the first's. std.process.start_foreground pub fn start_foreground(c: Command, group: int, tty: fs.File, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, } — start_job, and the job's group takes the terminal tty as its foreground before the program runs (no race: the child does it before exec, the parent again after). std.process.start_session pub fn start_session(c: Command, defaults: int) -> Child ! { unsupported, invalid, not_found, denied, io, } — s290 ([os.proc.session], sc81): start c as the leader of a new session, WITHOUT waiting for it. std.process.pid pub fn pid(ch: Child) -> int ! {io} — The child's operating-system process id (io once it is reaped). std.process.wait_status pub fn wait_status(take ch: Child) -> int ! {io} — s219 ([os.proc.status]): wait, and say how it ended. The exit code (0..255), or -N for a child ended by signal N — the number a shell reports as 128 + N (killed_by reads it). std.process.killed_by pub fn killed_by(status: int) -> int — The signal number a wait_status names, or 0 for an exit. std.process.Status pub struct Status { value: int, } — How a child ended or stopped, as one of three kinds that never meet ([os.proc.poll], [os.proc.status]): an EXIT with its code (0..255), an END BY SIGNAL N (the builtins' -N), or a STOP by signal N (the builtins' 256 + N). std.process.status_from pub fn status_from(value: int) -> Status — The Status a status number reads as: wait_status's answer, or the second half of os_wait_poll's. std.process.is_exited pub fn is_exited(s: Status) -> bool — Whether s is an exit (0..255). std.process.is_signalled pub fn is_signalled(s: Status) -> bool — Whether s is an end by a signal (-N). std.process.is_stopped pub fn is_stopped(s: Status) -> bool — Whether s is a stop (256 + N): the child is alive and waits to be continued. std.process.exit_code pub fn exit_code(s: Status) -> int ! {none} — The exit code of an exit; none for an end by signal, a stop, or a value of no kind. std.process.signal_of pub fn signal_of(s: Status) -> int ! {none} — The host signal number that ENDED the child; none for an exit, a stop, or a value of no kind. std.process.stopped_by pub fn stopped_by(s: Status) -> int ! {none} — The host signal number that STOPPED the child; none for an exit, an end, or a value of no kind. std.process.shell_code pub fn shell_code(s: Status) -> int — What a POSIX shell reports for s as $?: the exit code, or 128 + N for an end by signal N and for a stop by N alike (XCU 2.8.2; a stopped job's $? is dash's 128 + N). std.process.Change pub struct Change { changed: bool, child: Child, status: Status, live: int, } — What one poll found. std.process.poll pub fn poll() -> Change ! {io} — Look, without waiting, for a child of this program's that ended or stopped since it was last looked at ([os.proc.poll], ruling #84): the first such child in the order they were started, reaped if it ended. std.process.wait_status_core pub fn wait_status_core(take ch: Child) -> int ! {io} — s246 ([os.proc.status], ruling #88 R3 = D): wait, and say how it ended, a core included. wait_status's answer — the exit code (0..255), or -N for an end by signal N — except that a child that dumped core (the host's WCOREDUMP) answers -(256 + N), below every end without one. std.process.status_from_core pub fn status_from_core(value: int) -> Status — The Status a core sibling's answer reads as (wait_status_core, poll_core): -(256 + N), an end by signal N that dumped core, is the end by N (-N), so is_signalled, signal_of and shell_code answer for it exactly what they answer for the released wait's -N; every other value reads as status_from reads it. std.process.dumped_core pub fn dumped_core(value: int) -> bool — Whether a core sibling's answer says the host wrote a core: -(256 + N) for a signal number N from 1 to 255, the mirror of a stop's 256 + N. std.process.CoreChange pub struct CoreChange { change: Change, core: bool, } — What one poll_core found: the Change that poll would report, its status read by status_from_core (so every released accessor answers as it does for poll), and core, whether the host wrote a core for the end it reports (dumped_core). std.process.poll_core pub fn poll_core() -> CoreChange ! {io} — s246 ([os.proc.poll], ruling #88 R3 = D): poll, a core included. The same look at every child this program started, without waiting, in the order they were started, with an end that dumped core reported as such — what a shell needs to say "(core dumped)" after a job's words. std.process.Group pub struct Group { id: int, } — A process GROUP: the unit a job is, and what std.signal's send_group reaches (ruling #79 R1: the type is std's, over the builtin tier's group ids). std.process.group_of pub fn group_of(leader: Child) -> Group ! {io} — The group leader leads: a child started with start_job (or start_foreground) and group 0 leads a new group whose id is its process id. std.process.own_group pub fn own_group() -> Group ! {unsupported} — This process's own group — kill 0's, which a send to it reaches this process too ([os.signal.send.group]). std.process.lead_group pub fn lead_group() -> () ! {denied, invalid, io, unsupported} — Make THIS process the leader of a new group of its own, whose id is its process id ([os.term.group], setpgid(0, 0)): what an interactive shell does at start, and what GNU timeout does before it runs its command so that a send to its own group reaches everything the command started. std.process.join_group pub fn join_group(g: Group) -> () ! {denied, invalid, io, unsupported} — Move THIS process into group g of its own session ([os.term.group], setpgid(0, g)): what a shell does at exit to go back into the group it was started in. std.process.lead_session pub fn lead_session() -> () ! {denied, io, unsupported} — s290 ([os.term.session], sc81): make THIS process the leader of a new session, and of a new group in it, both ids its process id (own_session(), own_group().id and std.env.pid() agree after), with no controlling terminal. std.process.own_session pub fn own_session() -> int ! {unsupported} — s290 ([os.term.session], sc81): this process's session id (getsid(0)): its own process id when it leads its session, the leader's otherwise. std.process.wait pub fn wait(take ch: Child) -> int ! {signal, io} — Wait for ch to finish and answer its exit code, consuming the handle. std.process.kill pub fn kill(mut ch: Child) -> () ! {io} — Kill ch — end the child immediately, without reaping it. std.process.run pub fn run(c: Command) -> int ! {unsupported, invalid, not_found, denied, signal, io} — Start c, wait for it, and answer its exit code. std.process.is_success pub fn is_success(exit_code: int) -> bool — Whether exit_code means the program succeeded. std.process.exec pub fn exec(c: Command, env: List[str]) -> () ! {unsupported, invalid, not_found, denied, io} — Replace THIS program with the one c names — an exec, not a spawn. std.process.set_ids pub fn set_ids(uid: int, gid: int, groups: List[int]) -> () ! {denied, invalid, unsupported, io} — Make THIS process another user, for good. std.process.exit pub fn exit(code: int) — End THIS process immediately with code. std.process.exit_signal pub fn exit_signal(meaning: int) -> () ! {invalid, unsupported} — s246 ([os.signal.exit], ruling #88 R2): end THIS process by meaning's signal, so that its parent reads the end as the end by that signal (-N: signal_of, $? 128 + N) — what a wrapper whose command died of a signal does to die of the same one (GNU timeout, where exit(139) would only imitate SIGSEGV). std.process.CoreLimit pub struct CoreLimit { soft: int, hard: int, } — This process's core limit ([os.proc.core]): soft, the size in bytes past which a dump is cut (0: no core file), and hard, the ceiling the soft may be raised to; -1 is unlimited in either. std.process.core_limit pub fn core_limit() -> CoreLimit ! {unsupported} — s253 ([os.proc.core], wolf 0.2.35): this process's core limit, getrlimit(RLIMIT_CORE) as a CoreLimit. std.process.set_core_limit pub fn set_core_limit(soft: int, hard: int) -> () ! {denied, invalid, unsupported} — s253 ([os.proc.core], wolf 0.2.35): set this process's core limit, setrlimit(RLIMIT_CORE), for this process and every child it starts after the call. std.process.core_off pub fn core_off() -> () ! {unsupported} — s253 ([os.proc.core], wolf 0.2.35): this process dumps no core, whatever ends it, on every host and every core pattern. std.process.Fork pub struct Fork { pid: int, child: Child, } — What one fork answered, in the process that reads it (s247, [os.proc.fork]). std.process.fork pub fn fork() -> Fork ! {busy, io, unsupported} — s247 ([os.proc.fork], rulings #90 and #95): make a child process that runs on from this call, a copy of this program. std.process.is_child pub fn is_child(f: Fork) -> bool — Whether a fork's answer is the CHILD's (pid 0). std.rand [core] std.rand.Rng pub struct Rng { state: wrapping[u64], inc: wrapping[u64], } — A seeded PCG32 generator. std.rand.new pub fn new(seed: int) -> Rng — A generator seeded with seed. std.rand.next_int pub fn next_int(mut r: Rng) -> int — The next 32 bits of the stream, as an int in [0, 4294967296). std.rand.below pub fn below(mut r: Rng, n: int) -> int — A uniform draw from [0, n), without modulo bias — the high draws that would skew the residue are rejected and redrawn, so the number of draws is data-dependent but the distribution is exact. std.rand.next_float pub fn next_float(mut r: Rng) -> f64 — A uniform draw from [0.0, 1.0) with 52 bits of resolution: the draw fills a mantissa, so every representable multiple of 2^-52 in the interval is equally likely and 1.0 is never returned. std.rand.next_bool pub fn next_bool(mut r: Rng) -> bool — A fair coin, taken from the output word's top bit (the LCG's best bit after the output permutation). std.rand.shuffle pub fn shuffle(mut r: Rng, mut xs: List[int]) — Shuffles xs into a uniformly random permutation (Fisher–Yates, drawing from the front). std.rand.choose pub fn choose(mut r: Rng, xs: List[int]) -> int ! {none} — A uniformly chosen element of xs, or none when xs is empty. std.range [core] std.range.is_empty pub fn is_empty(r: range[int]) -> bool — True when r yields no values — 5..5 and 7..3 are empty, 2..7 is not. std.range.contains pub fn contains(r: range[int], x: int) -> bool — True when x is a value r yields: r.start <= x && x < r.end, the spelling [type.range.accessor] gives. std.range.len pub fn len(r: range[int]) -> int — The number of values r yields: r.end - r.start when r is non-empty, 0 when it is not — len(7..3) is 0 where the raw difference is -4 (module header), and len(a..=b) is b - a + 1 because end normalized to b + 1 at construction. std.range.clamp_to pub fn clamp_to(r: range[int], x: int) -> int ! {none} — The value of r nearest to x: x itself when r contains it, r.start when x lies below, and r.end - 1 — the last value yielded — when x is at or above end. std.range.collect pub fn collect[T](r: range[T]) -> List[T] — A fresh list holding every value r yields, in iteration order: the values a for x in r would see. std.search [core] std.search.binary_search pub fn binary_search(xs: List[int], x: int) -> int ! {none} — The index of some element equal to x, or none when xs holds none. std.search.binary_search_by pub fn binary_search_by(xs: List[int], by: fn(int) -> cmp.Ordering) -> int ! {none} — The index of the one element for which by answers Equal, or none. std.search.lower_bound pub fn lower_bound(xs: List[int], x: int) -> int — The first index at which x could be inserted keeping xs ascending — the index of the first element at or above x, and len(xs) when every element is below it. std.search.upper_bound pub fn upper_bound(xs: List[int], x: int) -> int — The last index at which x could be inserted keeping xs ascending — the index of the first element strictly above x. std.search.equal_range pub fn equal_range(xs: List[int], x: int) -> (int, int) — The half-open index range (first, last) of the elements equal to x — (lower_bound(xs, x), upper_bound(xs, x)). std.search.min_of pub fn min_of(xs: List[int]) -> int ! {none} — The least element of xs, or none when xs is empty. std.search.max_of pub fn max_of(xs: List[int]) -> int ! {none} — The greatest element of xs, or none when xs is empty. std.search.min_index pub fn min_index(xs: List[int]) -> int ! {none} — The index of the least element, or none when xs is empty. std.search.max_index pub fn max_index(xs: List[int]) -> int ! {none} — The index of the greatest element, or none when xs is empty. std.search.sum pub fn sum(xs: List[int]) -> int — The sum of xs; 0 for an empty list. std.search.product pub fn product(xs: List[int]) -> int — The product of xs; 1 for an empty list. std.set [core] std.signal [core] std.signal.reload pub fn reload() -> int — Re-read configuration (SIGHUP). std.signal.terminate pub fn terminate() -> int — Shut down now (SIGTERM). std.signal.quit pub fn quit() -> int — Shut down after draining (SIGQUIT; the terminal's Ctrl-\). std.signal.upgrade pub fn upgrade() -> int — Swap in a new binary (SIGUSR2). std.signal.interrupt pub fn interrupt() -> int — The terminal's interrupt character, Ctrl-C (SIGINT). std.signal.suspend pub fn suspend() -> int — The terminal's suspend character, Ctrl-Z (SIGTSTP). std.signal.bg_read pub fn bg_read() -> int — A background process group read the terminal (SIGTTIN). std.signal.bg_write pub fn bg_write() -> int — A background process group wrote to, or set, the terminal (SIGTTOU). std.signal.child pub fn child() -> int — A child stopped or ended (SIGCHLD). std.signal.user pub fn user() -> int — Another program's own signal (SIGUSR1; upgrade() is SIGUSR2). std.signal.alarm pub fn alarm() -> int — A timer ran out (SIGALRM). std.signal.broken_pipe pub fn broken_pipe() -> int — A write to a pipe or socket nobody reads (SIGPIPE). std.signal.abort pub fn abort() -> int — The process was asked to abort (SIGABRT). std.signal.continued pub fn continued() -> int — The process was continued after a stop (SIGCONT). std.signal.resize pub fn resize() -> int — The terminal's window changed size (SIGWINCH). std.signal.urgent pub fn urgent() -> int — Out-of-band data arrived on a socket (SIGURG). std.signal.virtual_alarm pub fn virtual_alarm() -> int — A user-time timer ran out (SIGVTALRM). std.signal.profile_alarm pub fn profile_alarm() -> int — A profiling timer ran out (SIGPROF). std.signal.cpu_limit pub fn cpu_limit() -> int — The CPU-time limit was passed (SIGXCPU). std.signal.file_limit pub fn file_limit() -> int — The file-size limit was passed (SIGXFSZ). std.signal.kill pub fn kill() -> int — End the process now; it cannot be caught or ignored (SIGKILL). std.signal.stop pub fn stop() -> int — Stop the process; it cannot be caught or ignored (SIGSTOP). std.signal.segment_fault pub fn segment_fault() -> int — An invalid memory reference (SIGSEGV). std.signal.bus_error pub fn bus_error() -> int — An access to an undefined part of a memory object (SIGBUS). std.signal.arithmetic pub fn arithmetic() -> int — An erroneous arithmetic operation (SIGFPE). std.signal.illegal pub fn illegal() -> int — An illegal instruction (SIGILL). std.signal.breakpoint pub fn breakpoint() -> int — A trace or breakpoint trap (SIGTRAP). std.signal.bad_syscall pub fn bad_syscall() -> int — A bad system call (SIGSYS). std.signal.listen pub fn listen(set: int) -> () ! {io} — Hear every meaning in set as an event (os_signal_listen); ends an ignore of them. std.signal.wait pub fn wait(set: int) -> int ! {io} — Park until a meaning in set arrives; that meaning. std.signal.wait_fd pub fn wait_fd(f: fs.File, set: int) -> int ! {unsupported, io} — Wait until the file f names has something to read or a meaning in set is delivered ([os.signal.wait.fd]): the meaning, taken off the queue as wait takes it, or 0 when f is ready — a byte, the end of input or a hang-up — with nothing read, so the read that follows says which. std.signal.WAIT_WRITE pub const WAIT_WRITE: int = 4611686018427387904 — s254 ([os.signal.wait.write], wolf 0.2.35): bit 62, the mark of a wait_fds element that waits for a WRITE. A file whose fd has it added — fs.File { fd: w.fd + signal.WAIT_WRITE } — asks whether w can take a write now instead of whether it has something to read (poll(2)'s POLLOUT): a pipe with room, a regular file always, and a pipe whose reader has gone (the write then answers its error). std.signal.Wake pub struct Wake { meaning: int, ready: int, } — What ended one wait_fds ([os.signal.wait.fds]): meaning, the meaning taken off the queue (0 when none was), and ready, the index in the list of the LOWEST file with something to read (-1 when none was). std.signal.wait_fds pub fn wait_fds(files: List[fs.File], set: int, deadline_ms: int) -> Wake ! { invalid, io, unsupported, } — s248 ([os.signal.wait.fds], ruling #93 R2 A): one wait over several files, a set of meanings and a deadline — what an editor's loop is: the terminal, its jobs' pipes and its signals, with a timer (the 25 ms that tells a lone ESC from an escape sequence, the 50 ms of a capability probe). std.signal.poll pub fn poll(set: int) -> int ! {io} — The oldest meaning in set that has arrived, taken; 0 when none has. std.signal.ignore pub fn ignore(set: int) -> () ! {unsupported, io} — Every meaning in set does nothing to this process — and to every child it starts ([os.signal.disp]). std.signal.reset pub fn reset(set: int) -> () ! {unsupported, io} — Every meaning in set does what the host does by default. std.signal.ignore_one pub fn ignore_one(meaning: int) -> () ! {invalid, io, unsupported} — s246 ([os.signal.disp.one], ruling #88 R1): ONE meaning does nothing to this process — and to every child it starts — named in the SENDING shape: one meaning of the table, any of the twenty-eight but kill() and stop(), or a host number host(n) (a real-time signal is host(realtime()?.first + k)). std.signal.reset_one pub fn reset_one(meaning: int) -> () ! {invalid, io, unsupported} — s246 ([os.signal.disp.one], ruling #88 R1): ONE meaning does what the host does by default — the undo of ignore_one, in the same sending shape (one meaning of the table but kill() and stop(), or host(n)). std.signal.raise pub fn raise(meaning: int) -> () ! {io} — Send meaning to this process (os_signal_raise). std.signal.send pub fn send(pid: int, meaning: int) -> () ! {unsupported, invalid, not_found, denied, io} — s232 ([os.signal.send]): send meaning's signal to the process pid — kill(2) for one process. std.signal.send_group pub fn send_group(g: process.Group, meaning: int) -> () ! { unsupported, invalid, not_found, denied, io, } — s241 ([os.signal.send.group], ruling #79 R1): send meaning's signal to every member of the process group g that this process may signal — kill(-pgid), what kill %1, fg, bg and kill -- -N do to a job. std.signal.send_all pub fn send_all(meaning: int) -> () ! {unsupported, invalid, not_found, denied, io} — s241 ([os.signal.send.all], ruling #79 R1): send meaning's signal to every process this one may signal, itself excepted — kill(-1), XCU kill -1. std.signal.number pub fn number(meaning: int) -> int ! {invalid, unsupported} — s232 ([os.signal.number]): the number THIS host gives meaning — what kill -l prints, what trap … 13 names and what a shell's 128 + N decodes. std.signal.last pub fn last() -> int ! {unsupported} — s241 ([os.signal.host], ruling #79 R4): this host's last signal number — the C library's SIGRTMAX on linux (64 under glibc and musl), 31 on macOS. std.signal.Realtime pub struct Realtime { first: int, last: int, } — The C library's real-time signal range ([os.signal.host]): host numbers first to last, both included, or first and last both 0 on a host that has none (macOS). std.signal.realtime pub fn realtime() -> Realtime ! {unsupported} — s241 ([os.signal.host]): the real-time range, as Realtime. std.signal.text pub fn text(meaning: int) -> str ! {invalid, unsupported} — s241 ([os.signal.text], ruling #79 R5): the host C library's words for meaning's signal, or for host signal N given host(N) — strsignal(3), what GNU kill -t prints and what a shell says of a job a signal ended. std.signal.host pub fn host(n: int) -> int — The meaning value that names host signal n ([os.signal.host], ruling #79 R4): -n, os_wait_status's spelling of "ended by signal n", so a program re-sends what it saw. std.signal.ignored pub fn ignored() -> int ! {unsupported} — s232 ([os.signal.ignored]): the set of listenable meanings this process ignores NOW. It changes nothing. std.sort [core] std.sort.sort pub fn sort[T: cmp.Ord](mut xs: List[T]) — Sorts xs ascending in place, stably. std.sort.sort_by pub fn sort_by[T](mut xs: List[T], by: fn(T, T) -> cmp.Ordering) — Sorts xs ascending in place, stably, ordering by by rather than by Ord. std.sort.sorted_by pub fn sorted_by[T](xs: List[T], by: fn(T, T) -> cmp.Ordering) -> List[T] — sort_by's returning twin: a fresh list holding xs's elements in by's order, with xs untouched. std.sort.sort_ints pub fn sort_ints(mut xs: List[int]) — Sorts a list of int ascending, in place, stably. std.sort.sort_floats pub fn sort_floats(mut xs: List[f64]) — Sorts a list of f64 ascending, in place, stably, under IEEE totalOrder (see total_lt): every NaN lands at the end and -0.0 sorts strictly below +0.0. std.sort.sort_strs pub fn sort_strs(mut xs: List[str]) — Sorts a list of str ascending, in place, stably, in the language's byte-lexicographic order ([mem.str.order]): unsigned byte compare, shorter first on a shared prefix, so every multi-byte code point sorts above every ASCII one. std.sort.sorted_ints pub fn sorted_ints(xs: List[int]) -> List[int] — sort_ints's returning twin: a fresh ascending list, xs untouched. std.sort.sorted_floats pub fn sorted_floats(xs: List[f64]) -> List[f64] — sort_floats's returning twin, under the same IEEE totalOrder. std.sort.sorted_strs pub fn sorted_strs(xs: List[str]) -> List[str] — sort_strs's returning twin, in the language's byte-lexicographic order ([mem.str.order]). std.sort.is_sorted pub fn is_sorted(xs: List[int]) -> bool — True when xs is in ascending order (ties allowed). std.sort.is_sorted_by pub fn is_sorted_by(xs: List[int], by: fn(int, int) -> cmp.Ordering) -> bool — True when xs is in ascending order under by (ties allowed). std.str [core] std.str.len pub fn len(s: str) -> int — The length of s in BYTES, O(1) — the honest unit (D25). std.str.is_empty pub fn is_empty(s: str) -> bool — Whether s holds no bytes. std.str.get pub fn get(s: str, from: int, to: int) -> str ! {none} — The bytes in [from, to) — the RECOVERABLE slice, and the primitive the rest of this module is written over ([mem.str.get], D25's anti-landmine form). std.str.bytes pub fn bytes(s: str) -> List[byte] — The raw bytes of s, in order, as the 0..255 element values §11's interim byte currency uses — std.bytes is the module that operates on them and bytes.from_str is the same view from that side. std.str.contains pub fn contains(s: str, needle: str) -> bool — Whether needle occurs anywhere in s, as a byte sequence. std.str.find pub fn find(s: str, needle: str) -> int ! {none} — The byte offset of the FIRST occurrence of needle in s; none when it does not occur. std.str.rfind pub fn rfind(s: str, needle: str) -> int ! {none} — The byte offset of the LAST occurrence of needle in s; none when it does not occur. std.str.find_all pub fn find_all(s: str, needle: str) -> List[int] — The byte offsets of every NON-OVERLAPPING occurrence of needle, left to right — the find-all family's one member, and the plural of find rather than a new vocabulary. std.str.count pub fn count(s: str, needle: str) -> int — The number of NON-OVERLAPPING occurrences of needle in s, scanning left to right — "aaa" contains one "aa", not two. std.str.starts_with pub fn starts_with(s: str, prefix: str) -> bool — Whether s begins with prefix. std.str.ends_with pub fn ends_with(s: str, suffix: str) -> bool — Whether s ends with suffix. std.str.starts_with_any pub fn starts_with_any(s: str, prefixes: List[str]) -> bool — Whether s begins with ANY of prefixes — the set form of starts_with, for the switch a parser writes over a keyword list. std.str.ends_with_any pub fn ends_with_any(s: str, suffixes: List[str]) -> bool — Whether s ends with ANY of suffixes — the set form of ends_with, for the extension test a file walker writes. std.str.strip_prefix pub fn strip_prefix(s: str, prefix: str) -> str ! {none} — s without a leading prefix; none when s does not start with it — the absence row rather than s unchanged, so the caller can tell the two apart (§2). std.str.strip_suffix pub fn strip_suffix(s: str, suffix: str) -> str ! {none} — s without a trailing suffix; none when it is not there — the absence row for strip_prefix's reason (§2). std.str.split pub fn split(s: str, sep: str) -> List[str] — Every piece of s between occurrences of sep, in order, keeping empty pieces: split("a,,b", ",") is three pieces and split("", ",") is one empty piece. std.str.splitn pub fn splitn(s: str, sep: str, n: int) -> List[str] — split stopping after n pieces: at most n are produced and the LAST one keeps the whole unsplit remainder, separators and all. std.str.rsplit pub fn rsplit(s: str, sep: str) -> List[str] — split's pieces in REVERSE order — last piece first. std.str.split_once pub fn split_once(s: str, sep: str) -> (str, str) ! {none} — The pieces of s before and after the FIRST occurrence of sep; none when sep does not occur — the pair is only meaningful together, so absence is one row and not two empty strings (§2). std.str.rsplit_once pub fn rsplit_once(s: str, sep: str) -> (str, str) ! {none} — split_once at the LAST occurrence of sep: the pieces before and after it, or none when it does not occur. std.str.replace pub fn replace(s: str, old: str, new: str) -> str — A fresh string with every NON-OVERLAPPING occurrence of old replaced by new, left to right, allocated in the ambient region. std.str.replacen pub fn replacen(s: str, old: str, new: str, n: int) -> str — replace stopping after n replacements; the rest of s is copied unchanged. std.str.lower pub fn lower(s: str) -> str — s with every code point lowercased, freshly allocated in the ambient region. std.str.upper pub fn upper(s: str) -> str — s with every code point uppercased, freshly allocated in the ambient region. std.str.eq_ignore_case pub fn eq_ignore_case(a: str, b: str) -> bool — Whether a and b are equal ignoring case, by comparing their case-folded forms. std.str.repeat pub fn repeat(s: str, n: int) -> str — s repeated n times, freshly allocated. std.str.trim pub fn trim(s: str) -> str — s with leading and trailing whitespace removed — a slice of s, no copy. std.str.trim_start pub fn trim_start(s: str) -> str — s with LEADING whitespace removed — a slice of s, no copy. std.str.trim_end pub fn trim_end(s: str) -> str — s with TRAILING whitespace removed — a slice of s, no copy. std.str.lines pub fn lines(s: str) -> List[str] — The lines of s, in order, each without its terminator. std.str.words pub fn words(s: str) -> List[str] — The whitespace-separated words of s, in order, dropping empty runs: any run of whitespace separates, leading and trailing whitespace produce no empty words, and a string of only whitespace has no words. std.str.each_word pub fn each_word(s: str, f: fn(str) -> ()) -> () — Walks the whitespace-separated words of s in order and calls f once per word, building nothing: the walk is the compiler's own lazy for-head over the receiver's bytes ([mem.str.view], s84), so each word is a zero-copy slice of s and no list exists. std.str.words_count pub fn words_count(s: str) -> int — The number of whitespace-separated words in s — words without the list OR the callback: the same fused walk as each_word, folded to a count. std.str.join pub fn join(sep: str, parts: List[str]) -> str — parts concatenated with the separator sep between consecutive items — the separator is the RECEIVER, as the sprint contract has it, which is why sep comes first. std.str.char_count pub fn char_count(s: str) -> int — The number of CODE POINTS in s — the count len deliberately does not give (§9: a function that counts code points says so in its name). std.str.char_offsets pub fn char_offsets(s: str) -> List[int] — The byte offset at which each code point of s STARTS, in order — the offset half of the blocked chars() (see the module header), and every offset in it is a boundary get will accept. std.str.code_points pub fn code_points(s: str) -> List[int] — The Unicode SCALAR VALUES of s's code points, in order, as ints. std.str.to_list_chars pub fn to_list_chars(s: str) -> List[char] — The code points of s as CHARS, in order — the sc03 contract's to_list_chars, code at last (sc24): a delegation to the language's s.chars() ([mem.str.chars], s120/s121), which yields the Unicode scalar values List[char]-typed under D58's ruling — a scalar value, ordered by scalar value, NOT an integer. std.str.is_ascii pub fn is_ascii(s: str) -> bool — Whether every code point in s is ASCII (below U+0080) — the cheap question a caller asks before treating byte offsets as character positions, and the one classification that needs no tables at all. std.str.to_strbuf pub fn to_strbuf(s: str) -> strbuf.StrBuf — s copied into a fresh std.strbuf.StrBuf — the allocating conversion into the builder (to_, §1: it allocates). std.strbuf [core] std.strbuf.StrBuf pub struct StrBuf { bytes: List[byte], } — The builder: an owned, growable string. std.strbuf.new pub fn new() -> StrBuf — A fresh empty builder in the ambient region (D10: no region argument, no annotation). std.strbuf.len pub fn len(b: StrBuf) -> int — The length of the buffer's contents in BYTES — the same honest unit as str.len (D25: byte offsets are the one currency). std.strbuf.push_str pub fn push_str(mut b: StrBuf, s: str) — Appends s to the end of the buffer. std.strbuf.push pub fn push(mut b: StrBuf, c: char) — Appends one code point — the sc03 contract's push(c), code at last (sc24), over D58's char ([type.char]: a Unicode scalar value, ordered, NOT an integer). std.strbuf.insert pub fn insert(mut b: StrBuf, off: int, s: str) — Inserts s at byte offset off, shifting everything at or after off to the right. std.strbuf.remove pub fn remove(mut b: StrBuf, from: int, to: int) — Removes the bytes in [from, to), closing the gap. std.strbuf.truncate pub fn truncate(mut b: StrBuf, n: int) — Shortens the buffer to n bytes, dropping everything after. std.strbuf.clear pub fn clear(mut b: StrBuf) — Empties the buffer, keeping it usable. std.strbuf.to_str pub fn to_str(b: StrBuf) -> str — The buffer's contents as a str. std.term [core] std.term.Mode pub struct Mode { canonical: bool, echo: bool, signals: bool, flow: bool, extended: bool, raw_cr: bool, raw_output: bool, strip8: bool, min: int, time: int, } — The terminal's mode, unpacked ([os.term.mode]). std.term.pack pub fn pack(m: Mode) -> int — The packed int the builtin reads: canonical=1, echo=2, signals=4, flow=8, extended=16, raw_cr=32, raw_output=64, strip8=128, min in bits 8..15, time in bits 16..23 ([os.term.mode]). std.term.unpack pub fn unpack(v: int) -> Mode — The Mode a packed int names. std.term.mode pub fn mode(tty: fs.File) -> Mode ! {unsupported, io} — The terminal's mode now. std.term.set_mode pub fn set_mode(tty: fs.File, m: Mode) -> () ! {unsupported, invalid, io} — Set the terminal's mode (output already written drains first; input already typed is kept). std.term.raw pub fn raw(m: Mode) -> Mode — m with input a key at a time: not canonical, no echo, no flow control and no extended input, one byte per read, no timer, so Ctrl-S, Ctrl-Q, Ctrl-V and Ctrl-O arrive as keys, as cfmakeraw(3) leaves them. std.term.raw_bytes pub fn raw_bytes(m: Mode) -> Mode — raw(m) with every byte passed through untranslated, both ways: raw_cr and raw_output on and strip8 off, so a typed Enter reads as CR (13), not LF (10, Ctrl-J's byte), a written LF reaches the terminal alone, and input keeps its eighth bit. std.term.restore_at_exit pub fn restore_at_exit(tty: fs.File, m: Mode, bytes: List[byte]) -> () ! { invalid, io, unsupported, } — s248 ([os.term.restore], ruling #93 R1 C): put the terminal back on every exit the runtime owns. Registers, for this process, a restore of tty: when the process ends — a return from main, process.exit, an error from main, a trap (after its report), the stack guard's report, process.exit_signal (before its raise), the death of the proc root — the runtime sets m exactly as set_mode sets it and then writes bytes to the terminal (an editor's alternate-screen leave and cursor show). std.term.foreground pub fn foreground(tty: fs.File) -> int ! {unsupported, io} — The terminal's foreground process group. std.term.set_foreground pub fn set_foreground(tty: fs.File, group_id: int) -> () ! {unsupported, io} — Make group_id the terminal's foreground process group. std.term.group pub fn group() -> int ! {unsupported} — This process's own process group. std.term.Size pub struct Size { rows: int, columns: int, } — The terminal's window size ([os.term.size]): rows lines of columns cells each. std.term.size pub fn size(tty: fs.File) -> Size ! {unsupported, io} — The window's size as the terminal holds it: what the emulator last told it, or what stty rows … cols … set (TIOCGWINSZ). std.term.set_size pub fn set_size(tty: fs.File, s: Size, xpixels: int, ypixels: int) -> () ! { invalid, io, unsupported, } — s292 ([os.term.size.set], sc81): set the window's size of the terminal tty names, as an emulator or stty rows … cols … does: s is the rows and the columns size reads back, on either end of a pseudo-terminal, and xpixels and ypixels the window's width and height in pixels, RFC 4254's two other fields (0 when the client does not know). std.term.Pty pub struct Pty { master: fs.File, slave: fs.File, } — A pseudo-terminal ([os.term.pty]): two std.fs files, the master, which the program that made it keeps, and a slave, the terminal another program runs on. std.term.open_pty pub fn open_pty() -> Pty ! {io, unsupported} — s292 ([os.term.pty], sc81): a new pseudo-terminal, its master and a slave, both close-on-exec; the slave granted and unlocked, and neither end this process's controlling terminal, whatever it leads. std.term.pty_name pub fn pty_name(master: fs.File) -> str ! {io, unsupported} — s292 ([os.term.pty], sc81): the slave's name for the master master names: /dev/pts/N on linux and PAX, /dev/ttysN on macOS. std.term.attr pub fn attr(tty: fs.File, op: int) -> int ! {invalid, io, unsupported} — s292 ([os.term.attr], sc81): one setting of the terminal tty names, by its RFC 4254 section 8 opcode (with RFC 8160's 42, IUTF8): a special character, 1 to 18, as its byte or -1 for disabled (as chars reads it); a flag (30 to 42 input, 50 to 62 local, 70 to 75 output, 92 and 93 control) as 0 or 1; the character size, 90 CS7 and 91 CS8, 1 for the size the terminal has; the speeds, 128 input and 129 output, in bits per second. std.term.set_attr pub fn set_attr(tty: fs.File, op: int, value: int) -> () ! {invalid, io, unsupported} — s292 ([os.term.attr], sc81): set one setting of the terminal tty names, by its RFC 4254 opcode, every other field as found (output already written drains first, as set_mode). std.term.open_controlling pub fn open_controlling(name: str) -> fs.File ! {denied, io, not_found, unsupported} — sc81: open the terminal name as THIS process's controlling terminal — the step a pty's program takes in its own session, after std.process.lead_session, so that the terminal's interrupt, quit and suspend keys, its hangup and signal.resize() reach it and /dev/tty opens ([os.term.pty], [os.term.session]). std.term.Chars pub struct Chars { erase: int, kill: int, interrupt: int, quit: int, suspend: int, end_of_file: int, word_erase: int, literal_next: int, start: int, stop: int, reprint: int, discard: int, } — The terminal's special characters ([os.term.chars]): the byte the user chose for each (stty erase ^H), or char_disabled() for one that is disabled (stty intr undef). std.term.char_disabled pub fn char_disabled() -> int — The word Chars holds for a character that is disabled: -1, the builtin's own ([os.term.chars]; the host's disabled value never reaches the program). std.term.chars_from pub fn chars_from(v: List[int]) -> Chars — The Chars a list in [os.term.chars]'s order names: erase, kill, interrupt, quit, suspend, end of file, word erase, literal next, start, stop, reprint, discard. std.term.chars pub fn chars(tty: fs.File) -> Chars ! {unsupported, io} — The terminal's special characters now. std.testing [core] std.testing.fail pub fn fail(msg: str) — Unconditional failure: prints msg on one line, then traps assert ([conf.trap.map]). std.testing.unreachable pub fn unreachable() — Marks code that must never execute; reaching it is the bug. std.testing.todo pub fn todo(msg: str) — Marks unfinished code: reaching it traps assert via fail, naming msg as what remains to build. std.testing.assert_eq pub fn assert_eq[T: cmp.Eq](a: T, b: T) — Asserts a equals b under cmp.Eq; a miss prints one line and traps assert. std.testing.assert_ne pub fn assert_ne[T: cmp.Eq](a: T, b: T) — Asserts a differs from b under cmp.Eq; equality prints one line and traps assert. std.testing.assert_lt pub fn assert_lt[T: cmp.Ord](a: T, b: T) — Asserts a < b under cmp.Ord. std.testing.assert_le pub fn assert_le[T: cmp.Ord](a: T, b: T) — Asserts a <= b under cmp.Ord. std.testing.assert_gt pub fn assert_gt[T: cmp.Ord](a: T, b: T) — Asserts a > b under cmp.Ord. std.testing.assert_ge pub fn assert_ge[T: cmp.Ord](a: T, b: T) — Asserts a >= b under cmp.Ord. std.testing.assert_contains pub fn assert_contains[T: cmp.Eq](xs: List[T], x: T) — Asserts xs contains an element equal to x under cmp.Eq. std.testing.assert_near pub fn assert_near(a: f64, b: f64, eps: f64) — Asserts a and b are within eps of each other — the absolute tolerance form, for a magnitude the test already knows. std.testing.assert_ulps pub fn assert_ulps(a: f64, b: f64, n: int) — Asserts a and b are at most n representable steps apart — the RELATIVE tolerance a float test actually wants, in the currency std.math.float documents its accuracy in (sc04's ulp harness). std.time [core] std.time.Instant pub struct Instant { ms: int, } — A reading of the MONOTONIC clock, in milliseconds from an arbitrary process-local anchor. std.time.Duration pub struct Duration { ms: int, } — A signed span of time, in milliseconds. std.time.now pub fn now() -> Instant — The current reading of the monotonic clock. std.time.monotonic_ns pub fn monotonic_ns() -> int — s248 ([os.clock.ns]): the monotonic clock in NANOSECONDS, from the anchor now reads (time_now_ms's): monotonic_ns() / 1000000 read after a now() is never smaller than its ms. std.time.unix_ms pub fn unix_ms() -> int — The current wall clock, in milliseconds since 1970-01-01T00:00:00Z. std.time.sleep pub fn sleep(d: Duration) — Block the calling thread for d. std.time.elapsed pub fn elapsed(since: Instant) -> Duration — How long ago since was read, on the monotonic clock. std.time.now_iso8601 pub fn now_iso8601() -> str — The wall clock, rendered — to_iso8601(unix_ms()). std.time.millis pub fn millis(n: int) -> Duration — A Duration of n milliseconds. std.time.seconds pub fn seconds(n: int) -> Duration — A Duration of n seconds. std.time.minutes pub fn minutes(n: int) -> Duration — A Duration of n minutes. std.time.hours pub fn hours(n: int) -> Duration — A Duration of n hours. std.time.as_millis pub fn as_millis(d: Duration) -> int — The millisecond count d names. std.time.as_seconds pub fn as_seconds(d: Duration) -> int — d in whole seconds, truncated TOWARD ZERO. std.time.as_minutes pub fn as_minutes(d: Duration) -> int — d in whole minutes, truncated toward zero. std.time.as_hours pub fn as_hours(d: Duration) -> int — d in whole hours, truncated toward zero. std.time.between pub fn between(earlier: Instant, later: Instant) -> Duration — The span from earlier to later, signed. std.time.add pub fn add(t: Instant, d: Duration) -> Instant — t advanced by d (which may be negative). std.time.is_before pub fn is_before(a: Instant, b: Instant) -> bool — Whether a is strictly before b on the monotonic clock. std.time.is_after pub fn is_after(a: Instant, b: Instant) -> bool — Whether a is strictly after b. std.time.plus pub fn plus(a: Duration, b: Duration) -> Duration — a + b. std.time.minus pub fn minus(a: Duration, b: Duration) -> Duration — a - b. std.time.negate pub fn negate(d: Duration) -> Duration — d with its sign flipped. std.time.is_zero pub fn is_zero(d: Duration) -> bool — Whether d is the zero span. std.time.is_negative pub fn is_negative(d: Duration) -> bool — Whether d runs backwards. std.time.to_iso8601 pub fn to_iso8601(unix_millis: int) -> str — unix_millis rendered as YYYY-MM-DDTHH:MM:SS.sssZ — the RFC 3339 profile of ISO 8601, in UTC, with exactly three fractional digits. std.time.unix_iso8601 pub fn unix_iso8601() -> str — unix_ms() rendered — see to_iso8601, which does the work. std.time.Local pub struct Local { year: int, month: int, day: int, hour: int, minute: int, second: int, nanos: int, offset_s: int, leap_correction_s: int, is_dst: bool, abbrev: str, } — Local Gregorian calendar fields; offset_s is seconds east of UTC, nanos 0..999999999, is_dst the zone's seasonal flag and abbrev its designation. std.time.local pub fn local(unix_s: int) -> Local ! {zone, io} — Local time at timestamp unix_s, from $TZ or /etc/localtime. std.time.local_in pub fn local_in(zone: str, unix_s: int) -> Local ! {zone, io} — Local time at unix_s: POSIX UNIX time without leap records, UNIX leap time with them (the same integer interpretation as host date). std.time.offset_at pub fn offset_at(zone: str, unix_s: int) -> int ! {zone, io} — Seconds east of UT in force in zone at timestamp unix_s. std.time.to_unix pub fn to_unix(l: Local) -> int — Timestamp of calendar fields at their EXPLICIT offset_s and leap_correction_s: UNIX leap time for leap-aware locals, POSIX UNIX time otherwise. std.time.format pub fn format(l: Local, fmt: str) -> str ! {format} — C-locale POSIX calendar formatting, pure and comptime-safe. std.unicode [core] std.unicode.from_code pub fn from_code(n: int) -> char ! {none} — n as a Unicode scalar value; none when n is not one — negative, above U+10FFFF, or in the surrogate range U+D800..U+DFFF, which UTF-8 may never encode. std.unicode.code pub fn code(c: char) -> int — The Unicode scalar value of c, as an int — the sc03 contract's char.code, code since sc24. std.unicode.utf8_len pub fn utf8_len(c: char) -> int — The number of bytes c occupies in UTF-8 — 1, 2, 3 or 4. std.unicode.is_ascii pub fn is_ascii(c: char) -> bool — Whether c is an ASCII character, U+0000..U+007F. std.unicode.is_ascii_alpha pub fn is_ascii_alpha(c: char) -> bool — Whether c is an ASCII letter, A..Z or a..z. std.unicode.is_ascii_digit pub fn is_ascii_digit(c: char) -> bool — Whether c is an ASCII decimal digit, 0..9. std.unicode.is_ascii_alnum pub fn is_ascii_alnum(c: char) -> bool — Whether c is an ASCII letter or digit. std.unicode.is_ascii_space pub fn is_ascii_space(c: char) -> bool — Whether c is ASCII whitespace: tab ('\t'), line feed ('\n'), vertical tab (U+000B), form feed (U+000C), carriage return ('\r') or space. std.unicode.is_ascii_upper pub fn is_ascii_upper(c: char) -> bool — Whether c is an ASCII uppercase letter, A..Z. std.unicode.is_ascii_lower pub fn is_ascii_lower(c: char) -> bool — Whether c is an ASCII lowercase letter, a..z. std.x [x] std.x.crypto [x] std.x.crypto.chacha20 [x] std.x.crypto.chacha20.block pub fn block(key: List[byte], counter: int, nonce: List[byte]) -> List[byte] — The ChaCha20 block function (RFC 8439 §2.3): 64 keystream bytes for one (key, counter, nonce) triple. std.x.crypto.chacha20.stream_xor pub fn stream_xor( key: List[byte], counter: int, nonce: List[byte], data: List[byte], ) -> List[byte] — The ChaCha20 stream cipher (RFC 8439 §2.4): XORs data with the keystream starting at block counter; its own inverse, so one function is both directions. std.x.crypto.chacha20.poly1305 pub fn poly1305(key: List[byte], msg: List[byte]) -> List[byte] — The Poly1305 one-time authenticator (RFC 8439 §2.5): a 16-byte tag over msg under a 32-byte one-time key (r || s). std.x.crypto.chacha20.poly_key pub fn poly_key(key: List[byte], nonce: List[byte]) -> List[byte] — The per-nonce Poly1305 key (RFC 8439 §2.6): the first 32 bytes of the ChaCha20 block at counter ZERO — which is why the AEAD's encryption starts at counter one. std.x.crypto.chacha20.seal pub fn seal( key: List[byte], nonce: List[byte], aad: List[byte], plaintext: List[byte], ) -> List[byte] — AEAD_CHACHA20_POLY1305 seal (RFC 8439 §2.8): encrypts plaintext under (key, nonce) with the ciphertext starting at block counter 1, authenticates aad and ciphertext per the §2.8 transcript under the §2.6 per-nonce Poly1305 key, and returns ciphertext || 16-byte tag as one sequence. std.x.crypto.chacha20.open pub fn open( key: List[byte], nonce: List[byte], aad: List[byte], boxed: List[byte], ) -> List[byte] ! {tag} — AEAD_CHACHA20_POLY1305 open (RFC 8439 §2.8): verifies the tag over the §2.8 transcript, and ONLY on success decrypts and returns the plaintext. std.x.crypto.chacha20.to_hex pub fn to_hex(b: List[byte]) -> str — b as lowercase hexadecimal, two digits per byte — this module's own rendering so its tests and examples import exactly one module (the sha2 precedent); std.hex.encode is the facade spelling. std.x.crypto.curve25519 [x] std.x.crypto.curve25519.x25519 pub fn x25519(scalar: List[byte], u_bytes: List[byte]) -> List[byte] ! {zero} — X25519 (RFC 7748 s5): the Diffie-Hellman scalar multiplication on Curve25519. std.x.crypto.curve25519.x25519_base pub fn x25519_base(scalar: List[byte]) -> List[byte] — X25519 against the standard base point u = 9 (RFC 7748 s6.1's key generation: the public key for a private scalar). std.x.crypto.curve25519.public pub fn public(secret: List[byte]) -> List[byte] — The Ed25519 public key for a 32-byte secret (RFC 8032 §5.1.5): A = [a]B compressed, where a is the clamped scalar. std.x.crypto.curve25519.sign pub fn sign(secret: List[byte], message: List[byte]) -> List[byte] — Ed25519 signature over message under a 32-byte secret (RFC 8032 §5.1.6). std.x.crypto.curve25519.verify pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool — Verify an Ed25519 signature (RFC 8032 §5.1.7), COFACTORLESS: the group equation [S]B = R + [k]A holds with no multiply-by-8, S is rejected unless S < L (strict — the malleability check Wycheproof's cases patrol), and both A and R must decompress canonically. std.x.crypto.curve25519.verify_strict pub fn verify_strict(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool — Verify an Ed25519 signature STRICTLY: everything verify checks (the lengths, S < L, canonical decompression of A and R, and RFC 8032 §5.1.7's cofactorless equation [S]B = R + [k]A), and also false when the public key A or the commitment R has small order, meaning [8]A or [8]R is the identity. std.x.crypto.curve25519.field_self_test pub fn field_self_test() -> bool — The field's algebraic identities, checked ALONE (RFC 7748 §5's arithmetic, before any ladder observes it). std.x.crypto.curve25519.to_hex pub fn to_hex(b: List[byte]) -> str — b as lowercase hexadecimal, two digits per byte — this module's own rendering so its tests and examples import exactly one module (the sha2/chacha20 precedent); std.hex.encode is the facade spelling. std.x.crypto.p256 [x] std.x.crypto.p256.public_key pub fn public_key(d: List[byte]) -> List[byte] — The ECDSA public key for a 32-byte big-endian private key d in [1, n): the uncompressed SEC1 encoding of [d]G (0x04 || X || Y). std.x.crypto.p256.sign pub fn sign(d: List[byte], message: List[byte]) -> List[byte] — An ECDSA signature over message under the 32-byte big-endian private key d, as the 64-byte fixed-width r || s (each 32 bytes, big-endian — the JOSE / IEEE P1363 form; DER is signature_der). std.x.crypto.p256.verify pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool — Verify an ECDSA signature (FIPS 186-5 §6.4.2) over message given a 65-byte uncompressed SEC1 public key and the 64-byte r || s signature. std.x.crypto.p256.verify_der pub fn verify_der(pubkey: List[byte], message: List[byte], der: List[byte]) -> bool — Verify an ECDSA signature supplied in DER form (SEQUENCE{INTEGER r, INTEGER s}) — the encoding X.509 certificates and TLS carry, and exactly what sc22's chain validator hands this module. std.x.crypto.p256.signature_der pub fn signature_der(sig: List[byte]) -> List[byte] — Encode a 64-byte r || s signature as strict DER (SEQUENCE{INTEGER r, INTEGER s}) — the form for an X.509/TLS consumer. std.x.crypto.p256.field_self_test pub fn field_self_test() -> bool — The FIELD's algebraic identities plus the cheap curve laws, checked ALONE before any ECDSA path observes them (the field-first discipline): additive inverse, multiply commutativity / associativity, distributivity, squaring as self-multiply, the Fermat inverse (a·a⁻¹ = 1), the byte round trip, that G is on the curve (SEC1 §3.2.2), and that the COMPLETE addition and doubling agree on [2]G. std.x.crypto.p256.self_test pub fn self_test() -> bool — The full self-test: field_self_test plus the GROUP-ORDER check that [n-1]G + G is the identity (so [n]G = O, n the group order) — a full table-free ladder, so this exceeds the checked tier's step budget and lupin's evaluation budget (native + slow, the ladder precedent). std.x.crypto.p256.to_hex pub fn to_hex(b: List[byte]) -> str — b as lowercase hexadecimal, two digits per byte. std.x.crypto.p384 [x] std.x.crypto.p384.verify_digest_der pub fn verify_digest_der(pubkey: List[byte], digest: List[byte], der: List[byte]) -> bool — Verify an ECDSA P-384 signature (FIPS 186-5 §6.4.2) given as a precomputed digest of any length (bits2int takes its leftmost 384 bits; a shorter digest is used whole) and a strict-DER signature. std.x.crypto.p384.verify_der pub fn verify_der(pubkey: List[byte], message: List[byte], der: List[byte]) -> bool — Verify an ECDSA P-384 signature with SHA-384 (TLS 1.3's ecdsa_secp384r1_sha384, X.509's ecdsa-with-SHA384) over message, the signature in the DER form X.509 and TLS carry. std.x.crypto.p384.verify pub fn verify(pubkey: List[byte], message: List[byte], sig: List[byte]) -> bool — Verify an ECDSA P-384 signature with SHA-384 over message, the signature as the raw 96-byte r || s (IEEE P1363) form. std.x.crypto.p384.self_test pub fn self_test() -> bool — The group self-test: G is on the curve and [n]G is the point at infinity, through the module's own point arithmetic. std.x.crypto.p384.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list. std.x.crypto.passwd [x] std.x.crypto.passwd.Cost pub struct Cost { n_log2: int, r: int, p: int, } — scrypt's three cost parameters, as a $7$ string carries them: N = 2^n_log2, block size r, parallelization p. std.x.crypto.passwd.Hashed pub struct Hashed { cost: Cost, salt: str, digest: List[byte], } — A parsed $7$ string: its cost, its salt characters (scrypt's salt octets) and the 32-octet derived key it stores. std.x.crypto.passwd.cost pub fn cost(n_log2: int, r: int, p: int) -> Cost ! {bad_n, bad_rp} — The cost N = 2^n_log2, r, p, checked as a $7$ string must carry it. std.x.crypto.passwd.default_cap pub fn default_cap() -> int — The working-memory ceiling verify and hash hold a cost to: scrypt.memory(18, 32, 1, 32) octets (N = 2^18, r = 32, p = 1, the largest cost Ubuntu's crypt_gensalt writes). std.x.crypto.passwd.gen_salt pub fn gen_salt(random: List[byte]) -> str ! {bad_random} — A salt string from random, octets the caller read from the OS random source (getrandom(2) or /dev/urandom; std draws no entropy of its own): the octets in crypt's base-64, so 16 octets make the 22 characters Ubuntu's crypt_gensalt writes and 64 make the 86 a $7$ string holds at most. std.x.crypto.passwd.encode pub fn encode(h: Hashed) -> str — The $7$ string for h: $7$, log2 N, r and p, the salt, $, the 43-character key. std.x.crypto.passwd.parse pub fn parse(stored: str) -> Hashed ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, } — Parses a stored crypt(5) field as a $7$ string. std.x.crypto.passwd.hash pub fn hash(password: List[byte], salt: str, c: Cost) -> str ! {bad_n, bad_rp, bad_salt, over_cap} — The $7$ string for password under salt and c: scrypt(password, salt, 2^n_log2, r, p, 32) behind the parameters, exactly as Ubuntu's crypt writes it for the same setting. std.x.crypto.passwd.verify_capped pub fn verify_capped(password: List[byte], stored: str, cap: int) -> bool ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, over_cap, } — verify with the caller's own memory ceiling: whether password hashes to stored when scrypt's working memory for the stored cost is at most cap octets. std.x.crypto.passwd.verify pub fn verify(password: List[byte], stored: str) -> bool ! { empty, locked, unsupported, malformed, bad_n, bad_rp, bad_salt, bad_hash, over_cap, } — Whether password hashes to stored, a crypt(5) field: the stored $7$ string's own cost and salt are used, and the derived key is compared with the stored one in constant time. std.x.crypto.rsa [x] std.x.crypto.rsa.PublicKey pub struct PublicKey { modulus: List[byte], exponent: List[byte], bits: int, } — An RSA public key (RFC 8017 §3.1): the modulus n and the public exponent e as minimal big-endian bytes, and n's length in bits. std.x.crypto.rsa.hash_sha256 pub fn hash_sha256() -> int — The SHA-256 selector for verify_pkcs1 and verify_pss: its digest size in bits. std.x.crypto.rsa.hash_sha384 pub fn hash_sha384() -> int — The SHA-384 selector. std.x.crypto.rsa.hash_sha512 pub fn hash_sha512() -> int — The SHA-512 selector. std.x.crypto.rsa.public_key pub fn public_key(modulus: List[byte], exponent: List[byte]) -> PublicKey ! { small_modulus, large_modulus, bad_modulus, bad_exponent, } — An RSA public key from its modulus and exponent as big-endian bytes (leading zero octets allowed and dropped), under the module's policy. std.x.crypto.rsa.parse_public_key pub fn parse_public_key(der_bytes: List[byte]) -> PublicKey ! { der, small_modulus, large_modulus, bad_modulus, bad_exponent, } — An RSA public key from its DER RSAPublicKey (RFC 8017 A.1.1: SEQUENCE { modulus INTEGER, publicExponent INTEGER }) — the content of an X.509 rsaEncryption SubjectPublicKeyInfo's BIT STRING. std.x.crypto.rsa.verify_pkcs1 pub fn verify_pkcs1(key: PublicKey, hash: int, message: List[byte], sig: List[byte]) -> bool — RSASSA-PKCS1-V1_5-VERIFY (RFC 8017 §8.2.2): true iff sig is the signature of message under key with the selected hash. std.x.crypto.rsa.verify_pss pub fn verify_pss( key: PublicKey, hash: int, message: List[byte], sig: List[byte], salt_len: int, ) -> bool — RSASSA-PSS-VERIFY (RFC 8017 §8.1.2, EMSA-PSS §9.1.2): true iff sig is a PSS signature of message under key, with MGF1 over the selected hash and a salt of exactly salt_len octets. std.x.crypto.rsa.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list. std.x.crypto.scrypt [x] std.x.crypto.scrypt.salsa20_8 pub fn salsa20_8(input: List[byte]) -> List[byte] — Salsa20/8 Core (RFC 7914 §3) of one 64-octet block: sixteen little-endian words in, sixteen out. std.x.crypto.scrypt.blockmix pub fn blockmix(b: List[byte], r: int) -> List[byte] — scryptBlockMix (RFC 7914 §4) of b, 2·r 64-octet blocks, with Salsa20/8 as H. std.x.crypto.scrypt.romix pub fn romix(b: List[byte], r: int, n: int) -> List[byte] ! {bad_n} — scryptROMix (RFC 7914 §5) of one 128·r-octet block with cost n. std.x.crypto.scrypt.pbkdf2_hmac_sha256 pub fn pbkdf2_hmac_sha256( password: List[byte], salt: List[byte], c: int, dk_len: int, ) -> List[byte] ! {bad_count, bad_dk_len} — PBKDF2-HMAC-SHA-256 (RFC 8018 §5.2): dk_len octets derived from password and salt with c iterations. std.x.crypto.scrypt.memory pub fn memory(n_log2: int, r: int, p: int, dk_len: int) -> int — The octets scrypt allocates at its peak for these parameters: 128·r·(N + 2p + 2) — V, B, the final PBKDF2's copy of B and the two scratch blocks X and Y — plus the dk_len octets of the key it returns and a fixed 16 KiB for Salsa's T and the HMAC states. std.x.crypto.scrypt.scrypt pub fn scrypt( password: List[byte], salt: List[byte], n_log2: int, r: int, p: int, dk_len: int, cap: int, ) -> List[byte] ! {bad_n, bad_rp, over_cap, bad_dk_len} — scrypt (RFC 7914 §6): dk_len octets derived from password and salt with N = 2^n_log2, block size r and parallelization p, refusing before it allocates anything when memory(n_log2, r, p, dk_len) exceeds cap octets. std.x.crypto.scrypt.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of b, this module's own so that its tests and doc examples import exactly one module (sha2's precedent). std.x.crypto.sha2 [x] std.x.crypto.sha2.Sha256 pub struct Sha256 { h0: wrapping[u64], h1: wrapping[u64], h2: wrapping[u64], h3: wrapping[u64], h4: wrapping[u64], h5: wrapping[u64], h6: wrapping[u64], h7: wrapping[u64], buf: List[byte], total: int, k: List[int], w: List[int], } — An in-progress SHA-256 computation. std.x.crypto.sha2.new256 pub fn new256() -> Sha256 — A fresh SHA-256 state — FIPS 180-4 §5.3.3's initial hash value ("the first thirty-two bits of the fractional parts of the square roots of the first eight prime numbers"). std.x.crypto.sha2.update256 pub fn update256(mut st: Sha256, data: List[byte]) — Absorbs data into the running SHA-256 computation. std.x.crypto.sha2.final256 pub fn final256(take st: Sha256) -> List[byte] — Pads (FIPS 180-4 §5.1.1: one 0x80 byte, zeros to 56 mod 64, the message length in BITS as a big-endian 64-bit word) and returns the 32 digest bytes, big-endian per word (§6.2.2 step 4, §3.1). std.x.crypto.sha2.sum256 pub fn sum256(msg: List[byte]) -> List[byte] — The SHA-256 digest of msg, one shot: new256 + update256 + final256. std.x.crypto.sha2.Sha512 pub struct Sha512 { h0: wrapping[u64], h1: wrapping[u64], h2: wrapping[u64], h3: wrapping[u64], h4: wrapping[u64], h5: wrapping[u64], h6: wrapping[u64], h7: wrapping[u64], buf: List[byte], total: int, khi: List[int], klo: List[int], whi: List[int], wlo: List[int], } — An in-progress SHA-512 computation. std.x.crypto.sha2.new512 pub fn new512() -> Sha512 — A fresh SHA-512 state — FIPS 180-4 §5.3.5's initial hash value ("the first sixty-four bits of the fractional parts of the square roots of the first eight prime numbers"). std.x.crypto.sha2.update512 pub fn update512(mut st: Sha512, data: List[byte]) — Absorbs data into the running SHA-512 computation; 1024-bit blocks. std.x.crypto.sha2.final512 pub fn final512(take st: Sha512) -> List[byte] — Pads (FIPS 180-4 §5.1.2: one 0x80, zeros to 112 mod 128, the bit length as a big-endian 128-bit word — the high word is the byte count's top three bits, exact for every representable length) and returns the 64 digest bytes. std.x.crypto.sha2.sum512 pub fn sum512(msg: List[byte]) -> List[byte] — The SHA-512 digest of msg, one shot. std.x.crypto.sha2.Sha384 pub struct Sha384 { st: Sha512, } — An in-progress SHA-384 computation: a Sha512 core under §5.3.4's initial value. std.x.crypto.sha2.new384 pub fn new384() -> Sha384 — A fresh SHA-384 state — FIPS 180-4 §5.3.4's initial hash value ("the square roots of the ninth through sixteenth prime numbers"). std.x.crypto.sha2.update384 pub fn update384(mut st: Sha384, data: List[byte]) — Absorbs data into the running SHA-384 computation. std.x.crypto.sha2.final384 pub fn final384(take st: Sha384) -> List[byte] — Pads exactly as SHA-512 and returns the LEFT-MOST 48 digest bytes (FIPS 180-4 §6.5 step 3 / §7 truncation). std.x.crypto.sha2.sum384 pub fn sum384(msg: List[byte]) -> List[byte] — The SHA-384 digest of msg, one shot. std.x.crypto.sha2.hmac256 pub fn hmac256(key: List[byte], msg: List[byte]) -> List[byte] — HMAC-SHA-256 (FIPS 198-1; RFC 2104). std.x.crypto.sha2.hmac384 pub fn hmac384(key: List[byte], msg: List[byte]) -> List[byte] — HMAC-SHA-384 (FIPS 198-1; RFC 2104). std.x.crypto.sha2.hmac512 pub fn hmac512(key: List[byte], msg: List[byte]) -> List[byte] — HMAC-SHA-512 (FIPS 198-1; RFC 2104). std.x.crypto.sha2.hkdf256_extract pub fn hkdf256_extract(salt: List[byte], ikm: List[byte]) -> List[byte] — HKDF-Extract over HMAC-SHA-256 (RFC 5869 §2.2). std.x.crypto.sha2.hkdf256_expand pub fn hkdf256_expand(prk: List[byte], info: List[byte], n: int) -> List[byte] — HKDF-Expand over HMAC-SHA-256 (RFC 5869 §2.3). std.x.crypto.sha2.hkdf256 pub fn hkdf256(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte] — HKDF over HMAC-SHA-256, extract-then-expand in one call (RFC 5869 §2). std.x.crypto.sha2.hkdf384_extract pub fn hkdf384_extract(salt: List[byte], ikm: List[byte]) -> List[byte] — HKDF-Extract over HMAC-SHA-384 (RFC 5869 §2.2). std.x.crypto.sha2.hkdf384_expand pub fn hkdf384_expand(prk: List[byte], info: List[byte], n: int) -> List[byte] — HKDF-Expand over HMAC-SHA-384 (RFC 5869 §2.3); the cap is 255 * 48. std.x.crypto.sha2.hkdf384 pub fn hkdf384(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte] — HKDF over HMAC-SHA-384, extract-then-expand in one call. std.x.crypto.sha2.hkdf512_extract pub fn hkdf512_extract(salt: List[byte], ikm: List[byte]) -> List[byte] — HKDF-Extract over HMAC-SHA-512 (RFC 5869 §2.2). std.x.crypto.sha2.hkdf512_expand pub fn hkdf512_expand(prk: List[byte], info: List[byte], n: int) -> List[byte] — HKDF-Expand over HMAC-SHA-512 (RFC 5869 §2.3); the cap is 255 * 64. std.x.crypto.sha2.hkdf512 pub fn hkdf512(salt: List[byte], ikm: List[byte], info: List[byte], n: int) -> List[byte] — HKDF over HMAC-SHA-512, extract-then-expand in one call. std.x.crypto.sha2.to_hex pub fn to_hex(b: List[byte]) -> str — b as lowercase hexadecimal, two digits per byte — this module's own rendering so its tests and examples import exactly one module (the std.bytes.from_str precedent); std.hex.encode is the facade spelling. std.x.deque_int [x] std.x.deque_int.DequeInt pub struct DequeInt { items: List[int], head: int, } — The queue: elements items[head .. std.x.deque_int.new pub fn new() -> DequeInt — A fresh empty queue. std.x.deque_int.len pub fn len(d: DequeInt) -> int — The number of elements. std.x.deque_int.is_empty pub fn is_empty(d: DequeInt) -> bool — Whether the queue holds no elements. std.x.deque_int.push_back pub fn push_back(mut d: DequeInt, v: int) — Appends v at the back. std.x.deque_int.push_front pub fn push_front(mut d: DequeInt, v: int) — Prepends v at the front. std.x.deque_int.front pub fn front(d: DequeInt) -> int ! {none} — The front element, left in place; none when empty. std.x.deque_int.back pub fn back(d: DequeInt) -> int ! {none} — The back element, left in place; none when empty. std.x.deque_int.pop_front pub fn pop_front(mut d: DequeInt) -> int ! {none} — Removes and returns the front element; none when empty. std.x.deque_int.pop_back pub fn pop_back(mut d: DequeInt) -> int ! {none} — Removes and returns the back element; none when empty. std.x.deque_int.clear pub fn clear(mut d: DequeInt) — Empties the queue, keeping it usable, and releases the buffer. std.x.deque_int.to_list pub fn to_list(d: DequeInt) -> List[int] — A fresh list of the elements, FRONT to BACK — the one order this type promises. std.x.jose [x] std.x.jose.signing_input pub fn signing_input(protected: str, payload: List[byte]) -> str — The JWS Signing Input (RFC 7515 §5.1): BASE64URL(UTF8(protected)) || '.' || BASE64URL(payload). std.x.jose.jws_sign_compact pub fn jws_sign_compact(secret: List[byte], protected: str, payload: List[byte]) -> str — A JWS in Compact Serialization (RFC 7515 §7.1) with EdDSA (RFC 8037): BASE64URL(protected) || '.' || BASE64URL(payload) || '.' || BASE64URL(signature), the signature being Ed25519 over the signing input's ASCII bytes. std.x.jose.jws_verify_compact pub fn jws_verify_compact(pubkey: List[byte], compact: str) -> bool — Verify a compact JWS against an Ed25519 public key. std.x.jose.jws_flattened pub fn jws_flattened(secret: List[byte], protected: str, payload: List[byte]) -> str — A JWS in Flattened JSON Serialization (RFC 7515 §7.2.2) with EdDSA: the object {"protected":"…","payload":"…","signature":"…"}, each value a base64url string. std.x.jose.jwk_ed25519_public pub fn jwk_ed25519_public(pubkey: List[byte]) -> str — The Ed25519 public key as an OKP JWK (RFC 8037 §2, RFC 7517): {"kty":"OKP","crv":"Ed25519","x":""} — the member order of RFC 8037 A.2's own example. std.x.jose.jwk_thumbprint_input pub fn jwk_thumbprint_input(pubkey: List[byte]) -> str — The canonical thumbprint hash input (RFC 7638 §3) for an OKP Ed25519 key: the required members crv, kty, x in lexicographic order, no whitespace — {"crv":"Ed25519","kty":"OKP","x":""}. std.x.jose.jwk_thumbprint pub fn jwk_thumbprint(pubkey: List[byte]) -> str — The RFC 7638 JWK Thumbprint of an OKP Ed25519 key: base64url (no pad) of SHA-256 over jwk_thumbprint_input(pubkey). std.x.jose.acme_protected_jwk pub fn acme_protected_jwk(pubkey: List[byte], nonce: str, url: str) -> str — The ACME protected header for a request that INLINES the account key (RFC 8555 §6.2, the newAccount case): {"alg":"EdDSA","jwk":, "nonce":"","url":""}. std.x.jose.acme_protected_kid pub fn acme_protected_kid(kid: str, nonce: str, url: str) -> str — The ACME protected header for a request that names the account by URL (RFC 8555 §6.2, every request after newAccount): {"alg":"EdDSA","kid":"","nonce":"","url":""}. std.x.jose.acme_body pub fn acme_body(secret: List[byte], protected: str, payload: List[byte]) -> str — The signed ACME request body (RFC 8555 §6.2): the flattened-JSON JWS over protected and payload, signed with the account key. std.x.json [x] std.x.json.is_valid pub fn is_valid(doc: str) -> bool — Whether doc is one well-formed RFC 8259 text. std.x.json.get pub fn get(doc: str, path: str) -> str ! {parse, missing} — The node at path, rendered as text. std.x.json.type_name pub fn type_name(doc: str, path: str) -> str ! {parse, missing} — The kind of the node at path — one of "object", "array", "str", "num", "bool", "null". std.x.json.len pub fn len(doc: str, path: str) -> int ! {parse, missing, kind} — How many elements an array has, or members an object has, at path. std.x.json.has pub fn has(doc: str, path: str) -> bool ! {parse} — Whether doc has a node at path. std.x.json.str_at pub fn str_at(doc: str, path: str) -> str ! {parse, missing, kind} — The text of the string node at path, decoded. std.x.json.bool_at pub fn bool_at(doc: str, path: str) -> bool ! {parse, missing, kind} — The boolean at path. std.x.json.is_null_at pub fn is_null_at(doc: str, path: str) -> bool ! {parse, missing} — Whether the node at path is JSON null. std.x.json.int_at pub fn int_at(doc: str, path: str) -> int ! {parse, missing, kind, overflow} — The integer at path, exactly. std.x.json.child pub fn child(path: str, segment: str) -> str — path extended by one object key. std.x.json.child_index pub fn child_index(path: str, i: int) -> str — path extended by one array index. std.x.json.Node pub struct Node { doc: str, path: str, } — One location in one well-formed document — the DOM half's handle (sc15). std.x.json.root pub fn root(doc: str) -> Node ! {parse} — The root node of a well-formed document. std.x.json.node pub fn node(doc: str, path: str) -> Node ! {parse, missing} — The node at path — the bridge between the two halves: a dotted path built with child/child_index (or received as data) becomes a handle the DOM half reads. std.x.json.member pub fn member(n: Node, key: str) -> Node ! {parse, missing, kind} — The member node at key of an object node. std.x.json.element pub fn element(n: Node, i: int) -> Node ! {parse, missing, kind} — The element node at index i of an array node. std.x.json.type_of pub fn type_of(n: Node) -> str ! {parse, missing} — The kind of the node — one of "object", "array", "str", "num", "bool", "null"; the kernel's vocabulary, verbatim, and type_name's answer over a handle. std.x.json.text_of pub fn text_of(n: Node) -> str ! {parse, missing} — The node rendered as text — get's answer over a handle: a string node comes back DECODED, a number keeps its source spelling, true, false and null spell themselves, and a container comes back as JSON text, a valid document in its own right. std.x.json.len_of pub fn len_of(n: Node) -> int ! {parse, missing, kind} — How many elements an array node has, or members an object node has. std.x.json.str_of pub fn str_of(n: Node) -> str ! {parse, missing, kind} — The text of a string node, decoded. std.x.json.bool_of pub fn bool_of(n: Node) -> bool ! {parse, missing, kind} — The boolean a bool node holds. std.x.json.int_of pub fn int_of(n: Node) -> int ! {parse, missing, kind, overflow} — The integer a number node holds, exactly. std.x.json.is_null pub fn is_null(n: Node) -> bool ! {parse, missing} — Whether the node is JSON null. std.x.list_eq [x] std.x.list_eq.contains pub fn contains[T: cmp.Eq](xs: List[T], v: T) -> bool — Whether any element of xs equals v under Eq. std.x.list_eq.index_of pub fn index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none} — The index of the first element equal to v under Eq; none when no element matches. std.x.list_eq.last_index_of pub fn last_index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none} — The index of the LAST element equal to v under Eq; none when no element matches. std.x.list_eq.dedup pub fn dedup[T: cmp.Eq](mut xs: List[T]) — Collapses runs of CONSECUTIVE equal elements (under Eq) to one, in place — the sorted-input companion, not a set builder. std.x.list_eq.starts_with pub fn starts_with[T: cmp.Eq](xs: List[T], prefix: List[T]) -> bool — Whether xs begins with every element of prefix, in order, under Eq; an empty prefix is always a prefix. std.x.list_eq.ends_with pub fn ends_with[T: cmp.Eq](xs: List[T], suffix: List[T]) -> bool — Whether xs ends with every element of suffix, in order, under Eq; an empty suffix is always a suffix. std.x.option_expect [x] std.x.option_expect.expect pub fn expect[T](v: T ! {none}, msg: str) -> T — v's value, or a trap carrying msg when v is absent — the assertion form of absence handling, for a miss the caller has already ruled out by construction. std.x.option_flatten [x] std.x.option_flatten.flatten pub fn flatten[T](v: T ! {none} ! {none}) -> T ! {none} — One layer of absence removed: a doubly-absent value is absent, and an inner miss is absent too. std.x.testing_text [x] std.x.testing_text.assert_starts_with pub fn assert_starts_with(s: str, p: str) — Asserts s begins with p; a miss prints one line and traps assert ([conf.trap.map]). std.x.tls [x] std.x.tls.cert [x] std.x.tls.cert.Cert pub struct Cert { version: int, serial: List[byte], sig_alg: str, issuer: List[byte], issuer_cn: str, subject: List[byte], subject_cn: str, not_before: int, not_after: int, spki_alg: str, spki_key: List[byte], has_bc: bool, is_ca: bool, path_len: int, key_usage: int, has_san: bool, san: List[str], crit_unknown: str, tbs: List[byte], sig: List[byte], sig_params: List[byte], spki_curve: str, has_eku: bool, eku: List[str], has_name_constraints: bool, } — A parsed X.509 certificate — the fields wolf-wws ws05 reads, plus the raw material validation needs (tbs is the exact DER of the TBSCertificate, the octets the signature is over; issuer/subject are the raw Name encodings, the chaining currency). std.x.tls.cert.parse pub fn parse(bytes: List[byte]) -> Cert ! {der} — Parse ONE DER certificate occupying the whole of bytes (RFC 5280 §4.1 over X.690 DER; trailing bytes reject). std.x.tls.cert.cert_end pub fn cert_end(chain: List[byte], offset: int) -> int ! {der} — The end offset (exclusive) of the DER certificate starting at offset in chain — the boundary walker for CONCATENATED DER (sc21's certificate_list entries, joined). std.x.tls.cert.oid_ed25519 pub fn oid_ed25519() -> str — The Ed25519 algorithm OID (RFC 8410), the key and the signature algorithm at once. std.x.tls.cert.oid_ecdsa_sha256 pub fn oid_ecdsa_sha256() -> str — The ecdsa-with-SHA256 signature algorithm OID (X9.62 / RFC 5480 — the ES256 certificate signature). std.x.tls.cert.oid_ec_public_key pub fn oid_ec_public_key() -> str — The id-ecPublicKey OID (X9.62 — an EC subjectPublicKey). std.x.tls.cert.alg_name pub fn alg_name(dotted: str) -> str — Classify a dotted algorithm OID: "ed25519" (1.3.101.112), "rsa" (the PKCS#1 arc — signature algorithms and rsaEncryption), "ecdsa" (the X9.62 arc — ECDSA signatures and id-ecPublicKey), "ed448" (1.3.101.113), else "unknown". std.x.tls.cert.ku_digital_signature pub fn ku_digital_signature() -> int — KeyUsage bit weight: digitalSignature (bit 0). std.x.tls.cert.ku_key_cert_sign pub fn ku_key_cert_sign() -> int — KeyUsage bit weight: keyCertSign (bit 5) — the bit an issuing CA's keyUsage must assert (§4.2.1.3). std.x.tls.cert.host_matches pub fn host_matches(pattern: str, host: str) -> bool — Exact, case-insensitive DNS name match (DNS names compare case-insensitively; both sides are lowered). std.x.tls.cert.timestamp pub fn timestamp(y: int, mo: int, d: int, h: int, mi: int, s: int) -> int — Build the compact yyyymmddhhmmss timestamp validate_chain and the Cert fields speak (UTC). std.x.tls.cert.oid_rsa_encryption pub fn oid_rsa_encryption() -> str — The rsaEncryption key OID (RFC 8017 A.1; RFC 3279 §2.3.1): an RSA subjectPublicKey whose BIT STRING holds the DER RSAPublicKey. std.x.tls.cert.oid_secp256r1 pub fn oid_secp256r1() -> str — The prime256v1 (P-256) named-curve OID (RFC 5480 §2.1.1.1). std.x.tls.cert.oid_secp384r1 pub fn oid_secp384r1() -> str — The secp384r1 (P-384) named-curve OID (RFC 5480 §2.1.1.1). std.x.tls.cert.oid_server_auth pub fn oid_server_auth() -> str — The id-kp-serverAuth key purpose (RFC 5280 §4.2.1.12): the extendedKeyUsage value a TLS server's certificate must allow. std.x.tls.cert.verify_signed_by pub fn verify_signed_by(child: Cert, issuer: Cert) -> int ! { der, unsupported_alg, bad_signature, weak_key, } — Verify child's signature over its TBSCertificate bytes with issuer's key. std.x.tls.cert.san_matches pub fn san_matches(pattern: str, host: str) -> bool — RFC 9525 §6.3 dNSName matching (DNS names compare case-insensitively; both sides are lowered). std.x.tls.cert.validate_path pub fn validate_path(chain: List[byte], hostname: str, roots: List[byte], now: int) -> Cert ! { der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, } — PATH VALIDATION against a root set (sc79, RFC 5280 §6.1 in the subset the module header names): build a path from the peer's leaf to one of the caller's roots and validate it at the SUPPLIED time, returning the parsed LEAF. std.x.tls.cert.validate_chain pub fn validate_chain(chain: List[byte], hostname: str, anchor: List[byte], now: int) -> Cert ! { der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, } — THE ws05 SEAM (frozen in shape since sc22): validate the peer's chain against ONE trust anchor — validate_path with a root set of exactly anchor, so it builds, judges and refuses exactly as that function does (sc79 widened what it accepts: RSA, RSA-PSS and P-384 signatures, RFC 9525 wildcards; and what it refuses by name: weak_key, bad_usage, name_constraints). std.x.tls.cert.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list. std.x.tls.client [x] std.x.tls.client.suite_chacha20_sha256 pub fn suite_chacha20_sha256() -> int — TLS_CHACHA20_POLY1305_SHA256 (0x1303) — the ONE cipher suite this profile offers and accepts (RFC 8446 §9.1 MTI; the suite sc17/sc20 built). std.x.tls.client.scheme_ed25519 pub fn scheme_ed25519() -> int — SignatureScheme ed25519 (0x0807) — first-class: CertificateVerify VERIFIES under it (sc18's verifier). std.x.tls.client.scheme_ecdsa_p256_sha256 pub fn scheme_ecdsa_p256_sha256() -> int — SignatureScheme ecdsa_secp256r1_sha256 (0x0403) — verifies via sc23's p256.verify_der (the sc21 "verify nothing" posture retired for this scheme too). std.x.tls.client.scheme_ecdsa_p384_sha384 pub fn scheme_ecdsa_p384_sha384() -> int — SignatureScheme ecdsa_secp384r1_sha384 (0x0503) — verifies via sc79's p384.verify_der against a P-384 leaf key. std.x.tls.client.scheme_rsa_pss_sha256 pub fn scheme_rsa_pss_sha256() -> int — SignatureScheme rsa_pss_rsae_sha256 (0x0804) — RFC 8446 §9.1's MTI RSA scheme; verifies since sc79 via rsa.verify_pss (SHA-256, MGF1 over SHA-256, a 32-byte salt) against an rsaEncryption leaf key. std.x.tls.client.scheme_rsa_pss_sha384 pub fn scheme_rsa_pss_sha384() -> int — SignatureScheme rsa_pss_rsae_sha384 (0x0805) — rsa.verify_pss with SHA-384 and a 48-byte salt. std.x.tls.client.scheme_rsa_pss_sha512 pub fn scheme_rsa_pss_sha512() -> int — SignatureScheme rsa_pss_rsae_sha512 (0x0806) — rsa.verify_pss with SHA-512 and a 64-byte salt. std.x.tls.client.signature_schemes pub fn signature_schemes() -> List[int] — The signature_algorithms this client offers (RFC 8446 §4.2.3), in preference order: ed25519, ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512 — every scheme verify_certificate_verify can judge, and nothing else (rsa_pss_pss_*, rsa_pkcs1_* and the SHA-1 schemes are not offered). std.x.tls.client.ServerHelloView pub struct ServerHelloView { legacy_version: int, random: List[byte], session_echo: List[byte], cipher_suite: int, compression: int, selected_version: int, key_share_group: int, server_share: List[byte], hello_retry: bool, } — A parsed ServerHello — the fields the client judges. std.x.tls.client.parse_server_hello pub fn parse_server_hello(msg: List[byte]) -> ServerHelloView ! {decode_error} — Parse a complete ServerHello wire message (4-byte handshake header included) into its view (§4.1.3). std.x.tls.client.check_negotiation pub fn check_negotiation(v: ServerHelloView) -> int ! { downgrade, handshake_failure, illegal_parameter, unexpected_message, } — Judge a parsed ServerHello against THIS profile (§4.1.3's checks, each a named refusal): downgrade — the sentinel randoms, an absent supported_versions, or a selected_version that is not 0x0304 (a TLS 1.2-shaped answer refuses by THIS name, RFC 8446 §4.1.3's downgrade protection); unexpected_message — the HelloRetryRequest sentinel (one key share is offered, a second flight is outside the profile); illegal_parameter — a legacy_version that is not 0x0303, a nonzero compression method, a key_share group that is not x25519(29) or a share that is not 32 bytes; handshake_failure — a cipher suite other than 0x1303. std.x.tls.client.check_encrypted_extensions pub fn check_encrypted_extensions(msg: List[byte]) -> int ! {decode_error} — Validate an EncryptedExtensions wire message's structure (§4.3.1): header, one uint16-prefixed extensions vector filling the body, each extension well-formed. std.x.tls.client.certificate_chain_of pub fn certificate_chain_of(msg: List[byte]) -> List[byte] ! {decode_error} — The peer's certificate chain out of a Certificate wire message (§4.4.2): the CertificateEntry cert_data blobs CONCATENATED, leaf first — exactly cert.validate_chain's chain currency. std.x.tls.client.CertVerifyView pub struct CertVerifyView { scheme: int, sig: List[byte], } — A parsed CertificateVerify: the SignatureScheme and the raw signature bytes. std.x.tls.client.certificate_verify_of pub fn certificate_verify_of(msg: List[byte]) -> CertVerifyView ! {decode_error} — Parse a CertificateVerify wire message (§4.4.3): scheme (uint16) + uint16-prefixed signature filling the body. std.x.tls.client.finished_of pub fn finished_of(msg: List[byte]) -> List[byte] ! {decode_error} — The verify_data out of a Finished wire message (§4.4.4): the body, which for this profile's SHA-256 must be exactly 32 bytes. std.x.tls.client.verify_certificate_verify pub fn verify_certificate_verify( spki_alg: str, spki_key: List[byte], scheme: int, sig: List[byte], transcript_hash: List[byte], ) -> int ! {unsupported_alg, bad_signature, weak_key} — Verify a server CertificateVerify signature (§4.4.3) against the validated leaf's SPKI: spki_alg/spki_key are the leaf's (cert.Cert's fields), transcript_hash is the running hash THROUGH Certificate (CertificateVerify itself excluded), scheme/ sig are the wire message's. std.x.tls.client.Pending pub struct Pending { fd: int, scalar: List[byte], hostname: str, anchors: List[byte], now: int, transcript: List[byte], } — The state between begin and complete: the ClientHello is on the wire, nothing has been read. std.x.tls.client.begin pub fn begin( take sock: net.Socket, hostname: str, anchors: List[byte], now: int, client_random: List[byte], key_seed: List[byte], ) -> Pending ! {closed, io} — PHASE ONE: take ownership of a connected socket (the CALLER dialed — net.connect is the caller's line), build and send the ClientHello, return without reading. std.x.tls.client.Client pub struct Client { fd: int, write_key: List[byte], write_iv: List[byte], write_seq: int, read_key: List[byte], read_iv: List[byte], read_seq: int, } — An established TLS 1.3 connection: the application-traffic keys and sequence numbers over the caller's socket. std.x.tls.client.complete pub fn complete(take p: Pending) -> Client ! { closed, timeout, io, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, } — PHASE TWO: read the server flight, verify EVERYTHING, send the client Finished, answer the established Client. std.x.tls.client.read pub fn read(mut c: Client) -> List[byte] ! { closed, timeout, bad_record_mac, decode_error, unexpected_message, io, } — One record's application data, deprotected. std.x.tls.client.write pub fn write(mut c: Client, data: List[byte]) -> () ! {closed, invalid, io} — Seal data as one application-data record and send it. std.x.tls.client.close pub fn close(take c: Client) -> () ! {io} — Close the connection, consuming the Client: a close_notify alert goes out under the write keys (best-effort — a peer that already vanished does not un-close the socket), then the socket closes. std.x.tls.client.named pub fn named[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> T ! {Row(str)} — The value of v, or the NAME of the row that refused it, coarsened into the single payload-carrying tag Row(str) — ONE handler arm at the consumer instead of this module's twenty-three. std.x.tls.client.row_name pub fn row_name[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> str — The NAME of the row that refused v, or "ok" when v carries a value — the marking form, for a caller that wants the WORD and not the value. std.x.tls.handshake [x] std.x.tls.handshake.concat pub fn concat(a: List[byte], b: List[byte]) -> List[byte] — a followed by b — the byte-sequence concatenation the callers and the transcript build on. std.x.tls.handshake.hs_client_hello pub fn hs_client_hello() -> int — HandshakeType client_hello (1). std.x.tls.handshake.hs_server_hello pub fn hs_server_hello() -> int — HandshakeType server_hello (2). std.x.tls.handshake.hs_encrypted_extensions pub fn hs_encrypted_extensions() -> int — HandshakeType encrypted_extensions (8). std.x.tls.handshake.hs_certificate pub fn hs_certificate() -> int — HandshakeType certificate (11). std.x.tls.handshake.hs_certificate_verify pub fn hs_certificate_verify() -> int — HandshakeType certificate_verify (15). std.x.tls.handshake.hs_finished pub fn hs_finished() -> int — HandshakeType finished (20). std.x.tls.handshake.handshake pub fn handshake(msg_type: int, body: List[byte]) -> List[byte] — Frame a handshake message: msg_type byte, a big-endian uint24 length of body, then body (§4). std.x.tls.handshake.ext pub fn ext(extension_type: int, data: List[byte]) -> List[byte] — One Extension: extension_type (uint16) then a uint16-length-prefixed extension_data. std.x.tls.handshake.ext_server_name pub fn ext_server_name(host: str) -> List[byte] — server_name (0), a single host_name (§3 of RFC 6066): a ServerNameList of one ServerName { NameType host_name(0), HostName opaque<1..2^16-1> }. std.x.tls.handshake.ext_server_name_ack pub fn ext_server_name_ack() -> List[byte] — server_name (0) as the server's empty acknowledgement in EncryptedExtensions (§4.2.10): the extension_data is empty. std.x.tls.handshake.ext_renegotiation_info_empty pub fn ext_renegotiation_info_empty() -> List[byte] — renegotiation_info (0xff01) with an empty renegotiated_connection (RFC 5746): a single zero length byte. std.x.tls.handshake.ext_supported_groups pub fn ext_supported_groups(groups: List[int]) -> List[byte] — supported_groups (0x000a, §4.2.7): a NamedGroupList, each group a big-endian uint16, uint16-length-prefixed. std.x.tls.handshake.ext_session_ticket_empty pub fn ext_session_ticket_empty() -> List[byte] — session_ticket (0x0023, RFC 5077) with an empty ticket. std.x.tls.handshake.ext_key_share_client_x25519 pub fn ext_key_share_client_x25519(pubkey: List[byte]) -> List[byte] — key_share (0x0033, §4.2.8) for a ClientHello: a KeyShareClientHello = a uint16-length-prefixed vector of one KeyShareEntry { NamedGroup x25519(0x001d), key_exchange opaque<1..2^16-1> = the 32 point bytes }. std.x.tls.handshake.ext_key_share_server_x25519 pub fn ext_key_share_server_x25519(pubkey: List[byte]) -> List[byte] — key_share (0x0033, §4.2.8) for a ServerHello: a KeyShareServerHello = a single KeyShareEntry (NO client_shares vector wrapper). std.x.tls.handshake.ext_supported_versions_client pub fn ext_supported_versions_client() -> List[byte] — supported_versions (0x002b, §4.2.1) for a ClientHello: a uint8-length-prefixed list of ProtocolVersions, here the single TLS 1.3 (0x0304). std.x.tls.handshake.ext_supported_versions_server pub fn ext_supported_versions_server() -> List[byte] — supported_versions (0x002b, §4.2.1) for a ServerHello: the single selected_version (0x0304), NOT length-prefixed. std.x.tls.handshake.ext_signature_algorithms pub fn ext_signature_algorithms(schemes: List[int]) -> List[byte] — signature_algorithms (0x000d, §4.2.3): a SignatureSchemeList, each scheme a big-endian uint16, uint16-length-prefixed. std.x.tls.handshake.ext_psk_key_exchange_modes pub fn ext_psk_key_exchange_modes(modes: List[byte]) -> List[byte] — psk_key_exchange_modes (0x002d, §4.2.9): a uint8-length-prefixed list of PskKeyExchangeMode bytes (0x01 = psk_dhe_ke). std.x.tls.handshake.ext_record_size_limit pub fn ext_record_size_limit(limit: int) -> List[byte] — record_size_limit (0x001c, RFC 8449): a single big-endian uint16. std.x.tls.handshake.client_hello pub fn client_hello( random: List[byte], session_id: List[byte], cipher_suites: List[byte], extensions: List[byte], ) -> List[byte] — ClientHello (§4.1.2): legacy_version 0x0303, a 32-byte random, an opaque legacy_session_id<0..32>, a CipherSuite vector<2..2^16-2> (raw suite bytes, uint16-length-prefixed here), the single null legacy_compression_method, and the extensions vector<8..2^16-1>. std.x.tls.handshake.server_hello pub fn server_hello( random: List[byte], session_id: List[byte], cipher_suite: int, extensions: List[byte], ) -> List[byte] — ServerHello (§4.1.3): legacy_version 0x0303, a 32-byte random, the echoed opaque legacy_session_id_echo<0..32>, the selected cipher_suite (uint16), the null legacy_compression_method, and the extensions vector<6..2^16-1>. std.x.tls.handshake.encrypted_extensions pub fn encrypted_extensions(extensions: List[byte]) -> List[byte] — EncryptedExtensions (§4.3.1): the extensions vector<0..2^16-1>. std.x.tls.handshake.certificate pub fn certificate(context: List[byte], cert_der: List[byte]) -> List[byte] — Certificate (§4.4.2) — OPAQUE cert bytes here (no ASN.1 parse): a certificate_request_context<0..255> then a certificate_list<0..2^24-1> of one CertificateEntry { cert_data opaque<1..2^24-1> = the DER blob, extensions Extension<0..2^16-1> = empty }. std.x.tls.handshake.certificate_verify pub fn certificate_verify(algorithm: int, signature: List[byte]) -> List[byte] — CertificateVerify (§4.4.3): the SignatureScheme algorithm (uint16) and the opaque signature<0..2^16-1>. std.x.tls.handshake.certificate_verify_content pub fn certificate_verify_content(context: str, transcript_hash: List[byte]) -> List[byte] — The octet string a CertificateVerify signature is computed over (§4.4.3): 64 0x20 (space) octets, then the ASCII context string ("TLS 1.3, server CertificateVerify" or "...client..."), then a single 0x00 separator, then the Transcript-Hash up to but not including the CertificateVerify. std.x.tls.handshake.finished_message pub fn finished_message(verify_data: List[byte]) -> List[byte] — Finished (§4.4.4): the verify_data (an HMAC-SHA256 output, 32 bytes) framed as a handshake message. std.x.tls.handshake.transcript_new pub fn transcript_new() -> List[byte] — A fresh, empty transcript. std.x.tls.handshake.transcript_add pub fn transcript_add(mut acc: List[byte], msg: List[byte]) — Append one handshake message's exact wire bytes (header included) to the running transcript, in order (§4.4.1). std.x.tls.handshake.transcript_hash pub fn transcript_hash(acc: List[byte]) -> List[byte] — The Transcript-Hash: SHA-256 of the accumulated handshake messages (§4.4.1). std.x.tls.handshake.ecdhe_shared pub fn ecdhe_shared(private: List[byte], peer_public: List[byte]) -> List[byte] ! {zero} — The (EC)DHE shared secret for the handshake extract (§7.4.2): the X25519 of your private scalar against the peer's peer_public point (sc18). std.x.tls.handshake.early_secret pub fn early_secret() -> List[byte] — The early secret (§7.1): HKDF-Extract(0, 0) for the no-PSK handshake — salt and IKM both 32 zero bytes. std.x.tls.handshake.handshake_secret pub fn handshake_secret(early: List[byte], dh: List[byte]) -> List[byte] — The handshake secret (§7.1): HKDF-Extract with salt Derive-Secret(early, "derived", "") and IKM the (EC)DHE shared secret. std.x.tls.handshake.master_secret pub fn master_secret(hs: List[byte]) -> List[byte] — The master secret (§7.1): HKDF-Extract with salt Derive-Secret(handshake, "derived", "") and IKM 32 zero bytes. std.x.tls.handshake.client_handshake_traffic pub fn client_handshake_traffic(hs: List[byte], th_ch_sh: List[byte]) -> List[byte] — client_handshake_traffic_secret (§7.1): Derive-Secret(handshake, "c hs traffic", Transcript-Hash(ClientHello..ServerHello)). std.x.tls.handshake.server_handshake_traffic pub fn server_handshake_traffic(hs: List[byte], th_ch_sh: List[byte]) -> List[byte] — server_handshake_traffic_secret (§7.1): Derive-Secret(handshake, "s hs traffic", Transcript-Hash(ClientHello..ServerHello)). std.x.tls.handshake.client_application_traffic pub fn client_application_traffic(master: List[byte], th_sfin: List[byte]) -> List[byte] — client_application_traffic_secret_0 (§7.1): Derive-Secret(master, "c ap traffic", Transcript-Hash(ClientHello..server Finished)). std.x.tls.handshake.server_application_traffic pub fn server_application_traffic(master: List[byte], th_sfin: List[byte]) -> List[byte] — server_application_traffic_secret_0 (§7.1): Derive-Secret(master, "s ap traffic", Transcript-Hash(ClientHello..server Finished)). std.x.tls.handshake.exporter_master pub fn exporter_master(master: List[byte], th_sfin: List[byte]) -> List[byte] — exporter_master_secret (§7.1): Derive-Secret(master, "exp master", Transcript-Hash(ClientHello..server Finished)). std.x.tls.handshake.resumption_master pub fn resumption_master(master: List[byte], th_cfin: List[byte]) -> List[byte] — resumption_master_secret (§7.1): Derive-Secret(master, "res master", Transcript-Hash(ClientHello..client Finished)). std.x.tls.handshake.finished_verify_data pub fn finished_verify_data(base_secret: List[byte], transcript_hash: List[byte]) -> List[byte] — The Finished verify_data (§4.4.4): HMAC-SHA256(finished_key, Transcript-Hash), where finished_key = HKDF-Expand-Label(base_secret, "finished", "", 32) (sc20's record.finished_key). std.x.tls.handshake.finished_for pub fn finished_for(base_secret: List[byte], transcript_hash: List[byte]) -> List[byte] — The complete Finished handshake message for a sender: frame the verify_data computed from base_secret over transcript_hash. std.x.tls.handshake.ct_eq pub fn ct_eq(a: List[byte], b: List[byte]) -> bool — Constant-time-shaped byte equality (§4.4.4's compare, sc17's tag discipline): fold every position's difference into an accumulator and test ONCE at the end — no early exit on the first mismatch, no secret-dependent branch. std.x.tls.handshake.verify_finished pub fn verify_finished( base_secret: List[byte], transcript_hash: List[byte], received: List[byte], ) -> bool — Verify a peer's Finished (§4.4.4): recompute the expected verify_data from base_secret (the peer's handshake traffic secret) over transcript_hash and compare it constant-time-shaped to received. std.x.tls.handshake.accept_finished pub fn accept_finished( base_secret: List[byte], transcript_hash: List[byte], received: List[byte], ) -> int ! {decrypt_error} — Accept a peer's Finished or raise the handshake-abort alert (§4.4.4 + §6.2): return 1 when the constant-time compare holds, otherwise the decrypt_error row — a wrong Finished aborts the handshake with the named alert and NO key material exposed (the recompute reveals nothing the peer did not already send; nothing derived-onward is returned on the miss). std.x.tls.handshake.role_client pub fn role_client() -> int — The client role (0) — sends ClientHello, then receives the server's flight (ServerHello, EncryptedExtensions, Certificate, CertificateVerify, Finished), then sends its own Finished. std.x.tls.handshake.role_server pub fn role_server() -> int — The server role (1) — receives ClientHello, sends its flight, then receives the client's Finished. std.x.tls.handshake.hs_expected pub fn hs_expected(role: int, stage: int) -> int — The handshake message type the given role legally receives at stage, or -1 when the flow expects no further message (the flight is complete). std.x.tls.handshake.hs_step pub fn hs_step(role: int, stage: int, msg_type: int) -> int ! {unexpected_message} — Drive one received message through the state machine (§4.1): if msg_type is the message the flow expects next for role at stage, return the next stage; otherwise raise unexpected_message (§6.2) — the reordered/dropped/illegal-message reject, by name. std.x.tls.handshake.hs_client_flight_complete pub fn hs_client_flight_complete(stage: int) -> bool — Whether the client has received the full server flight (its own Finished is next to SEND): stage 5 after ServerHello..server Finished. std.x.tls.handshake.hs_server_complete pub fn hs_server_complete(stage: int) -> bool — Whether the server has received the client's Finished — the handshake is complete: stage 2 after ClientHello and client Finished. std.x.tls.handshake.HandshakeResult pub struct HandshakeResult { cipher_suite: int, client_handshake_secret: List[byte], server_handshake_secret: List[byte], client_application_secret: List[byte], server_application_secret: List[byte], exporter_master_secret: List[byte], resumption_master_secret: List[byte], } — The negotiated result of a completed handshake (the ws05 seam): the selected cipher_suite, the client/server handshake and application traffic secrets, and the exporter/resumption master secrets. std.x.tls.handshake.handshake_result pub fn handshake_result( cipher_suite: int, client_handshake_secret: List[byte], server_handshake_secret: List[byte], client_application_secret: List[byte], server_application_secret: List[byte], exporter_master_secret: List[byte], resumption_master_secret: List[byte], ) -> HandshakeResult — Build the frozen ws05 result (the constructor — a module-qualified struct literal handshake.HandshakeResult { } does not parse across the module boundary, E0201, so the seam is a function exactly as sha2.new256 is). std.x.tls.handshake.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list. std.x.tls.record [x] std.x.tls.record.hkdf_label pub fn hkdf_label(length: int, label: str, context: List[byte]) -> List[byte] — The HkdfLabel structure encoded to bytes (§7.1): uint16 length big-endian, then the one-byte-length-prefixed "tls13 " + label, then the one-byte-length-prefixed context. std.x.tls.record.expand_label pub fn expand_label( secret: List[byte], label: str, context: List[byte], length: int, ) -> List[byte] — HKDF-Expand-Label (§7.1): expand secret under the structured HkdfLabel to length bytes. std.x.tls.record.derive_secret pub fn derive_secret(secret: List[byte], label: str, transcript: List[byte]) -> List[byte] — Derive-Secret (§7.1): HKDF-Expand-Label with the transcript hash as context and the digest length (32) as output. std.x.tls.record.extract pub fn extract(salt: List[byte], ikm: List[byte]) -> List[byte] — HKDF-Extract (RFC 5869 §2.2) — the key schedule's extract step, a thin name over sc16's HKDF so a test can build RFC 8448's whole chain through this module alone. std.x.tls.record.traffic_key pub fn traffic_key(secret: List[byte], key_len: int) -> List[byte] — The [sender]_write_key (§7.3): expand the traffic secret under the "key" label to the AEAD's key length (32 for ChaCha20-Poly1305, 16 for AES-128-GCM — the caller states which, since it knows the suite). std.x.tls.record.traffic_iv pub fn traffic_iv(secret: List[byte]) -> List[byte] — The [sender]_write_iv (§7.3): expand the traffic secret under the "iv" label to the 12-byte IV length. std.x.tls.record.finished_key pub fn finished_key(secret: List[byte]) -> List[byte] — The Finished MAC key (§4.4.4): HKDF-Expand-Label(Secret, "finished", "", Hash.length). std.x.tls.record.record_nonce pub fn record_nonce(iv: List[byte], seq: int) -> List[byte] — The per-record nonce (§5.3): iv XOR pad_left(seq, iv_length). std.x.tls.record.content_type_application_data pub fn content_type_application_data() -> int — ContentType application_data (23) — the OUTER opaque_type of every TLSCiphertext (§5.2; the real content type hides inside the encryption). std.x.tls.record.content_type_handshake pub fn content_type_handshake() -> int — ContentType handshake (22) — a common INNER content type (the EncryptedExtensions/Certificate/Finished flight). std.x.tls.record.content_type_alert pub fn content_type_alert() -> int — ContentType alert (21) — an inner content type a record open may have to surface. std.x.tls.record.record_header pub fn record_header(length: int) -> List[byte] — The five-byte TLSCiphertext header for an encrypted record of length bytes: 17 03 03 (§5.2). std.x.tls.record.additional_data pub fn additional_data(cipher_len: int) -> List[byte] — The AEAD additional-data for a record whose ciphertext (including the 16-byte tag) is cipher_len bytes: the record header (§5.2). std.x.tls.record.inner_plaintext pub fn inner_plaintext(content: List[byte], content_type: int, pad: int) -> List[byte] — The TLSInnerPlaintext (§5.2): content || ContentType content_type || zeros[pad]. std.x.tls.record.seal pub fn seal( key: List[byte], iv: List[byte], seq: int, content_type: int, content: List[byte], pad: int, ) -> List[byte] — Seal a record (§5.2): build the TLSInnerPlaintext (content || content_type || pad zeros), AEAD-seal it under the per-record nonce with the record header as additional-data, and frame it as a TLSCiphertext (header || ciphertext || tag). std.x.tls.record.open pub fn open(key: List[byte], iv: List[byte], seq: int, record: List[byte]) -> List[byte] ! { tag, short, unexpected, } — Open a record (§5.2/§5.4): verify the tag BEFORE exposing any plaintext (sc17's discipline — a tag failure returns with ZERO plaintext), then strip the padding by scanning from the end for the content-type octet, and return the deprotected inner plaintext (content || content_type, padding removed). std.x.tls.record.content_type_of pub fn content_type_of(inner: List[byte]) -> int — The inner content type recovered by open: the last octet of the deprotected inner plaintext (§5.4). std.x.tls.record.content_of pub fn content_of(inner: List[byte]) -> List[byte] — The inner content recovered by open: the deprotected inner plaintext with its trailing content-type octet removed (§5.4). std.x.tls.record.to_hex pub fn to_hex(b: List[byte]) -> str — Lowercase hex of a byte list.