std::pkg

Voyd API documentation generated from source declarations.

Table of Contents

mod std::array

Growable contiguous arrays with isolated copy operations.
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.

impl Array<i32>

Members
copied({ from source: Borrow<Array<i32>> }): () -> Array<i32>

Returns an independently owned copy of a scoped array.

impl<T> Array<T>

Members
init() -> Array<T>

Creates an empty array.

with_capacity(size: i32) -> Array<T>

Creates an empty array with capacity for at least size elements.

from(source: FixedArray<T>) -> Optional<Array<T>>

Builds a value from the provided source.

copied(self: Array<T>, add_capacity?: i32) -> Array<T>

Returns a shallow copy of the array.

When add_capacity is provided, the copy is guaranteed to have room for
at least that many additional items without reallocation.

Example:
let copy = values.copied(add_capacity: 8)

len(self: Array<T>) -> i32

Returns the number of stored elements.

capacity(self: Array<T>) -> i32

Returns how many elements can be stored before reallocation is required.

is_empty(self: Array<T>) -> bool

Returns true when no values are stored.

first(self: Array<T>) -> Optional<T>

Returns the first element, or None when empty.

last(self: Array<T>) -> Optional<T>

Returns the last element, or None when empty.

get(self: Array<T>, index: i32) -> Optional<T>

Returns the element at index, or None when out of bounds.

at(self: Array<T>, index: i32) -> T

Returns the value at the requested index and traps when the index is out of bounds.

slice(self: Array<T>, range: Range<i32>) -> Array<T>

Returns a subrange copy for the requested range.

Example:
let first_two = values.slice(0..2)

slice(self: Array<T>, { range: Range<i32> }) -> Array<T>

Returns a subrange copy for the requested range.

slice( self: Array<T>, { from start: i32 to end: i32 } ) -> Array<T>

Returns a subrange copy bounded by explicit indices.

Parameters:

  • start: Inclusive start index. Negative values index from the end.
  • end: Exclusive end index. Negative values index from the end.

Example:
let middle = values.slice(from: 1, to: -1)

map<O>( self: Array<T>, f: (v: T) -> O ) -> Array<O>

Applies a transform to each element and returns a new array.

filter( self: Array<T>, pred: (v: T) -> bool ) -> Array<T>

Returns a collection containing only values that satisfy the predicate.

filter( self: Array<T>, { where pred: (value: T) -> bool } ) -> Array<T>

Returns a collection containing only values that satisfy the predicate.

each( self: Array<T>, { visit f: (value: T) -> void } ) -> void

Invokes a callback for each element.

flat_map<O>( self: Array<T>, f: (v: T) -> Array<O> ) -> Array<O>

Maps each element and flattens the mapped sequences into one array.

flat_map<O>( self: Array<T>, { map f: (value: T) -> Sequence<O> } ) -> Array<O>

Maps each element and flattens the mapped sequences into one array.

reduce<O>( self: Array<T>, initial: O, { step: (acc: O, v: T) -> O } ) -> O

Reduces values to a single accumulator value.

reduce<O>( self: Array<T>, { initial: O combine: (acc: O, value: T) -> O } ) -> O

Reduces values to a single accumulator value.

find( self: Array<T>, pred: (v: T) -> bool ) -> Optional<T>

Returns the first value that satisfies the predicate.

find( self: Array<T>, { where pred: (value: T) -> bool } ) -> Option<T>

Returns the first value that satisfies the predicate.

any( self: Array<T>, pred: (v: T) -> bool ) -> bool

Returns true when at least one element matches the predicate.

any( self: Array<T>, { where pred: (value: T) -> bool } ) -> bool

Returns true when at least one element matches the predicate.

all( self: Array<T>, pred: (v: T) -> bool ) -> bool

Returns true only when every element matches the predicate.

all( self: Array<T>, { where pred: (value: T) -> bool } ) -> bool

Returns true only when every element matches the predicate.

contains(self: Array<T>, value: T) -> bool

Returns true when a matching value exists.

contains( self: Array<T>, { where pred: (value: T) -> bool } ) -> bool

Returns true when a matching value exists.

find_index(self: Array<T>, value: T) -> i32

Returns the index of the first matching value.

find_index( self: Array<T>, { where pred: (value: T) -> bool } ) -> Option<i32>

Returns the index of the first matching value.

find_index_where( self: Array<T>, pred: (v: T) -> bool ) -> i32

Returns the index of the first value that satisfies the predicate, or -1 when absent.

sorted( self: Array<T>, compare: (left: T, right: T): (()) -> i32 ) -> Array<T>

Returns a sorted copy.

sorted(self: Array<T>) -> Array<T>

Returns a sorted copy.

sorted( self: Array<T>, { by compare: (left: T, right: T): (()) -> Ordering } ) -> Array<T>

Returns a sorted copy.

reversed(self: Array<T>) -> Array<T>

Returns a reversed copy.

to_fixed_array(self: Array<T>) -> FixedArray<T>

Copies values into a fixed-size array.

raw_storage(self: Array<T>) -> FixedArray<T>

Copies values into a fixed-size array.

enumerate(self: Array<T>) -> Array<(i32, T)>

Returns pairs of (index, value) for each element.

concat(self: Array<T>, other: Array<T>) -> Array<T>

Returns a new collection with other appended.

take(self: Array<T>, n: i32) -> Array<T>

Returns a new array containing the first n elements.

drop(self: Array<T>, n: i32) -> Array<T>

Returns a new array without the first n elements.

partition( self: Array<T>, pred: (v: T) -> bool ) -> (Array<T>, Array<T>)

Splits values into two arrays based on the predicate result.

partition( self: Array<T>, { where pred: (value: T) -> bool } ) -> (Array<T>, Array<T>)

Splits values into two arrays based on the predicate result.

chunk(self: Array<T>, { of size: i32 }) -> Array<Array<T>>

Splits values into consecutive chunks of the requested size.

Parameter:

  • size: Number of elements per chunk. Non-positive values return an empty array.
window(self: Array<T>, size: i32) -> Array<Array<T>>

Returns all sliding windows of the requested size.

Parameter:

  • size: Number of values per window. Must be between 1 and len.
zip<U>(self: Array<T>, other: Array<U>) -> Array<(T, U)>

Pairs values from two sequences until either sequence ends.

fold( self: Array<T>, combine: (left: T, right: T) -> T ) -> Optional<T>

Combines all values into one using a binary reducer.

sort(~self: Array<T>) -> void

Sorts values in place.

reverse(~self: Array<T>) -> void

Reverses values in place.

clear(~self: Array<T>) -> void

Removes all stored values.

truncate(~self: Array<T>, len: i32) -> void

Shrinks the array to the requested length.

reserve(~self: Array<T>, additional: i32) -> void

Ensures capacity for at least additional more elements.

push(~self: Array<T>, value: T) -> void

Appends a value to the end.

pop(~self: Array<T>) -> Optional<T>

Removes and returns the last value.

insert(~self: Array<T>, value: T, { at index: i32 }) -> void

Inserts a value at the target location.

remove(~self: Array<T>, index: i32) -> Optional<T>

Removes and returns a value when present.

remove(~self: Array<T>, { at index: i32 }) -> T

Removes and returns a value when present.

extend(~self: Array<T>, other: Array<T>) -> void

Appends values from another collection or sequence.

splice( ~self: Array<T>, { at start: i32 removing remove_count: i32 inserting items: Array<T> } ) -> Array<T>

Replaces a range with inserted values and returns removed values.

Parameters:

  • start: Index where the splice begins. Clamped into 0..len.
  • remove_count: Number of existing values to remove.
  • items: Values inserted at start.

Example:
let removed = items.splice(at: 2, removing: 1, inserting: replacements)

replace(~self: Array<T>, index: i32, { with element: T }) -> bool

Replaces matching content with new content.

cleared(self: Array<T>) -> Array<T>

Returns a copy with all values removed.

reserved(self: Array<T>, additional: i32) -> Array<T>

Returns a copy with reserved additional capacity.

pushed(self: Array<T>, value: T) -> Array<T>

Returns a copy with one value appended.

popped(self: Array<T>) -> ArrayPop<T>

Returns a copy with the last value removed.

inserted(self: Array<T>, value: T, { at index: i32 }) -> Array<T>

Returns a copy with a value inserted at the requested index.

removed(self: Array<T>, index: i32) -> Array<T>

Returns a copy with one value removed.

extended(self: Array<T>, other: Array<T>) -> Array<T>

Returns a copy with values from other appended.

spliced( self: Array<T>, { at start: i32 removing remove_count: i32 inserting items: Array<T> } ) -> Array<T>

Returns a copy with a splice operation applied.

impl<T> Array<T> for Sequence<T>

Members
iter(self: Array<T>) -> Iterator<T>

Returns an iterator over values.

impl<T> Array<T> for SubscriptRead<i32, Optional<T>>

Members
subscript_get(self: Array<T>, index: i32) -> Optional<T>

Returns the value addressed by subscript syntax.

impl<T> Array<T> for SubscriptRead<Range<i32>, Array<T>>

Members
subscript_get(self: Array<T>, range: Range<i32>) -> Array<T>

Returns the value addressed by subscript syntax.

impl<T> Array<T> for SubscriptWrite<i32, T>

Members
subscript_set(~self: Array<T>, index: i32, value: T) -> void

Updates the value addressed by subscript syntax.

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.

Members
value: T

Contained boxed value.

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

Members
copied({ from source: Borrow<Bytes> }): () -> Bytes

Returns an independently owned copy of a scoped byte sequence.

len(self: Bytes) -> i32

Returns the number of bytes.

is_empty(self: Bytes) -> bool

Returns true when this sequence is empty.

get(self: Bytes, index: i32) -> Option<Byte>

Returns the byte at index, or None when out of bounds.

at(self: Bytes, index: i32) -> Byte

Returns the byte at index, trapping when out of bounds.

slice(self: Bytes, range: Range<i32>) -> Bytes

Returns a byte slice for the provided range.

  • range: half-open or closed range, following Range semantics.
slice(self: Bytes, { range: Range<i32> }) -> Bytes

Returns a byte slice for the provided range.

to_array(self: Bytes) -> Array<Byte>

Returns a copied array of bytes.

copied(self: Bytes) -> Bytes

Returns an independently owned copy of these bytes.

obj ByteBuffer

A mutable, growable byte buffer.

impl ByteBuffer

Members
init() -> ByteBuffer

Creates an empty byte buffer.

with_capacity(bytes: i32) -> ByteBuffer

Creates an empty byte buffer with at least bytes capacity.

Negative values are clamped to 0.

len(self: ByteBuffer) -> i32

Returns the number of bytes in the buffer.

is_empty(self: ByteBuffer) -> bool

Returns true when this buffer is empty.

capacity(self: ByteBuffer) -> i32

Returns total byte capacity.

as_bytes(self: ByteBuffer) -> Bytes

Returns an immutable bytes snapshot.

The returned Bytes is a copy of the current buffer contents.

push(~self: ByteBuffer, value: Byte) -> void

Appends one byte.

extend(~self: ByteBuffer, bytes: Bytes) -> void

Appends all bytes from bytes.

This is useful for concatenating previously captured Bytes values.

clear(~self: ByteBuffer) -> void

Removes all bytes.

mod std::data

Neutral dynamic values and checked structural decoding.

Wire-format packages translate their own values to DataValue; the
compiler-generated boundary codec performs the final typed conversion only
after this module validates the matching provider-neutral Shape.

Functions

fn default_encode_limits() -> EncodeLimits

Returns conservative default encoding limits.

fn default_decode_limits() -> DecodeLimits

Returns conservative default decoding limits.

fn default_decode_options() -> DecodeOptions

Returns decoder options that reject unknown fields.

fn encode<T>(value: T): () -> DataValue

Encodes a DTO-compatible value into the neutral dynamic tree.

fn write<T, SinkError, Writer>(writer: Writer, value: T): () -> Result<Unit, SinkError>

Writes a closed DTO directly into a stateful provider sink.

The compiler generates the schema traversal. The sink receives compact
record and variant descriptors without an intermediate DataValue tree.

fn read<T, SourceError, Reader>( reader: Reader, reject_unknown_fields: bool ): () -> Result<T, SourceError>

Reads a closed DTO directly from a stateful provider source.

fn decode<T>(value: DataValue): () -> Result<T, DecodeError>

Fallibly decodes a neutral value into a boundary-compatible Voyd type.

fn decode<T>(value: DataValue, { options: DecodeOptions }): () -> Result<T, DecodeError>

Fallibly decodes with an explicit unknown-field policy.

fn string_value(value: String) -> DataValue

Constructs a neutral string value from owned text.

fn string_value(value: StringSlice) -> DataValue

Constructs a neutral string value from a slice.

Type Aliases

type DataValue = |(|(|(|(|(|(|(|(|(|(DataNull, DataBool), DataI32), DataI64), DataF32), DataF64), DataString), DataBytes), DataArray), DataObject), DataVariant)

Provider-neutral dynamic value accepted by structural codecs.

type UnknownFieldPolicy = |(IgnoreUnknownFields, RejectUnknownFields)

Policy for fields not present in a target record or variant.

type DataKind = |(|(|(|(|(|(|(|(|(|(NullKind, BoolKind), I32Kind), I64Kind), F32Kind), F64Kind), StringKind), BytesKind), ArrayKind), RecordKind), VariantKind)

Provider-neutral kinds reported by a DataReader.

type DataValueReadErrorKind = |(DataValueSourceFailure, DataValueCustomFailure)

type DecodeErrorKind = |(|(|(|(|(|(MissingField, UnknownField), TypeMismatch), DuplicateField), InvalidVariant), InvalidShapeReference), CustomDtoFailure)

Stable categories of structural decode failures.

Objects

obj DataNull

Neutral null/unit value.

obj DataBool

Neutral boolean value.

Members
value: bool

obj DataI32

Neutral signed 32-bit integer value.

Members
value: i32

obj DataI64

Neutral signed 64-bit integer value.

Members
value: i64

obj DataF32

Neutral 32-bit floating-point value.

Members
value: f32

obj DataF64

Neutral 64-bit floating-point value.

Members
value: f64

obj DataString

Neutral owned string value.

Members
value: String

obj DataBytes

Neutral immutable byte sequence.

Members
value: Bytes

obj DataField

Named field in a neutral object or variant payload.

Members
name: String
value: DataValue

obj DataArray

Neutral ordered array value.

Members
values: Array<DataValue>

obj DataObject

Neutral string-keyed object value.

Members
fields: Array<DataField>

obj DataVariant

Neutral named variant value.

Members
name: String
fields: Array<DataField>

obj CustomDtoError

Validation failure reported by a custom DTO representation.

Members
code: String

Stable application/provider-independent failure code.

message: String

Human-readable detail for diagnostics.

obj IgnoreUnknownFields

Ignore object fields absent from the target Voyd type.

obj RejectUnknownFields

Reject object fields absent from the target Voyd type.

obj DecodeOptions

Structural decoder configuration.

Members
unknown_fields: UnknownFieldPolicy

obj EncodeLimits

Resource limits applied while writing a DTO value.

Members
max_depth: i32
max_bytes: i32
max_collection_length: i32

obj DecodeLimits

Resource limits applied before allocating decoded DTO storage.

Members
max_depth: i32
max_bytes: i32
max_collection_length: i32

obj NullKind

obj BoolKind

obj I32Kind

obj I64Kind

obj F32Kind

obj F64Kind

obj StringKind

obj BytesKind

obj ArrayKind

obj RecordKind

obj VariantKind

obj DataValueWriteError

Balanced-stream error reported by DataValueWriter.

Members
message: String

