Standard Library

The Quadrate standard library provides modules for common programming tasks.

Using Modules

Import a module with use:

use strings
use math

fn main() {
    "hello" strings::upper print nl  // HELLO
    16.0 math::sqrt print nl  // 4
}

Fallible Functions

Functions marked with ! can fail and require error handling:

use strings

fn main() {
    "hello" 0 3 strings::substring! print nl  // "hel"
}

Available Modules

Module Description
base64 Base64 encoding and decoding.
bits Bitwise operations for integer manipulation.
bytes Byte array operations and endianness conversion.
crypto Cryptographic hash functions, checksums, and HMAC.
ct Generic container types.
flag Command-line flag parsing.
fmt Formatted output functions.
fuzzy Minimum of two integers.
hex Hexadecimal encoding and decoding.
hof Higher-Order Function combinators.
http HTTP module.
io File and stream I/O operations.
json JSON parsing and querying without AST construction.
limits Numeric limits and constants.
log Logging module - structured logging with levels and rotation...
math Mathematical functions and constants.
mem Low-level memory allocation and manipulation.
net TCP network operations.
os Operating system interface.
path File path manipulation functions.
rand Random number generation using xorshift64* algorithm.
regex Regular expression matching using Thompson NFA.
sb StringBuilder - Efficient string building.
signal Unix signal handling with polling-based API.
sort Sorting algorithms for arrays.
strconv String to number conversions.
strings String manipulation functions.
term Terminal colors and formatting using ANSI escape codes.
testing Testing utilities for unit tests.
thread Thread module - threading primitives using C11 threads.
time Time operations and duration constants.
tls TLS/SSL secure socket operations.
tty Terminal detection and information.
unicode Unicode character constants and classification.
uri URI encoding, decoding, and parsing.
uuid UUID generation (version 4 random UUIDs).