Module catalog

use path::* is banned (E0124). List names explicitly.

IEEE float math is auto-imported from virtual prelude::math in the compiler — not this package: sin/cos/tan/sqrt/floor/ceil/ exp/ln, atan/atan2/asin/acos, log10/log2/cbrt, and sinh/cosh/tanh. num does not re-export those. Float power and remainder are the ** and % operators (num has no pow; overflow-aware int powers are arith’s checked_pow and friends). Named float constants PI, E, and TAU live on num as compile-time const (not HostInvoke).

HTTP lives in the separate coil-http package (use http::client::{Client};). CSPRNG is crypto::random_u64 / random_bytes on coil-crypto.

JSON lives in the separate coil-json package (use json::{Json, JsonValue, JsonError};). There is no in-tree codec::json. This package does not re-export it. See JSON.

ModuleImportRole
arithuse arith::{INT_MAX, INT_MIN, Checked, Wrapping, …};Explicit int overflow for add/sub/mul/neg/pow: checked_* (Option), wrapping_* (mod 2^64), saturating_*, overflowing_* ((int, bool)); plain + - * panic on overflow. checked_shl/shr, wrapping_shl/shr (count & 63) and overflowing_shl/shr take a shift count outside 0..=63, which << / >> trap on
asciiuse ascii::{is_digit, is_alnum, …};ASCII classify / digit / case helpers
convuse conv::{parse_int, int_to_hex, …};int_to_dec / parse_int / parse_float / radix parse
bytesuse bytes::{slice, concat, to_hex, …};[byte] helpers; Bytes wrapper; hex encode/decode
textuse text::{Searchable, trim, rfind, …};String helpers via UTF-8 bytes (virtual string owns format / to_bytes). Searchable gives string (and any Show type with an empty impl) pattern methods: "foobar".contains(p), starts_with / ends_with / find / find_all / split / split_once / replace_first / replace_all, where p is a string or any Pattern (coil-regex’s Regex)
encodinguse encoding::{encode, decode};Standard Base64 encode/decode
fmtuse fmt::{Buf, pad_left, …};Incremental string builder (Buf) and padding helpers
collectionsuse collections::{sort, sort_by, reverse, …};Stable mergesort / sort_by (T -> K with K: Ord) / reverse / collect_ints; strings sort by UTF-8 bytes
collections::vecuse collections::vec::{map, filter, chunks, windows, partition, …};Vec<T> helpers: map / filter / chunks / windows / partition / first / contains / …
collections::mapuse collections::map::{HashMap};Chaining hash map (Eq+Hash); get(k) -> Option<V>, get_or(k, fallback)
collections::setuse collections::set::{HashSet};Unique-value set backed by HashMap<T, bool>
collections::listuse collections::list::{List};Mutable deque (singly-linked); peek_* / pop_* → Option
collections::dequeuse collections::deque::{VecDeque};Ring-buffer deque over growable Vec; O(1) push/pop at both ends
collections::bitsetuse collections::bitset::{BitSet};Dense bit set of non-negative int indices; 63 bits per int word
collections::treeuse collections::tree::{TreeMap};Mutable BST map over Ord+Eq; remove / min / max / iter
numuse num::{PI, E, TAU, abs, min, signum, gcd, …};Float constants PI/E/TAU; helpers: abs, min/max/clamp over Ord, round, signum, gcd/lcm, trunc/fract, NaN/inf checks, euclidean div/rem, hypot
randomuse random::{Rng};Seeded Rng PRNG (from_time mixes coil-time timestamps as ints)
pathuse path::{Path};Path value: join / normalize / components / FS + file I/O
io::syncuse io::sync::{write_all, copy, …};Blocking adapters — IO adapters
io::fileuse io::file::{read_text, append_bytes, …};Whole-file read/write/append — IO adapters

Notes#

  • Prefer byte offsets for text::slice / rfind / Span offsets (mid-codepoint slices error on decode).
  • Byte constants use single-byte string literals ("/", "\n") under byte / [byte] expected types; whole strings coerce to [byte] / [byte; N] too.
  • num is named so a project math.hy does not shadow it.
  • Collections that are type-tied should be methods (m.insert(k, v)). Cross-module user classes are still limited in the language .
  • collections::vec::map / filter / partition accept open-T lambdas; fold is currently available for Vec<int> only.
  • chunks is the only name (no chunk alias). windows is overlapping exact-size slices; empty when size <= 0 or size > len.
  • partition returns Partitioned<T> (matched() / rest()), a named pair rather than Vec<Vec<T>>, so buckets are not positional [0]/[1].
  • sort_by<T, K: Ord> uses the same T -> K / K: Ord story as map + sort.
  • sort on a Vec<string> orders byte-wise (UTF-8, case-sensitive: "B" before "a", a prefix first), as < on strings does.
  • BitSet::with_capacity / capacity are in bits. Storage is Vec<int> with 63 usable bits per word (Coil int is signed 64-bit; sign bit unused).

What the compiler does not provide as builtins: not-builtins.

Synced from coil-stdlib/docs/modules.md . Edit it there; changes reach this site on the next package sync.

↑ ↓ navigate ↵ open