obj DataValueWriter

Concrete balanced writer that constructs one explicit DataValue tree.

impl DataValueWriter

Members
is_complete(self: DataValueWriter) -> bool

Returns true when exactly one balanced root value is ready.

finish(self: DataValueWriter) -> Result<DataValue, DataValueWriteError>

Finishes the session after exactly one balanced root value.

impl DataValueWriter for DataWriter<DataValueWriteError>

obj DataValueSourceFailure

obj DataValueCustomFailure

Members
cause: CustomDtoError

obj DataValueReadError

Pull-stream error reported by DataValueReader.

Members
kind: DataValueReadErrorKind
path: String
message: String

obj DataValueReader

Concrete pull reader over one explicit DataValue tree.

impl DataValueReader

Members
is_complete(self: DataValueReader) -> bool

Returns true after the root value and all containers have been consumed.

impl DataValueReader for DataReader<DataValueReadError>

obj MissingField

A required field was absent.

obj UnknownField

A field was not declared by the target shape.

obj TypeMismatch

A dynamic value had the wrong kind.

obj DuplicateField

An object or variant payload repeated a field name.

obj InvalidVariant

A union value named an unsupported variant.

obj InvalidShapeReference

A shape reference could not be resolved.

obj CustomDtoFailure

A custom DTO rejected its otherwise valid representation.

Members
cause: CustomDtoError

obj DecodeError

Precise, recoverable structural decode failure.

Members
kind: DecodeErrorKind

Failure category.

path: String

Rooted value path such as $.profile.age or $.items[2].

expected: String

Expected shape/value kind.

actual: String

Observed dynamic value kind or name.

Traits

trait CustomDto<T, Representation>

One provider-neutral external representation for an exceptional nominal type.

Representation must itself be eligible for automatic DTO derivation.
Implementations are format-independent and singular for T.

Members
write(value: T) -> Representation
read(value: Representation) -> Result<T, CustomDtoError>

trait HostTransportProvider<Reader, Writer>

Compiler-known lifecycle for a stateless host transport provider.

Members
create_reader(ptr: i32, len: i32) -> Reader
reader_complete(reader: Reader) -> bool
create_writer(ptr: i32, len: i32) -> Writer
finish_writer(writer: Writer) -> i32

trait DataWriter<SinkError>

Stateful sink used by generated DTO traversal.

Calls must form one balanced root value. A writer becomes unusable after
the first sink failure.

Members
reject(~self: <inferred>, message: String): () -> Result<Unit, SinkError>
write_null(~self: <inferred>): () -> Result<Unit, SinkError>
write_bool(~self: <inferred>, value: bool): () -> Result<Unit, SinkError>
write_i32(~self: <inferred>, value: i32): () -> Result<Unit, SinkError>
write_i64(~self: <inferred>, value: i64): () -> Result<Unit, SinkError>
write_f32(~self: <inferred>, value: f32): () -> Result<Unit, SinkError>
write_f64(~self: <inferred>, value: f64): () -> Result<Unit, SinkError>
write_string(~self: <inferred>, value: String): () -> Result<Unit, SinkError>
write_bytes(~self: <inferred>, value: Bytes): () -> Result<Unit, SinkError>
begin_array(~self: <inferred>, { length: i32 }): () -> Result<Unit, SinkError>
end_array(~self: <inferred>): () -> Result<Unit, SinkError>
begin_record( ~self: <inferred>, { name: String field_count: i32 } ): () -> Result<Unit, SinkError>
write_field(~self: <inferred>, name: String): () -> Result<Unit, SinkError>
end_record(~self: <inferred>): () -> Result<Unit, SinkError>
begin_variant( ~self: <inferred>, { union: String variant: String field_count: i32 } ): () -> Result<Unit, SinkError>
end_variant(~self: <inferred>): () -> Result<Unit, SinkError>

trait DataReader<SourceError>

Stateful pull source used by generated DTO traversal.

Members
reject(~self: <inferred>, message: String): () -> Result<Unit, SourceError>
reject_custom( ~self: <inferred>, code: String, message: String ): () -> Result<Unit, SourceError>
current_path(self: <inferred>) -> String
matches_name(self: <inferred>, actual: String, expected: String) -> bool
enter_field(~self: <inferred>, name: String): () -> void
enter_index(~self: <inferred>, index: i32): () -> void
leave(~self: <inferred>): () -> void
kind(self: <inferred>) -> Result<DataKind, SourceError>
read_null(~self: <inferred>): () -> Result<Unit, SourceError>
read_bool(~self: <inferred>): () -> Result<bool, SourceError>
read_i32(~self: <inferred>): () -> Result<i32, SourceError>
read_i64(~self: <inferred>): () -> Result<i64, SourceError>
read_f32(~self: <inferred>): () -> Result<f32, SourceError>
read_f64(~self: <inferred>): () -> Result<f64, SourceError>
read_string(~self: <inferred>): () -> Result<String, SourceError>
read_bytes(~self: <inferred>): () -> Result<Bytes, SourceError>
begin_array(~self: <inferred>): () -> Result<i32, SourceError>
has_next_element(self: <inferred>) -> Result<bool, SourceError>
end_array(~self: <inferred>): () -> Result<Unit, SourceError>
begin_record(~self: <inferred>): () -> Result<Unit, SourceError>
next_field(~self: <inferred>): () -> Result<Option<String>, SourceError>
skip_value(~self: <inferred>): () -> Result<Unit, SourceError>
end_record(~self: <inferred>): () -> Result<Unit, SourceError>
begin_variant(~self: <inferred>): () -> Result<String, SourceError>
end_variant(~self: <inferred>): () -> Result<Unit, SourceError>

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>

Members
init() -> Deque<T>

Creates an empty deque.

len(self: Deque<T>) -> i32

Returns the number of values.

is_empty(self: Deque<T>) -> bool

Returns true when the deque is empty.

push_front(~self: Deque<T>, value: T) -> void

Pushes value to the front.

push_back(~self: Deque<T>, value: T) -> void

Pushes value to the back.

pop_front(~self: Deque<T>) -> Option<T>

Pops and returns the front value.

pop_back(~self: Deque<T>) -> Option<T>

Pops and returns the back value.

front(self: Deque<T>) -> Option<T>

Returns the front value without removing it.

back(self: Deque<T>) -> Option<T>

Returns the back value without removing it.

clear(~self: Deque<T>) -> void

Removes all values.

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.

Members
dict: Dict<K, V>

Dictionary being accessed by this entry handle.

key: K

Associated key for this entry.

impl<K, V> DictEntry<K, V>

Members
or_insert(self: DictEntry<K, V>, default: V) -> Dict<K, V>

Inserts the default value when the entry is vacant and returns the dictionary.

or_insert_with( self: DictEntry<K, V>, make: (()) -> V ) -> Dict<K, V>

Lazily inserts a computed value when the entry is vacant and returns the dictionary.

and_modify( self: DictEntry<K, V>, f: (value: V) -> V ) -> DictEntry<K, V>

Applies a modifier function to the value when the entry already exists.

remove(self: DictEntry<K, V>) -> DictEntryRemove<K, V>

Removes the entry and returns the updated dictionary and previous value.

obj DictEntryRemove<K, V>

Result of removing a value through a dictionary entry.

Members
dict: Dict<K, V>

Dictionary after the removal.

value: Optional<V>

Removed value, when the entry existed.

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>

Members
init() -> Dict<K, V>

Creates an empty dictionary.

with_capacity(capacity: i32) -> Dict<K, V>

Creates an empty dictionary sized for an expected entry count.

Capacity is clamped to safe bounds and rounded up for bucket growth behavior.

len(self: Dict<K, V>) -> i32

Returns the number of stored elements.

is_empty(self: Dict<K, V>) -> bool

Returns true when no values are stored.

contains(self: Dict<K, V>, key: K) -> bool

Returns true when the dictionary currently stores key.

get(self: Dict<K, V>, key: K) -> Optional<V>

Returns the value for key, or None when absent.

insert(~self: Dict<K, V>, key: K, value: V) -> bool

Inserts a value and returns true when the key was not already present.

set(~self: Dict<K, V>, key: K, value: V) -> Dict<K, V>

Inserts or replaces the value for a key.

setting(self: Dict<K, V>, key: K, value: V) -> Dict<K, V>

Returns a dictionary with key inserted or updated.

removing(self: Dict<K, V>, key: K) -> Dict<K, V>

Returns a dictionary without key.

copied(self: Dict<K, V>) -> Dict<K, V>

Returns an independently mutable copy of this dictionary.

remove(~self: Dict<K, V>, key: K) -> Optional<V>

Removes and returns a value when present.

clear(~self: Dict<K, V>) -> void

Removes all stored values.

keys(self: Dict<K, V>) -> Array<K>

Returns all dictionary keys.

values(self: Dict<K, V>) -> Array<V>

Returns dictionary values.

entries(self: Dict<K, V>) -> Array<(K, V)>

Returns dictionary entries as key-value tuples.

each( self: Dict<K, V>, f: (key: K, value: V) -> void ) -> void

Invokes a callback for each element.

extend(~self: Dict<K, V>, other: Dict<K, V>) -> void

Appends values from another dictionary.

merged(self: Dict<K, V>, other: Dict<K, V>) -> Dict<K, V>

Returns a new dictionary containing entries from both inputs.

merged( self: Dict<K, V>, other: Dict<K, V>, resolve: (key: K, left: V, right: V): (()) -> V ) -> Dict<K, V>

Returns a new dictionary containing entries from both inputs.

If a key appears in both dictionaries, resolve chooses the output value.

map<U>( self: Dict<K, V>, f: (key: K, value: V) -> U ) -> Dict<K, U>

Transforms each value and keeps the original keys.

filter( self: Dict<K, V>, pred: (key: K, value: V) -> bool ) -> Dict<K, V>

Returns a collection containing only values that satisfy the predicate.

entry(self: Dict<K, V>, key: K) -> DictEntry<K, V>

Returns an entry handle for in-place updates on a specific key.

impl<K, V> Dict<K, V> for SubscriptRead<K, Optional<V>>

Members
subscript_get(self: Dict<K, V>, key: K) -> Optional<V>

Returns the value addressed by subscript syntax.

impl<K, V> Dict<K, V> for SubscriptWrite<K, V>

Members
subscript_set(~self: Dict<K, V>, key: K, value: V) -> void

Updates the value addressed by subscript syntax.

Traits

trait DictKey<K>

Key behavior required by Dict<K, V>.

Implementors define stable hashing and equality for dictionary lookups.

Members
dict_hash(self: <inferred>): () -> i32

Returns a hash used to choose the key bucket.

dict_eq(self: <inferred>, other: K): () -> bool

Returns true when this key equals other.

Implementations

impl<T> Array<T>

Members
group_by<K>( self: Array<T>, f: (value: T) -> K ) -> Dict<K, Array<T>>

Groups sequence values by key and returns grouped arrays.

impl String for DictKey<String>

Members
dict_hash(self: String) -> i32

Returns the hash code used for dictionary key bucketing.

dict_eq(self: String, other: String) -> bool

Compares this key with another key for dictionary equality.

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

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

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 }
  Baz

mod 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>

Objects

obj EnvGetResult

Host environment effect used by std::env.

Members
found: bool
value: String

obj EnvSetRequest

Members
key: String
value: String

obj EnvSetResult

Members
ok: bool
code: i32
message: String

Effects

eff Env

Operations in this effect mirror host process environment APIs and exchange
automatic DTO values.

Members
get(tail, key: String) -> EnvGetResult

Reads an environment variable value.

set(tail, request: EnvSetRequest) -> EnvSetResult

Sets an environment variable.

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

fn panic() -> void

Stops execution immediately without allocating a diagnostic message.

Type Aliases

type IoErrorKind = |(|(|(|(IoNotFound, IoAlreadyExists), IoPermissionDenied), IoConflict), IoOther)

Portable categories for host I/O failures.

Objects

obj HostError

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

obj IoNotFound

A filesystem path was not found.

obj IoAlreadyExists

A create-only operation targeted an existing path.

obj IoPermissionDenied

The host denied access to the requested operation.

obj IoConflict

The path is temporarily unavailable because of a filesystem conflict.

obj IoOther

The host reported an I/O failure without a more portable category.

obj IoError

Members
kind: IoErrorKind

Portable failure category. Host adapters retain their native details in
code and message.

code: i32

Machine-readable error code.

message: String

Human-readable error message.

Traits

trait Error<T>

Members
message(self: <inferred>): () -> String

mod std::fs

File system APIs backed by host runtime operations.

std::fs provides read/write/existence/removal/listing helpers that operate on
std::path::Path and return typed Result values where host I/O can fail.
Effect payloads use automatic DTO conversion.

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 remove(path: Path): Fs -> Result<Unit, IoError>

Removes a file or empty directory.

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.

fn create_dir_all(path: Path): Fs -> Result<Unit, IoError>

Creates a directory and all missing parent directories.

Existing directories are accepted as success.

fn rename(source: Path, { to destination: Path }): Fs -> Result<Unit, IoError>

Renames a file or directory from source to destination.

Host filesystem rename semantics apply. Renaming a temporary file over its
destination can be used for atomic replacement when both paths share a
filesystem.

fn write_atomic(path: Path, bytes: Bytes): Fs -> Result<Unit, IoError>

Atomically writes bytes, replacing the destination only after the complete
value has been written to a temporary file in the same directory.

A successful call guarantees that readers see either the previous complete
file or the new complete file. Host and operating-system durability after a
process or machine crash is outside this contract.

fn write_atomic(path: Path, value: String): Fs -> Result<Unit, IoError>

Atomically writes owned UTF-8 text. See the bytes overload for replacement
and durability guarantees.

fn write_atomic(path: Path, value: StringSlice): Fs -> Result<Unit, IoError>

Atomically writes borrowed UTF-8 text.

fn create_exclusive(path: Path, bytes: Bytes): Fs -> Result<Unit, IoError>

Creates and writes a new file atomically with respect to competing creators.
Returns IoAlreadyExists when another writer owns the destination.

fn create_exclusive(path: Path, value: String): Fs -> Result<Unit, IoError>

Creates and writes a new UTF-8 text file atomically with respect to competing
creators.

fn create_exclusive(path: Path, value: StringSlice): Fs -> Result<Unit, IoError>

Creates and writes a borrowed UTF-8 text file atomically with respect to
competing creators.

Objects

obj FsResult<T>

Host file-system effect used by std::fs.

Members
ok: bool
value: T
error_kind: String
error_code: i32
error_message: String

obj FsWriteBytesRequest

Members
path: String
bytes: Bytes

obj FsWriteStringRequest

Members
path: String
value: String

obj FsWriteRequest

Members
path: String
kind: String
bytes: Bytes
value: String

obj FsRenameRequest

Members
from: String
to: String

Effects

eff Fs

Operations in this effect proxy host file APIs using automatic DTO values.

Members
read_bytes(tail, path: String) -> FsResult<Bytes>

Reads file contents from path and returns raw byte data or an I/O error DTO.

read_string(tail, path: String) -> FsResult<String>

Reads UTF-8 text contents from path and returns string data or an I/O error DTO.

write_bytes(tail, request: FsWriteBytesRequest) -> FsResult<Unit>

Writes raw byte data to a file.

write_string(tail, request: FsWriteStringRequest) -> FsResult<Unit>

Writes UTF-8 text to a file.

exists(tail, path: String) -> bool

Returns the host-reported existence check for path.

list_dir(tail, path: String) -> FsResult<Array<String>>

Lists child paths in the directory at path, or returns an I/O error DTO.

remove(tail, path: String) -> FsResult<Unit>

