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.
| Module | Import | Role |
|---|---|---|
arith | use 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 |
ascii | use ascii::{is_digit, is_alnum, …}; | ASCII classify / digit / case helpers |
conv | use conv::{parse_int, int_to_hex, …}; | int_to_dec / parse_int / parse_float / radix parse |
bytes | use bytes::{slice, concat, to_hex, …}; | [byte] helpers; Bytes wrapper; hex encode/decode |
text | use 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) |
encoding | use encoding::{encode, decode}; | Standard Base64 encode/decode |
fmt | use fmt::{Buf, pad_left, …}; | Incremental string builder (Buf) and padding helpers |
collections | use collections::{sort, sort_by, reverse, …}; | Stable mergesort / sort_by (T -> K with K: Ord) / reverse / collect_ints; strings sort by UTF-8 bytes |
collections::vec | use collections::vec::{map, filter, chunks, windows, partition, …}; | Vec<T> helpers: map / filter / chunks / windows / partition / first / contains / … |
collections::map | use collections::map::{HashMap}; | Chaining hash map (Eq+Hash); get(k) -> Option<V>, get_or(k, fallback) |
collections::set | use collections::set::{HashSet}; | Unique-value set backed by HashMap<T, bool> |
collections::list | use collections::list::{List}; | Mutable deque (singly-linked); peek_* / pop_* → Option |
collections::deque | use collections::deque::{VecDeque}; | Ring-buffer deque over growable Vec; O(1) push/pop at both ends |
collections::bitset | use collections::bitset::{BitSet}; | Dense bit set of non-negative int indices; 63 bits per int word |
collections::tree | use collections::tree::{TreeMap}; | Mutable BST map over Ord+Eq; remove / min / max / iter |
num | use 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 |
random | use random::{Rng}; | Seeded Rng PRNG (from_time mixes coil-time timestamps as ints) |
path | use path::{Path}; | Path value: join / normalize / components / FS + file I/O |
io::sync | use io::sync::{write_all, copy, …}; | Blocking adapters — IO adapters |
io::file | use io::file::{read_text, append_bytes, …}; | Whole-file read/write/append — IO adapters |
Notes#
- Prefer byte offsets for
text::slice/rfind/Spanoffsets (mid-codepoint slices error on decode). - Byte constants use single-byte string literals (
"/","\n") underbyte/[byte]expected types; whole strings coerce to[byte]/[byte; N]too. numis named so a projectmath.hydoes 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/partitionaccept open-Tlambdas;foldis currently available forVec<int>only.chunksis the only name (nochunkalias).windowsis overlapping exact-size slices; empty whensize <= 0orsize > len.partitionreturnsPartitioned<T>(matched()/rest()), a named pair rather thanVec<Vec<T>>, so buckets are not positional[0]/[1].sort_by<T, K: Ord>uses the sameT -> K/K: Ordstory asmap+sort.sorton aVec<string>orders byte-wise (UTF-8, case-sensitive:"B"before"a", a prefix first), as<on strings does.BitSet::with_capacity/capacityare in bits. Storage isVec<int>with 63 usable bits per word (Coilintis signed 64-bit; sign bit unused).
What the compiler does not provide as builtins: not-builtins.