Table of Contents
modstd::arrayFunctions: 2 | Objects: 2 | Implementations: 5modstd::asyncRe-Exports: 1modstd::async::typesType Aliases: 1 | Objects: 1modstd::boxObjects: 1modstd::bytesType Aliases: 1 | Objects: 2 | Implementations: 2modstd::dequeObjects: 1 | Implementations: 1modstd::dictObjects: 2 | Traits: 1 | Implementations: 6modstd::encodingRe-Exports: 5modstd::encoding::asciiFunctions: 1modstd::encoding::base64Functions: 3modstd::encoding::errorsFunctions: 3 | Objects: 1modstd::encoding::hexFunctions: 3modstd::enumsMacros: 1modstd::envFunctions: 8 | Effects: 1modstd::errorFunctions: 2 | Objects: 2 | Traits: 1modstd::fetchFunctions: 9 | Type Aliases: 1 | Objects: 3 | Effects: 1 | Implementations: 2modstd::fsFunctions: 7 | Effects: 1modstd::inputFunctions: 6 | Objects: 1 | Effects: 1 | Implementations: 1modstd::jsonFunctions: 4 | Type Aliases: 1 | Objects: 7modstd::logFunctions: 20 | Type Aliases: 3 | Objects: 10 | Effects: 1modstd::mathRe-Exports: 10modstd::math::constantsModule Lets: 14 | Functions: 4modstd::math::errorsFunctions: 4 | Objects: 1modstd::math::floatFunctions: 46modstd::math::intFunctions: 19modstd::math::interpolateFunctions: 28modstd::memoryFunctions: 9modstd::msgpackRe-Exports: 10 | Functions: 23modstd::msgpack::errorsObjects: 1modstd::msgpack::fnsType Aliases: 1modstd::msgpack::typesType Aliases: 1 | Objects: 7modstd::numberRe-Exports: 2modstd::number::castFunctions: 24 | Objects: 1modstd::optionalRe-Exports: 2 | Macros: 2modstd::optional::fnsMacros: 2 | Functions: 10modstd::optional::typesType Aliases: 2 | Objects: 2modstd::outputFunctions: 20 | Type Aliases: 1 | Objects: 2 | Effects: 1modstd::pathObjects: 1 | Implementations: 1modstd::pkgRe-Exports: 87 | Macros: 4modstd::preludeRe-Exports: 48 | Macros: 2modstd::randomFunctions: 12 | Objects: 2 | Effects: 1 | Implementations: 1modstd::rangeObjects: 1 | Implementations: 1modstd::resultRe-Exports: 2modstd::result::fnsFunctions: 7modstd::result::typesType Aliases: 1 | Objects: 3modstd::setObjects: 1 | Implementations: 1modstd::stringRe-Exports: 7 | Functions: 2modstd::string::indexObjects: 1 | Implementations: 1modstd::string::typeType Aliases: 1 | Objects: 5 | Implementations: 3modstd::subscriptTraits: 2modstd::taskFunctions: 6 | Type Aliases: 1 | Objects: 2 | Effects: 1 | Implementations: 2modstd::testRe-Exports: 1modstd::test::assertionsFunctions: 3 | Effects: 1modstd::timeFunctions: 5 | Objects: 4 | Effects: 1 | Implementations: 4modstd::traitsRe-Exports: 19 | Macros: 1modstd::traits::cloneTraits: 2modstd::traits::collectTraits: 1modstd::traits::convertTraits: 4modstd::traits::defaultTraits: 1modstd::traits::eqTraits: 1modstd::traits::hashTraits: 2modstd::traits::ordType Aliases: 1 | Objects: 3 | Traits: 1modstd::traits::sequenceMacros: 1 | Traits: 2modstd::versionFunctions: 2modstd::vxFunctions: 1
mod std::array
Growable contiguous arrays with copy-on-write storage.
Supports negative indexing, range slicing, and eager sequence transforms.
Functions
fn new_array<T>({ from source: FixedArray<T> }) -> Optional<Array<T>>
Creates an array from fixed storage, returning None when null entries are present.
fn new_array_unchecked<T>({ from source: FixedArray<T> }) -> Array<T>
Creates an array from fixed storage without null-entry checks.
Objects
obj Array<T>
A growable contiguous collection with copy-on-write semantics.
impl<T> Array<T>
impl<T> Array<T> for Sequence<T>
impl<T> Array<T> for SubscriptRead<i32, Optional<T>>
impl<T> Array<T> for SubscriptRead<Range<i32>, Array<T>>
impl<T> Array<T> for SubscriptWrite<i32, T>
obj ArrayPop<T>
Result payload returned by Array::popped.
mod std::async
Re-Exports
pub types::all
mod std::async::types
Async completion type definitions.
Defines the shared completion vocabulary for values that may become ready later.
Type Aliases
type Completion<T, E> = |(Result<T, E>, Cancelled)
Cancellation-aware completion alias.
Async work completes with either a success value, an error, or cancellation.
Objects
obj Cancelled
Completion variant for work cancelled before producing a value or error.
mod std::box
Objects
obj Box<T>
Generic single-value container.
mod std::bytes
Byte-oriented collection types.
Bytes is an immutable view over byte data and ByteBuffer is a mutable,
growable builder. These types are useful for protocol work, file formats,
and interop with UTF-8 string APIs.
Example:
String::from_utf8(buffer.as_bytes().to_array())
converts buffered bytes into a validated String.
Type Aliases
type Byte = i32
A single byte value in the range 0..255.
Objects
obj Bytes
An immutable byte sequence view.
impl Bytes
obj ByteBuffer
A mutable, growable byte buffer.
impl ByteBuffer
mod std::deque
Double-ended queue built on top of std::array::Array.
Front operations are convenient but shift storage, so they are not constant-time.
Objects
obj Deque<T>
A double-ended queue.
Example:
let ~queue = Deque<i32>::init()
queue.push_back(1)
queue.push_front(0)
impl<T> Deque<T>
mod std::dict
Hash-map style dictionary collection.
Provides key/value storage with entry APIs, merge helpers, and iteration utilities.
Keys must implement DictKey<K> to supply hash and equality behavior.
Objects
obj DictEntry<K, V>
Entry handle for conditional dictionary updates.
Use this value with or_insert, or_insert_with, and and_modify.
impl<K, V> DictEntry<K, V>
obj Dict<K, V>
Mutable dictionary with hash-bucket storage.
Stores values by key and preserves only one value per key.
impl<K, V> Dict<K, V>
impl<K, V> Dict<K, V> for SubscriptRead<K, Optional<V>>
impl<K, V> Dict<K, V> for SubscriptWrite<K, V>
Traits
trait DictKey<K>
Key behavior required by Dict<K, V>.
Implementors define stable hashing and equality for dictionary lookups.
Implementations
impl<T> Array<T>
impl String for DictKey<String>
mod std::encoding
Text/binary encoding helpers and shared decode error types.
Re-Exports
pub ascii
pub errors
pub hex
pub base64
pub errors::DecodeError
mod std::encoding::ascii
ASCII normalization helpers for byte-to-string conversions.
Functions
fn ascii_string_from(bytes: Array<i32>) -> String
Builds a safe string from ASCII byte values.
Params:
bytes: Byte values expected to be ASCII.
Any byte outside the 0-127 range is replaced with ? (63).
mod std::encoding::base64
RFC 4648 base64 encode/decode helpers.
Functions
fn encode(bytes: Bytes) -> String
Encodes bytes as RFC 4648 base64 (with = padding).
Params:
bytes: Raw bytes to encode.
Returns an ASCII base64 string.
Example:
use std::encoding::base64
use std::bytes::ByteBuffer
let source = ByteBuffer::from_utf8("voyd")
let encoded = base64::encode(source.as_bytes())fn decode(s: String) -> Result<Bytes, DecodeError>
Decodes a base64 string into bytes.
fn decode(s: StringSlice) -> Result<Bytes, DecodeError>
Decodes a base64 string into bytes.
Params:
s: Base64 text with optional=padding.
Returns:
Ok<Bytes>for valid base64 input.Err<DecodeError>for invalid length, invalid characters, or invalid padding.
Example:
use std::encoding::base64
let decoded = base64::decode("dm95ZA==".as_slice())mod std::encoding::errors
Encoding-specific decode error definitions.
Functions
fn decode_error_invalid_length(message: String): () -> DecodeError
fn decode_error_invalid_character(message: String): () -> DecodeError
fn decode_error_invalid_padding(message: String): () -> DecodeError
Objects
obj DecodeError
mod std::encoding::hex
Lower-case hexadecimal encode/decode helpers.
Functions
fn encode(bytes: Bytes) -> String
Encodes bytes as lower-case hexadecimal.
Params:
bytes: Raw bytes to encode.
Returns an ASCII hex string that is always lower-case.
Example:
use std::encoding::hex
use std::bytes::ByteBuffer
let source = ByteBuffer::from_utf8("ok")
let encoded = hex::encode(source.as_bytes())fn decode(s: String) -> Result<Bytes, DecodeError>
Decodes a hexadecimal string into bytes.
fn decode(s: StringSlice) -> Result<Bytes, DecodeError>
Decodes a hexadecimal string into bytes.
Params:
s: Hex text using two digits per byte.
Returns:
Ok<Bytes>for valid hex input.Err<DecodeError>when the length is odd or any character is not hex.
Example:
use std::encoding::hex
let decoded = hex::decode("766f7964".as_slice())mod std::enums
Macros
macro enum
Quick way to define a union type with multiple inline object variants.
For example:
enum Result
Foo<T> { value: T }
Bar { value: i32 }
Bazmod std::env
Environment variable access backed by host process APIs.
std::env exposes typed reads for string/boolean/integer values plus a host-backed
mutation API for setting variables.
Functions
fn get(key: String): Env -> Option<String>
Reads an environment variable as a string, returning None when the key is missing.
fn get(key: StringSlice): Env -> Option<String>
fn get_bool(key: String): Env -> Option<bool>
Reads an environment variable and parses it as a boolean.
fn get_bool(key: StringSlice): Env -> Option<bool>
fn get_int(key: String): Env -> Option<i32>
Reads an environment variable and parses it as a 32-bit integer.
fn get_int(key: StringSlice): Env -> Option<i32>
fn set(key: String, value: String): Env -> Result<Unit, HostError>
Sets an environment variable to the provided string value.
fn set(key: StringSlice, value: StringSlice): Env -> Result<Unit, HostError>
Effects
eff Env
Host environment effect used by std::env.
Operations in this effect mirror host process environment APIs and exchange
MessagePack payloads for typed decoding in this module.
mod std::error
Shared runtime and host error definitions for the standard library.
Domain-specific parse and codec errors live with their owning modules.
std::error only defines cross-cutting runtime failures plus panic support.
Functions
fn panic(message: String) -> void
Stops execution immediately with a panic.
When host/runtime diagnostics are available, the panic message is preserved
so runtimes can surface human-readable failure context instead of a bare trap.
fn panic(message: StringSlice) -> void
Objects
obj HostError
obj IoError
Traits
trait Error<T>
mod std::fetch
HTTP request/response helpers backed by the host networking runtime.
std::fetch is organized around FetchRequest for deliberate request
construction, plus get and post helpers for the common cases. Requests
cross the host boundary as MessagePack DTOs and come back as
Result<FetchResponse, HostError>.
Functions
fn header(
{
name: String
value: String
}
): () -> FetchHeader
Creates one header value.
fn header(
{
name: StringSlice
value: StringSlice
}
): () -> FetchHeader
Shorthand for header with string-slice inputs.
fn request({ request: FetchRequest }): Fetch -> Result<FetchResponse, HostError>
Sends an HTTP request.
This is the canonical send path for pre-built FetchRequest values.
Use it when request construction and request execution should stay separate.
fn request(
{
method: String
url: String
headers?: FetchHeaders
body?: String
timeout_millis?: i32
}
): Fetch -> Result<FetchResponse, HostError>
Sends an HTTP request from explicit values.
This is the convenience entry point when building a one-off request inline.
fn request(
{
method: StringSlice
url: StringSlice
headers?: FetchHeaders
body?: StringSlice
timeout_millis?: i32
}
): Fetch -> Result<FetchResponse, HostError>
Shorthand for request with string-slice inputs.
fn get(url: String): Fetch -> Result<FetchResponse, HostError>
Sends a GET request.
fn get(url: StringSlice): Fetch -> Result<FetchResponse, HostError>
Shorthand for get(url.to_string()).
fn post(
{
url: String
body: String
}
): Fetch -> Result<FetchResponse, HostError>
Sends a POST request with a UTF-8 text body.
fn post(
{
url: StringSlice
body: StringSlice
}
): Fetch -> Result<FetchResponse, HostError>
Shorthand for post with string-slice inputs.
Type Aliases
type FetchHeaders = Array<FetchHeader>
Objects
obj FetchHeader
obj FetchRequest
impl FetchRequest
obj FetchResponse
impl FetchResponse
Effects
eff Fetch
Host networking effect used by std::fetch.
The payload is a MessagePack map with request metadata and optional body/timeout.
mod std::fs
File system APIs backed by host runtime operations.
std::fs provides read/write/existence/listing helpers that operate on
std::path::Path and return typed Result values where host I/O can fail.
All effect payloads are MessagePack-encoded DTOs.
Functions
fn read_bytes(path: Path): Fs -> Result<Bytes, IoError>
Reads a file as raw bytes.
Example:
let bytes = fs::read_bytes(Path::new("./image.bin".as_slice()))
fn read_string(path: Path): Fs -> Result<String, IoError>
Reads text from a file.
This expects host-side UTF-8 text decoding.
fn write_bytes(path: Path, bytes: Bytes): Fs -> Result<Unit, IoError>
Writes bytes to a file.
Example:
let write_result = fs::write_bytes(file_path, payload)
fn write_string(path: Path, value: String): Fs -> Result<Unit, IoError>
Writes text to a file.
Example:
let write_result = fs::write_string(file_path, "hello".as_slice())
fn write_string(path: Path, value: StringSlice): Fs -> Result<Unit, IoError>
Writes text to a file.
fn exists(path: Path): Fs -> bool
Returns true when the path exists in the file system.
fn list_dir(path: Path): Fs -> Result<Array<Path>, IoError>
Lists child paths in a directory.
Each returned Path is decoded from host-provided string entries.
Effects
eff Fs
Host file-system effect used by std::fs.
Operations in this effect proxy host file APIs using MessagePack payloads
and return DTOs decoded by helper functions in this module.
mod std::input
Standard input helpers backed by host-provided input streams.
std::input supports line-based reads, raw byte reads, and terminal detection.
Host interactions are encoded as MessagePack DTOs and decoded into typed results.
Functions
fn read_line(): Input -> Result<Option<String>, HostError>
Reads a line from stdin (or host prompt source).
Returns Ok(None) at end-of-input.
fn read_line(prompt: StringSlice): Input -> Result<Option<String>, HostError>
Reads a line using a prompt.
Example:
let next = input::read_line("> ".as_slice())
fn read_line(prompt: String): Input -> Result<Option<String>, HostError>
Reads a line using a prompt.
fn read_line(request: InputRequest): Input -> Result<Option<String>, HostError>
Reads a line using an explicit request value.
fn read_bytes(max_bytes: i32): Input -> Result<Option<Bytes>, IoError>
Reads up to max_bytes raw bytes from stdin.
Returns Ok(None) when no more bytes are available.
fn is_tty(): Input -> bool
Returns true when stdin is attached to an interactive terminal.
Objects
obj InputRequest
impl InputRequest
Effects
eff Input
Host input effect used by std::input.
Operations in this effect map host stdin facilities into typed MessagePack
DTOs consumed by this module.
mod std::json
JSON value model and UTF-8 parser/serializer helpers.
Use parse to decode JSON text into JsonValue and stringify/stringify_pretty
to encode values back to text. Stringification is fallible because JSON
numbers must be finite.
Functions
fn parse(source: String) -> Result<JsonValue, JsonError>
Parses UTF-8 JSON text into a JsonValue.
Params:
source: JSON source text.
Returns:
Ok<JsonValue>when the full input parses successfully.Err<JsonError>for malformed JSON or trailing characters.
Example:
use std::json
let parsed = json::parse("{\"ok\":true}")fn parse(source: StringSlice) -> Result<JsonValue, JsonError>
fn stringify(value: JsonValue) -> Result<String, JsonError>
Serializes a JsonValue to compact JSON text.
Params:
value: JSON value to serialize.
Returns Err(JsonError) when serialization would produce invalid JSON, such
as a JsonNumber containing NaN or infinity.
Example:
use std::json
let text = json::stringify(JsonBool { value: true })fn stringify_pretty(value: JsonValue) -> Result<String, JsonError>
Serializes a JsonValue to pretty JSON text with indentation.
Params:
value: JSON value to serialize.
Returns Err(JsonError) when serialization would produce invalid JSON.
Type Aliases
type JsonValue = |(JsonNull, |(JsonBool, |(JsonNumber, |(JsonString, |(JsonArray, JsonObject)))))
Tagged union over all supported JSON value variants.
Objects
obj JsonError
obj JsonNull
Represents the JSON null literal.
obj JsonBool
Represents a JSON boolean literal.
obj JsonNumber
Represents a JSON number.
obj JsonString
Represents a JSON string.
obj JsonArray
Represents a JSON array.
obj JsonObject
Represents a JSON object keyed by strings.
mod std::log
Structured logging primitives backed by a host logging sink.
std::log exposes level-specific helpers and typed field values for structured
payloads. Messages and fields are encoded as MessagePack maps/arrays.
Functions
fn trace(message: StringSlice): Log -> void
Emits a trace-level log message.
fn trace(message: String): Log -> void
Emits a trace-level log message.
fn trace(message: StringSlice, fields: LogFields): Log -> void
Emits a trace-level log message.
fn trace(message: String, fields: LogFields): Log -> void
Emits a trace-level log message.
fn debug(message: StringSlice): Log -> void
Emits a debug-level log message.
fn debug(message: String): Log -> void
Emits a debug-level log message.
fn debug(message: StringSlice, fields: LogFields): Log -> void
Emits a debug-level log message.
fn debug(message: String, fields: LogFields): Log -> void
Emits a debug-level log message.
fn info(message: StringSlice): Log -> void
Emits an info-level log message.
fn info(message: String): Log -> void
Emits an info-level log message.
fn info(message: StringSlice, fields: LogFields): Log -> void
Emits an info-level log message.
fn info(message: String, fields: LogFields): Log -> void
Emits an info-level log message.
fn warn(message: StringSlice): Log -> void
Emits a warning-level log message.
fn warn(message: String): Log -> void
Emits a warning-level log message.
fn warn(message: StringSlice, fields: LogFields): Log -> void
Emits a warning-level log message.
fn warn(message: String, fields: LogFields): Log -> void
Emits a warning-level log message.
fn error(message: StringSlice): Log -> void
Emits an error-level log message.
fn error(message: String): Log -> void
Emits an error-level log message.
fn error(message: StringSlice, fields: LogFields): Log -> void
Emits an error-level log message.
fn error(message: String, fields: LogFields): Log -> void
Emits an error-level log message.
Type Aliases
type LogLevel = |(LogTrace, |(LogDebug, |(LogInfo, |(LogWarn, LogError))))
type LogFieldValue = |(LogString, |(LogInt, |(LogFloat, LogBool)))
type LogFields = Array<LogField>
Objects
obj LogTrace
obj LogDebug
obj LogInfo
obj LogWarn
obj LogError
obj LogString
obj LogInt
obj LogFloat
obj LogBool
obj LogField
Effects
eff Log
Host logging effect used by std::log.
std::log converts typed log-level and field values into a MessagePack map
consumed by the host log sink.
mod std::math
Math APIs for integer, float, interpolation, constants, and math errors.
Import through std::math for namespaced calls (for example,
math::pow(2.0, 3.0)), or import math::all to enable UFCS-style calls
such as 2.0.pow(3.0).
Re-Exports
pub constants
pub errors
pub float
pub int
pub interpolate
pub errors::MathError
pub constants::all
pub float::all
pub int::all
pub interpolate::all
mod std::math::constants
Mathematical constants and unit conversion helpers.
Module Lets
let PI
Archimedes' constant (Ï€) as f64.
let PI_F32: f32
Archimedes' constant (Ï€) as f32.
let TAU
Tau (2Ï€) as f64.
let TAU_F32: f32
Tau (2Ï€) as f32.
let E
Euler's number (e) as f64.
let E_F32: f32
Euler's number (e) as f32.
let INFINITY
Positive infinity as f64.
let INFINITY_F32: f32
Positive infinity as f32.
let NEG_INFINITY
Negative infinity as f64.
let NEG_INFINITY_F32: f32
Negative infinity as f32.
let NAN
Not-a-number as f64.
let NAN_F32: f32
Not-a-number as f32.
let EPSILON
Difference between 1.0 and the next representable f64.
let EPSILON_F32: f32
Difference between 1.0 and the next representable f32.
Functions
fn deg_to_rad(value: f64) -> f64
Converts degrees to radians.
value is interpreted as degrees.
fn deg_to_rad(value: f32) -> f32
Converts degrees to radians.
fn rad_to_deg(value: f64) -> f64
Converts radians to degrees.
value is interpreted as radians.
fn rad_to_deg(value: f32) -> f32
Converts radians to degrees.
mod std::math::errors
Math-specific error types and stable error code helpers.
Functions
fn math_error_code_invalid_input() -> i32
Error code for invalid input values.
fn math_error_code_overflow() -> i32
Error code for overflow conditions.
fn math_error_code_divide_by_zero() -> i32
Error code for divide-by-zero conditions.
fn math_error<T>(code: i32) -> Result<T, MathError>
Constructs a MathError result with the provided code.
Objects
obj MathError
Error type returned by fallible std math APIs.
mod std::math::float
Floating-point and numeric helper APIs used by std::math.
Functions in this module favor direct Wasm intrinsics for predictable
runtime behavior across hosts.
Functions
fn abs(value: i32) -> Result<i32, MathError>
Returns the absolute value, rejecting signed overflow.
fn abs(value: i64) -> Result<i64, MathError>
Returns the absolute value, rejecting signed overflow.
fn abs(value: f64) -> f64
Returns the absolute value.
fn abs(value: f32) -> f32
Returns the absolute value.
fn signum(value: i32) -> i32
Returns the sign of value as -1, 0, or 1.
fn signum(value: i64) -> i64
Returns the sign of value as -1, 0, or 1.
fn signum(value: f64) -> f64
Returns the sign of value as -1, 0, or 1.
Returns NaN unchanged.
fn signum(value: f32) -> f32
Returns the sign of value as -1, 0, or 1.
Returns NaN unchanged.
fn floor(value: f64) -> f64
Rounds value down to the nearest integer.
fn floor(value: f32) -> f32
Rounds value down to the nearest integer.
fn ceil(value: f64) -> f64
Rounds value up to the nearest integer.
fn ceil(value: f32) -> f32
Rounds value up to the nearest integer.
fn round(value: f64) -> f64
Rounds value to the nearest integer using ties-to-even semantics.
fn round(value: f32) -> f32
Rounds value to the nearest integer using ties-to-even semantics.
fn trunc(value: f64) -> f64
Rounds value toward zero.
fn trunc(value: f32) -> f32
Rounds value toward zero.
fn fract(value: f64) -> f64
Returns the fractional component of value.
fn fract(value: f32) -> f32
Returns the fractional component of value.
fn sqrt(value: f64) -> f64
Returns the square root of value.
fn sqrt(value: f32) -> f32
Returns the square root of value.
fn hypot(x: f64, y: f64) -> f64
Returns the Euclidean norm of (x, y): sqrt(xx + yy).
fn hypot(x: f32, y: f32) -> f32
Returns the Euclidean norm of (x, y): sqrt(xx + yy).
fn pow(value: f64, exponent: f64) -> f64
Raises value to the power of exponent.
fn pow(value: f32, exponent: f32) -> f32
Raises value to the power of exponent.
fn sin(value: f64) -> f64
Returns the sine of value (radians).
fn sin(value: f32) -> f32
Returns the sine of value (radians).
fn cos(value: f64) -> f64
Returns the cosine of value (radians).
fn cos(value: f32) -> f32
Returns the cosine of value (radians).
fn tan(value: f64) -> f64
Returns the tangent of value (radians).
fn tan(value: f32) -> f32
Returns the tangent of value (radians).
fn atan2(y: f64, x: f64) -> f64
Returns the angle in radians between the positive x-axis and (x, y).
Parameter order follows atan2(y, x).
fn atan2(y: f32, x: f32) -> f32
Returns the angle in radians between the positive x-axis and (x, y).
Parameter order follows atan2(y, x).
fn ln(value: f64) -> f64
Returns the natural logarithm (base e).
fn ln(value: f32) -> f32
Returns the natural logarithm (base e).
fn log2(value: f64) -> f64
Returns the base-2 logarithm.
fn log2(value: f32) -> f32
Returns the base-2 logarithm.
fn log10(value: f64) -> f64
Returns the base-10 logarithm.
fn log10(value: f32) -> f32
Returns the base-10 logarithm.
fn exp(value: f64) -> f64
Returns e raised to value.
fn exp(value: f32) -> f32
Returns e raised to value.
fn is_nan(value: f64) -> bool
Returns true when value is NaN.
fn is_nan(value: f32) -> bool
Returns true when value is NaN.
fn is_finite(value: f64) -> bool
Returns true when value is finite.
Finite means not NaN and not positive/negative infinity.
fn is_finite(value: f32) -> bool
Returns true when value is finite.
fn is_infinite(value: f64) -> bool
Returns true when value is infinite.
fn is_infinite(value: f32) -> bool
Returns true when value is infinite.
mod std::math::int
Integer math helpers for comparisons, Euclidean remainder, and
overflow-aware arithmetic operations.
Functions
fn max<T>(a: T, b: T) -> T
Returns the larger of a and b.
fn min<T>(a: T, b: T) -> T
Returns the smaller of a and b.
fn mod_euclid(value: i32, modulus: i32) -> Result<i32, MathError>
Returns the non-negative Euclidean remainder for 32-bit integers.
modulus must be greater than zero.
fn mod_euclid(value: i64, modulus: i64) -> Result<i64, MathError>
Returns the non-negative Euclidean remainder for 64-bit integers.
modulus must be greater than zero.
fn rem_euclid(value: i32, modulus: i32) -> Result<i32, MathError>
Returns the Euclidean remainder for 32-bit integers.
fn rem_euclid(value: i64, modulus: i64) -> Result<i64, MathError>
Returns the Euclidean remainder for 64-bit integers.
fn div_rem(value: i32, divisor: i32) -> (i32, i32)
Returns quotient and remainder for 32-bit integers.
divisor must not be zero.
fn div_rem(value: i64, divisor: i64) -> (i64, i64)
Returns quotient and remainder for 64-bit integers.
divisor must not be zero.
fn checked_div_rem(value: i32, divisor: i32) -> Result<(i32, i32), MathError>
Returns quotient and remainder, rejecting divide-by-zero and signed overflow.
Signed overflow covers the MIN / -1 case.
fn checked_div_rem(value: i32, { by divisor: i32 }) -> Result<(i32, i32), MathError>
Returns quotient and remainder using a labeled divisor argument.
fn checked_div_rem(value: i64, divisor: i64) -> Result<(i64, i64), MathError>
Returns quotient and remainder, rejecting divide-by-zero and signed overflow.
Signed overflow covers the MIN / -1 case.
fn checked_div_rem(value: i64, { by divisor: i64 }) -> Result<(i64, i64), MathError>
Returns quotient and remainder using a labeled divisor argument.
fn next_power_of_two(value: i32) -> Result<i32, MathError>
Returns the next power of two for a 32-bit integer.
Values less than or equal to 1 return 1.
fn is_power_of_two(value: i32) -> bool
Returns true when value is a power of two.
fn is_power_of_two(value: i64) -> bool
Returns true when value is a power of two.
fn prev_power_of_two(value: i32) -> Result<i32, MathError>
Returns the greatest power of two less than or equal to value.
value must be positive.
fn prev_power_of_two(value: i64) -> Result<i64, MathError>
Returns the greatest power of two less than or equal to value.
value must be positive.
fn next_multiple_of(value: i32, factor: i32) -> Result<i32, MathError>
Returns the smallest multiple of factor that is greater than or equal to value.
factor must be positive.
fn next_multiple_of(value: i64, factor: i64) -> Result<i64, MathError>
Returns the smallest multiple of factor that is greater than or equal to value.
factor must be positive.
mod std::math::interpolate
Interpolation and range-mapping helpers for scalar numeric values.
Includes clamping, range checks, forward interpolation, inverse
interpolation, and range remapping.
Functions
fn clamp(value: i32, min: i32, max: i32) -> i32
Clamps value into the inclusive range formed by min and max.
The bounds are normalized first, so callers do not need to pre-sort them.
fn clamp(
value: i32,
{
min: i32
max: i32
}
) -> i32
fn clamp(value: i64, min: i64, max: i64) -> i64
fn clamp(
value: i64,
{
min: i64
max: i64
}
) -> i64
fn clamp(value: f32, min: f32, max: f32) -> f32
fn clamp(
value: f32,
{
min: f32
max: f32
}
) -> f32
fn clamp(value: f64, min: f64, max: f64) -> f64
fn clamp(
value: f64,
{
min: f64
max: f64
}
) -> f64
fn between(value: i32, min: i32, max: i32) -> bool
Returns whether value lies inside the inclusive range formed by min and max.
fn between(
value: i32,
{
min: i32
max: i32
}
) -> bool
fn between(value: i64, min: i64, max: i64) -> bool
fn between(
value: i64,
{
min: i64
max: i64
}
) -> bool
fn between(value: f32, min: f32, max: f32) -> bool
fn between(
value: f32,
{
min: f32
max: f32
}
) -> bool
fn between(value: f64, min: f64, max: f64) -> bool
fn between(
value: f64,
{
min: f64
max: f64
}
) -> bool
fn lerp(start: f64, end: f64, t: f64) -> f64
Returns the linear interpolation between start and end at t.
t = 0 yields start, t = 1 yields end, and values outside that range
extrapolate. Supports UFCS call style: 0.0.lerp(10.0, 0.25).
fn lerp(
start: f64,
{
to end: f64
at t: f64
}
) -> f64
fn lerp(start: f32, end: f32, t: f32) -> f32
fn lerp(
start: f32,
{
to end: f32
at t: f32
}
) -> f32
fn inverse_lerp(value: f64, start: f64, end: f64) -> f64
Returns interpolation progress of value within the range start..end.
A return value of 0 means value == start, and 1 means value == end.
Values outside the range produce progress below 0 or above 1. Supports
UFCS call style: 5.0.inverse_lerp(0.0, 10.0).
fn inverse_lerp(
value: f64,
{
start: f64
end: f64
}
) -> f64
fn inverse_lerp(value: f32, start: f32, end: f32) -> f32
fn inverse_lerp(
value: f32,
{
start: f32
end: f32
}
) -> f32
fn map_range(value: f64, in_min: f64, in_max: f64, out_min: f64, out_max: f64) -> f64
Maps value from one range into another range.
This is equivalent to lerp(out_min, out_max, inverse_lerp(value, in_min, in_max)).
Supports UFCS call style: 5.0.map_range(0.0, 10.0, 100.0, 200.0).
fn map_range(
value: f64,
{
in_min: f64
in_max: f64
out_min: f64
out_max: f64
}
) -> f64
fn map_range(value: f32, in_min: f32, in_max: f32, out_min: f32, out_max: f32) -> f32
fn map_range(
value: f32,
{
in_min: f32
in_max: f32
out_min: f32
out_max: f32
}
) -> f32
mod std::memory
Low-level WebAssembly linear memory intrinsics.
These APIs are thin wrappers over compiler intrinsics and are intended for
runtime and systems-level utilities that need explicit memory access.
Functions
fn size(): () -> i32
Returns the current WebAssembly memory size in pages.
fn grow(pages: i32): () -> i32
Grows WebAssembly linear memory by page count and returns the previous size.
fn load_u8(ptr: i32): () -> i32
Reads an unsigned 8-bit value from linear memory.
fn store_u8(ptr: i32, value: i32): () -> void
Writes an unsigned 8-bit value to linear memory.
fn load_u16(ptr: i32): () -> i32
Reads an unsigned 16-bit value from linear memory.
fn store_u16(ptr: i32, value: i32): () -> void
Writes an unsigned 16-bit value to linear memory.
fn load_u32(ptr: i32): () -> i32
Reads an unsigned 32-bit value from linear memory.
fn store_u32(ptr: i32, value: i32): () -> void
Writes an unsigned 32-bit value to linear memory.
fn copy(dest: i32, src: i32, len: i32): () -> void
Copies len bytes from src to dest in linear memory.
mod std::msgpack
Public MessagePack API surface for constructing values and encoding/decoding
them at the Wasm memory boundary.
make_ functions construct typed MessagePack values, unpack_ functions
validate and extract native values, and encode_value / decode_value
bridge MessagePack bytes across linear memory.
Re-Exports
pub fns::MsgPack
pub errors::MsgPackError
pub types::Binary
pub types::Bool
pub types::F32
pub types::F64
pub types::I32
pub types::I64
pub types::Null
pub types::Numeric
Functions
fn make_null(): () -> MsgPack
Constructs the MessagePack null value.
fn make_bool(value: bool): () -> MsgPack
fn make_string(value: String): () -> MsgPack
Constructs a MessagePack string from owned text.
fn make_string(value: StringSlice): () -> MsgPack
Shorthand for make_string(value.to_string()).
fn make_binary(value: Binary): () -> MsgPack
fn make_array(value: Array<MsgPack>): () -> MsgPack
Constructs a MessagePack array from an existing sequence of values.
fn make_f32(value: f32): () -> MsgPack
fn make_f64(value: f64): () -> MsgPack
fn make_i32(value: i32): () -> MsgPack
fn make_i64(value: i64): () -> MsgPack
fn make_map(value: Dict<String, MsgPack>): () -> MsgPack
Constructs a MessagePack map from string keys to values.
fn unpack_bool(value: MsgPack): () -> Result<bool, MsgPackError>
fn unpack_string(value: MsgPack): () -> Result<String, MsgPackError>
fn unpack_binary(value: MsgPack): () -> Result<Binary, MsgPackError>
fn unpack_array(value: MsgPack): () -> Result<Array<MsgPack>, MsgPackError>
fn unpack_f32(value: MsgPack): () -> Result<f32, MsgPackError>
Extracts an f32, accepting both MessagePack f32 and f64 values.
fn unpack_f64(value: MsgPack): () -> Result<f64, MsgPackError>
Extracts an f64, accepting both MessagePack f32 and f64 values.
fn unpack_i32(value: MsgPack): () -> Result<i32, MsgPackError>
Extracts an i32, rejecting values that overflow that range.
fn unpack_i64(value: MsgPack): () -> Result<i64, MsgPackError>
fn unpack_map(value: MsgPack): () -> Result<Dict<String, MsgPack>, MsgPackError>
Extracts a string-keyed map.
fn encode_value(value: MsgPack, ptr: i32, len: i32): () -> Result<i32, MsgPackError>
Encodes value into the caller-provided memory region [ptr, ptr + len).
Returns the number of bytes written, or Err(MsgPackError) when the region
is too small for the encoded payload.
fn decode_value(ptr: i32, len: i32): () -> Result<MsgPack, MsgPackError>
Decodes one MessagePack value from the readable memory region [ptr, ptr + len).
Returns Err(MsgPackError) when decoding fails or when trailing bytes remain
after the first value.
fn missing_field<T>(field: String): () -> Result<T, MsgPackError>
mod std::msgpack::errors
Public MessagePack boundary error definitions.
Objects
obj MsgPackError
mod std::msgpack::fns
MessagePack serializer implementation used by std::msgpack.
This module owns the in-memory codec and value constructors/unpackers.
Type Aliases
type MsgPack = |(Null, |(Numeric, |(Bool, |(String, |(Binary, |(Array<MsgPack>, MsgPackMap))))))
Recursive MessagePack value union used by the serializer boundary.
mod std::msgpack::types
Primitive wrapper types used by std::msgpack value unions.
Type Aliases
type Numeric = |(I32, |(I64, |(F32, F64)))
Numeric subset of MessagePack wrapper types.
Objects
obj I32
MessagePack 32-bit integer wrapper.
obj I64
MessagePack 64-bit integer wrapper.
obj F32
MessagePack 32-bit float wrapper.
obj F64
MessagePack 64-bit float wrapper.
obj Bool
MessagePack boolean wrapper.
obj Null
MessagePack null wrapper.
obj Binary
MessagePack binary payload wrapper.
mod std::number
Numeric conversion APIs.
Use std::number::cast for explicit primitive conversions and checked
narrowing operations, plus primitive numeric string formatting.
Re-Exports
pub cast
pub cast::all
mod std::number::cast
Primitive numeric conversion APIs.
This module centralizes numeric conversion intrinsics behind explicit,
typed std functions.
Functions
fn cast_error_code_invalid_input() -> i32
Error code for non-finite or non-integer checked float inputs.
fn cast_error_code_overflow() -> i32
Error code for values that overflow the destination type.
fn cast_error<T>(code: i32) -> Result<T, CastError>
Constructs a CastError result with the provided code.
fn to_f64(value: i32) -> f64
Converts an i32 to f64.
fn to_f64(value: i64) -> f64
Converts an i64 to f64.
fn to_f64(value: f32) -> f64
Converts an f32 to f64.
fn to_f32(value: i32) -> f32
Converts an i32 to f32.
fn to_f32(value: i64) -> f32
Converts an i64 to f32.
fn to_f32(value: f64) -> f32
Converts an f64 to f32.
fn to_i64(value: i32) -> i64
Sign-extends an i32 into i64.
fn to_i32_wrapping(value: i64) -> i32
Wraps an i64 into i32 by truncating to the low 32 bits.
fn to_i32_checked(value: i64): () -> Result<i32, CastError>
Converts an i64 to i32, returning overflow on narrowing failure.
fn to_i32_checked(value: f32): () -> Result<i32, CastError>
Converts an f32 to i32, requiring a finite in-range value.
Fractional values are truncated toward zero.
fn to_i32_checked(value: f64): () -> Result<i32, CastError>
Converts an f64 to i32, requiring a finite in-range value.
Fractional values are truncated toward zero.
fn to_i64_checked(value: f32): () -> Result<i64, CastError>
Converts an f32 to i64, requiring a finite in-range value.
Fractional values are truncated toward zero.
fn to_i64_checked(value: f64): () -> Result<i64, CastError>
Converts an f64 to i64, requiring a finite in-range value.
Fractional values are truncated toward zero.
fn reinterpret_i32(value: f32) -> i32
Reinterprets f32 bits as i32.
fn reinterpret_f32(value: i32) -> f32
Reinterprets i32 bits as f32.
fn reinterpret_i64(value: f64) -> i64
Reinterprets f64 bits as i64.
fn reinterpret_f64(value: i64) -> f64
Reinterprets i64 bits as f64.
fn to_string(value: i32) -> String
Formats an i32 as decimal text.
fn to_string(value: i64) -> String
Formats an i64 as decimal text.
fn to_string(value: f32) -> String
Formats an f32 as decimal text.
fn to_string(value: f64) -> String
Formats an f64 as decimal text.
Non-finite values format as NaN, Infinity, or -Infinity.
Objects
obj CastError
Error returned by checked numeric casts.
mod std::optional
Optional standard module.
Re-exports optional value types and helper functions.
Re-Exports
pub types::all
pub fns::all
Macros
macro ??
macro ?.
mod std::optional::fns
Optional helper functions.
Constructors, predicates, and combinators for Optional<T> values.
Macros
macro ??
macro ?.
Functions
fn some<T>(value: T): () -> Optional<T>
Constructs an optional value containing value.
fn none<T>(): () -> Optional<T>
Constructs an empty optional value.
fn is_some<T>(opt: Optional<T>): () -> boolean
Returns true when the optional value is present.
fn is_none<T>(opt: Optional<T>): () -> boolean
Returns true when the optional value is absent.
fn unwrap_or<T>(opt: Optional<T>, default: T): () -> T
Returns the contained value or a fallback.
fn unwrap_or_else<T>(
opt: Optional<T>,
default: (()) -> T
) -> T
Returns the contained value or computes a fallback lazily.
fn map<T, U>(
opt: Optional<T>,
f: (v: T) -> U
) -> Optional<U>
Transforms a present value and leaves None unchanged.
fn and_then<T, U>(
opt: Optional<T>,
f: (v: T) -> Optional<U>
) -> Optional<U>
Runs f when a value is present and flattens the result.
fn or_value<T>(opt: Optional<T>, fallback: Optional<T>): () -> Optional<T>
Returns opt when present, otherwise fallback.
fn or_else<T>(
opt: Optional<T>,
fallback: (()) -> Optional<T>
) -> Optional<T>
Returns opt when present, otherwise computes a fallback optional value.
mod std::optional::types
Optional type definitions.
Defines Some, None, and aliases used across the standard library.
Type Aliases
type Optional<T> = |(Some<T>, None)
Optional sum type.
Represents either Some<T> or None.
type Option<T> = Optional<T>
Alias for Optional<T>.
Objects
obj Some<T>
Present optional variant.
Contains a payload value of type T.
obj None
Empty optional variant.
mod std::output
Standard output/error stream helpers backed by host runtime operations.
std::output is the public surface for stdout/stderr writes, flushing, and
terminal detection. Single-argument helpers default to stdout; pass
StdErr {} when you need to target stderr explicitly.
Functions
fn write(value: StringSlice): Output -> Result<Unit, IoError>
Shorthand for write(value, StdOut {}).
fn write(value: String): Output -> Result<Unit, IoError>
Shorthand for write(value.as_slice()).
fn write(value: StringSlice, target: OutputTarget): Output -> Result<Unit, IoError>
Writes UTF-8 text to target.
Use this overload as the canonical text-write entry point when you need to
choose stdout vs stderr explicitly.
fn write(value: String, target: OutputTarget): Output -> Result<Unit, IoError>
Shorthand for write(value.as_slice(), target).
fn write_line(value: StringSlice): Output -> Result<Unit, IoError>
Shorthand for write_line(value, StdOut {}).
fn write_line(value: String): Output -> Result<Unit, IoError>
Shorthand for write_line(value.as_slice()).
fn write_line(value: StringSlice, target: OutputTarget): Output -> Result<Unit, IoError>
Writes value followed by exactly one line-feed byte to target.
This is the canonical line-oriented write API for this module. It always
appends \n and does not inspect whether value already ends with one.
fn write_line(value: String, target: OutputTarget): Output -> Result<Unit, IoError>
Shorthand for write_line(value.as_slice(), target).
fn print(value: StringSlice): Output -> void
Writes one whole line to stdout.
print is a best-effort convenience helper for debugging and scripting. It
intentionally ignores write failures instead of surfacing IoError. Use
write_line when you need to observe or handle output errors.
fn print(value: String): Output -> void
Shorthand for print(value.as_slice()).
fn print(value: i32): Output -> void
Shorthand for print(to_string(value)).
fn print(value: i64): Output -> void
Shorthand for print(to_string(value)).
fn print(value: f32): Output -> void
Shorthand for print(to_string(value)).
fn print(value: f64): Output -> void
Shorthand for print(to_string(value)).
fn write(bytes: Bytes): Output -> Result<Unit, IoError>
Shorthand for write(bytes, StdOut {}).
fn write(bytes: Bytes, target: OutputTarget): Output -> Result<Unit, IoError>
Writes raw bytes to target without UTF-8 encoding.
Use this for binary output or when text conversion would be incorrect.
fn flush(): Output -> Result<Unit, IoError>
Shorthand for flush(StdOut {}).
fn flush(target: OutputTarget): Output -> Result<Unit, IoError>
Flushes buffered output for target.
fn is_tty(): Output -> bool
Shorthand for is_tty(StdOut {}).
fn is_tty(target: OutputTarget): Output -> bool
Returns whether target is attached to an interactive terminal.
Type Aliases
type OutputTarget = |(StdOut, StdErr)
Objects
obj StdOut
obj StdErr
Effects
eff Output
Host output effect used by std::output.
Operations in this effect forward writes/flushes to host-managed stdout and
stderr streams using MessagePack DTO payloads.
mod std::path
Pure path string utilities.
std::path performs lexical path composition and inspection without touching
the file system. Use std::fs when you need host-backed path existence or I/O.
Objects
obj Path
impl Path
mod std::pkg
Standard library package root exports.
This module re-exports core std modules and common types/functions for convenient
import via std::pkg.
Package-root exports intentionally mirror the safe default surface area.
Advanced/raw constructors stay available from their owning modules so callers
opt in explicitly, for example std::array::new_array_unchecked or
std::string::new_string.
Re-Exports
pub array
pub optional
pub result
pub async
pub prelude
pub error
pub version
pub enums
pub string
pub box
pub memory
pub msgpack
pub dict
pub range
pub subscript
pub traits
pub bytes
pub encoding
pub json
pub set
pub deque
pub error
pub log
pub time
pub random
pub env
pub fetch
pub input
pub output
pub path
pub fs
pub test
pub task
pub std::output::print
pub std::optional::types::Optional
pub std::optional::types::Option
pub std::optional::types::Some
pub std::optional::types::None
pub std::optional::fns::all
pub std::result::types::Result
pub std::result::types::Ok
pub std::result::types::Err
pub std::result::fns::all
pub std::enums::enum
pub std::array::Array
pub std::array::ArrayPop
pub std::dict::Dict
pub std::dict::DictEntry
pub std::dict::DictKey
pub std::traits::Sequence
pub std::traits::Iterator
pub std::traits::for
pub std::range::Range
pub std::subscript::SubscriptRead
pub std::subscript::SubscriptWrite
pub std::bytes::Byte
pub std::bytes::Bytes
pub std::bytes::ByteBuffer
pub std::encoding::errors::DecodeError
pub std::string::String
pub std::string::StringSlice
pub std::string::StringIndex
pub std::string::CharSet
pub std::string::Utf8Error
pub std::string::ParseIntError
pub std::string::ParseFloatError
pub std::string::from_utf8
pub std::box::Box
pub std::json::JsonArray
pub std::json::JsonBool
pub std::json::JsonError
pub std::json::JsonNull
pub std::json::JsonNumber
pub std::json::JsonObject
pub std::json::JsonString
pub std::json::JsonValue
pub std::json::parse
pub std::json::stringify
pub std::json::stringify_pretty
pub std::set::Set
pub std::deque::Deque
pub std::traits::all
pub std::test::assertions::Test
pub std::test::assertions::assert
pub vx
pub math
pub number
Macros
macro ??
macro ?.
macro enum
macro for
mod std::prelude
Safe default imports for source modules.
std::prelude is implicitly imported for src modules and should stay
limited to everyday, high-confidence APIs. Advanced constructors that depend
on raw storage invariants, such as std::array::new_array_unchecked and
std::string::new_string, require explicit module-qualified imports.
Re-Exports
pub std::optional::types::Optional
pub std::optional::types::Option
pub std::optional::types::Some
pub std::optional::types::None
pub std::optional::fns::some
pub std::optional::fns::none
pub std::optional::fns::??
pub std::result::types::Result
pub std::result::types::Ok
pub std::result::types::Err
pub std::result::fns::ok
pub std::result::fns::err
pub std::result::fns::and_then
pub std::result::fns::unwrap_or
pub std::traits::Eq
pub std::traits::Ord
pub std::traits::Hash
pub std::traits::Default
pub std::traits::Clone
pub std::traits::Copy
pub std::traits::Sequence
pub std::traits::Iterator
pub std::traits::for
pub std::range::Range
pub std::array::Array
pub std::array::ArrayPop
pub std::dict::Dict
pub std::dict::DictEntry
pub std::dict::DictKey
pub std::deque::Deque
pub std::set::Set
pub std::bytes::Byte
pub std::bytes::Bytes
pub std::bytes::ByteBuffer
pub std::box::Box
pub std::math
pub std::output
pub std::output::print
pub std::string::String
pub std::string::StringSlice
pub std::string::StringIndex
pub std::string::CharSet
pub std::string::Utf8Error
pub std::string::ParseIntError
pub std::string::ParseFloatError
pub std::string::from_utf8
pub std::error::panic
pub std::test::assertions::assert
Macros
macro ??
macro for
mod std::random
Random-number and random-byte helpers backed by the host Random effect.
The host implementation is expected to provide cryptographically secure
randomness when available.
Functions
fn next_i64(): Random -> i64
Returns a random 64-bit integer.
fn next_u64(): Random -> U64Bits
Returns random 64-bit bits interpreted as an unsigned integer payload.
fn fill_bytes(~buf: ByteBuffer, len: i32): Random -> void
Fills a byte buffer with cryptographically secure random bytes.
len controls the number of bytes appended to buf.
Example:
let buf = ByteBuffer::new()
random::fill_bytes(buf, len: 16)
buf.len() == 16
fn random_bool(): Random -> bool
Returns a random boolean value.
fn random_i32(): Random -> i32
Returns a random i32 value.
Default behavior (no range): samples across the full i32 domain.
fn random_i32(range: Range<i32>): Random -> i32
Returns a random i32 value within the provided range.
The range lower bound is inclusive. The upper bound follows Range:
exclusive by default, inclusive when include_end is true.
Example:
random::random_i32(1..6) samples values in [1, 5].
fn random_i64(): Random -> i64
Returns a random i64 value.
Default behavior (no range): samples across the full i64 domain.
fn random_i64(range: Range<i64>): Random -> i64
Returns a random i64 value within the provided range.
The range lower bound is inclusive. The upper bound follows Range:
exclusive by default, inclusive when include_end is true.
fn random_f64(): Random -> f64
Returns a random floating-point value in [0.0, 1.0).
This no-argument overload is the default behavior.
fn random_f64(range: Range<f64>): Random -> f64
Returns a random floating-point value within the provided range.
The lower bound is inclusive. The upper bound follows Range semantics:
exclusive by default, inclusive when include_end is true.
Example:
random::random_f64(0.0..10.0) samples values in [0.0, 10.0).
fn random_f32(): Random -> f32
Returns a random floating-point value in [0.0, 1.0) as f32.
This no-argument overload is the default behavior.
fn random_f32(range: Range<f32>): Random -> f32
Returns a random floating-point value within the provided range as f32.
The lower bound is inclusive. The upper bound follows Range semantics:
exclusive by default, inclusive when include_end is true.
Objects
obj U64Bits
Raw 64-bit bits interpreted as unsigned payload.
val LocalRng
Fast deterministic pseudo-random generator for local sampling.
LocalRng is not cryptographically secure. It is intended for hot local
loops (for example, render jitter) where host-effect round-trips are too
expensive.
impl LocalRng
Effects
eff Random
Host-provided random source effect.
The host random provider should use a secure entropy source when available.
std::random normalizes returned values into i32 byte ranges where needed.
mod std::range
Integer range type and iteration behavior.
Range is used by slicing and range-based APIs across std.
Objects
obj Range<T>
Range value used by slicing and bounded APIs.
impl Range<i32> for Sequence<i32>
mod std::result
Result standard module.
Re-exports the core Result type family and functional helpers.
Re-Exports
pub types::all
pub fns::all
mod std::result::fns
Result helper functions.
Functional constructors and combinators for working with Result<T, E>.
Functions
fn ok<T, E>(value: T): () -> Result<T, E>
Constructs a successful Result value.
Use this when an operation completes with a value.
fn err<T, E>(error: E): () -> Result<T, E>
Constructs a failing Result value.
Use this when an operation cannot produce a success value.
fn is_ok<T, E>(result: Result<T, E>): () -> bool
Returns true when the result is successful.
fn is_err<T, E>(result: Result<T, E>): () -> bool
Returns true when the result is an error.
fn unwrap_or<T, E>(result: Result<T, E>, fallback: T): () -> T
Returns the contained value or a fallback.
The fallback is returned unchanged when result is Err.
fn map<T, E, U>(
result: Result<T, E>,
f: (v: T) -> U
) -> Result<U, E>
Transforms an Ok value and leaves Err unchanged.
fn and_then<T, E, U>(
result: Result<T, E>,
f: (v: T) -> Result<U, E>
) -> Result<U, E>
Chains another result-producing operation on success.
Errors are propagated without invoking f.
mod std::result::types
Result type definitions.
Contains the sum type used to represent success (Ok) or failure (Err).
Type Aliases
type Result<T, E> = |(Ok<T>, Err<E>)
Result sum type.
A value is either Ok<T> for success or Err<E> for failure.
Objects
obj Unit
Unit sentinel type used by APIs that need a concrete object shape.
obj Ok<T>
Successful Result variant.
Stores the produced value for success paths.
obj Err<E>
Failing Result variant.
Stores error information for failure paths.
mod std::set
Hash-based set collection backed by std::dict::Dict.
Values must implement DictKey so membership uses hash/equality semantics.
Objects
obj Set<T>
A hash-based set of unique values.
Example:
let ~tags = Set<String>::init()
tags.insert("alpha")
tags.contains("alpha")
impl<T> Set<T>
mod std::string
Public string module surface.
This module re-exports the core string types and parse/error helpers from
std::string::type. Prefer from_utf8 for external bytes and reserve
new_string for advanced code that already owns trusted UTF-8 storage.
Re-Exports
pub index::StringIndex
pub type::CharSet
pub type::ParseFloatError
pub type::ParseIntError
pub type::String
pub type::StringSlice
pub type::Utf8Error
Functions
fn new_string(from_bytes: FixedArray<i32>): () -> String
Builds a string from owned UTF-8 byte storage without re-validating it.
This is the sharp-edge constructor for code that already controls the
underlying bytes. Invalid sequences are normalized into replacement runes
during decoding, so prefer from_utf8 when bytes come from external input.
fn from_utf8(source: Array<i32>) -> Result<String, Utf8Error>
Validates UTF-8 bytes and builds a string on success.
This is the canonical public entry point for converting byte arrays into
strings from untrusted or host-provided data.
mod std::string::index
String index primitives.
A StringIndex is an opaque byte offset into a UTF-8 string.
Most callers should construct and move indices through String APIs like
start_index, end_index, index, and grapheme_index.
Objects
obj StringIndex
Opaque byte index used by string traversal APIs.
impl StringIndex
mod std::string::type
Core UTF-8 string types and operations.
String is an owned UTF-8 value and StringSlice is a non-owning byte
window into a String. Index-based traversal uses StringIndex byte
offsets, with helpers that keep movement on rune or grapheme boundaries.
Type Aliases
type CharSet = Array<i32>
Rune set used by trimming and character membership APIs.
Objects
obj String
Owned UTF-8 string value.
impl String
impl String for Sequence<i32>
obj StringSlice
Non-owning view into a String byte range.
impl StringSlice
obj Utf8Error
Error returned when UTF-8 validation fails.
obj ParseIntError
Error returned when integer parsing fails.
obj ParseFloatError
Error returned when floating-point parsing fails.
mod std::subscript
Subscript traits.
Provides shared indexing contracts for read and write operations.
Traits
trait SubscriptRead<Index, Output>
Read-only subscript contract.
trait SubscriptWrite<Index, Value>
Mutable subscript contract.
mod std::task
Same-run task primitives backed by the runtime task scheduler.
Tasks are concurrent units of work inside a single Voyd run. They are
cooperative and event-loop driven, not thread-parallel.
Functions
fn spawn<T>(work: (fn) -> T): TaskRuntime -> Task<T>
fn detach<T>(work: (fn) -> T): TaskRuntime -> Task<T>
fn join(task: Task<void>): TaskRuntime -> TaskOutcome<Unit>
fn join<T>(task: Task<T>): TaskRuntime -> TaskOutcome<T>
fn cancel<T>(task: Task<T>): TaskRuntime -> bool
fn yield_now(): TaskRuntime -> Unit
Type Aliases
type TaskOutcome<T> = Completion<T, TaskError>
Objects
obj Task<T>
impl Task<void>
impl<T> Task<T>
obj TaskError
Effects
eff TaskRuntime
mod std::test
Re-Exports
pub assertions::all
mod std::test::assertions
Test assertion utilities.
Hosts effectful assertion helpers used by std and smoke tests.
Functions
fn assert(cond: boolean): fail -> void
Fails the current test when cond is false.
fn assert<T>(value: T, { eq expected: T }): fail -> void
Fails the current test when value is not equal to expected.
fn assert<T>(value: T, { neq expected: T }): fail -> void
Fails the current test when value is equal to expected.
Effects
eff Test
Host test-runner effect used by assertion helpers.
The runtime consumes these operations to mark test outcomes and emit test logs.
mod std::time
Time primitives backed by the host Time effect.
Includes monotonic timing (Instant), wall-clock timing (SystemTime),
duration utilities, and blocking sleep.
Functions
fn sleep(ms: i64): Time -> Result<Unit, HostError>
Suspends execution for the provided millisecond count.
Example: time::sleep(250).
fn sleep(duration: Duration): Time -> Result<Unit, HostError>
Suspends execution for the provided duration.
Example: time::sleep(Duration::from_secs(1)).
fn set_timeout<T>(
delay: Duration,
work: (fn) -> T
): ::(task, TaskRuntime) -> ::(task, Task<T>)
Schedules a detached callback task to run after the provided delay.
fn after_delay<T>(
delay: Duration,
work: (fn) -> T
): (::(task, TaskRuntime), Time) -> T
Runs callback work after waiting for the provided delay.
fn set_interval<T>(
delay: Duration,
overlap: Overlap,
work: (fn) -> T
): ::(task, TaskRuntime) -> ::(task, Task<Unit>)
Schedules repeating callback work using the provided overlap policy.
The returned task is the interval driver. Cancelling it prevents future ticks.
Objects
obj Duration
Represents a millisecond-based time span.
impl Duration
obj Instant
Monotonic timestamp that is suitable for elapsed-time measurement.
impl Instant
obj SystemTime
Wall-clock timestamp represented as milliseconds from the Unix epoch.
impl SystemTime
obj Overlap
Interval overlap policy.
Policies are explicit so repeating work does not silently adopt JS-style
concurrent overlap.
impl Overlap
Effects
eff Time
Host-provided time operations.
std::time decodes host responses into typed success/error values.
mod std::traits
Core standard traits.
Re-exports shared behavior contracts used throughout the language and std.
Re-Exports
pub sequence::Sequence
pub sequence::Iterator
pub sequence::for
pub eq::Eq
pub ord::Ord
pub ord::Ordering
pub ord::Less
pub ord::Equal
pub ord::Greater
pub hash::Hash
pub hash::Hasher
pub default::Default
pub clone::Clone
pub clone::Copy
pub convert::From
pub convert::Into
pub convert::TryFrom
pub convert::TryInto
pub collect::Collect
Macros
macro for
mod std::traits::clone
Value duplication traits.
Clone supports explicit duplication, while Copy marks cheap copy semantics.
Traits
trait Clone<T>
Trait for creating an explicit duplicate of a value.
trait Copy<T>
Trait for values that can be copied without ownership transfer concerns.
mod std::traits::collect
Collection construction traits.
Provides conversions from sequences into concrete collection types.
Traits
trait Collect<T>
Trait for creating a value from a sequence of items.
mod std::traits::convert
Conversion traits.
Provides infallible and fallible conversion contracts.
Traits
trait From<To, From>
Infallible conversion into To from From.
trait Into<From, To>
Infallible conversion from From into To.
trait TryFrom<To, From, E>
Fallible conversion into To from From.
trait TryInto<From, To, E>
Fallible conversion from From into To.
mod std::traits::default
Traits
trait Default<T>
Trait for producing a default instance of a type.
mod std::traits::eq
Traits
trait Eq<T>
Trait for checking equality between two values of the same type.
mod std::traits::hash
Hashing traits.
Defines writer and value hashing contracts used by hash-based collections.
Traits
trait Hasher
Trait implemented by hash state writers.
trait Hash<T>
Trait for values that can feed bytes into a hasher.
mod std::traits::ord
Ordering trait and ordering marker types.
Defines total ordering comparisons and relational operator overloads.
Type Aliases
type Ordering = |(Less, |(Equal, Greater))
Union type representing a comparison result.
Objects
obj Less
Marker for values less than the compared value.
obj Equal
Marker for values equal to the compared value.
obj Greater
Marker for values greater than the compared value.
Traits
trait Ord<T>
Trait for total ordering between values.
mod std::traits::sequence
Sequence and iterator traits.
Defines iteration contracts and the for macro expansion used by the language.
Macros
macro for
Traits
trait Sequence<T>
Trait for values that can produce iterators.
trait Iterator<T>
Trait for stateful iterators over T values.
mod std::version
Version metadata for the standard library package.
Functions
fn std_version() -> String
Returns the version of the standard library package.
fn language_version() -> String
Returns the language version this standard library targets.
mod std::vx
Virtual DOM helpers.
Utilities for constructing VX element payloads encoded as MsgPack maps.
Functions
fn create_element(
{
name: String
attributes?: Array<Array<MsgPack>>
children: Array<MsgPack>
}
) -> MsgPack
Creates a virtual DOM element payload for renderer consumption.
The returned value is a MsgPack map with name, children, and optional attributes.