Removes the file or empty directory at path, or returns an I/O error DTO.

create_dir_all(tail, path: String) -> FsResult<Unit>

Creates path and any missing parent directories, or returns an I/O error DTO.

rename(tail, request: FsRenameRequest) -> FsResult<Unit>

Renames a file or directory.

write_atomic(tail, request: FsWriteRequest) -> FsResult<Unit>

Atomically replaces a file after fully writing a same-directory temporary.

create_exclusive(tail, request: FsWriteRequest) -> FsResult<Unit>

Creates and writes a file only when its path does not already exist.

mod std::http

Shared HTTP protocol values and helpers.

std::http is pure: it defines methods, statuses, headers, bodies,
inbound requests, and responses used by client and server effects.

Re-Exports

pub client

pub server

pub wire

Functions

fn method(value: StringSlice) -> Method

Parses a standard HTTP method or preserves an extension method.

fn method(value: String) -> Method

Parses a standard HTTP method or preserves an extension method.

fn method_as_string(value: Method) -> String

Returns the method token as a string.

fn headers() -> Headers

Creates an empty header collection.

Type Aliases

type Method = |(|(|(|(|(|(|(|(|(Get, Head), Post), Put), Patch), Delete), Options), Trace), Connect), Other)

type Header = object_literal(name: HeaderName, value: String)

type RequestTarget = |(Origin, Absolute)

Objects

obj Status

impl Status

Members
from(code: i32) -> Result<Status, HttpError>

Creates a status from a standard code.

custom( { code: i32 reason: String } ) -> Result<Status, HttpError>

Creates a status from a code and custom reason phrase.

custom( { code: i32 reason: StringSlice } ) -> Result<Status, HttpError>

Creates a status from a code and custom reason phrase.

code(self: Status) -> i32

Returns the numeric HTTP status code.

reason(self: Status) -> String

Returns the reason phrase.

is_success(self: Status) -> bool

Returns true for 2xx status codes.

is_client_error(self: Status) -> bool

Returns true for 4xx status codes.

is_server_error(self: Status) -> bool

Returns true for 5xx status codes.

ok() -> Status
created() -> Status
no_content() -> Status
bad_request() -> Status
unauthorized() -> Status
forbidden() -> Status
not_found() -> Status
method_not_allowed() -> Status
internal_server_error() -> Status

obj HeaderName

impl HeaderName

Members
from(value: StringSlice) -> Result<HeaderName, HttpError>

Builds a case-insensitive HTTP header name.

from(value: String) -> Result<HeaderName, HttpError>

Builds a case-insensitive HTTP header name.

as_string(self: HeaderName) -> String

Returns the name with caller-provided casing.

normalized(self: HeaderName) -> String

Returns the lowercase lookup key.

obj Headers

impl Headers

Members
empty() -> Headers

Creates an empty header collection.

from(entries: Array<Header>) -> Result<Headers, HttpError>

Builds headers from existing header values.

append(self: Headers, { header: Header }) -> Headers

Returns a copy with one header appended.

append( self: Headers, { header name: StringSlice value: StringSlice } ) -> Headers

Returns a copy with one header appended.

append( self: Headers, { header name: String value: String } ) -> Headers

Returns a copy with one header appended.

set(self: Headers, { header: Header }) -> Headers

Returns a copy with all existing values for the header name replaced.

set( self: Headers, { header name: StringSlice value: StringSlice } ) -> Headers

Returns a copy with all existing values for the header name replaced.

set( self: Headers, { header name: String value: String } ) -> Headers

Returns a copy with all existing values for the header name replaced.

remove(self: Headers, name: HeaderName) -> Headers

Returns a copy without values matching name.

remove(self: Headers, name: StringSlice) -> Headers

Returns a copy without values matching name.

remove(self: Headers, name: String) -> Headers

Returns a copy without values matching name.

get(self: Headers, name: HeaderName) -> Option<String>

Returns the first value matching name.

get(self: Headers, name: StringSlice) -> Option<String>

Returns the first value matching name.

get(self: Headers, name: String) -> Option<String>

Returns the first value matching name.

get_all(self: Headers, name: HeaderName) -> Array<String>

Returns every value matching name.

get_all(self: Headers, name: StringSlice) -> Array<String>

Returns every value matching name.

get_all(self: Headers, name: String) -> Array<String>

Returns every value matching name.

contains(self: Headers, name: HeaderName) -> bool

Returns true when any value exists for name.

contains(self: Headers, name: StringSlice) -> bool

Returns true when any value exists for name.

contains(self: Headers, name: String) -> bool

Returns true when any value exists for name.

entries(self: Headers) -> Array<Header>

Returns copied header entries in wire order.

content_type(self: Headers) -> Option<String>

Returns the first content-type value.

content_length(self: Headers) -> Option<i64>

Returns parsed content-length when present and valid.

obj Body

impl Body

Members
empty() -> Body

Creates an empty body.

bytes(value: Bytes) -> Body

Creates a byte body.

text(value: StringSlice) -> Body

Creates a UTF-8 text body.

text(value: String) -> Body

Creates a UTF-8 text body.

len(self: Body) -> i32

Returns the buffered byte length.

is_empty(self: Body) -> bool

Returns true when no bytes are stored.

as_bytes(self: Body) -> Bytes

Returns this body as bytes.

as_text(self: Body) -> Result<String, HttpError>

Returns this body as UTF-8 text.

obj QueryString

Members
raw: String

obj IncomingRequest

Members
method: Method
path: String
query: QueryString
headers: Headers
body: Body

impl IncomingRequest

Members
header(self: IncomingRequest, name: StringSlice) -> Option<String>

Returns the first header matching name.

header(self: IncomingRequest, name: String) -> Option<String>

Returns the first header matching name.

query_string(self: IncomingRequest) -> Option<String>

Returns the raw query string.

body_bytes(self: IncomingRequest) -> Bytes

Returns the request body as bytes.

text(self: IncomingRequest) -> Result<String, HttpError>

Returns the request body as UTF-8 text.

json(self: IncomingRequest) -> Result<JsonValue, HttpError>

Parses the request body as JSON.

obj Response

Members
status: Status
headers: Headers
body: Body

impl Response

Members
new( { status: Status headers?: Headers body?: Body } ) -> Response

Creates a response with optional headers and body.

ok() -> Response
created() -> Response
no_content() -> Response
bad_request() -> Response
unauthorized() -> Response
forbidden() -> Response
not_found() -> Response
method_not_allowed() -> Response
internal_server_error() -> Response
is_success(self: Response) -> bool

Returns true for 2xx status codes.

header(self: Response, name: StringSlice) -> Option<String>

Returns the first header matching name.

header(self: Response, name: String) -> Option<String>

Returns the first header matching name.

bytes(self: Response) -> Bytes

Returns the body as bytes.

text(self: Response) -> Result<String, HttpError>

Returns the body as UTF-8 text.

json(self: Response) -> Result<JsonValue, HttpError>

Parses the body as JSON.

with(self: Response, { status: Status }) -> Response

Returns a copy with a different status.

with(self: Response, { header: Header }) -> Response

Returns a copy with one header appended.

with( self: Response, { header name: StringSlice value: StringSlice } ) -> Response

Returns a copy with one header appended.

with( self: Response, { header name: String value: String } ) -> Response

Returns a copy with one header appended.

with(self: Response, { headers: Headers }) -> Response

Returns a copy with replaced headers.

with(self: Response, { body: Body }) -> Response

Returns a copy with a different body.

text(self: Response, value: StringSlice) -> Response

Returns a text response and sets content-type when missing.

text(self: Response, value: String) -> Response

Returns a text response and sets content-type when missing.

bytes(self: Response, value: Bytes) -> Response

Returns a byte response and sets content-type when missing.

json(self: Response, value: JsonValue) -> Response

Returns a JSON response and sets content-type when missing.

empty(self: Response) -> Response

Returns a response with an empty body.

obj HttpError

Members
code: i32
message: String

mod std::http::client

Host-backed outbound HTTP client capability.

Requests are built with typed HTTP values and cross the host boundary as
provider-neutral automatic DTOs.

Functions

fn send(request: ClientRequest): HttpClient -> Result<Response, HostError>

Sends a prebuilt request.

fn request(request: ClientRequest): HttpClient -> Result<Response, HostError>

Alias for send.

fn get(url: StringSlice): HttpClient -> Result<Response, HostError>

Sends a GET request.

fn get(url: String): HttpClient -> Result<Response, HostError>

Sends a GET request.

fn head(url: StringSlice): HttpClient -> Result<Response, HostError>

Sends a HEAD request.

fn head(url: String): HttpClient -> Result<Response, HostError>

Sends a HEAD request.

fn delete(url: StringSlice): HttpClient -> Result<Response, HostError>

Sends a DELETE request.

fn delete(url: String): HttpClient -> Result<Response, HostError>

Sends a DELETE request.

fn post( { url: StringSlice body: Body } ): HttpClient -> Result<Response, HostError>

Sends a POST request.

fn post( { url: String body: Body } ): HttpClient -> Result<Response, HostError>

Sends a POST request.

fn put( { url: StringSlice body: Body } ): HttpClient -> Result<Response, HostError>

Sends a PUT request.

fn put( { url: String body: Body } ): HttpClient -> Result<Response, HostError>

Sends a PUT request.

fn patch( { url: StringSlice body: Body } ): HttpClient -> Result<Response, HostError>

Sends a PATCH request.

fn patch( { url: String body: Body } ): HttpClient -> Result<Response, HostError>

Sends a PATCH request.

Type Aliases

type RedirectPolicy = |(|(Follow, Manual), Error)

Objects

obj ClientRequest

Members
method: Method
url: String
headers: Headers
body: Body
options: RequestOptions

impl ClientRequest

Members
get(url: StringSlice) -> ClientRequest

Builds a GET request.

get(url: String) -> ClientRequest

Builds a GET request.

head(url: StringSlice) -> ClientRequest

Builds a HEAD request.

head(url: String) -> ClientRequest

Builds a HEAD request.

delete(url: StringSlice) -> ClientRequest

Builds a DELETE request.

delete(url: String) -> ClientRequest

Builds a DELETE request.

post( { url: StringSlice body: Body } ) -> ClientRequest

Builds a POST request.

post( { url: String body: Body } ) -> ClientRequest

Builds a POST request.

put( { url: StringSlice body: Body } ) -> ClientRequest

Builds a PUT request.

put( { url: String body: Body } ) -> ClientRequest

Builds a PUT request.

patch( { url: StringSlice body: Body } ) -> ClientRequest

Builds a PATCH request.

patch( { url: String body: Body } ) -> ClientRequest

Builds a PATCH request.

custom( { method: Method url: StringSlice body?: Body headers?: Headers options?: RequestOptions } ) -> ClientRequest

Builds a request from explicit values.

custom( { method: Method url: String body?: Body headers?: Headers options?: RequestOptions } ) -> ClientRequest

Builds a request from explicit values.

with(self: ClientRequest, { header: Header }) -> ClientRequest

Returns a copy with one header appended.

with( self: ClientRequest, { header name: StringSlice value: StringSlice } ) -> ClientRequest

Returns a copy with one header appended.

with( self: ClientRequest, { header name: String value: String } ) -> ClientRequest

Returns a copy with one header appended.

with(self: ClientRequest, { headers: Headers }) -> ClientRequest

Returns a copy with replaced headers.

with(self: ClientRequest, { body: Body }) -> ClientRequest

Returns a copy with a different body.

with(self: ClientRequest, { timeout_millis: i32 }) -> ClientRequest

Returns a copy with a timeout budget.

with(self: ClientRequest, { redirect_policy: RedirectPolicy }) -> ClientRequest

Returns a copy with a redirect policy.

obj RequestOptions

Members
timeout_millis: i32
redirect_policy: RedirectPolicy

impl RequestOptions

Members
default() -> RequestOptions

Returns the default request policy.

with(self: RequestOptions, { timeout_millis: i32 }) -> RequestOptions

Returns a copy with a timeout budget.

with(self: RequestOptions, { redirect_policy: RedirectPolicy }) -> RequestOptions

Returns a copy with a redirect policy.

obj RedirectPolicyDto

Members
kind: String
max_redirects: i32

obj ClientRequestDto

Members
method: String
url: String
headers: Array<::(wire, HeaderDto)>
body: Bytes
timeout_millis: i32
redirect_policy: RedirectPolicyDto

Effects

eff HttpClient

Host HTTP client effect.

Members
request(tail, payload: ClientRequestDto) -> ::(wire, HttpResult<::(wire, ResponseDto)>)

Sends an HTTP request DTO and returns a host result DTO.

mod std::http::server

Host-backed inbound HTTP server capability.

The low-level API exposes explicit listen/accept/respond/close lifecycle
operations. serve_each provides a small safe request loop with an explicit
request task policy.

Functions

fn listen(config: ServerConfig): HttpServer -> Result<Server, HostError>

Starts a host HTTP server.

fn accept(server: Server): HttpServer -> Result<PendingRequest, HostError>

Accepts the next pending request.

fn accept_streaming( server: Server ): HttpServer -> Result<StreamingPendingRequest, HostError>

Accepts a request whose body can be consumed incrementally.

Configure the server with stream_request_bodies: true to avoid buffering
in the host. Buffered hook implementations remain compatible and are
exposed as the reader's first chunk.

fn respond( handle: RequestHandle, response: ::(http, Response) ): HttpServer -> Result<Unit, HostError>

Responds to one pending request.

fn start_response( handle: RequestHandle, response: ::(http, Response) ): HttpServer -> Result<Unit, HostError>

Starts a response without ending its body.

fn write_response( handle: RequestHandle, chunk: Bytes ): HttpServer -> Result<Unit, HostError>

Writes a chunk to an open response stream with host backpressure.

fn finish_response(handle: RequestHandle): HttpServer -> Result<Unit, HostError>

Finishes an open response stream.

fn stream( response: ::(http, Response), { body: fn: (ResponseWriter, open) -> void } ): (ResponseStream, open) -> ::(http, Response)

Produces a streaming response from an ordinary Web handler.

The enclosing server loop binds the stream to the current request. Calling
this outside serve_each leaves ResponseStream visible to the caller.

fn write(chunk: Bytes): ResponseWriter -> Result<Unit, HostError>

Writes one byte chunk from a streaming response producer.

fn close(server: Server): HttpServer -> Result<Unit, HostError>

Closes a server.

fn serve_each( { config: ServerConfig policy: ServeTaskPolicy handle: fn(::(http, IncomingRequest)): (open) -> ::(http, Response) } ): (HttpServer, ::(task, TaskRuntime), open) -> Result<Unit, HostError>

Listens and handles each accepted request according to policy.

Each accepted request is responded to exactly once by this helper. Sequential
policy returns accept/respond host errors directly. Detached policy reports
per-request respond failures through the task runtime's detached failure
diagnostics and keeps accepting new requests.

fn serve_each_streaming( { config: ServerConfig policy: ServeTaskPolicy handle: fn(::(http, IncomingRequest), RequestBody): (open) -> ::(http, Response) } ): (HttpServer, ::(task, TaskRuntime), open) -> Result<Unit, HostError>

Listens and handles requests with lazily consumed request bodies.

Set config.stream_request_bodies to true so the host accepts requests
after their headers arrive. The handler receives the request head and a
backpressure-aware body reader separately.

Objects

obj Server

impl Server

obj RequestHandle

impl RequestHandle

obj ServerConfig

Members
port: i32
host: String
max_body_bytes: i32
max_pending_requests: i32
response_timeout_millis: i32

Maximum idle time before an unanswered or stalled response is released.

stream_request_bodies: bool

impl ServerConfig

