Std Package
The Std package is the Rux standard library — the core set of types and functions available to every program. It is developed at github.com/rux-lang/Std and is organized into modules: a core Std module of types and functions available everywhere, plus submodules such as Std::Io, Std::Memory, and Std::Math.
Unstable API
The standard library is under active development and its API is not yet stable. Names, signatures, and behavior may change between releases, and this documentation will be updated to match. Pin a specific version of Std if you need a stable surface, and expect to revisit your code when upgrading.
Installation
Add the standard library to your project, then install dependencies:
rux add Std
rux installImport the modules, types, or functions you need:
import Std::Io::*;
import Std::Memory::*;
import Std::Math;Contents
Module Std
Core types and functions available without a submodule prefix.
| Symbol | Description |
|---|---|
Assert | Abort the program if a condition is false. |
Display | Interface for converting a value to a String. |
Exit | Terminate the process with an exit code. |
Fatal | Report an unrecoverable error and terminate. |
Format | Build a String from a format string and arguments. |
String | A heap-allocated UTF-8 string. |
StringBuilder | A growable buffer for building strings efficiently. |
| Floating-point helpers | IsNan and IsInfinite for float64. |
Module Std::Io
Console input and output.
| Function | Description |
|---|---|
Print | Write a value to standard output, without a newline. |
PrintLine | Write a value to standard output, followed by a newline. |
ReadLine | Read a line of text from standard input. |
Module Std::Memory
Raw heap allocation and memory manipulation.
| Function | Description |
|---|---|
Alloc | Allocate a block of uninitialized memory on the heap. |
Compare | Compare two blocks byte by byte. |
Copy | Copy bytes between non-overlapping blocks. |
Free | Release a heap block previously returned by Alloc/Realloc. |
Realloc | Resize a previously allocated block, preserving its contents. |
Set | Fill a block with a byte value. |
Zero | Fill a block with zeros. |
Module Std::Math
Mathematical constants and floating-point functions.
| Topic | Description |
|---|---|
Std::Math | Pi/E, trigonometry, powers, roots, and rounding. |
Module Std::Random
Seeded pseudo-random number generation.
| Topic | Description |
|---|---|
Std::Random | Random integers, floats, and booleans from a seed. |
Collections
| Module | Description |
|---|---|
Std::HashMap | Hash map from integer keys to pointer values. |
Std::HashSet | Hash set of integers. |
Encoding & hashing
| Module | Description |
|---|---|
Std::Base64 | Base64 encoding and decoding. |
Std::Hash | BLAKE2/3, SHA-0/1/256/512, and MD5 digests. |
Std::Hex | Hexadecimal encoding and decoding. |
System
| Module | Description |
|---|---|
Std::Sort | In-place sorting of integer arrays. |
Std::Time | Sleeping, monotonic timing, and wall-clock time. |
Std::UUID | Generate, format, and validate version-4 UUIDs. |