Members
init( { port: i32 host?: String max_body_bytes?: i32 max_pending_requests?: i32 response_timeout_millis?: i32 stream_request_bodies?: bool } ) -> ServerConfig

Creates a server configuration with common defaults.

response_timeout_millis is an idle watchdog. Successful streaming body
reads and response writes refresh it, and finishing cancels it.

obj PendingRequest

Members
handle: RequestHandle
request: ::(http, IncomingRequest)

obj StreamingPendingRequest

A request accepted with a lazily read body.

Members
handle: RequestHandle
request: ::(http, IncomingRequest)
body: RequestBody

obj RequestBody

Backpressure-aware request body reader.

impl RequestBody

Members
next(self: RequestBody): HttpServer -> Result<Option<Bytes>, HostError>

Reads the next body chunk, or None after end-of-stream.

read_all(self: RequestBody): HttpServer -> Result<Bytes, HostError>

Buffers all remaining chunks while preserving the host body limit.

obj ServeTaskPolicy

impl ServeTaskPolicy

Members
sequential() -> ServeTaskPolicy

Handles one request at a time before accepting the next request.

detached() -> ServeTaskPolicy

Handles each request in a detached task before accepting the next request.

obj ServerConfigDto

Members
port: i32
host: String
max_body_bytes: i32
max_pending_requests: i32
response_timeout_millis: i32
stream_request_bodies: bool

obj RespondRequestDto

Members
request_id: i32
response: ::(wire, ResponseDto)

obj ChunkRequestDto

Members
request_id: i32
chunk: Bytes

Effects

eff ResponseStream

Dynamically scoped response-stream request used by stream.

Members
begin_stream(resume, response: ::(wire, ResponseDto)) -> Unit
finish_stream(resume) -> Unit

eff ResponseWriter

Dynamically scoped writer available while a response stream is open.

Members
write_chunk(tail, chunk: Bytes) -> ::(wire, HttpResult<Unit>)

eff HttpServer

Host HTTP server effect.

Members
listen_raw(tail, payload: ServerConfigDto) -> ::(wire, HttpResult<i32>)

Starts a server and returns a server id.

accept_raw(resume, server_id: i32) -> ::(wire, HttpResult<::(wire, PendingRequestDto)>)

Suspends until a request is available or the server closes.

read_request_raw(resume, request_id: i32) -> ::(wire, HttpResult<::(wire, RequestChunkDto)>)

Reads the next chunk for a streaming request.

respond_raw(tail, payload: RespondRequestDto) -> ::(wire, HttpResult<Unit>)

Sends one response for a request handle.

start_response_raw(tail, payload: RespondRequestDto) -> ::(wire, HttpResult<Unit>)

Starts a streaming response for a request handle.

write_response_raw(tail, payload: ChunkRequestDto) -> ::(wire, HttpResult<Unit>)

Writes one streaming response chunk.

finish_response_raw(resume, request_id: i32) -> ::(wire, HttpResult<Unit>)

Finishes a streaming response.

close_raw(tail, server_id: i32) -> ::(wire, HttpResult<Unit>)

Closes a server and releases host resources.

mod std::http::wire

Provider-neutral DTOs for standard HTTP host effects.

Functions

fn decode_result<T>(result: HttpResult<T>) -> Result<T, HostError>

fn encode_result<T>(result: Result<T, HostError>, fallback: T) -> HttpResult<T>

fn encode_headers(headers: Headers) -> Array<HeaderDto>

fn decode_headers(source: Array<HeaderDto>) -> Result<Headers, HostError>

fn encode_response(response: Response) -> ResponseDto

fn decode_response(value: ResponseDto) -> Result<Response, HostError>

fn decode_response_result(result: HttpResult<ResponseDto>) -> Result<Response, HostError>

fn decode_pending_request_result( result: HttpResult<PendingRequestDto> ) -> Result<(i32, IncomingRequest, bool), HostError>

fn body_from_bytes(bytes: Bytes) -> Body

Objects

obj HttpResult<T>

Members
ok: bool
value: T
error_code: i32
error_message: String

obj HeaderDto

Members
name: String
value: String

obj ResponseDto

Members
status: i32
reason: String
headers: Array<HeaderDto>
body: Bytes

obj PendingRequestDto

Members
request_id: i32
method: String
path: String
query: String
headers: Array<HeaderDto>
body: Bytes
body_streaming: bool

obj RequestChunkDto

Members
chunk: Bytes
done: bool

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 use automatic DTO conversion.

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

Members
prompt: String

Optional prompt shown before reading input.

impl InputRequest

Members
init(prompt?: StringSlice) -> InputRequest

Builds a read request.

init(prompt: String) -> InputRequest

Builds a read request.

obj InputReadBytesRequest

Members
max_bytes: i32

obj InputLineResult

Members
ok: bool
found: bool
value: String
code: i32
message: String

obj InputBytesResult

Members
ok: bool
found: bool
value: Bytes
code: i32
message: String

Effects

eff Input

Host input effect used by std::input.

Members
read_line(tail, request: InputRequest) -> InputLineResult

Reads one line using the provided request.

read_bytes_op(tail, request: InputReadBytesRequest) -> InputBytesResult

Reads up to max_bytes bytes from standard input.

is_tty_op(tail) -> bool

Reports whether stdin is attached to an interactive terminal.

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.

fn strict_decode_options() -> JsonDecodeOptions

Returns strict typed-decoder options that reject unknown record fields.

fn permissive_decode_options() -> JsonDecodeOptions

Returns forward-compatible typed-decoder options that ignore unknown fields.

fn encode<T>(value: T): () -> Result<String, JsonError>

Encodes a DTO-compatible value as compact JSON text.

Signed 64-bit integers outside JavaScript's exact integer range are
rejected. Bytes requires an explicit application representation.

fn encode_with_limits<T>( value: T, { limits: EncodeLimits } ): () -> Result<String, JsonError>

Encodes compact JSON with explicit depth, byte, and collection limits.

fn encode_value<T>(value: T): () -> Result<JsonValue, JsonError>

Encodes a DTO-compatible value as an explicit JSON value tree.

Use this when an API needs to inspect or compose JSON before stringifying it.

fn decode<T>(source: String): () -> Result<T, JsonDecodeError>

Parses and strictly decodes JSON into a closed boundary-compatible type.

fn decode<T>(source: StringSlice): () -> Result<T, JsonDecodeError>

Parses and strictly decodes a borrowed JSON source.

fn decode<T>( source: String, { options: JsonDecodeOptions } ): () -> Result<T, JsonDecodeError>

Parses and decodes JSON with an explicit unknown-field policy.

fn decode<T>( source: StringSlice, { options: JsonDecodeOptions } ): () -> Result<T, JsonDecodeError>

Parses and decodes borrowed JSON with an explicit unknown-field policy.

fn decode<T>(value: JsonValue): () -> Result<T, JsonDecodeError>

Strictly decodes an already-parsed JSON value.

fn decode<T>( value: JsonValue, { options: JsonDecodeOptions } ): () -> Result<T, JsonDecodeError>

Decodes an already-parsed JSON value with explicit field policy.

fn decode_versioned<T>( source: String, { current current_version: i32 migrate: JsonMigration } ): () -> Result<T, JsonDecodeError>

Decodes a versioned document and requires migrations to produce current.

fn decode_versioned<T>( source: StringSlice, { current current_version: i32 migrate: JsonMigration } ): () -> Result<T, JsonDecodeError>

Decodes a borrowed versioned document with explicit migration dispatch.

fn decode_versioned<T>( document: JsonValue, { current current_version: i32 migrate: JsonMigration } ): () -> Result<T, JsonDecodeError>

Decodes an already-parsed versioned document with explicit migration dispatch.

fn number_in_range( value: JsonValue, { at path: String min: f64 max: f64 } ): () -> Result<f64, JsonDecodeError>

Reads a JSON number and enforces an inclusive finite range.

fn number_in_range( value: JsonValue, { at path: StringSlice min: f64 max: f64 } ): () -> Result<f64, JsonDecodeError>

Reads a ranged JSON number using a borrowed path.

Type Aliases

type JsonDecodeErrorKind = |(|(|(|(JsonParseFailure, JsonSchemaFailure), JsonVersionFailure), JsonConstraintFailure), JsonCustomDtoFailure)

Stable categories for typed JSON decoding failures.

type JsonMigration = (fn(version: i32, document: JsonValue)) -> Result<JsonValue, JsonDecodeError>

Migration callback for a parsed versioned document.

type JsonValue = |(JsonNull, |(JsonBool, |(JsonNumber, |(JsonString, |(JsonArray, JsonObject)))))

Tagged union over all supported JSON value variants.

Objects

obj JsonError

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

obj JsonWriter

Direct compact-JSON sink used by compiler-generated DTO traversal.

impl JsonWriter

Members
finish(self: JsonWriter) -> Result<String, JsonError>

Finishes exactly one balanced JSON value.

impl JsonWriter for DataWriter<JsonError>

obj JsonParseFailure

The JSON text itself was malformed.

obj JsonSchemaFailure

A parsed value did not match the requested Voyd type.

obj JsonVersionFailure

A versioned document could not be dispatched or migrated.

obj JsonConstraintFailure

A decoded number violated an explicit application constraint.

obj JsonCustomDtoFailure

A custom DTO rejected a valid JSON representation.

Members
code: String

obj JsonDecodeError

Typed JSON failure with a rooted JSON path and retained cause text.

Members
kind: JsonDecodeErrorKind
path: String
message: String

obj JsonDecodeOptions

Unknown-field behavior used by typed JSON decoding.

Members
unknown_fields: UnknownFieldPolicy
limits: DecodeLimits

obj JsonNull

Represents the JSON null literal.

obj JsonBool

Represents a JSON boolean literal.

Members
value: bool

Stored boolean payload.

obj JsonNumber

Represents a JSON number.

Members
value: f64

Stored numeric payload.

obj JsonString

Represents a JSON string.

Members
value: String

Stored string payload.

obj JsonArray

Represents a JSON array.

Members
value: Array<JsonValue>

Stored element values.

obj JsonObject

Represents a JSON object keyed by strings.

Members
value: Dict<String, JsonValue>

Stored object fields.

obj JsonReader

Pull reader over one JSON source without constructing a JsonValue tree.

impl JsonReader

Members
is_complete(self: JsonReader) -> bool

Returns true after one balanced root and all source text are consumed.

impl JsonReader for DataReader<JsonError>

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

Members
value: String

String field payload.

obj LogInt

Members
value: i64

Integer field payload.

obj LogFloat

Members
value: f64

Floating-point field payload.

obj LogBool

Members
value: bool

Boolean field payload.

obj LogField

Members
key: String

Associated key for this entry.

value: LogFieldValue

Log field payload.

obj LogEvent

Members
level: String
message: String
fields: LogFields

Effects

eff Log

Host logging effect used by std::log.

std::log sends a typed event to the host log sink.

Members
emit(tail, event: LogEvent) -> void

Emits one structured log event.

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.

Members
code: i32

Machine-readable error code.

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::meta

Provider-neutral reification of boundary-compatible Voyd types.

Shape is a stable runtime graph. It describes Voyd structure without
exposing compiler type ids or a schema dialect such as JSON Schema.

Functions

fn shape_of<T>() -> Shape

Reifies a closed boundary-compatible type as a portable runtime graph.

Unsupported or unresolved type arguments produce a compile-time diagnostic.

fn try_shape_of<T>() -> Option<Shape>

Reifies a boundary-compatible type, or returns None when no honest shape exists.

Type Aliases

type ShapeNode = |(|(|(|(|(|(|(|(|(|(|(BoolShape, I32Shape), I64Shape), F32Shape), F64Shape), StringShape), BytesShape), UnitShape), ArrayShape), RecordShape), UnionShape), RefShape)

One node in a portable shape graph.

Objects

obj Shape

A complete portable type graph.

Members
root: ShapeNode

Root node for the reified type.

definitions: Array<ShapeDefinition>

Named nodes referenced by RefShape entries.

obj ShapeDefinition

A named node used to close recursive shape graphs.

Members
key: String

Graph-local, deterministic key used by references.

name: String

Source-level display name for the defined type.

shape: ShapeNode

Reified definition body.

documentation: String

Declaration documentation when available.

obj BoolShape

Boolean primitive shape.

obj I32Shape

Signed 32-bit integer primitive shape.

obj I64Shape

Signed 64-bit integer primitive shape.

obj F32Shape

32-bit floating-point primitive shape.

obj F64Shape

64-bit floating-point primitive shape.

obj StringShape

String primitive shape.

obj BytesShape

Immutable byte sequence shape.

obj UnitShape

Void/unit boundary shape.

obj ArrayShape

Growable-array shape.

Members
element: ShapeNode

Shape of every array element.

obj ShapeField

Field in a record or variant payload.

Members
name: String

Source field name.

shape: ShapeNode

Resolved field shape.

optional: bool

Whether the field may be omitted.

documentation: String

Field documentation when available.

obj RecordShape

Record or structural-object shape.

Members
name: String

Stable source-level name, or a deterministic structural spelling.

documentation: String

Declaration documentation when available.

fields: Array<ShapeField>

Fields in declaration order.

obj ShapeVariant

One supported named union variant.

Members
name: String

Variant name used by neutral data values.

documentation: String

Variant documentation when available.

fields: Array<ShapeField>

Variant payload fields in declaration order.

obj UnionShape

Named union/variant shape.

Members
name: String

Stable source-level union name.

documentation: String

Union declaration documentation when available.

variants: Array<ShapeVariant>

Supported variants in declaration order.

obj RefShape

Reference to a named entry in Shape::definitions.

Members
key: String

Graph-local definition key. Compiler-local ids are never exposed.

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::MsgPackMap

pub fns::MsgPackReader

pub fns::MsgPackWriter

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 encode<T>(value: T): () -> Result<Bytes, MsgPackError>

Encodes a DTO-compatible value into immutable MessagePack bytes.

fn encode_with_limits<T>( value: T, { limits: EncodeLimits } ): () -> Result<Bytes, MsgPackError>

Encodes with explicit depth, byte, and collection limits.

fn encode_value_bytes(value: MsgPack): () -> Result<Bytes, MsgPackError>

Encodes an explicitly constructed MessagePack value into immutable bytes.

fn decode<T>(bytes: Bytes): () -> Result<T, MsgPackError>

Decodes immutable MessagePack bytes into a DTO-compatible value.

fn decode_with_limits<T>( bytes: Bytes, { limits: DecodeLimits } ): () -> Result<T, MsgPackError>

Decodes with explicit depth, byte, and collection limits.

fn decode_value_bytes(bytes: Bytes): () -> Result<MsgPack, MsgPackError>

Decodes immutable bytes into the parsed MessagePack value tree.

fn from_data_value(value: DataValue): () -> MsgPack

Converts a provider-neutral dynamic value into the parsed MessagePack tree.

fn to_data_value(value: MsgPack): () -> DataValue

Converts a parsed MessagePack tree into a provider-neutral dynamic value.

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>

Type Aliases

type MsgPack = RawMsgPack

mod std::msgpack::errors

Public MessagePack boundary error definitions.

Objects

obj MsgPackError

Members
code: i32

Machine-readable error code.

custom_code: String

Stable custom DTO code, or an empty string for provider failures.

path: String

Rooted DTO path for typed decode failures.

message: String

Human-readable error message.

mod std::msgpack::fns

MessagePack serializer implementation used by std::msgpack.
This module owns the in-memory codec and value constructors/unpackers.

Objects

obj MsgPackMap

Internal representation for MessagePack maps before conversion to Dict.

obj MsgPackWriter

Direct MessagePack sink used by compiler-generated DTO traversal.

impl MsgPackWriter

Members
finish(self: MsgPackWriter) -> Result<Bytes, MsgPackError>

Finishes exactly one balanced DTO value.

impl MsgPackWriter for DataWriter<MsgPackError>

obj MsgPackReader

Direct MessagePack source used by compiler-generated DTO traversal.

impl MsgPackReader

Members
is_complete(self: MsgPackReader) -> bool

Returns true after one balanced root and every source byte are consumed.

impl MsgPackReader for DataReader<MsgPackError>

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.

Members
value: i32

Wrapped payload value.

obj I64

MessagePack 64-bit integer wrapper.

Members
value: i64

Wrapped payload value.

obj F32

MessagePack 32-bit float wrapper.

Members
value: f32

Wrapped payload value.

obj F64

MessagePack 64-bit float wrapper.

Members
value: f64

Wrapped payload value.

obj Bool

MessagePack boolean wrapper.

Members
value: bool

Wrapped payload value.

obj Null

MessagePack null wrapper.

obj Binary

MessagePack binary payload wrapper.

Members
bytes: Array<i32>

Raw bytes stored by this value.

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 number_format_error_code_invalid_precision() -> i32

The requested precision is outside the supported range.

fn number_format_error_code_non_finite() -> i32

The policy rejects the provided NaN or infinite value.

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.

fn format_fixed( value: f64, { decimal_places: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f64 with a fixed number of decimal places.

Rounding uses IEEE-754 ties-to-even semantics. Negative zero is normalized
to unsigned zero. decimal_places must be between 0 and 15.

fn format_fixed( value: f32, { decimal_places: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f32 with a fixed number of decimal places.

fn format_significant( value: f64, { digits: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f64 with the requested significant decimal digits.

Values with decimal exponents outside -6...20 use compact scientific
notation. digits must be between 1 and 16.

fn format_significant( value: f32, { digits: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f32 with the requested significant decimal digits.

fn format_scientific( value: f64, { digits: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f64 in compact scientific notation such as 1.25e6.

digits counts all significant digits and must be between 1 and 16.

fn format_scientific( value: f32, { digits: i32 trim_trailing_zeros?: bool non_finite?: NonFinitePolicy } ): () -> Result<String, NumberFormatError>

Formats an f32 in compact scientific notation.

Objects

obj CastError

Error returned by checked numeric casts.

Members
code: i32

Machine-readable error code.

obj NonFinitePolicy

Controls how explicit number-formatting APIs handle NaN and infinities.

impl NonFinitePolicy

Members
symbols() -> NonFinitePolicy

Emit NaN, Infinity, or -Infinity.

reject() -> NonFinitePolicy

Reject non-finite values with number_format_error_code_non_finite.

obj NumberFormatError

Error returned by explicit number-formatting APIs.

Members
code: i32

Machine-readable error code.

message: String

Human-readable failure description.

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.

Parameters
  • value

    Value to wrap in Some.

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.

Parameters
  • opt

    Optional value to inspect.

fn is_none<T>(opt: Optional<T>): () -> boolean

Returns true when the optional value is absent.

Parameters
  • opt

    Optional value to inspect.

fn unwrap_or<T>(opt: Optional<T>, default: T): () -> T

Returns the contained value or a fallback.

Parameters
  • opt

    Optional value to unwrap.

  • default

    Fallback value returned for None.

fn unwrap_or_else<T>( opt: Optional<T>, default: (()) -> T ) -> T

Returns the contained value or computes a fallback lazily.

Parameters
  • opt

    Optional value to unwrap.

  • default

    Function invoked only when opt is None.

fn map<T, U>( opt: Optional<T>, f: (v: T) -> U ) -> Optional<U>

Transforms a present value and leaves None unchanged.

Parameters
  • opt

    Optional value to transform.

  • f

    Mapping function applied to Some payloads.

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.

Parameters
  • opt

    Optional value to transform.

  • f

    Function applied to Some payloads.

fn or_value<T>(opt: Optional<T>, fallback: Optional<T>): () -> Optional<T>

Returns opt when present, otherwise fallback.

Parameters
  • opt

    Primary optional value.

  • fallback

    Fallback optional value used for None.

fn or_else<T>( opt: Optional<T>, fallback: (()) -> Optional<T> ) -> Optional<T>

Returns opt when present, otherwise computes a fallback optional value.

Parameters
  • opt

    Primary optional value.

  • fallback

    Function invoked to compute a fallback for None.

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.

Members
value: T

Stored payload value.

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

obj OutputWriteRequest

Members
value: String
target: String

obj OutputWriteBytesRequest

Members
bytes: Bytes
target: String

obj OutputTargetRequest

Members
target: String

obj OutputResult

Members
ok: bool
code: i32
message: String

Effects

eff Output

Host output effect used by std::output.

Operations in this effect forward automatic DTO values to host-managed
stdout and stderr streams.

Members
write_op(tail, request: OutputWriteRequest) -> OutputResult

Writes UTF-8 text to the selected output stream.

write_bytes_op(tail, request: OutputWriteBytesRequest) -> OutputResult

Writes raw bytes to the selected output stream.

flush_op(tail, request: OutputTargetRequest) -> OutputResult

Flushes buffered data for the selected output stream.

is_tty_op(tail, request: OutputTargetRequest) -> bool

Returns whether the selected stream is a terminal.

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

Members
new(path: String) -> Path

Constructs a value from the provided input.

new(path: StringSlice) -> Path

Constructs a value from the provided input.

as_string(self: Path) -> String

Returns the path as a string value.

join(self: Path, child: String) -> Path

Returns a path with child appended.

join(self: Path, child: StringSlice) -> Path

Returns a path with child appended.

parent(self: Path) -> Option<Path>

Returns the parent path when one exists.

file_name(self: Path) -> Option<String>

Returns the final path segment when one exists.

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 shared_cell

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 http

pub input

pub output

pub path

pub fs

pub test

pub task

pub meta

pub data

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::shared_cell::SharedCell

pub std::shared_cell::SharedCellBorrowError

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::enums::enum

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::log

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 enum

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 random_error_code_invalid_length() -> i32

The requested secure-byte length is negative.

fn random_error_code_invalid_payload() -> i32

The host returned a malformed, truncated, or out-of-range byte payload.

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 secure_bytes(len: i32): Random -> Result<Bytes, RandomError>

Returns exactly len cryptographically secure random bytes.

The host payload is validated without normalization or pseudo-random
fallback. A deterministic Random::fill_bytes handler can supply fixtures
in tests.

fn fill_bytes(buf: ByteBuffer, len: i32): Random -> ByteBuffer

Fills a byte buffer with cryptographically secure random bytes.
len controls the number of bytes appended to buf.
Example:
let buf = random::fill_bytes(ByteBuffer::init(), 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 RandomError

Error returned when secure host entropy cannot satisfy a byte request.

Members
code: i32

Machine-readable error code.

message: String

Human-readable failure description.

obj UuidParseError

Error returned when UUID text is not in canonical hyphenated form.

Members
index: i32

Byte index associated with the failure.

message: String

Human-readable failure description.

obj Uuid

A 128-bit universally unique identifier.

Uuid::v4 uses the host Random effect's cryptographically secure byte
source. Text formatting is canonical lower-case 8-4-4-4-12 hexadecimal.

impl Uuid

Members
v4(): Random -> Result<Uuid, RandomError>

Generates a version-4 UUID from 16 secure host bytes.

parse(source: StringSlice): () -> Result<Uuid, UuidParseError>

Parses canonical hyphenated UUID text. Hexadecimal input is case-insensitive.

parse(source: String): () -> Result<Uuid, UuidParseError>

Parses canonical hyphenated UUID text. Hexadecimal input is case-insensitive.

is_valid(source: StringSlice) -> bool

Returns whether the source is a canonical hyphenated UUID.

is_valid(source: String) -> bool

Returns whether the source is a canonical hyphenated UUID.

to_string(self: Uuid) -> String

Formats this UUID as canonical lower-case 8-4-4-4-12 text.

obj U64Bits

Raw 64-bit bits interpreted as unsigned payload.

Members
bits: i64

Underlying bit pattern.

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

Members
seeded(seed: i64) -> LocalRng

Creates a local RNG from explicit seed bits.

seeded(seed: U64Bits) -> LocalRng

Creates a local RNG from explicit seed bits.

seeded_from_host(): Random -> LocalRng

Seeds a local RNG from the host random source.

This performs one host random effect call, then all subsequent sampling
remains local and effect-free.

next_u64(~self: LocalRng) -> U64Bits

Returns the next random bits.

next_i64(~self: LocalRng) -> i64

Returns the next random signed integer.

random_bool(~self: LocalRng) -> bool

Returns a random boolean value.

random_i32(~self: LocalRng) -> i32

Returns a random i32 value.

random_i32(~self: LocalRng, range: Range<i32>) -> i32

Returns a random i32 value within the provided range.

random_i64(~self: LocalRng) -> i64

Returns a random i64 value.

random_i64(~self: LocalRng, range: Range<i64>) -> i64

Returns a random i64 value within the provided range.

random_f64(~self: LocalRng) -> f64

Returns a random floating-point value in [0.0, 1.0).

random_f64(~self: LocalRng, range: Range<f64>) -> f64

Returns a random floating-point value within the provided range.

random_f32(~self: LocalRng) -> f32

Returns a random floating-point value in [0.0, 1.0) as f32.

random_f32(~self: LocalRng, range: Range<f32>) -> f32

Returns a random floating-point value within the provided range as f32.

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.

Members
next_i64(tail) -> i64

Returns a random signed 64-bit integer.

next_u64(tail) -> i64

Returns random 64-bit bits interpreted as an unsigned integer payload.

The transport representation is i64, but callers should treat the bits
as unsigned payload.

fill_bytes(tail, len: i32) -> Bytes

Returns exactly len random bytes.

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.

Members
start: Optional<T>

Optional inclusive starting index.

end: Optional<T>

Optional ending index.

include_end: bool

Whether end is included in the range.

impl Range<i32> for Sequence<i32>

Members
iter(self: Range<i32>) -> Iterator<i32>

Returns an iterator over integer range values.

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.

Parameters
  • value

    Success value to wrap.

fn err<T, E>(error: E): () -> Result<T, E>

Constructs a failing Result value.

Use this when an operation cannot produce a success value.

Parameters
  • error

    Error value to wrap.

fn is_ok<T, E>(result: Result<T, E>): () -> bool

Returns true when the result is successful.

Parameters
  • result

    Result value to inspect.

fn is_err<T, E>(result: Result<T, E>): () -> bool

Returns true when the result is an error.

Parameters
  • result

    Result value to inspect.

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.

Parameters
  • result

    Result value to unwrap.

  • fallback

    Value returned for Err results.

fn map<T, E, U>( result: Result<T, E>, f: (v: T) -> U ) -> Result<U, E>

Transforms an Ok value and leaves Err unchanged.

Parameters
  • result

    Source result value.

  • f

    Mapping function applied only to Ok payloads.

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.

Parameters
  • result

    Source result value.

  • f

    Continuation invoked for Ok payloads.

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.

Members
value: T

Successful payload value.

obj Err<E>

Failing Result variant.

Stores error information for failure paths.

Members
error: E

Error payload value.

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().inserting("alpha")
tags.contains("alpha")

impl<T> Set<T>

Members
init() -> Set<T>

Creates an empty set.

len(self: Set<T>) -> i32

Returns the number of values in the set.

is_empty(self: Set<T>) -> bool

Returns true when the set is empty.

contains(self: Set<T>, value: T) -> bool

Returns true when value is in the set.

insert(~self: Set<T>, value: T) -> bool

Inserts value, returning true only when it was newly inserted.

remove(~self: Set<T>, value: T) -> bool

Removes value, returning true only when it existed.

inserting(self: Set<T>, value: T) -> Set<T>

Returns a set containing value.

removing(self: Set<T>, value: T) -> Set<T>

Returns a set without value.

clear(~self: Set<T>) -> void

Removes all values.

values(self: Set<T>) -> Array<T>

Returns all values in unspecified order.

The returned sequence reflects hash-bucket traversal order, not insertion order.

mod std::shared_cell

Explicit single-threaded shared mutable state.

SharedCell<T> allows multiple owners to retain the same cell while keeping
access to its value lexically scoped. Runtime checks reject overlapping
mutable and shared access; operations never block and are not thread-safe.

Type Aliases

type SharedCellBorrowError = |(AlreadyMutablyBorrowed, AlreadySharedBorrowed)

Objects

obj SharedCell<T>

A single-threaded container for intentionally shared mutable state.

Prefer an ordinary ~T borrow when one owner can lend exclusive access.
Use SharedCell<T> when multiple long-lived owners must retain the state.

impl<T> SharedCell<T>

Members
init(value: T) -> SharedCell<T>

Creates an unborrowed cell containing value.

with<R>( self: SharedCell<T>, body: fn(value: Borrow<T>): (()) -> R ): () -> R

Runs body with shared access to the contained value.

Multiple nested shared accesses are allowed. A nested mutable access
panics with a deterministic conflict message.

with_mut<R>( self: SharedCell<T>, body: fn(~(value): Borrow<T>): (()) -> R ): () -> R

Runs body with exclusive access to the contained value.

Any overlapping shared or mutable access panics with a deterministic
conflict message.

try_with<R>( self: SharedCell<T>, body: fn(value: Borrow<T>): (()) -> R ): () -> Result<R, SharedCellBorrowError>

Attempts to run body with shared access.

try_with_mut<R>( self: SharedCell<T>, body: fn(~(value): Borrow<T>): (()) -> R ): () -> Result<R, SharedCellBorrowError>

Attempts to run body with exclusive access.

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

Members
to_i32(self: StringIndex) -> i32

Returns the raw integer byte offset for this index.

This is mainly useful for interop with low-level APIs.

mod std::string::type

Core UTF-8 string types and operations.

String is an owned UTF-8 value and StringSlice is a stable byte window
backed by retained immutable storage. 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

Members
init() -> String

Creates an empty string.

with_capacity({ bytes _capacity: i32 }) -> String

Creates an empty string with capacity for at least _capacity bytes.

from_utf8(source: Array<i32>) -> Result<String, Utf8Error>

Validates UTF-8 bytes and builds a string on success.

  • source: byte array to validate as UTF-8.
byte_len(self: String): () -> i32

Returns the number of UTF-8 bytes.

rune_len(self: String): () -> i32

Returns the number of Unicode scalar values.

grapheme_len(self: String) -> i32

Returns the number of grapheme clusters.

is_empty(self: String) -> bool

Returns true when no values are stored.

to_utf8(self: String): () -> Array<i32>

Returns a UTF-8 byte array copy.

This allocates a new Array<i32> containing the exact encoded bytes.
Mutating the returned array never changes the string or slices derived
from it.

Example:
String::from_utf8(text.to_utf8())
round-trips text through bytes validation.

to_string(self: String): () -> String

Returns this value as an owned string.

concat(self: String, other: String) -> String

Returns a new string by appending other.

concat(self: String, other: StringSlice) -> String

Returns a new string by appending other.

as_slice(self: String): () -> StringSlice

Returns a stable slice backed by this string's immutable storage.

start_index(self: String): () -> StringIndex

Returns the first valid string index.

end_index(self: String): () -> StringIndex

Returns the index immediately after the last byte.

slice(self: String, range: Range<i32>) -> StringSlice

Returns a subrange view for the requested range.

  • range: byte-based range expression.

Start and end are clamped to valid bounds and moved to rune boundaries.
Empty or inverted ranges return an empty slice.

Example:
name.slice(0..4).to_string()
returns the first four bytes, snapped to rune boundaries.

slice(self: String, { range: Range<i32> }) -> StringSlice
index( self: String, { after cursor: StringIndex by steps?: i32 } ) -> Option<StringIndex>

Moves a string index by rune steps.

  • cursor: starting byte index.
  • steps: number of runes to move; defaults to 1.

Negative steps move backward. Returns None when cursor is invalid or
movement would go out of bounds.

Example:
text.index(after: text.start_index(), by: 2)
moves to the third rune boundary.

grapheme_index( self: String, { after cursor: StringIndex by steps?: i32 } ) -> Option<StringIndex>

Moves a string index by grapheme clusters.

  • cursor: starting byte index.
  • steps: number of grapheme clusters to move; defaults to 1.
graphemes(self: String) -> StringGraphemeSequence

Returns an iterator over grapheme slices.

get_byte(self: String, index: i32) -> Option<i32>

Returns the byte at the requested index, or None when the index is out of bounds.

equals(self: String, other: String): () -> bool

Returns true when both strings have identical bytes.

hash_i32(self: String): () -> i32

Returns a 32-bit hash of the string contents.

rune_at(self: String, index: i32) -> Option<i32>

Returns the rune at the requested rune index.

slice( self: String, { bytes start: i32 len: i32 } ): () -> StringSlice

Returns a substring view using byte offsets.

slice_bytes(self: String, start: i32, len: i32): () -> StringSlice

Returns a substring view using byte offsets.

slice( self: String, { runes start: i32 len: i32 } ): () -> StringSlice

Returns a substring view using rune offsets.

slice_runes(self: String, start: i32, len: i32): () -> StringSlice

Returns a substring view using rune offsets.

find_rune(self: String, rune: i32, { from?: StringIndex }) -> Option<StringIndex>

Returns the index of the first matching rune.

starts_with(self: String, prefix: StringSlice) -> bool

Returns true when the value begins with the provided prefix.

starts_with(self: String, prefix: String) -> bool

Returns true when the value begins with the provided prefix.

ends_with(self: String, suffix: StringSlice) -> bool

Returns true when the value ends with the provided suffix.

ends_with(self: String, suffix: String) -> bool

Returns true when the value ends with the provided suffix.

contains(self: String, substring: StringSlice) -> bool

Returns true when a matching value exists.

contains(self: String, substring: String) -> bool

Returns true when a matching value exists.

contains( self: String, { where pred: (rune: i32) -> bool } ) -> bool

Returns true when a matching value exists.

find(self: String, substring: StringSlice, { from?: StringIndex }) -> Option<StringIndex>

Returns the first value that satisfies the predicate.

find(self: String, substring: String, { from?: StringIndex }) -> Option<StringIndex>

Returns the first value that satisfies the predicate.

reverse_find( self: String, substring: StringSlice, { to?: StringIndex } ) -> Option<StringIndex>

Returns the last match of a substring before the optional limit.

reverse_find(self: String, substring: String, { to?: StringIndex }) -> Option<StringIndex>

Returns the last match of a substring before the optional limit.

find_range( self: String, substring: StringSlice, { from?: StringIndex } ) -> Option<Range<i32>>

Returns the start and end byte range of the first substring match.

find_range(self: String, substring: String, { from?: StringIndex }) -> Option<Range<i32>>

Returns the start and end byte range of the first substring match.

split_once(self: String, { on separator: i32 }): () -> Option<(StringSlice, StringSlice)>

Splits at the first matching separator.

split( self: String, { on separator: i32 max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: String, { on separator: StringSlice max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: String, { on separator: String max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: String, { where pred: rune: i32: (()) -> bool max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

lines(self: String, { keep_ends?: bool }) -> Array<StringSlice>

Splits a string slice into lines.

words(self: String) -> Array<StringSlice>

Splits the text into whitespace-delimited words.

trimmed(self: String): () -> StringSlice

Returns a trimmed slice view.

trimmed(self: String, chars: CharSet) -> StringSlice

Returns a trimmed slice view.

trim(~self: String) -> void

Trims leading and trailing characters in place.

trim(~self: String, chars: CharSet) -> void

Trims leading and trailing characters in place.

lowered(self: String): () -> String

Returns a lowercase ASCII copy of this string.

lower(~self: String) -> void

Converts this string in place to lowercase ASCII characters.

uppered(self: String): () -> String

Returns an uppercase ASCII copy of this string.

upper(~self: String) -> void

Converts this string in place to uppercase ASCII characters.

replaced( self: String, { old: String with replacement: String max_replacements?: i32 } ): () -> String

Returns a new string with replacements applied.

replace( ~self: String, { old: String with replacement: String max_replacements?: i32 } ) -> void

Replaces matching content with new content.

repeat(self: String, count: i32) -> String

Returns a new string repeated count times.

pad_left( self: String, { width: i32 with?: i32 } ) -> String

Returns a copy padded on the left to the requested width.

pad_right( self: String, { width: i32 with?: i32 } ) -> String

Returns a copy padded on the right to the requested width.

parse_int(self: String, { radix?: i32 }): () -> Result<i32, ParseIntError>

Parses this string as an i32.

  • radix: base in the inclusive range 2..36 (defaults to 10).

Supports optional leading + or -.

Error codes:

  • 1: invalid radix.
  • 2: empty input (or sign without digits).
  • 3: digit not valid for radix.
  • 4: value overflowed i32.

Example:
hex.parse_int(radix: 16) parses "ff" into 255.

parse_float(self: String): () -> Result<f64, ParseFloatError>

Parses this string as an f64.

Accepted format:
[+|-]?digits[.digits][e[+|-]digits]

Error codes:

  • 1: invalid or incomplete numeric format.

Example:
number.parse_float() parses "3.5e2" into 350.0.

to_debug(self: String) -> String

Returns a debug-friendly escaped string representation.

to_repr(self: String) -> String

Returns a source-like escaped string representation.

impl String for Eq<String>

Members
eq(self: String, { other: String }) -> bool
ne(self: String, { other: String }) -> bool
==(self: String, other: String) -> bool
!=(self: String, other: String) -> bool

impl String for Sequence<i32>

Members
iter(self: String) -> Iterator<i32>

Returns an iterator over values.

obj StringSlice

Stable view into an immutable UTF-8 byte range.

The backing storage is retained directly, so later mutation of the source
String does not invalidate this value or change its contents.

impl StringSlice

Members
byte_len(self: StringSlice) -> i32

Returns the number of UTF-8 bytes.

is_empty(self: StringSlice) -> bool

Returns true when no values are stored.

slice( self: StringSlice, { bytes start: i32 len: i32 } ) -> StringSlice

Returns a nested byte-range view.

get_byte(self: StringSlice, index: i32) -> Option<i32>

Returns the byte at the requested index, or None when the index is out of bounds.

to_string(self: StringSlice) -> String

Returns an owned string copy.

find_rune(self: StringSlice, rune: i32, { from?: StringIndex }) -> Option<StringIndex>

Returns the index of the first matching rune.

starts_with(self: StringSlice, prefix: StringSlice) -> bool

Returns true when the value begins with the provided prefix.

starts_with(self: StringSlice, prefix: String) -> bool

Returns true when the value begins with the provided prefix.

ends_with(self: StringSlice, suffix: StringSlice) -> bool

Returns true when the value ends with the provided suffix.

ends_with(self: StringSlice, suffix: String) -> bool

Returns true when the value ends with the provided suffix.

contains(self: StringSlice, substring: StringSlice) -> bool

Returns true when a matching value exists.

contains(self: StringSlice, substring: String) -> bool

Returns true when a matching value exists.

contains( self: StringSlice, { where pred: (rune: i32) -> bool } ) -> bool

Returns true when a matching value exists.

find( self: StringSlice, substring: StringSlice, { from?: StringIndex } ) -> Option<StringIndex>

Returns the first value that satisfies the predicate.

find(self: StringSlice, substring: String, { from?: StringIndex }) -> Option<StringIndex>

Returns the first value that satisfies the predicate.

reverse_find( self: StringSlice, substring: StringSlice, { to?: StringIndex } ) -> Option<StringIndex>

Returns the last match of a substring before the optional limit.

reverse_find( self: StringSlice, substring: String, { to?: StringIndex } ) -> Option<StringIndex>

Returns the last match of a substring before the optional limit.

find_range( self: StringSlice, substring: StringSlice, { from?: StringIndex } ) -> Option<Range<i32>>

Returns the start and end byte range of the first substring match.

find_range( self: StringSlice, substring: String, { from?: StringIndex } ) -> Option<Range<i32>>

Returns the start and end byte range of the first substring match.

split_once( self: StringSlice, { on separator: i32 } ): () -> Option<(StringSlice, StringSlice)>

Splits at the first matching separator.

split( self: StringSlice, { on separator: i32 max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: StringSlice, { on separator: StringSlice max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: StringSlice, { on separator: String max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

split( self: StringSlice, { where pred: rune: i32: (()) -> bool max_splits?: i32 keep_empty?: bool } ) -> Array<StringSlice>

Splits a string by a delimiter or predicate.

lines(self: StringSlice, { keep_ends?: bool }) -> Array<StringSlice>

Splits a string slice into lines.

words(self: StringSlice) -> Array<StringSlice>

Splits the text into whitespace-delimited words.

trimmed(self: StringSlice): () -> StringSlice

Returns a trimmed slice view.

trimmed(self: StringSlice, chars: CharSet) -> StringSlice

Returns a trimmed slice view.

lowered(self: StringSlice): () -> String

Returns a lowercase ASCII copy of this slice.

parse_int(self: StringSlice, { radix?: i32 }): () -> Result<i32, ParseIntError>

Parses this string as an i32.

parse_i32(self: StringSlice, { radix?: i32 }): () -> Result<i32, ParseIntError>

Parses this string as an i32.

parse_i64(self: StringSlice, { radix?: i32 }): () -> Result<i64, ParseIntError>

Parses this string as an i64.

impl StringSlice for Eq<StringSlice>

Members
eq(self: StringSlice, { other: StringSlice }) -> bool
ne(self: StringSlice, { other: StringSlice }) -> bool
==(self: StringSlice, other: StringSlice) -> bool
!=(self: StringSlice, other: StringSlice) -> bool

obj Utf8Error

Error returned when UTF-8 validation fails.

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

obj ParseIntError

Error returned when integer parsing fails.

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

obj ParseFloatError

Error returned when floating-point parsing fails.

Members
code: i32

Machine-readable error code.

message: String

Human-readable error message.

mod std::subscript

Subscript traits.

Provides shared indexing contracts for read and write operations.

Traits

trait SubscriptRead<Index, Output>

Read-only subscript contract.

Members
subscript_get(self: <inferred>, index: Index): () -> Output

Returns the value addressed by index.

trait SubscriptWrite<Index, Value>

Mutable subscript contract.

Members
subscript_set(~self: <inferred>, index: Index, value: Value): () -> void

Writes value at index.

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: (open) -> T): (TaskRuntime, open) -> Task<T>

fn detach<T>(work: fn: (open) -> T): (TaskRuntime, open) -> 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>

Members
await(self: Task<void>): TaskRuntime -> Completion<Unit, TaskError>

Waits for a Task<void> to finish and reports a Unit success payload.

impl<T> Task<T>

Members
await(self: Task<T>): TaskRuntime -> Completion<T, TaskError>

Waits for this task to reach a terminal outcome.

obj TaskError

Members
message: String

Effects

eff TaskRuntime

Members
wait(resume, id: i32) -> i32
yield_once(resume) -> void
failure_message(tail, id: i32) -> String

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.

Members
fail(resume) -> void

Marks the current test as failed and stops normal assertion flow.

fail_with(resume, pointer: i32, byte_len: i32) -> void

Marks the current test as failed with a UTF-8 message in linear memory.
Assertion helpers own this low-level transport; callers normally use
std::test::numeric::assert_close.

skip(resume) -> void

Marks the current test as skipped.

log(resume) -> void

Emits a structured test log event for the active test case.

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 timestamp_error_code_invalid_format() -> i32

The timestamp does not match the supported RFC 3339 grammar.

fn timestamp_error_code_invalid_date() -> i32

The timestamp contains an invalid Gregorian calendar date.

fn timestamp_error_code_invalid_time() -> i32

The timestamp contains an invalid wall-clock time.

fn timestamp_error_code_invalid_offset() -> i32

The timestamp contains an invalid UTC offset.

fn timestamp_error_code_out_of_range() -> i32

The timestamp is outside RFC 3339's four-digit year range.

fn timestamp_error_code_unsupported_precision() -> i32

The timestamp contains more precision than SystemTime can preserve.

fn timestamp_error_code_overflow() -> i32

Timestamp arithmetic exceeded the representable range.

fn timestamp_error_code_formatting() -> i32

SystemTime could not be represented in the requested timestamp format.

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 TimestampError

Error returned when an RFC 3339 timestamp cannot be parsed or formatted.

Members
code: i32

Machine-readable error code. Use the timestamp_error_code_* helpers.

index: i32

Byte index associated with the error, or -1 for a formatting error.

message: String

Human-readable failure description.

obj Duration

Represents a millisecond-based time span.

impl Duration

Members
from_millis(ms: i64) -> Duration

Constructs a duration from milliseconds.

from_secs(s: i64) -> Duration

Constructs a duration from seconds.

as_millis(self: Duration) -> i64

Returns the duration in milliseconds.

as_secs(self: Duration) -> i64

Returns the duration in seconds.

obj Instant

Monotonic timestamp that is suitable for elapsed-time measurement.

impl Instant

Members
now(): Time -> Instant

Captures the current time value.

elapsed(self: Instant): Time -> Duration

Returns the duration since this instant was captured.

obj SystemTime

Wall-clock timestamp represented as milliseconds from the Unix epoch.

impl SystemTime

Members
from_unix_millis(value: i64) -> SystemTime

Constructs a wall-clock timestamp from Unix epoch milliseconds.

now(): Time -> SystemTime

Captures the current time value.

unix_millis(self: SystemTime) -> i64

Returns milliseconds since the Unix epoch.

parse_rfc3339(source: StringSlice): () -> Result<SystemTime, TimestampError>

Parses an RFC 3339 timestamp and normalizes any numeric offset to UTC.

Exactly one to three fractional-second digits are accepted. Leap seconds
are rejected because Unix epoch milliseconds cannot represent them.

parse_rfc3339(source: String): () -> Result<SystemTime, TimestampError>

Parses an RFC 3339 timestamp and normalizes any numeric offset to UTC.

to_rfc3339(self: SystemTime): () -> Result<String, TimestampError>

Formats this timestamp in UTC with fixed millisecond precision.

RFC 3339 uses four-digit years, so values outside years 0000 through
9999 return timestamp_error_code_formatting.

obj Overlap

Interval overlap policy.

Policies are explicit so repeating work does not silently adopt JS-style
concurrent overlap.

impl Overlap

Members
serial() -> Overlap

Run one callback at a time. The next delay starts after the callback finishes.

concurrent() -> Overlap

Allow ticks to overlap by spawning a detached callback task for each tick.

obj TimeResult

Members
ok: bool
code: i32
message: String

Effects

eff Time

Host-provided time operations.

std::time decodes host responses into typed success/error values.

Members
monotonic_now_millis(tail) -> i64

Returns a monotonic millisecond timestamp suitable for elapsed-time math.

system_now_millis(tail) -> i64

Returns wall-clock milliseconds since Unix epoch.

sleep_millis(tail, ms: i64) -> TimeResult

Suspends execution for ms milliseconds.

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.

Members
clone(self: <inferred>): () -> T

Returns a cloned value.

trait Copy<T>

Trait for values that can be copied without ownership transfer concerns.

Members
copy(self: <inferred>): () -> T

Returns a copied value.

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.

Members
from_iterator({ ~items: Iterator<T> }): () -> Self

Builds Self by consuming all items from items.

mod std::traits::convert

Conversion traits.

Provides infallible and fallible conversion contracts.

Traits

trait From<To, From>

Infallible conversion into To from From.

Members
from({ value: From }): () -> To

Converts value into To.

trait Into<From, To>

Infallible conversion from From into To.

Members
into(self: <inferred>): () -> To

Converts self into To.

trait TryFrom<To, From, E>

Fallible conversion into To from From.

Members
try_from({ value: From }): () -> Result<To, E>

Attempts to convert value into To.

trait TryInto<From, To, E>

Fallible conversion from From into To.

Members
try_into(self: <inferred>): () -> Result<To, E>

Attempts to convert self into To.

mod std::traits::default

Traits

trait Default<T>

Trait for producing a default instance of a type.

Members
default(): () -> T

Returns the default value for T.

mod std::traits::eq

Traits

trait Eq<T>

Trait for checking equality between two values of the same type.

Members
eq(self: <inferred>, { other: T }): () -> bool

Returns true when self equals other.

ne(self: <inferred>, { other: T }): () -> bool

Returns true when self does not equal other.

==(self: <inferred>, other: T): () -> bool

Operator overload for equality checks.

!=(self: <inferred>, other: T): () -> bool

Operator overload for inequality checks.

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.

Members
write(self: <inferred>, { bytes: Array<i32> }): () -> void

Writes bytes into the hasher state.

finish(self: <inferred>): () -> i64

Finalizes hashing and returns the digest value.

trait Hash<T>

Trait for values that can feed bytes into a hasher.

Members
hash(self: <inferred>, { into: Hasher }): () -> void

Writes this value into into.

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.

Members
cmp(self: <inferred>, { other: T }): () -> Ordering

Compares self with other and returns an Ordering marker.

<(self: <inferred>, other: T): () -> bool

Operator overload for less-than checks.

<=(self: <inferred>, other: T): () -> bool

Operator overload for less-than-or-equal checks.

>(self: <inferred>, other: T): () -> bool

Operator overload for greater-than checks.

>=(self: <inferred>, other: T): () -> bool

Operator overload for greater-than-or-equal checks.

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.

Members
iter(self: <inferred>): () -> Iterator<T>

Returns an iterator over sequence items.

trait Iterator<T>

Trait for stateful iterators over T values.

Members
next(~self: <inferred>): () -> Option<T>

Produces the next item, or None when exhausted.

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

Re-Exports

pub canvas

pub command::Cmd

pub command::Ref

Functions

fn keyboard_on_key_down<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to global keydown events through the browser VX runtime host.

fn keyboard_on_key_down<Msg>( { key: String handler: (fn(KeyboardEvent)) -> Msg } ) -> Sub<Msg>

fn keyboard_on_key_down<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn keyboard_on_key_down<Msg>( { key: StringSlice handler: (fn(KeyboardEvent)) -> Msg } ) -> Sub<Msg>

fn keyboard_on_key_up<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to global keyup events through the browser VX runtime host.

fn keyboard_on_key_up<Msg>( { key: String handler: (fn(KeyboardEvent)) -> Msg } ) -> Sub<Msg>

fn keyboard_on_key_up<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn keyboard_on_key_up<Msg>( { key: StringSlice handler: (fn(KeyboardEvent)) -> Msg } ) -> Sub<Msg>

fn online_status<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser online/offline changes through the VX runtime host.

fn online_status<Msg>( { key: String handler: (fn(bool)) -> Msg } ) -> Sub<Msg>

fn online_status<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn online_status<Msg>( { key: StringSlice handler: (fn(bool)) -> Msg } ) -> Sub<Msg>

fn window_on_resize<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser window resize changes through the VX runtime host.

fn window_on_resize<Msg>( { key: String handler: (fn(WindowSize)) -> Msg } ) -> Sub<Msg>

fn window_on_resize<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn window_on_resize<Msg>( { key: StringSlice handler: (fn(WindowSize)) -> Msg } ) -> Sub<Msg>

fn document_on_visibility_change<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to document visibility changes through the VX runtime host.

fn document_on_visibility_change<Msg>( { key: String handler: (fn(DocumentVisibility)) -> Msg } ) -> Sub<Msg>

fn document_on_visibility_change<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn document_on_visibility_change<Msg>( { key: StringSlice handler: (fn(DocumentVisibility)) -> Msg } ) -> Sub<Msg>

fn location_on_change<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser URL changes from history traversal or hash changes.

fn location_on_change<Msg>( { key: String handler: (fn(Location)) -> Msg } ) -> Sub<Msg>

fn location_on_change<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn location_on_change<Msg>( { key: StringSlice handler: (fn(Location)) -> Msg } ) -> Sub<Msg>

fn window_on_focus<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser window focus events.

fn window_on_focus<Msg>( { key: String handler: (fn(GenericEvent)) -> Msg } ) -> Sub<Msg>

fn window_on_focus<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn window_on_focus<Msg>( { key: StringSlice handler: (fn(GenericEvent)) -> Msg } ) -> Sub<Msg>

fn window_on_blur<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser window blur events.

fn window_on_blur<Msg>( { key: String handler: (fn(GenericEvent)) -> Msg } ) -> Sub<Msg>

fn window_on_blur<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn window_on_blur<Msg>( { key: StringSlice handler: (fn(GenericEvent)) -> Msg } ) -> Sub<Msg>

fn animation_frame<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser animation frames.

fn animation_frame<Msg>( { key: String handler: (fn(AnimationFrame)) -> Msg } ) -> Sub<Msg>

fn animation_frame<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn animation_frame<Msg>( { key: StringSlice handler: (fn(AnimationFrame)) -> Msg } ) -> Sub<Msg>

fn media_query<Msg>( { query: String value: Msg } ) -> Sub<Msg>

Subscribes to a browser media query.

fn media_query<Msg>( { query: String handler: (fn(MediaQuery)) -> Msg } ) -> Sub<Msg>

fn media_query<Msg>( { query: StringSlice value: Msg } ) -> Sub<Msg>

fn media_query<Msg>( { query: StringSlice handler: (fn(MediaQuery)) -> Msg } ) -> Sub<Msg>

fn storage_on_change<Msg>( { key: String value: Msg } ) -> Sub<Msg>

Subscribes to browser storage events.

fn storage_on_change<Msg>( { key: String handler: (fn(StorageChange)) -> Msg } ) -> Sub<Msg>

fn storage_on_change<Msg>( { key: StringSlice value: Msg } ) -> Sub<Msg>

fn storage_on_change<Msg>( { key: StringSlice handler: (fn(StorageChange)) -> Msg } ) -> Sub<Msg>

fn broadcast_channel<Msg>( { name: String value: Msg } ) -> Sub<Msg>

Subscribes to messages from a browser BroadcastChannel.

fn broadcast_channel<Payload, Msg>( { name: String handler: (fn(Payload)) -> Msg } ) -> Sub<Msg>

fn broadcast_channel<Msg>( { name: StringSlice value: Msg } ) -> Sub<Msg>

fn broadcast_channel<Payload, Msg>( { name: StringSlice handler: (fn(Payload)) -> Msg } ) -> Sub<Msg>

fn state_handle<T>({ initial: T }): Component -> StateHandle<T>

Reads a component-local typed state handle.

fn state_handle({ initial: StringSlice }): Component -> StateHandle<String>

fn state<T>({ initial: T }): Component -> (T, (fn(T)) -> void)

Reads component-local typed state as a (value, setter) pair.

fn state({ initial: StringSlice }): Component -> (String, (fn(String)) -> void)

fn task<Key, T>( { key: Key task: Task<T> } ): Component -> Unit

Registers a task with the current component instance.

fn lower_server_html_node<Msg>(value: Html<Msg>): () -> HtmlWire

Lowers a view for server rendering, claims its callbacks, and removes
client-only message mapping nodes.

fn frame<Msg>(root: Html<Msg>): () -> Html<Msg>

Creates a versioned VX render frame.

fn text(value: String): () -> Html<void>

Creates a VX text node.

fn text(value: StringSlice): () -> Html<void>

Creates a VX text node from a string slice.

fn html_child(value: Html<void>): () -> Html<void>

Converts a nested node into the opaque child plan expected by VSX lowering.

fn html_child<Msg>(value: Html<Msg>): () -> Html<Msg>

fn html_child<Msg>(value: HtmlInput<Msg>): () -> Html<Msg>

fn html_child(value: String): () -> Html<void>

Converts interpolated text into an opaque child plan.

fn html_child(value: StringSlice): () -> Html<void>

fn html_child(value: Array<Html<void>>): () -> Html<void>

Flattens an interpolated child list into one fragment plan.

fn html_child<Msg>(value: Array<HtmlInput<Msg>>): () -> Html<Msg>

fn html_child<Msg>(value: Array<Html<Msg>>): () -> Html<Msg>

fn fragment(children: Array<Html<void>>): () -> Html<void>

Creates a VX fragment node.

fn fragment<Msg>(children: Array<HtmlInput<Msg>>): () -> Html<Msg>

fn element( { tag: String attrs?: Array<Attr<void>> children: Array<Html<void>> } ) -> Html<void>

Creates a VX element node using the versioned renderer schema.

fn element<Msg>( { tag: String attrs?: Array<Attr<Msg>> children: Array<Html<Msg>> } ) -> Html<Msg>

fn element<Msg>( { tag: String attrs: Array<AttrInput<Msg>> children: Array<HtmlInput<Msg>> } ) -> Html<Msg>

fn html_element( { tag: String attrs?: Array<Attr<void>> children: Array<Html<void>> } ) -> Html<void>

fn html_element<Msg>( { tag: String attrs?: Array<Attr<Msg>> children: Array<Html<Msg>> } ) -> Html<Msg>

fn html_element<Msg>( { tag: String attrs: Array<AttrInput<Msg>> children: Array<HtmlInput<Msg>> } ) -> Html<Msg>

fn attr( { name: String value: String } ): () -> Attr<void>

Creates a string-valued DOM attribute.

fn attr( { name: String value: bool } ): () -> Attr<void>

fn attr( { name: String value: i32 } ): () -> Attr<void>

fn attr( { name: StringSlice value: String } ): () -> Attr<void>

fn attr( { name: StringSlice value: bool } ): () -> Attr<void>

fn attr( { name: StringSlice value: i32 } ): () -> Attr<void>

fn attr( { name: String value: StringSlice } ): () -> Attr<void>

fn attr( { name: StringSlice value: StringSlice } ): () -> Attr<void>

fn id(value: String): () -> Attr<void>

fn id(value: StringSlice): () -> Attr<void>

fn class(value: String): () -> Attr<void>

fn class(value: StringSlice): () -> Attr<void>

fn classes(values: Array<String>): () -> Attr<void>

fn role(value: String): () -> Attr<void>

fn role(value: StringSlice): () -> Attr<void>

fn name(value: String): () -> Attr<void>

fn name(value: StringSlice): () -> Attr<void>

fn placeholder(value: String): () -> Attr<void>

fn placeholder(value: StringSlice): () -> Attr<void>

fn input_type(value: String): () -> Attr<void>

fn input_type(value: StringSlice): () -> Attr<void>

fn tab_index(value: i32): () -> Attr<void>

fn ref<T>(target: Ref<T>): () -> Attr<void>

fn value(value: String): () -> Attr<void>

fn value(value: StringSlice): () -> Attr<void>

fn disabled(value: bool): () -> Attr<void>

fn checked(value: bool): () -> Attr<void>

fn prop( { name: String value: String } ): () -> Attr<void>

fn prop( { name: StringSlice value: StringSlice } ): () -> Attr<void>

fn prop( { name: String value: bool } ): () -> Attr<void>

fn prop( { name: StringSlice value: bool } ): () -> Attr<void>

fn prop( { name: String value: i32 } ): () -> Attr<void>

fn prop( { name: StringSlice value: i32 } ): () -> Attr<void>

fn style( { name: String value: String } ): () -> Attr<void>

fn style( { name: StringSlice value: StringSlice } ): () -> Attr<void>

fn styles(values: Array<(String, String)>): () -> Array<Attr<void>>

fn keyed( { key: String child: Html<void> } ): () -> Html<void>

fn keyed( { key: StringSlice child: Html<void> } ): () -> Html<void>

fn keyed<Msg>( { key: String child: Html<Msg> } ): () -> Html<Msg>

fn keyed<Msg>( { key: StringSlice child: Html<Msg> } ): () -> Html<Msg>

fn keyed( { key: String body: (fn) -> Html<void> } ): Component -> Html<void>

fn keyed( { key: StringSlice body: (fn) -> Html<void> } ): Component -> Html<void>

fn map_html<ChildMsg, ParentMsg>( { html: Html<ChildMsg> handler: (fn(ChildMsg)) -> ParentMsg } ) -> Html<ParentMsg>

Lifts child HTML through a message mapper owned by the current render.

fn map_html<ChildMsg, ParentMsg>( { html: Html<void> handler: (fn(ChildMsg)) -> ParentMsg } ) -> Html<ParentMsg>

fn event_handler<Msg>( { name: String handler: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_handler<Msg>( { name: StringSlice handler: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_payload_handler<Event, Msg>( { name: String handler: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_payload_handler<Event, Msg>( { name: StringSlice handler: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Msg>( { name: String message: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Msg>( { name: StringSlice message: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Event, Msg>( { name: String message: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Event, Msg>( { name: StringSlice message: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Msg>( { name: String message: Msg options?: EventOptions } ): () -> Attr<Msg>

fn event_message<Msg>( { name: StringSlice message: Msg options?: EventOptions } ): () -> Attr<Msg>

fn html_event_message<Msg>( { name: String message: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn html_event_message<Event, Msg>( { name: String message: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn html_event_message<Msg>( { name: String message: Msg options?: EventOptions } ): () -> Attr<Msg>

fn html_event_handler<Msg>( { name: String handler: (fn) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn html_event_payload_handler<Event, Msg>( { name: String handler: (fn(Event)) -> Msg options?: EventOptions } ): () -> Attr<Msg>

fn on_click_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_click_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_double_click_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_double_click_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_mouse_down_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_mouse_down_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_mouse_up_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_mouse_up_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_mouse_move_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_mouse_move_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_mouse_enter_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_mouse_enter_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_mouse_leave_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_mouse_leave_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_pointer_down_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_pointer_down_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_pointer_up_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_pointer_up_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_pointer_move_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_pointer_move_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_pointer_cancel_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_pointer_cancel_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_key_down_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_key_down_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_key_up_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_key_up_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_input_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_input_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_change_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_change_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_submit_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_submit_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_focus_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_focus_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_blur_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_blur_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_scroll_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_scroll_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_wheel_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_wheel_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_drag_start_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_drag_start_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_drag_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_drag_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_drag_end_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_drag_end_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_drop_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_drop_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn on_context_menu_message<Msg>(message: Msg): () -> Attr<Msg>

fn on_context_menu_with<Msg>( { options: EventOptions message: Msg } ): () -> Attr<Msg>

fn program<Model, Msg>( { model: Model frame?: Html<Msg> commands?: Cmd<Msg> subscriptions?: Sub<Msg> } ) -> Program<Model, Msg>

fn next<Model, Msg>(model: Model) -> Program<Model, Msg>

Creates the next program transition from an explicit model.

fn next<Model, Msg>( { model: Model cmd: Cmd<Msg> } ) -> Program<Model, Msg>

Creates the next program transition with one command.

fn map_model<Model, Msg, NextModel>( program: Program<Model, Msg>, handler: (fn(Model)) -> NextModel ) -> Program<NextModel, Msg>

Lifts a child program result through a typed model mapper.

fn map_model<Model, Msg, NextModel>( { program: Program<Model, Msg> map: (fn(Model)) -> NextModel hydrate: (fn(NextModel)) -> Model } ) -> Program<NextModel, Msg>

Lifts a child program through model mappers in both runtime directions.
The hydrate mapper is required when the mapped program adopts an SSR model.

fn map_message<Model, ChildMsg, ParentMsg>( program: Program<Model, ChildMsg>, handler: (fn(ChildMsg)) -> ParentMsg ) -> Program<Model, ParentMsg>

Lifts a child program result through a typed message mapper.

fn program<Model, Msg>( { init: fn: (open) -> Model hydrate?: fn(Model): (open) -> Program<Model, Msg> step: fn(Model, Msg): (open) -> Program<Model, Msg> view: fn(Model): (open) -> Html<Msg> subscriptions?: fn(Model): (open) -> Sub<Msg> } ) -> Program<Model, Msg>

fn program<Model, Msg>( { init: fn: (open) -> Program<Model, Msg> hydrate?: fn(Model): (open) -> Program<Model, Msg> step: fn(Model, Msg): (open) -> Program<Model, Msg> view: fn(Model): (open) -> Html<Msg> subscriptions?: fn(Model): (open) -> Sub<Msg> } ) -> Program<Model, Msg>

Type Aliases

type AttrValueWire = |(|(AttrString, AttrBool), AttrI32)

type AttrWireNode = |(NamedAttr, EventAttr)

type HtmlWireList = |(HtmlWireEnd, HtmlWireNext)

type AttrWireList = |(AttrWireEnd, AttrWireNext)

type HtmlWireNode = |(|(|(|(|(HtmlText, HtmlFragment), HtmlElement), HtmlKeyed), HtmlMapped), HtmlFrame)

type SubscriptionWire = |(|(|(|(SubscriptionNone, SubscriptionBatch), SubscriptionRuntime), SubscriptionMap), SubscriptionOwned)

type ProgramWire = |(|(|(ProgramResult, ProgramMapModel), ProgramMapMessage), ProgramHandlers)

type HtmlInput<Msg> = |(Html<void>, Html<Msg>)

type AttrInput<Msg> = |(Attr<void>, Attr<Msg>)

type RenderKey = String

type MouseEvent = object_literal(kind: String, pointer_id: i32, x: f64, y: f64, client_x: f64, client_y: f64, button: i32, alt_key: bool, ctrl_key: bool, meta_key: bool, shift_key: bool, delta_x: f64, delta_y: f64)

type KeyboardEvent = object_literal(kind: String, key: String, code: String, alt_key: bool, ctrl_key: bool, meta_key: bool, shift_key: bool)

type WindowSize = object_literal(kind: String, width: f64, height: f64)

type DocumentVisibility = object_literal(kind: String, state: String, hidden: bool)

type Location = object_literal(kind: String, href: String, pathname: String, search: String, hash: String)

type AnimationFrame = object_literal(kind: String, timestamp: f64)

type MediaQuery = object_literal(kind: String, query: String, matches: bool)

type StorageChange = object_literal(kind: String, storage: String, ?:(key, String), ?:(old_value, String), ?:(new_value, String), url: String)

type InputEvent = object_literal(kind: String, value: String, checked: bool, input_type: String)

type SubmitEvent = object_literal(kind: String, form_keys: Array<String>, form_values: Array<String>)

type GenericEvent = object_literal(kind: String, event: String)

Objects

obj EventOptionsWire

Members
prevent_default: bool
stop_propagation: bool
capture: bool
passive: bool
pointer_capture: bool

obj AttrWire

Members
node: AttrWireNode

obj HtmlWire

Members
node: HtmlWireNode

obj Html<Msg>

impl<Msg> Html<Msg> for CustomDto<Html<Msg>, HtmlWire>

obj Attr<Msg>

impl<Msg> Attr<Msg> for CustomDto<Attr<Msg>, AttrWire>

obj Program<Model, Msg>

impl<Model, Msg> Program<Model, Msg> for CustomDto<Program<Model, Msg>, ProgramWire>

obj Sub<Msg>

impl<Msg> Sub<Msg> for CustomDto<Sub<Msg>, SubscriptionWire>

impl<Msg> Sub<Msg>

Members
map<NextMsg>( self: Sub<Msg>, handler: (fn(Msg)) -> NextMsg ) -> Sub<NextMsg>

Lifts a child subscription through a retained typed message mapper.

impl<Msg> Sub<Msg>

Members
none() -> Sub<Msg>

Creates an empty subscription set.

batch(values: Array<Sub<Msg>>) -> Sub<Msg>

Creates a subscription batch from existing subscription values.

every( { key: String millis: i64 value: Msg } ) -> Sub<Msg>

Creates an interval subscription that dispatches a typed message.

every( { key: StringSlice millis: i64 value: Msg } ) -> Sub<Msg>

obj EventOptions

Members
prevent_default: bool
stop_propagation: bool
capture: bool
passive: bool
pointer_capture: bool

Captures the active pointer on pointer down and releases it on pointer up or cancel.

obj DomElement

obj StateHandle<T>

Members
id: i32
value: T

impl<T> StateHandle<T>

Members
set(self: StateHandle<T>, value: T): Component -> void

Replaces component-local typed state and schedules the component runtime.

update(self: StateHandle<T>, value: T): Component -> StateHandle<T>

Replaces component-local typed state and returns the updated handle.

Effects

eff Component

Members
state_scope(tail, key: EncodedPayload) -> void
state_key(tail, id: i32) -> i32
state_get(tail, id: i32, initial: EncodedPayload) -> EncodedPayload
state_set(tail, id: i32, value: EncodedPayload) -> void
task_started(tail, key: EncodedPayload, task_id: i32) -> void

Implementations

impl<Msg> Cmd<Msg> for CustomDto<Cmd<Msg>, CommandWire>

mod std::vx::canvas

Typed Canvas rendering and measurement commands for VX.

Functions

fn render<Msg>(value: Frame) -> Cmd<Msg>

Paints a typed canvas frame through the browser VX runtime host.

fn measure_text<Msg>( { selector: String value: String font?: String handler: (fn(TextMetrics)) -> Msg } ) -> Cmd<Msg>

Measures text in logical CSS pixels and dispatches the typed metrics.

fn radial_gradient( { inner_color: String outer_color: String inner_radius?: f64 outer_radius?: f64 } ) -> RadialGradient

Creates a radial color fill for a canvas circle.

fn path_move_to(point: Point) -> PathSegment

Starts a path at a logical CSS-pixel point without drawing a segment.

fn path_line_to(point: Point) -> PathSegment

Adds a straight segment to a logical CSS-pixel point.

fn path_quadratic_curve_to( { control: Point to: Point } ) -> PathSegment

Adds a quadratic Bézier segment.

fn path_bezier_curve_to( { control_1: Point control_2: Point to: Point } ) -> PathSegment

Adds a cubic Bézier segment.

fn path_arc( { center: Point radius: f64 start_angle: f64 end_angle: f64 counter_clockwise?: bool } ) -> PathSegment

Adds a circular arc. Angles are expressed in radians.

fn path_arc_to( { control_1: Point control_2: Point radius: f64 } ) -> PathSegment

Adds an arc tangent to two lines.

fn path_ellipse( { center: Point radius_x: f64 radius_y: f64 rotation: f64 start_angle: f64 end_angle: f64 counter_clockwise?: bool } ) -> PathSegment

Adds an elliptical arc. Angles and rotation are expressed in radians.

fn path_rect( { origin: Point width: f64 height: f64 } ) -> PathSegment

Adds a rectangular subpath.

fn path_close() -> PathSegment

Closes the current path subpath.

fn path( { segments: Array<PathSegment> fill?: String stroke?: String stroke_width?: f64 fill_rule?: FillRule alpha?: f64 glow_color?: String glow_blur?: f64 } ) -> Draw

Paints a typed path from its segments.

fn save() -> Draw

Saves the current transform, dash, compositing, and paint state.

fn restore() -> Draw

Restores the most recently saved Canvas state.

fn transform(matrix: Transform) -> Draw

Multiplies the current Canvas transform by an affine matrix.

fn translate( { x: f64 y: f64 } ) -> Draw

Translates subsequent draws in logical CSS pixels.

fn rotate(radians: f64) -> Draw

Rotates subsequent draws by radians.

fn scale( { x: f64 y: f64 } ) -> Draw

Scales subsequent draws along each axis.

fn line_dash( { pattern: Array<f64> offset?: f64 } ) -> Draw

Sets the line-dash pattern for subsequent draws. An empty pattern resets it.

fn composite(operation: CompositeOperation) -> Draw

Sets the compositing operation for subsequent draws.

fn frame( { selector: String width: f64 height: f64 draws: Array<Draw> clear?: bool background?: String } ) -> Frame

Creates a versioned canvas frame in CSS-pixel logical coordinates.

fn line( { from: Point to: Point color: String width?: f64 alpha?: f64 glow_color?: String glow_blur?: f64 } ) -> Draw

Creates a straight canvas line.

fn polyline( { points: Array<Point> color: String width?: f64 alpha?: f64 closed?: bool fill?: String } ) -> Draw

Creates a connected canvas path, optionally closed and filled.

fn circle( { center: Point radius: f64 fill?: String stroke?: String stroke_width?: f64 alpha?: f64 glow_color?: String glow_blur?: f64 radial_gradient?: RadialGradient } ) -> Draw

Creates a canvas circle with optional stroke, glow, and radial fill.

fn ellipse( { center: Point radius_x: f64 radius_y: f64 rotation?: f64 fill?: String stroke?: String stroke_width?: f64 alpha?: f64 } ) -> Draw

Creates a canvas ellipse. Rotation is expressed in radians.

fn text( { position: Point value: String color: String font?: String align?: String baseline?: String alpha?: f64 max_width?: f64 } ) -> Draw

Creates canvas text using a CSS canvas font string.

Type Aliases

type FillRule = |(NonZero, EvenOdd)

type CompositeOperation = |(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(SourceOver, SourceIn), SourceOut), SourceAtop), DestinationOver), DestinationIn), DestinationOut), DestinationAtop), Lighter), Copy), Xor), Multiply), Screen), Overlay), Darken), Lighten), ColorDodge), ColorBurn), HardLight), SoftLight), Difference), Exclusion), Hue), Saturation), Color), Luminosity)

type TextMetrics = object_literal(width: f64, actual_bounding_box_left: f64, actual_bounding_box_right: f64, actual_bounding_box_ascent: f64, actual_bounding_box_descent: f64)

Logical CSS-pixel metrics returned by measure_text.

Objects

val Point

A logical point in CSS-pixel canvas coordinates.

Members
x: f64
y: f64

val Transform

A 2D affine transform using the browser Canvas matrix convention.

Members
a: f64
b: f64
c: f64
d: f64
e: f64
f: f64

obj PathSegment

A typed segment in a Canvas path.

impl PathSegment

impl PathSegment for CustomDto<PathSegment, PathSegmentDto>

obj Draw

A typed canvas draw or state operation produced by the Canvas constructors.

impl Draw

impl Draw for CustomDto<Draw, DrawDto>

obj Frame

A versioned canvas frame ready for the browser VX runtime.

impl Frame

impl Frame for CustomDto<Frame, FrameDto>

obj RadialGradient

A radial fill used by canvas circles.

impl RadialGradient

impl RadialGradient for CustomDto<RadialGradient, RadialGradientDto>

mod std::vx::command

Core VX command envelope and constructors shared by VX feature modules.

Objects

obj Cmd<Msg>

impl<Msg> Cmd<Msg>

Members
none() -> Cmd<Msg>

Creates an empty command.

message(value: Msg) -> Cmd<Msg>

Creates a command that dispatches a typed application message.

batch(values: Array<Cmd<Msg>>) -> Cmd<Msg>

Creates a command batch from existing command values.

map<NextMsg>( self: Cmd<Msg>, handler: (fn(Msg)) -> NextMsg ) -> Cmd<NextMsg>

Lifts a child command through a retained typed message mapper.

copy_to_clipboard(value: String) -> Cmd<Msg>

Copies text to the browser clipboard through the VX runtime host.

copy_to_clipboard(value: StringSlice) -> Cmd<Msg>
read_clipboard(handler: (fn(String)) -> Msg) -> Cmd<Msg>
set_document_title(value: String) -> Cmd<Msg>

Sets the browser document title through the VX runtime host.

set_document_title(value: StringSlice) -> Cmd<Msg>
push_url(value: String) -> Cmd<Msg>

Pushes a URL into browser history through the VX runtime host.

push_url(value: StringSlice) -> Cmd<Msg>
replace_url(value: String) -> Cmd<Msg>

Replaces the current browser history URL through the VX runtime host.

replace_url(value: StringSlice) -> Cmd<Msg>
set_hash(value: String) -> Cmd<Msg>

Replaces the browser location hash through the VX runtime host.

set_hash(value: StringSlice) -> Cmd<Msg>
navigate_back() -> Cmd<Msg>

Navigates one entry back in browser history.

navigate_forward() -> Cmd<Msg>

Navigates one entry forward in browser history.

open_url(value: String) -> Cmd<Msg>

Opens a URL in a browser window or tab.

open_url(value: StringSlice) -> Cmd<Msg>
open_url( { url: String target: String } ) -> Cmd<Msg>
open_url( { url: StringSlice target: StringSlice } ) -> Cmd<Msg>
scroll_window_to( { x: f64 y: f64 } ) -> Cmd<Msg>

Scrolls the browser window to an absolute coordinate.

scroll_window_by( { x: f64 y: f64 } ) -> Cmd<Msg>

Scrolls the browser window by a relative coordinate.

local_storage_set( { key: String value: String } ) -> Cmd<Msg>

Writes a string value into localStorage.

local_storage_set( { key: StringSlice value: StringSlice } ) -> Cmd<Msg>
local_storage_remove(key: String) -> Cmd<Msg>

Removes a localStorage key.

local_storage_remove(key: StringSlice) -> Cmd<Msg>
local_storage_clear() -> Cmd<Msg>

Clears localStorage.

session_storage_set( { key: String value: String } ) -> Cmd<Msg>

Writes a string value into sessionStorage.

session_storage_set( { key: StringSlice value: StringSlice } ) -> Cmd<Msg>
session_storage_remove(key: String) -> Cmd<Msg>

Removes a sessionStorage key.

session_storage_remove(key: StringSlice) -> Cmd<Msg>
session_storage_clear() -> Cmd<Msg>

Clears sessionStorage.

perform<T>( { task: Task<T> handler: (fn(T)) -> Msg } ) -> Cmd<Msg>

Creates a task command envelope from a Voyd task and retained typed result mapper.

perform<T>( { work: fn: (open) -> T handler: (fn(T)) -> Msg } ): ::(tasks, TaskRuntime) -> Cmd<Msg>

Detaches effectful work and dispatches its typed result through a retained mapper.

delay( { millis: i64 value: Msg } ) -> Cmd<Msg>

Creates a timer command that dispatches a typed message after the delay.

focus<T>(target: Ref<T>) -> Cmd<Msg>

Creates a DOM focus command for a constrained VX ref.

scroll_into_view<T>(target: Ref<T>) -> Cmd<Msg>

Creates a scroll-into-view command for a constrained VX ref.

select_text<T>(target: Ref<T>) -> Cmd<Msg>

Selects text in an input-like DOM element found by data-vx-ref.

obj Ref<T>

Members
id: String