Wado

core:prelude

Auto-imported in every module. Disable with #![no_prelude].

Synopsis

let mut greeting = String::new();
greeting.push_str("Hello, ");
greeting.push_str("Wado!");
assert greeting == "Hello, Wado!";

let primes = [2, 3, 5, 7] as List<i32>;
assert primes.len() == 4;
assert primes.get(1) matches { Some(v) && v == 3 };
assert primes.get(9) matches { None };

let decoded = String::try_from_utf8([87, 97, 100, 111] as ByteList);
assert decoded matches { Ok(s) && s == "Wado" };

Functions

pub fn ref_eq<affine T>(a: &T, b: &T) -> bool

Whether a and b point to one place, not merely to equal values. == on references compares the values.

pub fn eq_constant_time<A: AsByteSlice, B: AsByteSlice>(a: &A, b: &B) -> bool

Whether two byte strings are equal, in time that does not depend on where they first differ.

Use it whenever one side is a secret — a MAC, a token, an API key. == stops at the first differing byte, so how long it took says how much of a guess was right, and a secret falls one byte at a time. Everything else should keep using ==, which is faster.

A length difference is still answered immediately: a MAC and a digest have public lengths, and only their contents are hidden. Neither the optimizer nor Wasm promises constant-time execution, so this takes the care it can rather than making a guarantee.

pub fn panic(message: String) -> !

Logs a message to stderr and traps.

pub fn unreachable() -> !

Traps unconditionally, marking code no run reaches: no input, not even one that breaks a contract, leads here, so reaching it is a bug in the code around it. Test coverage plans no region that leads only here. Where a caller can lead the run here, check the contract with panic or assert.

Traits

pub affine trait Eq<Rhs = Self> with ()

Trait for equality comparisons. Types implementing this trait can be compared with == and != operators.

fn eq(&self, other: &Rhs) -> bool

Returns true if self equals other.

pub affine trait Ord: Eq with ()

A total order over the type: what <, sort, TreeMap and a T: Ord bound read. A float's puts every NaN last, as one value, and -0.0 equal to 0.0.

fn cmp(&self, other: &Self) -> Ordering

Compares self with other and returns an Ordering.

pub trait Hasher with ()

What a Hash impl feeds its value into. The hasher owns the algorithm and its seed; an impl only says which words and bytes make up the value.

fn write_u64(&mut self, x: u64)

fn write_bytes(&mut self, bytes: ByteSlice)

Takes the length too, so consecutive byte runs never run together.

pub affine trait Hash: Eq with ()

A value a hash table can key on. Values that are == feed a hasher alike.

fn hash<H: Hasher>(&self, h: &mut H)

pub affine trait Default with ()

Trait for providing a default value for a type. Types implementing this trait can produce a sensible "zero" or "empty" value.

fn default() -> Self

Returns the default value for this type.

pub affine trait Drop with ()

What a drop of an affine value runs: at scope exit, at a store over it, for a value nothing keeps, and by name. A type without an impl drops its fields one by one. What drop leaves in self drops field by field after it, and only an affine type implements it.

fn drop(self)

pub trait Reflect with ()

A type's identity: the root every reflected kind sits under. Sealed and compiler-synthesized like the kinds. See WEP 2026-06-13.

fn decl_name() -> String

#[compiler_item("reflect_decl_name")]

Returns the declaration's name. A shape no declaration names answers for itself: an anonymous struct with "", and a tagged template's type with its holes (`${i32:04}`).

fn wire_name_policy() -> CaseStyle

#[compiler_item("reflect_wire_name_policy")]

The declaration's #[wire(name_policy)] (Identity if none). Every kind carries the attribute, and it says the same thing on each: the root answers so a caller need not know which kind it holds. A newtype answers with the policy of the declaration it wraps.

pub trait ReflectStruct: Reflect with ()

Compile-time struct introspection. The compiler synthesizes an impl for every struct; it cannot be implemented in user code and is callable only in monomorphized contexts (T a concrete struct). See WEP 2026-06-13.

fn members() -> Self::Members

#[compiler_item("reflect_struct_members")]

Returns the per-field members.

fn from_fields(fields: Self::FieldInputs) -> Self

#[compiler_item("reflect_struct_from_fields")]

Assembles the struct from its field values.

fn default_slot(index: i32) -> Self::FieldSlots

#[compiler_item("reflect_struct_default_slot")]

Empty slots but index, which holds that field's declared default (f: T = expr) if it has one. No other field's default is evaluated.

fn empty_slots() -> Self::FieldSlots

#[compiler_item("reflect_struct_empty_slots")]

All slots empty. Starting here is what makes a filled slot mean "the wire wrote this", so a repeat is visible without a second record.

pub affine trait Member with ()

The attr-reading face of a reflected member. Sealed and compiler-synthesized; user impls are rejected. See WEP 2026-06-13.

fn name(&self) -> String

#[compiler_item("member_name")]

The source field name.

fn wire_name_override(&self) -> Option<String>

#[compiler_item("member_wire_name_override")]

The raw #[wire(name)] value (casing not applied), or None.

pub trait ReflectVariant: Reflect with ()

Compile-time variant introspection. The compiler synthesizes an impl for every variant; it cannot be implemented in user code and is callable only in monomorphized contexts (T a concrete variant). See WEP 2026-06-13 §3.

fn discriminant(&self) -> i32

#[compiler_item("reflect_variant_discriminant")]

Returns the live case's tag.

fn members() -> Self::Members

#[compiler_item("reflect_variant_members")]

Returns the per-case members.

fn wire_tag() -> Option<String>

#[compiler_item("reflect_variant_wire_tag")]

Returns the key #[wire(tag)] writes each case under, or None where the variant declares none.

pub trait ReflectEnum: Reflect with ()

Compile-time enum introspection. The compiler synthesizes an impl for every enum; it cannot be implemented in user code and is callable only in monomorphized contexts (T a concrete enum). See WEP 2026-06-13 §3b.

fn discriminant(&self) -> i32

#[compiler_item("reflect_enum_discriminant")]

Returns the value's tag.

fn from_discriminant(disc: i32) -> Option<Self>

#[compiler_item("reflect_enum_from_discriminant")]

Returns the case with the given tag; None for an unknown tag.

fn members() -> Self::Members

#[compiler_item("reflect_enum_members")]

Returns the per-case members.

pub trait ReflectFlags: Reflect with ()

Compile-time flags introspection. The compiler synthesizes an impl for every flags type; it cannot be implemented in user code and is callable only in monomorphized contexts (T a concrete flags type). See WEP 2026-06-13 §3c.

fn bits(&self) -> u64

#[compiler_item("reflect_flags_bits")]

Returns the value's bits, u64-normalized.

fn from_bits(raw: u64) -> Option<Self>

#[compiler_item("reflect_flags_from_bits")]

Returns the value with the given bits; None when unknown bits are set.

fn members() -> Self::Members

#[compiler_item("reflect_flags_members")]

Returns the per-bit members.

pub trait ReflectNewtype: Reflect with ()

Compile-time newtype introspection. The compiler synthesizes an impl for every newtype; it cannot be implemented in user code and is callable only in monomorphized contexts (T a concrete newtype).

The one kind with no members: a newtype has a base, and the value bridges both ways are the From the compiler already generates for it. Structure it inherits from that base — ReflectStruct::<T> on a newtype over a struct walks the struct's fields — so only the base is stated here. See WEP 2026-06-13.

pub trait ReflectTemplate: Reflect with ()

Compile-time introspection of a tagged template literal's shape. The compiler synthesizes an impl per shape; it cannot be implemented in user code and is callable only in monomorphized contexts (T the anonymous type a template literal denotes). See WEP 2026-01-10.

fn members() -> Self::Members

#[compiler_item("reflect_template_members")]

Returns the per-hole members.

fn tail(t: &Self) -> StrSlice

#[compiler_item("reflect_template_tail")]

The literal text after the last hole of t — the whole template when it has none — with escapes processed.

fn raw_tail(t: &Self) -> StrSlice

#[compiler_item("reflect_template_raw_tail")]

tail(t) as written: a cooked template's escapes preserved, a raw template's text itself.

fn hashes() -> i32

#[compiler_item("reflect_template_hashes")]

How many #s delimit the template on each end: 0 for `…`, 1 for #`…`#.

pub trait Ref with ()

Marker for reference-identity types: those whose value is a Wasm GC reference. Sealed and compiler-synthesized; user impls are rejected. See WEP 2026-01-20.

pub trait RefMut with ()

Marker for in-place-mutable reference types: Ref minus the replace-on-assign ones (variant, fn). A &mut to one of these writes through to the stored value. Sealed and compiler-synthesized; user impls are rejected. See WEP 2026-01-20.

pub trait AffineResource with ()

Marker every affine resource holds, and nothing else. Sealed and compiler-stated; user impls are rejected. See WEP: Affine Types.

pub trait AnyBits with ()

Marker of a type every bit pattern of its width is a value of: the fixed-width integers, the floats, v128, and a newtype or flags type over one. builtin::load reads one from any bytes. Sealed and compiler-stated; user impls are rejected. See WEP: Linear Arrays.

pub affine trait IndexRef<IndexType> with ()

Immutable reference indexing: &container[i] reads through this. Output: Ref — only a reference element can be handed out by reference; a value element is read through IndexValue.

fn index_ref(&self, index: IndexType) -> &Self::Output

Returns a reference to the element at the given index.

pub affine trait IndexRefMut<IndexType> with ()

Mutable reference indexing: container[i].mutating_method(). Output: RefMut — the element must be mutated in place, so a replace-on-assign element (variant, fn) cannot be handed out mutably by reference.

fn index_ref_mut(&mut self, index: IndexType) -> &mut Self::Output

Returns a mutable reference to the element at the given index.

pub affine trait IndexAssign<IndexType> with ()

Value-assignment indexing: container[i] = value. Separate from IndexRefMut: a scalar element has no addressable cell, so writing it by value is a distinct operation from handing out a &mut.

fn index_assign(&mut self, index: IndexType, value: Self::Output)

Assigns a value to the element at the given index.

pub affine trait IndexSwap<IndexType> with ()

Element exchange: c.index_swap(a, b) does what [c[a], c[b]] = [c[b], c[a]] does, moving the two elements rather than copying them, so it serves an affine element too. Like that assignment it checks b before a, and a == b leaves the container as it was.

fn index_swap(&mut self, a: IndexType, b: IndexType)

pub affine trait IndexValue<IndexType> with ()

Value-copy indexing: container[i] yields a copy of the element. The value-semantics counterpart to IndexRef for elements that cannot be aliased by reference (scalars, resources). An affine container hands out copyable elements by value too (LinearArray).

fn index_value(&self, index: IndexType) -> Self::Output

Returns a copy of the element at the given index.

pub trait Add<Rhs = Self> with ()

Trait for the + operator. Types implementing this trait can use the + operator for addition.

fn add(&self, rhs: &Rhs) -> Self::Output

Adds two values and returns the result.

pub trait Sub<Rhs = Self> with ()

Trait for the - operator (binary subtraction). Types implementing this trait can use the - operator for subtraction.

fn sub(&self, rhs: &Rhs) -> Self::Output

Subtracts rhs from self and returns the result.

pub trait Mul<Rhs = Self> with ()

Trait for the * operator. Types implementing this trait can use the * operator for multiplication.

fn mul(&self, rhs: &Rhs) -> Self::Output

Multiplies two values and returns the result.

pub trait Div<Rhs = Self> with ()

Trait for the / operator. Types implementing this trait can use the / operator for division.

fn div(&self, rhs: &Rhs) -> Self::Output

Divides self by rhs and returns the result.

pub trait Rem<Rhs = Self> with ()

Trait for the % operator. Types implementing this trait can use the % operator for remainder.

fn rem(&self, rhs: &Rhs) -> Self::Output

Returns the remainder of dividing self by rhs.

pub trait Neg with ()

Trait for the unary - operator (negation). Types implementing this trait can use the - prefix operator.

fn neg(&self) -> Self::Output

Returns the negation of self.

pub trait BitAnd<Rhs = Self> with ()

Trait for the & operator (bitwise AND).

fn bitand(&self, rhs: &Rhs) -> Self::Output

Returns the bitwise AND of self and rhs.

pub trait BitOr<Rhs = Self> with ()

Trait for the | operator (bitwise OR).

fn bitor(&self, rhs: &Rhs) -> Self::Output

Returns the bitwise OR of self and rhs.

pub trait BitXor<Rhs = Self> with ()

Trait for the ^ operator (bitwise XOR).

fn bitxor(&self, rhs: &Rhs) -> Self::Output

Returns the bitwise XOR of self and rhs.

pub trait BitNot with ()

Trait for the ~ operator (bitwise NOT).

fn bitnot(&self) -> Self::Output

Returns the bitwise NOT of self.

pub trait Shl<Rhs = Self> with ()

Trait for the << operator (left shift).

fn shl(&self, rhs: &Rhs) -> Self::Output

Returns self shifted left by rhs bits.

pub trait Shr<Rhs = Self> with ()

Trait for the >> operator (right shift).

fn shr(&self, rhs: &Rhs) -> Self::Output

Returns self shifted right by rhs bits.

pub affine trait Display with ()

Trait for user-facing display formatting. Types implementing this trait can be formatted with ${x} in template strings. All format traits write to a Formatter that wraps &mut String.

fn fmt(&self, f: &mut Formatter)

Formats the value and writes to the given formatter.

pub affine trait Error: Display with ()

What every standard library error type is: a failure carrying a reason a person can read. It adds nothing to Display, so a bound on it says only that.

pub affine trait Inspect with ()

Trait for debug/inspect formatting. Types implementing this trait can be formatted with ${x:?} in template strings. Unlike Display, Inspect always shows the "raw" debug representation:

fn inspect(&self, f: &mut Formatter)

Formats the value as a debug representation and writes to the given formatter.

pub trait Binary with ()

Trait for formatting values as binary integers. Used with the ${x:b} format specifier.

fn fmt_binary(&self, f: &mut Formatter)

Formats the value as binary and writes to the given formatter.

pub trait Octal with ()

Trait for formatting values as octal integers. Used with the ${x:o} format specifier.

fn fmt_octal(&self, f: &mut Formatter)

Formats the value as octal and writes to the given formatter.

pub trait LowerHex with ()

Trait for formatting values as lowercase hexadecimal. Used with the ${x:x} format specifier.

fn fmt_lower_hex(&self, f: &mut Formatter)

Formats the value as lowercase hex and writes to the given formatter.

pub trait UpperHex with ()

Trait for formatting values as uppercase hexadecimal. Used with the ${x:X} format specifier.

fn fmt_upper_hex(&self, f: &mut Formatter)

Formats the value as uppercase hex and writes to the given formatter.

pub trait LowerExp with ()

Trait for formatting values in lowercase exponential notation. Used with the ${x:e} format specifier.

fn fmt_lower_exp(&self, f: &mut Formatter)

Formats the value in lowercase exponential notation and writes to the given formatter.

pub trait UpperExp with ()

Trait for formatting values in uppercase exponential notation. Used with the ${x:E} format specifier.

fn fmt_upper_exp(&self, f: &mut Formatter)

Formats the value in uppercase exponential notation and writes to the given formatter.

pub affine trait Iterator with _

The core iterator trait for sequences of values. Types implementing this trait can be iterated over using for-of loops.

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Returns None when iteration is complete.

fn collect<C: FromIterator<Elem = Self::Item> = List<Self::Item>>(&mut self) -> C

fn count(&mut self) -> i32

fn map<U, effect E, F: fn mut(Self::Item) -> U with E>(self, f: F) -> IterMap<Self, F> with ()

fn fold<Acc>(&mut self, init: Acc, mut f: fn mut(Acc, Self::Item) -> Acc with _) -> Acc with _

Like reduce, but takes an explicit initial accumulator instead of using the first element. Always returns a value (unlike reduce, which returns None for empty iterators).

fn for_each(&mut self, mut f: fn mut(Self::Item) with _) with _

Calls f for every remaining element. Consumes the iterator.

fn find(&mut self, mut pred: fn mut(Self::Item) -> bool with _) -> Option<Self::Item> with _

Returns the first element for which pred returns true, advancing the iterator up to that point.

fn any(&mut self, mut pred: fn mut(Self::Item) -> bool with _) -> bool with _

Returns true if pred returns true for at least one element (∃). False for empty iterators. Short-circuits: stops advancing the iterator as soon as a matching element is found.

fn all(&mut self, mut pred: fn mut(Self::Item) -> bool with _) -> bool with _

Returns true if pred returns true for every element (∀). True for empty iterators. Short-circuits: stops advancing the iterator as soon as a non-matching element is found.

fn last(&mut self) -> Option<Self::Item>

Advances the entire iterator and returns the last element, or None if empty.

fn nth(&mut self, n: i32) -> Option<Self::Item>

fn position(&mut self, mut pred: fn mut(Self::Item) -> bool with _) -> Option<i32> with _

fn reduce(&mut self, mut f: fn mut(Self::Item, Self::Item) -> Self::Item with _) -> Option<Self::Item> with _

Reduces elements to a single value without an initial accumulator. Returns None if the iterator is empty.

fn filter<effect E, F: fn mut(Self::Item) -> bool with E>(self, pred: F) -> IterFilter<Self, F> with ()

Returns an adapter that skips elements for which pred returns false.

fn enumerate(self) -> IterEnumerate<Self> with ()

Returns an adapter that yields [i, element] tuples, where i starts at 0.

fn take(self, n: i32) -> IterTake<Self> with ()

Returns an adapter that stops after yielding at most n elements.

fn skip(self, n: i32) -> IterSkip<Self> with ()

Returns an adapter that discards the first n elements before yielding the rest.

fn step_by(self, step: i32) -> IterStepBy<Self> with ()

Returns an adapter that yields the first element, then every step-th after it.

fn chain<affine J: Iterator<Item = Self::Item>>(self, other: J) -> IterChain<Self, J> with ()

fn zip<affine J: Iterator>(self, other: J) -> IterZip<Self, J> with ()

Returns an adapter that yields [a, b] pairs, stopping when either iterator is exhausted.

fn sum<S: Sum<Elem = Self::Item> = Self::Item>(&mut self) -> Option<S>

Adds the remaining elements. None for an empty iterator.

fn product<P: Product<Elem = Self::Item> = Self::Item>(&mut self) -> Option<P>

fn min<E: Extremum<Elem = Self::Item> = Self::Item>(&mut self) -> Option<E>

fn max<E: Extremum<Elem = Self::Item> = Self::Item>(&mut self) -> Option<E>

fn min_by(&mut self, mut cmp: fn mut(&Self::Item, &Self::Item) -> Ordering with _) -> Option<Self::Item> with _

fn max_by(&mut self, mut cmp: fn mut(&Self::Item, &Self::Item) -> Ordering with _) -> Option<Self::Item> with _

The largest remaining element under cmp, the last on ties.

fn min_by_key<K: Ord>(&mut self, mut key: fn mut(Self::Item) -> K with _) -> Option<Self::Item> with _

The remaining element with the smallest key, the first on ties.

fn max_by_key<K: Ord>(&mut self, mut key: fn mut(Self::Item) -> K with _) -> Option<Self::Item> with _

The remaining element with the largest key, the last on ties.

pub affine trait IntoIterator with _

Conversion into an Iterator. Types implementing this trait can be used in for-of loops directly.

fn into_iter(&self) -> Self::Iter

Creates an iterator from a value.

pub affine trait ForOf with _

What for let x of e walks when e is a value of a type implementing it: the loop passes e to start and calls the state's next(&mut self) -> Option<Item> until it answers None. The loop owns what it walks, so an affine element moves into the binding once. Any other iterable is walked through its IntoIterator.

fn start(self) -> Self::State

pub affine trait From<T> with ()

Infallible conversion trait. Implement this to define how to convert from type T into Self. Usage: TargetType::from(value) — the target type is always explicit.

The compiler provides a reflexive blanket impl From<T> for T for all types.

fn from(value: T) -> Self

Converts a value of type T into Self.

pub affine trait TryFrom<T> with ()

Fallible conversion trait. Err: Error, so a caller reaching the failure through the bound can always report its reason.

fn try_from(value: T) -> Result<Self, Self::Err>

Attempts to convert a value of type T into Self.

pub trait Sum with ()

Addition over an iterator of Elem, carrying Iterator::sum's element bound. Implemented for every Add<Output = Self>.

fn sum_iter<I: Iterator<Item = Self::Elem>>(iter: &mut I) -> Option<Self> with _

pub trait Product with ()

Multiplication over an iterator of Elem, carrying Iterator::product's element bound. Implemented for every Mul<Output = Self>.

fn product_iter<I: Iterator<Item = Self::Elem>>(iter: &mut I) -> Option<Self> with _

pub trait Extremum with ()

Least and greatest over an iterator of Elem, carrying Iterator::min and max's element bound. Implemented for every Ord.

fn min_iter<I: Iterator<Item = Self::Elem>>(iter: &mut I) -> Option<Self> with _

fn max_iter<I: Iterator<Item = Self::Elem>>(iter: &mut I) -> Option<Self> with _

pub trait FromIterator with ()

Trait for creating a collection from any iterator of Elem.

fn from_iter<I: Iterator<Item = Self::Elem>>(iter: &mut I) -> Self with _

pub trait LiteralSpread with ()

..base inside a { … } literal: merge base into self, last write wins. A target without this impl rejects ..base where it is written.

fn spread_literal(&mut self, base: Self)

pub trait FromStr with ()

Parse a value from text that may not denote one, where From<String> is for text that always does. The parameter takes a StrSlice among the rest, so a field is parsed out of a larger buffer with no substring allocation.

fn from_str<S: AsStrSlice>(s: S) -> Result<Self, Self::Err>

Parse the whole of any AsStrSlice text as Self.

pub trait LenientFromStr with ()

Forgiving sibling of FromStr: parse a human-supplied string, accepting the common spelling variations for the type (casing, radix prefixes, digit separators, alternate boolean words). Leniency widens accepted spellings only — an undenotable value still yields Err, and whitespace is never trimmed (that is the caller's concern). See docs/wep-2026-06-22-lenient-from-str.md.

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<Self, Self::Err>

Parse the entire string as Self, accepting forgiving spellings.

pub trait PushDisplay with ()

Writes a Display value into a String in place, skipping the temporary String that a `${value}` template allocates before copying it in. The alloc-free counterpart to buf.push_str(${value}) for a single value with no format spec — the hot path in the serde numeric encoders.

A trait (not an inherent impl String, which the coherence rules forbid on a foreign type) and placed here, not in string.wado, so String stays a leaf that Formatter depends on — mirroring impl Display for String above.

fn push_display<T: Display>(&mut self, value: &T)

pub affine trait Waitable with ()

What a WaitableSet waits on: a value the host reports events for by its handle. It is sealed, so a set holds only what it can account for: the standard library implements it on the calls, and a variant whose cases each hold one derives it with impl Waitable for V;. A bare stream or future end is none, since no copy on it is in flight: a copy started on one, ReadCopy, WriteCopy or FutureReadCopy, is one.

fn wait_on(&self) -> WaitOn

pub trait Sequence with ()

Read-only random-access sequence: Array<T>, List<T>, and Slice<T>.

Implementors supply len and at; everything else is a default body over those two, so no default constructs a Slice. Methods needing an Elem bound (contains, binary_search, …) cannot live here — an associated type carries no bound — and stay bounded inherent impls.

fn len(&self) -> i32

fn at(&self, index: i32) -> Self::Elem

The element at index. get answers for an index that may be out of range.

fn get_unchecked(&self)

#[unavailable("write `unchecked xs.at(i)`")]

fn is_empty(&self) -> bool

fn get(&self, index: i32) -> Option<Self::Elem>

fn first(&self) -> Option<Self::Elem>

fn last(&self) -> Option<Self::Elem>

fn position(&self, mut pred: fn mut(Self::Elem) -> bool with _) -> Option<i32> with _

pub trait AsSlice: Sequence with ()

Reference view over a contiguous sequence. Implemented by Array<T>, List<T>, and Slice<T>; the implementations forward to Slice, which carries the real bodies.

fn as_slice(&self) -> Slice<Self::Elem>

fn slice(&self, start: i32, end: i32) -> Slice<Self::Elem>

Sub-view over [start, end), clamped to this sequence.

fn iter_value(&self) -> SliceValueIter<Self::Elem>

fn iter_ref(&self) -> SliceRefIter<Self::Elem>

fn windows(&self, size: i32) -> SliceWindows<Self::Elem>

Overlapping windows of size consecutive elements.

fn chunks(&self, size: i32) -> SliceChunks<Self::Elem>

pub trait AsStrSlice: Eq<String> + Display with ()

Conversion to a StrSlice that copies no bytes, so one signature takes an owned string, a reference to one, or a view of part of one.

fn as_str_slice(&self) -> StrSlice

fn internal_append_to(&self, out: &mut String)

Append this text to out. String overrides it to copy straight out of its own backing array: the view the default builds hides the append's operands from the constant-folding frame, which is how a template of literals stops folding to one.

fn len(&self) -> i32

fn is_empty(&self) -> bool

fn byte_at(&self, index: i32) -> u8

fn is_char_boundary(&self, index: i32) -> bool

fn floor_char_boundary(&self, index: i32) -> i32

fn ceil_char_boundary(&self, index: i32) -> i32

fn slice(&self, start: i32, end: i32) -> StrSlice

fn as_bytes(&self) -> ByteSlice

fn chars(&self) -> StrCharIter

fn bytes(&self) -> StrUtf8ByteIter

fn to_string(&self) -> String

fn starts_with<P: AsStrSlice>(&self, pat: P) -> bool

fn ends_with<P: AsStrSlice>(&self, pat: P) -> bool

fn contains<P: AsStrSlice>(&self, pat: P) -> bool

fn find<P: AsStrSlice>(&self, pat: P) -> Option<i32>

fn rfind<P: AsStrSlice>(&self, pat: P) -> Option<i32>

fn strip_prefix<P: AsStrSlice>(&self, prefix: P) -> Option<StrSlice>

fn strip_suffix<P: AsStrSlice>(&self, suffix: P) -> Option<StrSlice>

fn cmp_str<P: AsStrSlice>(&self, other: P) -> Ordering

fn eq_str<P: AsStrSlice>(&self, other: P) -> bool

fn eq_ignore_ascii_case<P: AsStrSlice>(&self, other: P) -> bool

fn char_at_byte(&self, byte_index: i32) -> char

fn trim_ascii_start(&self) -> StrSlice

fn trim_ascii_end(&self) -> StrSlice

fn trim_ascii(&self) -> StrSlice

fn trim_start(&self) -> StrSlice

fn trim_end(&self) -> StrSlice

fn trim(&self) -> StrSlice

fn split<P: AsStrSlice>(&self, sep: P) -> StrSplitIter

fn splitn<P: AsStrSlice>(&self, n: i32, sep: P) -> StrSplitNIter

fn split_whitespace(&self) -> StrSplitWhitespaceIter

fn lines(&self) -> StrLinesIter

fn split_once<P: AsStrSlice>(&self, sep: P) -> Option<[StrSlice, StrSlice]>

fn rsplit_once<P: AsStrSlice>(&self, sep: P) -> Option<[StrSlice, StrSlice]>

fn char_indices(&self) -> StrCharIndicesIter

fn to_chars(&self) -> List<char>

fn to_ascii_lowercase(&self) -> String

fn to_ascii_uppercase(&self) -> String

fn substr_bytes(&self, start: i32, end: i32) -> String

fn contains_char(&self, ch: char) -> bool

fn find_char(&self, pred: fn mut(char) -> bool with _) -> Option<i32> with _

fn repeat(&self, n: i32) -> String

fn replace<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T) -> String

fn replacen<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T, count: i32) -> String

pub trait AsByteSlice with ()

Conversion to a ByteSlice that copies no bytes.

Implemented by ByteArray, ByteList, and ByteSlice (and String, whose UTF-8 bytes view directly), so byte-reading APIs (e.g. core:cbor / core:json from_bytes) accept any of them.

fn as_byte_slice(&self) -> ByteSlice

pub trait FromLeBytes with ()

A fixed-width number that reads from little-endian bytes, as List::from_le_bytes does.

fn bits() -> i32

The width in bits: the type's BITS, until a trait can declare one (#2141).

fn from_le_at(bytes: ByteSlice, at: i32) -> Self

The value whose bits() / 8 bytes start at at.

pub trait Step with ()

Types that can be incremented by one step (for range iteration).

fn next_step(&self) -> Option<Self>

Resources

pub resource Future<T>

Readable end of an async value (WASI Component Model future). Opaque i32 handle managed by the runtime.

Use Future::<T>::new() to create a [Future<T>, FutureWritable<T>] pair. The readable end is passed to consumers; the writable end fulfills the future.

fn new() -> [Future<T>, FutureWritable<T>]

#[cm("future-new")]

Create a new future pair: [Future<T>, FutureWritable<T>].

fn read(self) -> Option<T>

#[cm("future-read")]

Read the value from the future: Some(value) when fulfilled, None if the writer dropped without writing. A readable end is read once, so the read consumes it.

fn cancel_read(&self) -> u32

#[cm("future-cancel-read")]

Cancel the read in flight, blocking until it settles, and return the CopyResult it ended on, numbered as the Component Model numbers it. A FutureReadCopy dropped in flight calls it. It traps on an end with no read in flight.

fn drop(self)

#[cm("future-drop-readable")]

Drop the readable end of the future.

pub fn start_read(self) -> FutureReadCopy<T>

Start the read without waiting for it, so a WaitableSet can wait on it beside other work. The end moves into the read.

pub resource FutureWritable<T>

Writable end of an async value (WASI Component Model future). Opaque i32 handle managed by the runtime.

fn write(self, value: T) -> FutureWrite<T>

#[cm("future-write")]

Fulfill the future with a value. A writable end is written once, so the write consumes it. A reader that dropped first leaves the value in rest.

fn cancel_write(&self)

#[cm("future-cancel-write")]

Cancel an in-progress write. Blocks until cancellation completes.

fn drop(self)

#[cm("future-drop-writable")]

Drop this writable end handle. Traps if no value has been written yet.

pub resource Stream<T>

Readable end of an async sequence (WASI Component Model stream). Stream::<T>::new() creates the [Stream<T>, StreamWritable<T>] pair.

fn new() -> [Stream<T>, StreamWritable<T>]

#[cm("stream-new")]

fn begin_read(&self, max: i32, into: ReadInto) -> StartedRead<T>

#[cm("stream-read")]

One Component Model copy of up to max elements, started and not waited for. It is the operation a handler answers, with StartedRead::settled. A program calls start_read, which holds the end for the copy: a second copy on an end that is copying traps, and a StartedRead dropped in flight waits for its copy where a ReadCopy cancels it. A handler may ignore into: it says where a host copy lands, and settled answers with the elements themselves.

fn cancel_read(&self) -> u32

#[cm("stream-cancel-read")]

Cancel the copy in flight, blocking until it settles, and return the packed word the Component Model answers: the count the copy moved shifted left by four, over its CopyResult. A ReadCopy dropped in flight calls it, so a handler that started the copy on another end answers it by cancelling there. It traps on an end with no copy in flight.

fn drop(self)

#[cm("stream-drop-readable")]

Drop the readable end of the stream.

pub fn start_read(self, max: i32) -> ReadCopy<T>

Start one copy of up to max elements without waiting for it. The end moves into the copy, and ReadCopy::finish hands it back.

pub fn read_to_end(&self) -> List<T>

Read until the writable end drops, and return everything it wrote. Only the result stops it: an empty Completed copy is the writer offering nothing this time, and more can still follow.

pub fn read_to_end_sized(&self, expected: i32) -> List<T>

read_to_end into a buffer made for expected elements up front, so a stream whose length is known is never copied into a doubled buffer. A doubling past half the address space is what a large file cannot afford.

pub fn read_to_end_bytes(&self) -> ByteList

read_to_end, as the byte buffer a byte stream carries.

pub resource StreamWritable<T>

Writable end of an async sequence (WASI Component Model stream).

fn begin_write(&self, data: List<T>) -> StartedWrite<T>

#[cm("stream-write")]

One Component Model copy of data, started and not waited for. An empty data is the CM's readiness signal: it settles once a reader rendezvouses, having written nothing. It is the operation a handler answers, with StartedWrite::settled. A program calls start_write, which holds the end for the copy: a second copy on an end that is copying traps, and a StartedWrite dropped in flight waits for its copy where a WriteCopy cancels it.

fn cancel_write(&self) -> u32

#[cm("stream-cancel-write")]

Cancel the copy in flight, as Stream::cancel_read does, for a WriteCopy dropped in flight.

fn write_raw_all(&self, data: Slice<T>) -> CopyResult

#[cm("stream-write-raw-all")]

write_all for a byte view, lowered once with no value-semantics copy. Any element type but a byte is a compile error.

fn drop(self)

#[cm("stream-drop-writable")]

Drop the writable end, signaling end-of-stream.

pub fn start_write(self, data: List<T>) -> WriteCopy<T>

Start one copy of data without waiting for it. The end moves into the copy, and WriteCopy::finish hands it back.

pub fn write_all(&self, data: List<T>) -> CopyResult

Write every element, or stop early when the readable end drops. Returns the result of the copy that ended the loop.

pub resource Subtask

A raw CM subtask handle. AsyncCall<T> holds one, with its result buffer. Dropping a subtask leaves the set it is joined to.

fn drop(self)

#[cm("subtask-drop")]

Drop a completed subtask. Traps if the subtask has not yet resolved.

fn cancel(&self) -> u32

#[cm("subtask-cancel")]

Cancel this in-progress subtask, blocking until it resolves, and return the state it resolved in.

pub resource ErrorContext

An error context carrying a debug message across component boundaries.

fn new(message: String) -> ErrorContext

#[cm("error-context-new")]

Create a new error context with the given message.

fn debug_message(&self) -> String

#[cm("error-context-debug-message")]

Get the debug message from this error context.

fn drop(self)

#[cm("error-context-drop")]

Drop the error context.

Types

pub type ByteArray = Array<u8>

An owned, fixed-length byte buffer.

impl AsByteSlice for ByteArray

fn as_byte_slice(&self) -> ByteSlice

pub type ByteList = List<u8>

pub fn to_hex(&self) -> String

Renders the bytes as a lowercase hexadecimal string, two digits per byte (e.g. [0x0f, 0xa0] -> "0fa0").

impl AsByteSlice for ByteList

fn as_byte_slice(&self) -> ByteSlice

pub type ByteSlice = Slice<u8>

impl AsByteSlice for ByteSlice

fn as_byte_slice(&self) -> ByteSlice

Primitive Types

f32

pub const BITS: i32

pub const PI: f32

pub const TAU: f32

pub const E: f32

pub const LN2: f32

pub const LN10: f32

pub const LOG2_E: f32

pub const LOG10_E: f32

pub const SQRT2: f32

pub const FRAC_1_SQRT2: f32

pub const FRAC_PI_2: f32

pub const FRAC_PI_4: f32

pub const INFINITY: f32

pub const NEG_INFINITY: f32

pub const NAN: f32

pub const MAX: f32

pub const MIN: f32

pub const MIN_POSITIVE: f32

The smallest positive normal value.

pub const EPSILON: f32

The gap between 1.0 and the next larger value.

pub const RADIX: i32

pub const MANTISSA_DIGITS: i32

Significand bits, the implicit leading one included.

pub const DIGITS: i32

Decimal digits that survive a round trip through the type.

pub const MIN_EXP: i32

pub const MAX_EXP: i32

pub const MIN_10_EXP: i32

pub const MAX_10_EXP: i32

pub fn to_string(&self) -> String

pub fn abs(x: f32) -> f32

Absolute value

pub fn ceil(x: f32) -> f32

Ceiling (round toward +infinity)

pub fn floor(x: f32) -> f32

Floor (round toward -infinity)

pub fn trunc(x: f32) -> f32

Truncate toward zero

pub fn round(x: f32) -> f32

Round to nearest, breaking ties away from zero

Wasm rounds the other way, so this is a software implementation — slower than round_ties_even.

pub fn round_ties_even(x: f32) -> f32

Round to nearest, breaking ties toward the even neighbour

pub fn sqrt(x: f32) -> f32

Square root

pub fn min(x: f32, y: f32) -> f32

The lesser of two values by the order, where NaN is greatest; x when they are equal.

pub fn max(x: f32, y: f32) -> f32

The greater of two values by the order, where NaN is greatest; y when they are equal.

pub fn ieee754_min(x: f32, y: f32) -> f32

IEEE 754-2019 minimum: NaN when either value is, and -0.0 below 0.0.

pub fn ieee754_max(x: f32, y: f32) -> f32

IEEE 754-2019 maximum: NaN when either value is, and -0.0 below 0.0.

pub fn clamp(x: f32, low: f32, high: f32) -> f32

x confined to low..=high by the order, except that a NaN x stays NaN.

pub fn copysign(x: f32, y: f32) -> f32

Copy sign from y to x

pub fn sin(x: f32) -> f32

Sine (in radians)

pub fn cos(x: f32) -> f32

Cosine (in radians)

pub fn tan(x: f32) -> f32

Tangent (in radians)

pub fn asin(x: f32) -> f32

Arc sine (returns radians)

pub fn acos(x: f32) -> f32

Arc cosine (returns radians)

pub fn atan(x: f32) -> f32

Arc tangent (returns radians)

pub fn atan2(y: f32, x: f32) -> f32

Arc tangent of y/x (returns radians)

pub fn sinh(x: f32) -> f32

Hyperbolic sine

pub fn cosh(x: f32) -> f32

Hyperbolic cosine

pub fn tanh(x: f32) -> f32

Hyperbolic tangent

pub fn asinh(x: f32) -> f32

Inverse hyperbolic sine

pub fn acosh(x: f32) -> f32

Inverse hyperbolic cosine

pub fn atanh(x: f32) -> f32

Inverse hyperbolic tangent

pub fn exp(x: f32) -> f32

e raised to the power x

pub fn exp2(x: f32) -> f32

2 raised to the power x

pub fn exp10(x: f32) -> f32

10 raised to the power x

pub fn expm1(x: f32) -> f32

e^x - 1 (more accurate for small x)

pub fn ln(x: f32) -> f32

Natural logarithm (base e)

pub fn log2(x: f32) -> f32

Logarithm base 2

pub fn log10(x: f32) -> f32

Logarithm base 10

pub fn ln1p(x: f32) -> f32

ln(1 + x) (more accurate for small x)

pub fn pow(x: f32, y: f32) -> f32

x raised to the power y

pub fn cbrt(x: f32) -> f32

Cube root

pub fn hypot(x: f32, y: f32) -> f32

Euclidean distance: sqrt(x^2 + y^2)

pub fn fmod(x: f32, y: f32) -> f32

Floating-point remainder of x/y

pub fn erf(x: f32) -> f32

Error function: (2/√π) ∫₀ˣ e^(-t²) dt

pub fn erfc(x: f32) -> f32

Complementary error function: 1 - erf(x), accurate where erf is near 1

pub fn gamma(x: f32) -> f32

Gamma function: Γ(x), which is (x - 1)! at a positive integer

pub fn ln_gamma(x: f32) -> f32

Natural logarithm of |Γ(x)|

pub fn mul_add(x: f32, y: f32, z: f32) -> f32

x * y + z, rounded once instead of twice.

Wasm has no scalar FMA instruction, so this is a software implementation — slower than x * y + z.

pub fn is_nan(&self) -> bool

pub fn ieee754_eq(&self, other: f32) -> bool

IEEE 754's ==: false when either is a NaN, where == holds for two.

pub fn ieee754_ne(&self, other: f32) -> bool

IEEE 754's !=: true when either is a NaN.

pub fn ieee754_lt(&self, other: f32) -> bool

IEEE 754's <: false when either is a NaN, where < orders NaN last.

pub fn ieee754_le(&self, other: f32) -> bool

IEEE 754's <=: false when either is a NaN.

pub fn ieee754_gt(&self, other: f32) -> bool

IEEE 754's >: false when either is a NaN.

pub fn ieee754_ge(&self, other: f32) -> bool

IEEE 754's >=: false when either is a NaN.

pub fn is_finite(&self) -> bool

pub fn to_bits(&self) -> u32

Reinterprets the bits of this f32 as a u32.

pub fn from_bits(bits: u32) -> f32

Creates an f32 from its bit representation.

impl From<f16> for f32

fn from(value: f16) -> f32

impl From<bf16> for f32

fn from(value: bf16) -> f32

impl TryFrom<i128> for f32

pub fn try_from(value: i128) -> Result<f32, ConvertError>

impl TryFrom<u128> for f32

pub fn try_from(value: u128) -> Result<f32, ConvertError>

impl FromStr for f32

fn from_str<S: AsStrSlice>(s: S) -> Result<f32, ParseFloatError>

impl LenientFromStr for f32

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<f32, LenientParseError>

impl Display for f32

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for f32

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for f32

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for f32

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Eq for f32

pub fn eq(&self, other: &Self) -> bool

impl Ord for f32

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for f32

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for f32

pub fn default() -> f32

impl TryFrom<i64> for f32

pub fn try_from(value: i64) -> Result<f32, ConvertError>

impl TryFrom<u64> for f32

pub fn try_from(value: u64) -> Result<f32, ConvertError>

impl FromLeBytes for f32

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> f32

f64

pub const BITS: i32

pub const PI: f64

pub const TAU: f64

pub const E: f64

pub const LN2: f64

pub const LN10: f64

pub const LOG2_E: f64

pub const LOG10_E: f64

pub const SQRT2: f64

pub const FRAC_1_SQRT2: f64

pub const FRAC_PI_2: f64

pub const FRAC_PI_4: f64

pub const INFINITY: f64

pub const NEG_INFINITY: f64

pub const NAN: f64

pub const MAX: f64

pub const MIN: f64

pub const MIN_POSITIVE: f64

The smallest positive normal value.

pub const EPSILON: f64

The gap between 1.0 and the next larger value.

pub const RADIX: i32

pub const MANTISSA_DIGITS: i32

Significand bits, the implicit leading one included.

pub const DIGITS: i32

Decimal digits that survive a round trip through the type.

pub const MIN_EXP: i32

pub const MAX_EXP: i32

pub const MIN_10_EXP: i32

pub const MAX_10_EXP: i32

pub const MAX_SAFE_INTEGER: f64

The largest integer exactly representable in f64: 2^53 - 1. Mirrors JS Number.MAX_SAFE_INTEGER.

pub const MIN_SAFE_INTEGER: f64

The smallest integer exactly representable in f64: -(2^53 - 1). Mirrors JS Number.MIN_SAFE_INTEGER.

pub fn to_string(&self) -> String

pub fn abs(x: f64) -> f64

Absolute value

pub fn ceil(x: f64) -> f64

Ceiling (round toward +infinity)

pub fn floor(x: f64) -> f64

Floor (round toward -infinity)

pub fn trunc(x: f64) -> f64

Truncate toward zero

pub fn round(x: f64) -> f64

Round to nearest, breaking ties away from zero

Wasm rounds the other way, so this is a software implementation — slower than round_ties_even.

pub fn round_ties_even(x: f64) -> f64

Round to nearest, breaking ties toward the even neighbour

pub fn sqrt(x: f64) -> f64

Square root

pub fn min(x: f64, y: f64) -> f64

The lesser of two values by the order, where NaN is greatest; x when they are equal.

pub fn max(x: f64, y: f64) -> f64

The greater of two values by the order, where NaN is greatest; y when they are equal.

pub fn ieee754_min(x: f64, y: f64) -> f64

IEEE 754-2019 minimum: NaN when either value is, and -0.0 below 0.0.

pub fn ieee754_max(x: f64, y: f64) -> f64

IEEE 754-2019 maximum: NaN when either value is, and -0.0 below 0.0.

pub fn clamp(x: f64, low: f64, high: f64) -> f64

x confined to low..=high by the order, except that a NaN x stays NaN.

pub fn copysign(x: f64, y: f64) -> f64

Copy sign from y to x

pub fn sin(x: f64) -> f64

Sine (in radians)

pub fn cos(x: f64) -> f64

Cosine (in radians)

pub fn tan(x: f64) -> f64

Tangent (in radians)

pub fn asin(x: f64) -> f64

Arc sine (returns radians)

pub fn acos(x: f64) -> f64

Arc cosine (returns radians)

pub fn atan(x: f64) -> f64

Arc tangent (returns radians)

pub fn atan2(y: f64, x: f64) -> f64

Arc tangent of y/x (returns radians)

pub fn sinh(x: f64) -> f64

Hyperbolic sine

pub fn cosh(x: f64) -> f64

Hyperbolic cosine

pub fn tanh(x: f64) -> f64

Hyperbolic tangent

pub fn asinh(x: f64) -> f64

Inverse hyperbolic sine

pub fn acosh(x: f64) -> f64

Inverse hyperbolic cosine

pub fn atanh(x: f64) -> f64

Inverse hyperbolic tangent

pub fn exp(x: f64) -> f64

e raised to the power x

pub fn exp2(x: f64) -> f64

2 raised to the power x

pub fn exp10(x: f64) -> f64

10 raised to the power x

pub fn expm1(x: f64) -> f64

e^x - 1 (more accurate for small x)

pub fn ln(x: f64) -> f64

Natural logarithm (base e)

pub fn log2(x: f64) -> f64

Logarithm base 2

pub fn log10(x: f64) -> f64

Logarithm base 10

pub fn ln1p(x: f64) -> f64

ln(1 + x) (more accurate for small x)

pub fn pow(x: f64, y: f64) -> f64

x raised to the power y

pub fn cbrt(x: f64) -> f64

Cube root

pub fn hypot(x: f64, y: f64) -> f64

Euclidean distance: sqrt(x^2 + y^2)

pub fn fmod(x: f64, y: f64) -> f64

Floating-point remainder of x/y

pub fn erf(x: f64) -> f64

Error function: (2/√π) ∫₀ˣ e^(-t²) dt

pub fn erfc(x: f64) -> f64

Complementary error function: 1 - erf(x), accurate where erf is near 1

pub fn gamma(x: f64) -> f64

Gamma function: Γ(x), which is (x - 1)! at a positive integer

pub fn ln_gamma(x: f64) -> f64

Natural logarithm of |Γ(x)|

pub fn mul_add(x: f64, y: f64, z: f64) -> f64

x * y + z, rounded once instead of twice.

Wasm has no scalar FMA instruction, so this is a software implementation — slower than x * y + z.

pub fn is_nan(&self) -> bool

pub fn ieee754_eq(&self, other: f64) -> bool

IEEE 754's ==: false when either is a NaN, where == holds for two.

pub fn ieee754_ne(&self, other: f64) -> bool

IEEE 754's !=: true when either is a NaN.

pub fn ieee754_lt(&self, other: f64) -> bool

IEEE 754's <: false when either is a NaN, where < orders NaN last.

pub fn ieee754_le(&self, other: f64) -> bool

IEEE 754's <=: false when either is a NaN.

pub fn ieee754_gt(&self, other: f64) -> bool

IEEE 754's >: false when either is a NaN.

pub fn ieee754_ge(&self, other: f64) -> bool

IEEE 754's >=: false when either is a NaN.

pub fn is_finite(&self) -> bool

pub fn to_bits(&self) -> u64

Reinterprets the bits of this f64 as a u64.

pub fn from_bits(bits: u64) -> f64

Creates an f64 from its bit representation.

impl From<f16> for f64

fn from(value: f16) -> f64

impl From<bf16> for f64

fn from(value: bf16) -> f64

impl TryFrom<i128> for f64

pub fn try_from(value: i128) -> Result<f64, ConvertError>

impl TryFrom<u128> for f64

pub fn try_from(value: u128) -> Result<f64, ConvertError>

impl FromStr for f64

fn from_str<S: AsStrSlice>(s: S) -> Result<f64, ParseFloatError>

impl LenientFromStr for f64

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<f64, LenientParseError>

impl Display for f64

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for f64

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for f64

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for f64

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Eq for f64

pub fn eq(&self, other: &Self) -> bool

impl Ord for f64

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for f64

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for f64

pub fn default() -> f64

impl From<f32> for f64

pub fn from(value: f32) -> f64

impl TryFrom<i64> for f64

pub fn try_from(value: i64) -> Result<f64, ConvertError>

impl TryFrom<u64> for f64

pub fn try_from(value: u64) -> Result<f64, ConvertError>

impl FromLeBytes for f64

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> f64

f16

pub const BITS: i32

pub const MAX: f16

pub const MIN: f16

pub const MIN_POSITIVE: f16

The smallest positive normal value.

pub const EPSILON: f16

The gap between 1.0 and the next larger value.

pub const INFINITY: f16

pub const NEG_INFINITY: f16

pub const NAN: f16

pub const RADIX: i32

pub const MANTISSA_DIGITS: i32

Significand bits, the implicit leading one included.

pub const DIGITS: i32

Decimal digits that survive a round trip through the type.

pub const MIN_EXP: i32

pub const MAX_EXP: i32

pub const MIN_10_EXP: i32

pub const MAX_10_EXP: i32

pub fn to_bits(&self) -> u16

Reinterprets the bits of this f16 as a u16.

pub fn from_bits(bits: u16) -> f16

Creates an f16 from its bit representation.

pub fn from_f32(v: f32) -> f16

Rounds v to the nearest f16, ties to even, saturating to an infinity. Use f16::try_from where an inexact value should be refused instead.

pub fn from_f64(v: f64) -> f16

Rounds v once to the nearest f16, ties to even, saturating to an infinity.

pub fn is_nan(&self) -> bool

True for a NaN, quiet or signaling.

pub fn ieee754_eq(&self, other: f16) -> bool

IEEE 754's ==, on the values widened to f32.

pub fn ieee754_ne(&self, other: f16) -> bool

IEEE 754's !=, on the values widened to f32.

pub fn ieee754_lt(&self, other: f16) -> bool

IEEE 754's <, on the values widened to f32.

pub fn ieee754_le(&self, other: f16) -> bool

IEEE 754's <=, on the values widened to f32.

pub fn ieee754_gt(&self, other: f16) -> bool

IEEE 754's >, on the values widened to f32.

pub fn ieee754_ge(&self, other: f16) -> bool

IEEE 754's >=, on the values widened to f32.

impl FromStr for f16

fn from_str<S: AsStrSlice>(s: S) -> Result<f16, ParseFloatError>

impl LenientFromStr for f16

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<f16, LenientParseError>

impl TryFrom<f32> for f16

pub fn try_from(value: f32) -> Result<f16, ConvertError>

impl TryFrom<f64> for f16

pub fn try_from(value: f64) -> Result<f16, ConvertError>

impl Eq for f16

pub fn eq(&self, other: &Self) -> bool

impl Ord for f16

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for f16

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for f16

pub fn default() -> f16

impl Display for f16

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for f16

pub fn inspect(&self, f: &mut Formatter)

impl FromLeBytes for f16

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> f16

bf16

pub const BITS: i32

pub const MAX: bf16

pub const MIN: bf16

pub const MIN_POSITIVE: bf16

The smallest positive normal value.

pub const EPSILON: bf16

The gap between 1.0 and the next larger value.

pub const INFINITY: bf16

pub const NEG_INFINITY: bf16

pub const NAN: bf16

pub const RADIX: i32

pub const MANTISSA_DIGITS: i32

Significand bits, the implicit leading one included.

pub const DIGITS: i32

Decimal digits that survive a round trip through the type.

pub const MIN_EXP: i32

pub const MAX_EXP: i32

pub const MIN_10_EXP: i32

pub const MAX_10_EXP: i32

pub fn to_bits(&self) -> u16

Reinterprets the bits of this bf16 as a u16.

pub fn from_bits(bits: u16) -> bf16

Creates a bf16 from its bit representation.

pub fn from_f32(v: f32) -> bf16

Rounds v to the nearest bf16, ties to even. bf16 takes f32's exponent field as is, so the top 16 bits are the result and only the mantissa rounds.

pub fn from_f64(v: f64) -> bf16

Rounds v once to the nearest bf16, ties to even.

pub fn is_nan(&self) -> bool

True for a NaN, quiet or signaling.

pub fn ieee754_eq(&self, other: bf16) -> bool

IEEE 754's ==, on the values widened to f32.

pub fn ieee754_ne(&self, other: bf16) -> bool

IEEE 754's !=, on the values widened to f32.

pub fn ieee754_lt(&self, other: bf16) -> bool

IEEE 754's <, on the values widened to f32.

pub fn ieee754_le(&self, other: bf16) -> bool

IEEE 754's <=, on the values widened to f32.

pub fn ieee754_gt(&self, other: bf16) -> bool

IEEE 754's >, on the values widened to f32.

pub fn ieee754_ge(&self, other: bf16) -> bool

IEEE 754's >=, on the values widened to f32.

impl FromStr for bf16

fn from_str<S: AsStrSlice>(s: S) -> Result<bf16, ParseFloatError>

impl LenientFromStr for bf16

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<bf16, LenientParseError>

impl TryFrom<f32> for bf16

pub fn try_from(value: f32) -> Result<bf16, ConvertError>

impl TryFrom<f64> for bf16

pub fn try_from(value: f64) -> Result<bf16, ConvertError>

impl Eq for bf16

pub fn eq(&self, other: &Self) -> bool

impl Ord for bf16

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for bf16

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for bf16

pub fn default() -> bf16

impl Display for bf16

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for bf16

pub fn inspect(&self, f: &mut Formatter)

impl FromLeBytes for bf16

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> bf16

i64

pub const BITS: i32

pub const MAX: i64

pub const MIN: i64

pub fn max(a: i64, b: i64) -> i64

pub fn min(a: i64, b: i64) -> i64

pub fn clamp(value: i64, low: i64, high: i64) -> i64

value confined to low..=high.

pub fn abs(x: i64) -> i64

The magnitude of x. MIN has none in i64 and wraps to itself, as negating it does.

pub fn div_floor(&self, rhs: i64) -> i64

self / rhs rounded toward negative infinity. Traps where / does.

pub fn div_ceil(&self, rhs: i64) -> i64

self / rhs rounded toward positive infinity. Traps where / does.

pub fn clz(x: i64) -> i64

Counts the leading zeros in this integer.

pub fn ctz(x: i64) -> i64

Counts the trailing zeros in this integer.

pub fn popcnt(x: i64) -> i64

Counts the number of set bits (population count).

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<i64, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<i64, ParseIntError>

impl TryFrom<u128> for i64

pub fn try_from(value: u128) -> Result<i64, ConvertError>

impl TryFrom<i128> for i64

pub fn try_from(value: i128) -> Result<i64, ConvertError>

impl FromStr for i64

fn from_str<S: AsStrSlice>(s: S) -> Result<i64, ParseIntError>

impl LenientFromStr for i64

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<i64, LenientParseError>

impl Display for i64

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for i64

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for i64

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for i64

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for i64

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for i64

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for i64

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for i64

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for i64

pub fn eq(&self, other: &Self) -> bool

impl Ord for i64

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for i64

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for i64

pub fn default() -> i64

impl From<i8> for i64

pub fn from(value: i8) -> i64

impl From<i16> for i64

pub fn from(value: i16) -> i64

impl From<i32> for i64

pub fn from(value: i32) -> i64

impl From<u8> for i64

pub fn from(value: u8) -> i64

impl From<u16> for i64

pub fn from(value: u16) -> i64

impl From<u32> for i64

pub fn from(value: u32) -> i64

impl TryFrom<u64> for i64

pub fn try_from(value: u64) -> Result<i64, ConvertError>

impl FromLeBytes for i64

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> i64

impl Step for i64

fn next_step(&self) -> Option<i64>

u64

pub const BITS: i32

pub const MAX: u64

pub const MIN: u64

pub fn max(a: u64, b: u64) -> u64

pub fn min(a: u64, b: u64) -> u64

pub fn clamp(value: u64, low: u64, high: u64) -> u64

value confined to low..=high.

pub fn wrapping_neg(&self) -> u64

The negation modulo 2^64: 0 for 0, MAX - self + 1 otherwise.

pub fn div_ceil(&self, rhs: u64) -> u64

self / rhs rounded up. Traps where / does.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<u64, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<u64, ParseIntError>

impl TryFrom<u128> for u64

pub fn try_from(value: u128) -> Result<u64, ConvertError>

impl TryFrom<i128> for u64

pub fn try_from(value: i128) -> Result<u64, ConvertError>

impl FromStr for u64

fn from_str<S: AsStrSlice>(s: S) -> Result<u64, ParseIntError>

impl LenientFromStr for u64

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<u64, LenientParseError>

impl Display for u64

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for u64

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for u64

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for u64

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for u64

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for u64

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for u64

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for u64

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for u64

pub fn eq(&self, other: &Self) -> bool

impl Ord for u64

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for u64

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for u64

pub fn default() -> u64

impl From<u8> for u64

pub fn from(value: u8) -> u64

impl From<u16> for u64

pub fn from(value: u16) -> u64

impl From<u32> for u64

pub fn from(value: u32) -> u64

impl TryFrom<i64> for u64

pub fn try_from(value: i64) -> Result<u64, ConvertError>

impl FromLeBytes for u64

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> u64

impl Step for u64

fn next_step(&self) -> Option<u64>

i8

pub const BITS: i32

pub const MAX: i8

pub const MIN: i8

pub fn max(a: i8, b: i8) -> i8

pub fn min(a: i8, b: i8) -> i8

pub fn clamp(value: i8, low: i8, high: i8) -> i8

value confined to low..=high.

pub fn abs(x: i8) -> i8

The magnitude of x. MIN has none in i8 and wraps to itself, as negating it does.

pub fn div_floor(&self, rhs: i8) -> i8

self / rhs rounded toward negative infinity. Traps where / does.

pub fn div_ceil(&self, rhs: i8) -> i8

self / rhs rounded toward positive infinity. Traps where / does.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<i8, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<i8, ParseIntError>

impl FromStr for i8

fn from_str<S: AsStrSlice>(s: S) -> Result<i8, ParseIntError>

impl LenientFromStr for i8

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<i8, LenientParseError>

impl Display for i8

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for i8

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for i8

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for i8

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for i8

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for i8

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for i8

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for i8

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for i8

pub fn eq(&self, other: &Self) -> bool

impl Ord for i8

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for i8

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for i8

pub fn default() -> i8

impl TryFrom<i64> for i8

pub fn try_from(value: i64) -> Result<i8, ConvertError>

impl TryFrom<i32> for i8

pub fn try_from(value: i32) -> Result<i8, ConvertError>

impl TryFrom<i16> for i8

pub fn try_from(value: i16) -> Result<i8, ConvertError>

impl FromLeBytes for i8

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> i8

impl Step for i8

fn next_step(&self) -> Option<i8>

i16

pub const BITS: i32

pub const MAX: i16

pub const MIN: i16

pub fn max(a: i16, b: i16) -> i16

pub fn min(a: i16, b: i16) -> i16

pub fn clamp(value: i16, low: i16, high: i16) -> i16

value confined to low..=high.

pub fn abs(x: i16) -> i16

The magnitude of x. MIN has none in i16 and wraps to itself, as negating it does.

pub fn div_floor(&self, rhs: i16) -> i16

self / rhs rounded toward negative infinity. Traps where / does.

pub fn div_ceil(&self, rhs: i16) -> i16

self / rhs rounded toward positive infinity. Traps where / does.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<i16, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<i16, ParseIntError>

impl FromStr for i16

fn from_str<S: AsStrSlice>(s: S) -> Result<i16, ParseIntError>

impl LenientFromStr for i16

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<i16, LenientParseError>

impl Display for i16

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for i16

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for i16

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for i16

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for i16

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for i16

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for i16

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for i16

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for i16

pub fn eq(&self, other: &Self) -> bool

impl Ord for i16

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for i16

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for i16

pub fn default() -> i16

impl From<i8> for i16

pub fn from(value: i8) -> i16

impl From<u8> for i16

pub fn from(value: u8) -> i16

impl TryFrom<i64> for i16

pub fn try_from(value: i64) -> Result<i16, ConvertError>

impl TryFrom<i32> for i16

pub fn try_from(value: i32) -> Result<i16, ConvertError>

impl FromLeBytes for i16

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> i16

impl Step for i16

fn next_step(&self) -> Option<i16>

i32

pub const BITS: i32

pub const MAX: i32

pub const MIN: i32

pub fn max(a: i32, b: i32) -> i32

pub fn min(a: i32, b: i32) -> i32

pub fn clamp(value: i32, low: i32, high: i32) -> i32

value confined to low..=high.

pub fn abs(x: i32) -> i32

The magnitude of x. MIN has none in i32 and wraps to itself, as negating it does.

pub fn div_floor(&self, rhs: i32) -> i32

self / rhs rounded toward negative infinity. Traps where / does.

pub fn div_ceil(&self, rhs: i32) -> i32

self / rhs rounded toward positive infinity. Traps where / does.

pub fn clz(x: i32) -> i32

Counts the leading zeros in this integer.

pub fn ctz(x: i32) -> i32

Counts the trailing zeros in this integer.

pub fn popcnt(x: i32) -> i32

Counts the number of set bits (population count).

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<i32, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<i32, ParseIntError>

impl FromStr for i32

fn from_str<S: AsStrSlice>(s: S) -> Result<i32, ParseIntError>

impl LenientFromStr for i32

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<i32, LenientParseError>

impl Display for i32

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for i32

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for i32

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for i32

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for i32

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for i32

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for i32

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for i32

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for i32

pub fn eq(&self, other: &Self) -> bool

impl Ord for i32

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for i32

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for i32

pub fn default() -> i32

impl From<i8> for i32

pub fn from(value: i8) -> i32

impl From<i16> for i32

pub fn from(value: i16) -> i32

impl From<u8> for i32

pub fn from(value: u8) -> i32

impl From<u16> for i32

pub fn from(value: u16) -> i32

impl From<bool> for i32

pub fn from(value: bool) -> i32

impl TryFrom<i64> for i32

pub fn try_from(value: i64) -> Result<i32, ConvertError>

impl FromLeBytes for i32

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> i32

impl Step for i32

fn next_step(&self) -> Option<i32>

u8

pub const BITS: i32

pub const MAX: u8

pub const MIN: u8

pub fn max(a: u8, b: u8) -> u8

pub fn min(a: u8, b: u8) -> u8

pub fn clamp(value: u8, low: u8, high: u8) -> u8

value confined to low..=high.

pub fn wrapping_neg(&self) -> u8

The negation modulo 2^8: 0 for 0, MAX - self + 1 otherwise.

pub fn div_ceil(&self, rhs: u8) -> u8

self / rhs rounded up. Traps where / does.

pub fn is_ascii_digit(&self) -> bool

Returns true if the byte is an ASCII digit: 0-9.

pub fn is_ascii_alphabetic(&self) -> bool

Returns true if the byte is an ASCII letter: a-z or A-Z.

pub fn is_ascii_alphanumeric(&self) -> bool

Returns true if the byte is an ASCII letter or digit: a-z, A-Z, 0-9.

pub fn is_ascii_lowercase(&self) -> bool

Returns true if the byte is an ASCII lowercase letter: a-z.

pub fn is_ascii_uppercase(&self) -> bool

Returns true if the byte is an ASCII uppercase letter: A-Z.

pub fn is_ascii_whitespace(&self) -> bool

Returns true if the byte is ASCII whitespace: SP, HT, LF, VT, FF, CR.

pub fn is_hexdigit(&self) -> bool

Returns true if the byte is a hexadecimal digit: 0-9, a-f, A-F.

pub fn to_ascii_lowercase(&self) -> u8

Converts an ASCII uppercase letter to lowercase, leaving every other byte unchanged.

pub fn to_ascii_uppercase(&self) -> u8

Converts an ASCII lowercase letter to uppercase, leaving every other byte unchanged.

pub fn eq_ignore_ascii_case(&self, other: &u8) -> bool

Checks that two bytes are an ASCII case-insensitive match.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<u8, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<u8, ParseIntError>

impl FromStr for u8

fn from_str<S: AsStrSlice>(s: S) -> Result<u8, ParseIntError>

impl LenientFromStr for u8

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<u8, LenientParseError>

impl Display for u8

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for u8

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for u8

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for u8

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for u8

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for u8

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for u8

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for u8

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for u8

pub fn eq(&self, other: &Self) -> bool

impl Ord for u8

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for u8

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for u8

pub fn default() -> u8

impl TryFrom<u32> for u8

pub fn try_from(value: u32) -> Result<u8, ConvertError>

impl TryFrom<u16> for u8

pub fn try_from(value: u16) -> Result<u8, ConvertError>

impl FromLeBytes for u8

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> u8

impl Step for u8

fn next_step(&self) -> Option<u8>

u16

pub const BITS: i32

pub const MAX: u16

pub const MIN: u16

pub fn max(a: u16, b: u16) -> u16

pub fn min(a: u16, b: u16) -> u16

pub fn clamp(value: u16, low: u16, high: u16) -> u16

value confined to low..=high.

pub fn wrapping_neg(&self) -> u16

The negation modulo 2^16: 0 for 0, MAX - self + 1 otherwise.

pub fn div_ceil(&self, rhs: u16) -> u16

self / rhs rounded up. Traps where / does.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<u16, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<u16, ParseIntError>

impl FromStr for u16

fn from_str<S: AsStrSlice>(s: S) -> Result<u16, ParseIntError>

impl LenientFromStr for u16

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<u16, LenientParseError>

impl Display for u16

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for u16

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for u16

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for u16

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for u16

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for u16

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for u16

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for u16

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for u16

pub fn eq(&self, other: &Self) -> bool

impl Ord for u16

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for u16

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for u16

pub fn default() -> u16

impl From<u8> for u16

pub fn from(value: u8) -> u16

impl TryFrom<u32> for u16

pub fn try_from(value: u32) -> Result<u16, ConvertError>

impl FromLeBytes for u16

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> u16

impl Step for u16

fn next_step(&self) -> Option<u16>

u32

pub const BITS: i32

pub const MAX: u32

pub const MIN: u32

pub fn max(a: u32, b: u32) -> u32

pub fn min(a: u32, b: u32) -> u32

pub fn clamp(value: u32, low: u32, high: u32) -> u32

value confined to low..=high.

pub fn wrapping_neg(&self) -> u32

The negation modulo 2^32: 0 for 0, MAX - self + 1 otherwise.

pub fn div_ceil(&self, rhs: u32) -> u32

self / rhs rounded up. Traps where / does.

pub fn to_string(&self) -> String

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<u32, ParseIntError>

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<u32, ParseIntError>

impl FromStr for u32

fn from_str<S: AsStrSlice>(s: S) -> Result<u32, ParseIntError>

impl LenientFromStr for u32

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<u32, LenientParseError>

impl Display for u32

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for u32

pub fn inspect(&self, f: &mut Formatter)

impl LowerExp for u32

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for u32

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Binary for u32

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for u32

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for u32

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for u32

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for u32

pub fn eq(&self, other: &Self) -> bool

impl Ord for u32

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for u32

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for u32

pub fn default() -> u32

impl From<u8> for u32

pub fn from(value: u8) -> u32

impl From<u16> for u32

pub fn from(value: u16) -> u32

impl TryFrom<i32> for u32

pub fn try_from(value: i32) -> Result<u32, ConvertError>

impl TryFrom<i64> for u32

pub fn try_from(value: i64) -> Result<u32, ConvertError>

impl TryFrom<u64> for u32

pub fn try_from(value: u64) -> Result<u32, ConvertError>

impl FromLeBytes for u32

fn bits() -> i32
fn from_le_at(bytes: ByteSlice, at: i32) -> u32

impl Step for u32

fn next_step(&self) -> Option<u32>

bool

pub fn to_string(&self) -> String

impl FromStr for bool

fn from_str<S: AsStrSlice>(s: S) -> Result<bool, ParseBoolError>

impl LenientFromStr for bool

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<bool, LenientParseError>

impl Display for bool

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for bool

pub fn inspect(&self, f: &mut Formatter)

impl Eq for bool

pub fn eq(&self, other: &Self) -> bool

impl Ord for bool

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for bool

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for bool

pub fn default() -> bool

char

pub fn from_u32(value: u32) -> char

The char whose scalar value is value. char::try_from answers for a value that may not be one.

pub fn from_i32(value: i32) -> char

The char whose scalar value is value. char::try_from(value as u32) answers for a value that may not be one.

pub fn from_u32_unchecked(value: u32)

#[unavailable("write `unchecked char::from_u32(value)`")]

pub fn is_scalar_value(value: u32) -> bool

Whether value is a Unicode scalar value: in 0..=0x10FFFF and not a surrogate.

pub fn to_string(&self) -> String

pub fn is_ascii_whitespace(&self) -> bool

Returns true if the character is ASCII whitespace, as POSIX isspace() has it: SP, HT, LF, VT, FF, CR.

pub fn is_whitespace(&self) -> bool

Returns true if the character is Unicode whitespace: ASCII whitespace, U+0085 (NEXT LINE), and the Zs/Zl/Zp code points.

pub fn is_ascii_lowercase(&self) -> bool

Returns true if the character is an ASCII lowercase letter: a-z.

pub fn is_ascii_uppercase(&self) -> bool

Returns true if the character is an ASCII uppercase letter: A-Z.

pub fn to_ascii_lowercase(&self) -> char

Converts an ASCII uppercase letter to lowercase. Non-ASCII and non-uppercase characters are returned unchanged.

pub fn to_ascii_uppercase(&self) -> char

Converts an ASCII lowercase letter to uppercase. Non-ASCII and non-lowercase characters are returned unchanged.

pub fn eq_ignore_ascii_case(&self, other: &char) -> bool

Checks that two characters are an ASCII case-insensitive match.

pub fn is_ascii_digit(&self) -> bool

Returns true if the character is an ASCII digit: 0-9.

pub fn is_ascii_alphabetic(&self) -> bool

Returns true if the character is an ASCII letter: a-z or A-Z.

pub fn is_ascii_alphanumeric(&self) -> bool

Returns true if the character is an ASCII letter or digit: a-z, A-Z, 0-9.

pub fn is_hexdigit(&self) -> bool

Returns true if the character is a hexadecimal digit: 0-9, a-f, A-F.

pub fn hex_digit_value(&self) -> i32

Returns the numeric value of an ASCII hexadecimal digit (0–15).

pub fn len_utf8(&self) -> i32

Returns the number of bytes this character needs in UTF-8 encoding.

pub fn encode_utf8(&self) -> ByteList

Encodes this character as UTF-8, returning the bytes.

impl FromStr for char

fn from_str<S: AsStrSlice>(s: S) -> Result<char, ParseCharError>

impl LenientFromStr for char

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<char, LenientParseError>

impl Display for char

pub fn fmt(&self, f: &mut Formatter)

impl Inspect for char

pub fn inspect(&self, f: &mut Formatter)

impl Eq for char

pub fn eq(&self, other: &Self) -> bool

impl Ord for char

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for char

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for char

pub fn default() -> char

impl TryFrom<u32> for char

pub fn try_from(value: u32) -> Result<char, ConvertError>

impl Step for char

fn next_step(&self) -> Option<char>

v128

impl Eq for v128

pub fn eq(&self, other: &Self) -> bool

impl Inspect for v128

pub fn inspect(&self, f: &mut Formatter)

Structs

pub struct VariantCase<affine T, affine P>

A case handle minted by ReflectVariant::members(): the payload type P is static, the case index is a value. extract / construct bridge a variant value and its payload in both directions. See WEP 2026-06-13 §3e.

Fields are private.

pub fn discriminant(&self) -> i32

The case's tag.

pub fn is_unit(&self) -> bool

Whether the case carries no payload.

pub fn holds(&self, v: &T) -> bool

Whether v's live case is this case.

pub fn construct(&self, payload: P) -> T

Builds this case around payload.

pub fn make(&self) -> T

Builds this case with no payload. Traps unless is_unit().

pub fn extract_ref(&self, v: &T) -> &P

The payload of this case in v, by reference, so an affine payload is not copied. Traps unless holds(v).

pub fn extract(&self, v: &T) -> P

The payload of this case in v. Traps unless holds(v).

impl Member for VariantCase<T, P>

fn name(&self) -> String
fn wire_name_override(&self) -> Option<String>

impl Inspect for VariantCase<T, P>

fn inspect(&self, f: &mut Formatter)

pub struct EnumCase<T>

A case handle minted by ReflectEnum::members(): an enum case carries no payload, so the member holds the case value itself. make mints it and holds tests a value's live case. See WEP 2026-06-13 §3b.

Fields are private.

pub fn discriminant(&self) -> i32

The case's discriminant.

pub fn holds(&self, v: &T) -> bool

Whether v is this case.

pub fn make(&self) -> T

The enum value for this case.

impl Member for EnumCase<T>

fn name(&self) -> String
fn wire_name_override(&self) -> Option<String>

impl Inspect for EnumCase<T>

fn inspect(&self, f: &mut Formatter)

pub struct FlagsBit<T>

A bit handle minted by ReflectFlags::members(): the member holds the single-bit flags value. set mints it and is_set tests a value for the bit. See WEP 2026-06-13 §3c.

Fields are private.

pub fn bit(&self) -> u64

The member's bitmask, u64-normalized.

pub fn is_set(&self, v: &T) -> bool

Whether v has this bit set.

pub fn set(&self) -> T

The flags value with only this bit set.

impl Member for FlagsBit<T>

fn name(&self) -> String
fn wire_name_override(&self) -> Option<String>

impl Inspect for FlagsBit<T>

fn inspect(&self, f: &mut Formatter)

pub struct TemplateHole<T, affine V>

A hole handle minted by ReflectTemplate::members(): the hole's position and specifier are constants of the shape, and lit / raw / get / get_ref / fmt reach what a template value holds. See WEP 2026-01-10.

Fields are private.

pub fn index(&self) -> i32

The hole's position in the template.

pub fn lit(&self, t: &T) -> StrSlice

The literal text in t between the previous hole (or the start) and this one, escapes processed.

pub fn raw(&self, t: &T) -> StrSlice

lit(t) with escapes preserved: \n is a backslash and an n.

pub fn has_spec(&self) -> bool

Whether the hole wrote a :spec.

pub fn spec(&self) -> Option<String>

The specifier as written after the :, or None without one.

pub fn get_ref(&self, t: &T) -> &V

A reference to the hole's value in t, which copies nothing, so it reaches a hole of an affine type as well.

pub fn fmt(&self, t: &T, f: &mut Formatter)

Renders the value through the trait method the specifier's type selects (Display::fmt when it names none), on a Formatter carrying the specifier's settings over f's buffer.

pub fn get(&self, t: &T) -> V

The hole's value in t.

impl Inspect for TemplateHole<T, V>

fn inspect(&self, f: &mut Formatter)

pub struct StructField<affine T, affine F>

A field handle minted by ReflectStruct::members(): the field type F is static, and get reads the field's value out of a struct. See WEP 2026-06-13.

Fields are private.

pub fn index(&self) -> i32

The field's declaration index.

pub fn has_default(&self) -> bool

Whether the field declares a default value.

pub fn is_secret(&self) -> bool

Whether the field is marked #[secret].

pub fn get_ref(&self, v: &T) -> &F

This field in v, by reference.

pub fn get(&self, v: &T) -> F

The value of this field in v.

impl Member for StructField<T, F>

fn name(&self) -> String
fn wire_name_override(&self) -> Option<String>

impl Inspect for StructField<T, F>

fn inspect(&self, f: &mut Formatter)

pub struct IterMap<affine I: Iterator, F>

Generic map iterator adapter that wraps any Iterator. Its type carries the function's, so advancing it performs what the function does.

inner: I

f: F

impl Iterator for IterMap<I, F>

fn next(&mut self) -> Option<Self::Item> with E

impl IntoIterator for IterMap<I, F>

fn into_iter(&self) -> IterMap<I, F>

pub struct IterFilter<affine I: Iterator, F>

Generic filter iterator adapter that wraps any Iterator. Its type carries the predicate's, so advancing it performs what the predicate does.

inner: I

pred: F

impl Iterator for IterFilter<I, F>

fn next(&mut self) -> Option<Self::Item> with E

impl IntoIterator for IterFilter<I, F>

fn into_iter(&self) -> IterFilter<I, F>

pub struct IterEnumerate<affine I: Iterator>

Generic enumerate iterator adapter that yields (index, element) pairs.

inner: I

count: i32

impl Iterator for IterEnumerate<I>

fn next(&mut self) -> Option<Self::Item> with _

pub struct IterTake<affine I: Iterator>

Generic take iterator adapter that limits elements from any Iterator.

inner: I

remaining: i32

impl Iterator for IterTake<I>

fn next(&mut self) -> Option<Self::Item> with _

pub struct IterSkip<affine I: Iterator>

Generic skip iterator adapter that skips elements from any Iterator.

inner: I

remaining: i32

impl Iterator for IterSkip<I>

fn next(&mut self) -> Option<Self::Item> with _

pub struct IterStepBy<affine I: Iterator>

Generic step iterator adapter that yields every gap + 1-th element of any Iterator.

inner: I

gap: i32

started: bool

impl Iterator for IterStepBy<I>

fn next(&mut self) -> Option<Self::Item> with _

pub struct IterChain<affine I: Iterator, affine J: Iterator>

Generic chain iterator adapter that chains two iterators of the same item type.

first: I

second: J

first_done: bool

impl Iterator for IterChain<I, J>

fn next(&mut self) -> Option<Self::Item> with _

pub struct IterZip<affine I: Iterator, affine J: Iterator>

Generic zip iterator adapter that pairs elements from two iterators.

first: I

second: J

impl Iterator for IterZip<I, J>

fn next(&mut self) -> Option<Self::Item> with _

pub struct ConvertError

Error type returned by fallible conversions.

message: String

pub fn new(message: String) -> ConvertError

impl Display for ConvertError

fn fmt(&self, f: &mut Formatter)

pub struct LenientParseError

Error returned by the lenient string parsers (LenientFromStr). All built-in impls share this single type, carrying a short human-readable reason. See docs/wep-2026-06-22-lenient-from-str.md.

Fields are private.

pub fn new(reason: String) -> LenientParseError

pub fn reason(&self) -> String

A short description of why parsing failed.

impl Display for LenientParseError

fn fmt(&self, f: &mut Formatter)

pub struct Formatter

Formatter that writes directly into a referenced output buffer. The Formatter does not own its buffer; it writes into the caller's &mut String. This avoids intermediate allocations.

Format specification fields match Rust's format syntax: [[fill]align][sign][#][0][width][.precision]type

Unset width and precision use the sentinels on impl Formatter.

fill: char

Fill character for padding (default: ' ')

align: Alignment

Text alignment mode

sign_plus: bool

Whether to always show + sign for positive numbers

alternate: bool

Whether the spec asked for the alternate form (# flag): a radix prefix, or the indented multi-line Inspect.

zero_pad: bool

Whether to use zero-padding (0 flag)

width: i32

Minimum field width in characters; NO_WIDTH for none

precision: i32

Decimal places for floats; max rendered length for sequences (chars / elements). Negative values are the sentinels below.

indent: i32

Current indentation level for the alternate (#) Inspect

buf: &mut String

Reference to the output buffer

pub const NO_WIDTH: i32

No width given: every padding path is a no-op.

pub const PRECISION_DEFAULT: i32

No precision given: sequence Inspect uses DEFAULT_SEQ_LIMIT, others ignore.

pub const PRECISION_INFINITE: i32

Render uncapped: sequence Inspect skips truncation.

pub const DEFAULT_SEQ_LIMIT: i32

Default sequence Inspect cap: chars for String, elements for List.

pub fn resolved_seq_limit(&self) -> i32

The element/char cap a sequence Inspect should apply: the explicit precision when given, else DEFAULT_SEQ_LIMIT. A negative result (PRECISION_INFINITE) means uncapped.

pub fn new(buf: &mut String) -> Formatter

#[compiler_item("formatter_new")]

Create a Formatter with the default spec, writing into the given buffer.

pub fn write_str<S: AsStrSlice>(&mut self, s: S)

#[compiler_item("formatter_write_str")]

Write any AsStrSlice text to the output buffer.

pub fn write_display<T: Display>(&mut self, value: &T)

Write a Display value with the default spec, as write_str writes text as it stands: the spec belongs to the value, not to its parts.

pub fn write_char(&mut self, c: char)

Write a single character to the output buffer.

pub fn write_char_n(&mut self, c: char, n: i32)

Write n copies of a character to the output buffer.

pub fn pad<S: AsStrSlice>(&mut self, content: S)

Pad a pre-formatted content string to the configured width. If no width is set or content is already as wide, writes content as-is. Width counts characters, so a multi-byte content pads by what it renders.

pub fn mark(&self) -> i32

Return the current byte position in the output buffer. Used with apply_padding for the speculative-write pattern:

  1. Call mark() to record the start position
  2. Write content directly to buf_mut()
  3. Call apply_padding(mark) to insert padding if needed

pub fn apply_padding(&mut self, start_pos: i32)

Apply width/alignment padding to content already written at start_pos. Content bytes in buf[start_pos..] are shifted in-place if padding is needed.

pub fn write_from_memory(&mut self, ptr: i32, len: i32)

Write raw bytes from linear memory, applying width/alignment padding. Used only for values produced by bundled Wasm functions (e.g., f64_to_buffer).

pub fn prepare_int_write<S: AsStrSlice>(&mut self, is_negative: bool, alt_prefix: S, digit_count: i32) -> i32

Prepare the output buffer for integer digits.

Writes sign, prefix, and any padding/fill, then reserves digit_count uninitialised bytes and returns their byte-offset inside buf. The caller must fill exactly digit_count bytes (backwards) via buf.internal_raw_bytes() at the returned offset. alt_prefix is the radix marker (0x, 0b, 0o) the alternate form asks for; a plain spec drops it without the caller having to hand over an empty string, which would leave a value copy behind.

pub fn write_indent(&mut self)

Write indentation (2 spaces per level) for pretty-printing.

pub fn write_newline_indent(&mut self)

Write a newline followed by indentation for pretty-printing.

pub fn open_brace<S: AsStrSlice>(&mut self, open: S)

Open a pretty-printed brace: write opening delimiter, increase indent.

pub fn close_brace<S: AsStrSlice>(&mut self, close: S)

Close a pretty-printed brace: decrease indent, write newline+indent, write closing delimiter.

pub struct u128

Unsigned 128-bit integer Stored as two 64-bit parts: low (bits 0-63) and high (bits 64-127)

Fields are private.

pub const BITS: i32

pub const MAX: u128

pub const MIN: u128

pub fn from_u64(value: u64) -> u128

#[compiler_item("u128_from_u64")]

Create a u128 from a u64 value (zero-extended)

pub fn from_i64(value: i64) -> u128

#[compiler_item("u128_from_i64")]

Create a u128 from an i64 value (sign-extended, as value as u128 is)

pub fn from_f64(value: f64) -> u128

#[compiler_item("u128_from_f64")]

value truncated toward zero and saturated at u128's bounds, NaN as 0: what value as u128 is.

pub fn from_pair(low: u64, high: u64) -> u128

#[compiler_item("u128_from_pair")]

Create a u128 from low and high 64-bit parts Used by the compiler for efficient large literal construction

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<u128, ParseIntError>

Parse a hexadecimal u128 from a string (equivalent to from_str_radix(s, 16)).

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<u128, ParseIntError>

Parse a u128 from a string in the given radix.

pub fn from_str_radix_slice(s: &StrSlice, radix: u32) -> Result<u128, ParseIntError>

Parse the view as a u128 in the given radix, allocating no substring.

pub fn zero() -> u128

Creates a zero u128

pub fn one() -> u128

Creates a u128 with value 1

pub fn max(a: u128, b: u128) -> u128

The larger of two values.

pub fn min(a: u128, b: u128) -> u128

The smaller of two values.

pub fn clamp(value: u128, low: u128, high: u128) -> u128

value confined to low..=high.

pub fn wrapping_neg(&self) -> u128

The negation modulo 2^128: 0 for 0, MAX - self + 1 otherwise.

pub fn div_ceil(&self, rhs: u128) -> u128

self / rhs rounded up. Traps where / does.

pub fn low(&self) -> u64

#[compiler_item("u128_low")]

Gets the low 64 bits Used by the compiler to lower truncating u128 as <int> casts.

pub fn high(&self) -> u64

Gets the high 64 bits

pub fn from_i128(val: i128) -> u128

#[compiler_item("u128_from_i128")]

Create a u128 from an i128 (reinterpret bits) Used by the compiler to lower i128 as u128 casts.

pub fn as_f64(&self) -> f64

#[compiler_item("u128_as_f64")]

Convert to f64, rounding to the nearest representable value with ties to even — the same semantics as Rust's value as f64 cast. Used by the compiler to lower u128 as f64 casts.

pub fn as_f32(&self) -> f32

#[compiler_item("u128_as_f32")]

Convert to f32, rounding to the nearest representable value with ties to even; values above f32::MAX become infinity — the same semantics as Rust's value as f32 cast. Used by the compiler to lower u128 as f32 casts.

pub fn div_rem(&self, divisor: &u128) -> [u128, u128]

Divide self by divisor, returning (quotient, remainder). One native division when both fit in 64 bits, otherwise Algorithm D over limbs.

pub fn to_string(&self) -> String

Convert u128 to String (for template string interpolation)

impl FromStr for u128

fn from_str<S: AsStrSlice>(s: S) -> Result<u128, ParseIntError>

impl LenientFromStr for u128

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<u128, LenientParseError>

impl Display for u128

pub fn fmt(&self, f: &mut Formatter)

impl LowerExp for u128

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for u128

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Inspect for u128

pub fn inspect(&self, f: &mut Formatter)

impl Binary for u128

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for u128

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for u128

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for u128

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for u128

pub fn eq(&self, other: &Self) -> bool

impl Ord for u128

pub fn cmp(&self, other: &Self) -> Ordering

impl Add for u128

pub fn add(&self, other: &Self) -> Self::Output

impl Sub for u128

pub fn sub(&self, other: &Self) -> Self::Output

impl Mul for u128

pub fn mul(&self, other: &Self) -> Self::Output

impl BitAnd for u128

pub fn bitand(&self, other: &Self) -> Self::Output

impl BitOr for u128

pub fn bitor(&self, other: &Self) -> Self::Output

impl BitXor for u128

pub fn bitxor(&self, other: &Self) -> Self::Output

impl BitNot for u128

pub fn bitnot(&self) -> Self::Output

impl Shl for u128

pub fn shl(&self, rhs: &u128) -> Self::Output

impl Shr for u128

pub fn shr(&self, rhs: &u128) -> Self::Output

impl Div for u128

pub fn div(&self, other: &Self) -> Self::Output

impl Rem for u128

pub fn rem(&self, other: &Self) -> Self::Output

impl Default for u128

pub fn default() -> u128

impl From<u8> for u128

pub fn from(value: u8) -> u128

impl From<u16> for u128

pub fn from(value: u16) -> u128

impl From<u32> for u128

pub fn from(value: u32) -> u128

impl From<u64> for u128

pub fn from(value: u64) -> u128

impl TryFrom<i128> for u128

pub fn try_from(value: i128) -> Result<u128, ConvertError>

impl Step for u128

fn next_step(&self) -> Option<u128>

pub struct i128

Signed 128-bit integer Stored as two 64-bit parts: low (bits 0-63, unsigned) and high (bits 64-127, signed)

Fields are private.

pub const BITS: i32

pub const MAX: i128

pub const MIN: i128

pub fn from_i64(value: i64) -> i128

#[compiler_item("i128_from_i64")]

Create an i128 from an i64 value (sign-extended)

pub fn from_u64(value: u64) -> i128

#[compiler_item("i128_from_u64")]

Create an i128 from a u64 value (zero-extended)

pub fn from_f64(value: f64) -> i128

#[compiler_item("i128_from_f64")]

value truncated toward zero and saturated at i128's bounds, NaN as 0: what value as i128 is.

pub fn from_pair(low: u64, high: i64) -> i128

#[compiler_item("i128_from_pair")]

Create an i128 from low and high 64-bit parts Used by the compiler for efficient large literal construction

pub fn from_str_hex<S: AsStrSlice>(s: S) -> Result<i128, ParseIntError>

Parse a hexadecimal i128 from a string (equivalent to from_str_radix(s, 16)).

pub fn from_str_radix<S: AsStrSlice>(s: S, radix: u32) -> Result<i128, ParseIntError>

Parse an i128 from a string in the given radix.

pub fn from_str_radix_slice(s: &StrSlice, radix: u32) -> Result<i128, ParseIntError>

Parse the view as an i128 in the given radix, allocating no substring.

pub fn zero() -> i128

Creates a zero i128

pub fn one() -> i128

Creates an i128 with value 1

pub fn max(a: i128, b: i128) -> i128

The larger of two values.

pub fn min(a: i128, b: i128) -> i128

The smaller of two values.

pub fn clamp(value: i128, low: i128, high: i128) -> i128

value confined to low..=high.

pub fn abs(x: i128) -> i128

The magnitude of x. MIN has none in i128 and wraps to itself, as negating it does.

pub fn div_floor(&self, rhs: i128) -> i128

self / rhs rounded toward negative infinity. Traps where / does.

pub fn div_ceil(&self, rhs: i128) -> i128

self / rhs rounded toward positive infinity. Traps where / does.

pub fn low(&self) -> u64

#[compiler_item("i128_low")]

Gets the low 64 bits (unsigned) Used by the compiler to lower truncating i128 as <int> casts.

pub fn high(&self) -> i64

Gets the high 64 bits (signed)

pub fn is_negative(&self) -> bool

Checks if this i128 is negative

pub fn abs_u128(&self) -> u128

Get absolute value as u128

pub fn from_u128(val: u128) -> i128

#[compiler_item("i128_from_u128")]

Create i128 from u128 (reinterpret bits) Used by the compiler to lower u128 as i128 casts.

pub fn as_f64(&self) -> f64

#[compiler_item("i128_as_f64")]

Convert to f64, rounding to the nearest representable value with ties to even — the same semantics as Rust's value as f64 cast. Used by the compiler to lower i128 as f64 casts.

pub fn as_f32(&self) -> f32

#[compiler_item("i128_as_f32")]

Convert to f32, rounding to the nearest representable value with ties to even — the same semantics as Rust's value as f32 cast. Used by the compiler to lower i128 as f32 casts.

pub fn div_rem(&self, divisor: &i128) -> [i128, i128]

Divide self by divisor, returning (quotient, remainder) Uses signed division semantics:

pub fn to_string(&self) -> String

Convert i128 to String (for template string interpolation)

impl FromStr for i128

fn from_str<S: AsStrSlice>(s: S) -> Result<i128, ParseIntError>

impl LenientFromStr for i128

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<i128, LenientParseError>

impl Display for i128

pub fn fmt(&self, f: &mut Formatter)

impl LowerExp for i128

pub fn fmt_lower_exp(&self, f: &mut Formatter)

impl UpperExp for i128

pub fn fmt_upper_exp(&self, f: &mut Formatter)

impl Inspect for i128

pub fn inspect(&self, f: &mut Formatter)

impl Binary for i128

pub fn fmt_binary(&self, f: &mut Formatter)

impl Octal for i128

pub fn fmt_octal(&self, f: &mut Formatter)

impl LowerHex for i128

pub fn fmt_lower_hex(&self, f: &mut Formatter)

impl UpperHex for i128

pub fn fmt_upper_hex(&self, f: &mut Formatter)

impl Eq for i128

pub fn eq(&self, other: &Self) -> bool

impl Ord for i128

pub fn cmp(&self, other: &Self) -> Ordering

impl Add for i128

pub fn add(&self, other: &Self) -> Self::Output

impl Sub for i128

pub fn sub(&self, other: &Self) -> Self::Output

impl Mul for i128

pub fn mul(&self, other: &Self) -> Self::Output

impl Neg for i128

pub fn neg(&self) -> Self::Output

impl BitAnd for i128

pub fn bitand(&self, other: &Self) -> Self::Output

impl BitOr for i128

pub fn bitor(&self, other: &Self) -> Self::Output

impl BitXor for i128

pub fn bitxor(&self, other: &Self) -> Self::Output

impl BitNot for i128

pub fn bitnot(&self) -> Self::Output

impl Shl for i128

pub fn shl(&self, rhs: &i128) -> Self::Output

impl Shr for i128

pub fn shr(&self, rhs: &i128) -> Self::Output

impl Div for i128

pub fn div(&self, other: &Self) -> Self::Output

impl Rem for i128

pub fn rem(&self, other: &Self) -> Self::Output

Not through div_rem: MIN % -1 is 0, though MIN / -1 overflows.

impl Default for i128

pub fn default() -> i128

impl From<i8> for i128

pub fn from(value: i8) -> i128

impl From<i16> for i128

pub fn from(value: i16) -> i128

impl From<i32> for i128

pub fn from(value: i32) -> i128

impl From<i64> for i128

pub fn from(value: i64) -> i128

impl TryFrom<u128> for i128

pub fn try_from(value: u128) -> Result<i128, ConvertError>

impl Step for i128

fn next_step(&self) -> Option<i128>

pub struct ResourceId

The identity of a live affine resource, which owns nothing. A dropped resource's identity may come back for a later one, since the host reuses a freed handle index. Nothing converts it back into a resource.

Fields are private.

pub fn of<affine R: AffineResource>(r: &R) -> ResourceId

The identity of r. A static function rather than a method, so it takes no name from any resource.

pub affine struct FutureReadCopy<affine T>

A read started on a future end, holding the end until it is finished. Dropping one in flight cancels it, and drops a value it had read.

Fields are private.

pub fn finish(self) -> Option<T>

The value, or None where the writer dropped without writing. Waits for a read that has not settled, so a read never inserted into a set finishes as well. The end drops, as a read consumes it.

impl Drop for FutureReadCopy<T>

fn drop(self)

impl Waitable for FutureReadCopy<T>

fn wait_on(&self) -> WaitOn

pub struct StreamChunk<affine T>

What one read copy moved, and how that copy ended. A copy carries elements and the peer's drop together, so result is what says more follows.

items: List<T>

result: CopyResult

pub struct StreamWrite<affine T>

What one write copy did not deliver, and how it ended. A reader may take a prefix, and the elements it left come back in rest.

rest: List<T>

result: CopyResult

pub struct FutureWrite<affine T>

What FutureWritable::write did not deliver, and how its copy ended: the value comes back in rest where the reader dropped first.

rest: Option<T>

result: FutureWriteResult

pub struct ReadInto

Where a host copy started by Stream::begin_read lands: memory the copy allocates for itself, or memory core:* lends it, which the host writes into directly. Only core:* lends, so no raw address is ever handed out.

A handler holds the value it is handed, and may forward it to another read. So lent memory says how much of it there is, and whether the lender still lends it: a read asking for more is held to the room, and one after the lend ended traps rather than writing what someone else now owns.

Fields are private.

pub fn fresh() -> ReadInto

Memory the copy allocates for itself, and frees once it has settled.

pub affine struct StartedRead<affine T>

A read copy as Stream::begin_read started it: one the host may still be copying into buffer, or one a handler settled with its items.

Fields are private.

pub fn settled(chunk: StreamChunk<T>) -> StartedRead<T>

A copy that already moved chunk, for a handler to answer Stream::begin_read with.

pub affine struct ReadCopy<affine T>

One copy started on a stream end, holding the end until it is finished. Dropping one in flight cancels it, and drops what it had copied.

Fields are private.

pub fn finish(self) -> [Stream<T>, StreamChunk<T>]

The end and what the copy moved. Waits for a copy that has not settled, so a copy never inserted into a set finishes as well.

impl Drop for ReadCopy<T>

fn drop(self)

impl Waitable for ReadCopy<T>

fn wait_on(&self) -> WaitOn

pub affine struct StartedWrite<affine T>

A write copy as StreamWritable::begin_write started it: one the host may still be copying out of buffer, which holds data lowered, or one a handler settled.

Fields are private.

pub fn settled(written: StreamWrite<T>) -> StartedWrite<T>

A copy that already ended as written says, for a handler to answer StreamWritable::begin_write with.

impl Drop for StartedWrite<T>

fn drop(self)

What the copy did not deliver is still the writer's, so it drops here.

pub affine struct WriteCopy<affine T>

One copy started on a writable end, holding the end until it is finished. Dropping one in flight cancels it.

Fields are private.

pub fn finish(self) -> [StreamWritable<T>, StreamWrite<T>]

The end and what the copy left of its data. Waits for a copy that has not settled, so a copy never inserted into a set finishes as well.

impl Drop for WriteCopy<T>

fn drop(self)

impl Waitable for WriteCopy<T>

fn wait_on(&self) -> WaitOn

pub affine struct WaitableSet<affine W: Waitable>

A set of values the host reports events for, owning each while it waits. A wait moves the member that is ready back out. Dropping the set drops the members it still holds.

A set has one member type. A loop waiting on several kinds declares a variant of its own and derives Waitable on it with impl Waitable for V;.

Fields are private.

pub fn new() -> WaitableSet<W>

pub fn insert(&mut self, member: W)

Moves member into the set. A member is in one set at a time, so whether the host has an event left for it is settled here.

pub fn wait(&mut self) -> Ready<W>

Blocks until a member is ready, and moves it out: a copy once it settled, a call once it resolved. A member ready without the host comes first. Traps on an empty set.

pub fn poll(&mut self) -> Option<Ready<W>>

The member that is ready, as wait means it, moved out, or None where none is yet.

pub fn drain(&mut self) -> List<W>

Moves every member out, the ready ones first, leaving the set empty. A race keeps its losers this way, where dropping the set would drop them.

pub fn len(&self) -> i32

pub fn is_empty(&self) -> bool

impl Drop for WaitableSet<W>

fn drop(self)

Drops the members first, each leaving the host's set as it drops: the host traps on dropping a set that still has one.

pub struct Ready<affine W>

A member of a WaitableSet that is ready, moved out of the set with the event.

member: W

event: ReadyEvent

pub affine struct AsyncCall<affine T>

A handle to an in-flight CM async import call, parameterised by the result type T. Returned by the synthesised adapter for a WIT async func import.

AsyncCall<T> holds the CM subtask with the linear-memory buffer into which the host writes the async result. wait blocks until the call returns and takes the lifted result; cancel aborts the in-flight call. Either one consumes the call, and dropping a call cancels it.

The subtask begins running the moment the adapter returns, so writes to stream parameters (e.g. a request body) made after the adapter call and before wait / cancel are rendezvoused with the host subtask.

Example (HTTP POST body):

let [body_rx, body_tx] = Stream::<u8>::new();
let [req, _tx_future] = Request::new(headers, Option::Some(body_rx), ...);
let task = Client::send(req);       // host subtask starts
body_tx.write_all(body_bytes);      // rendezvous with host read
body_tx.drop();
let resp = task.wait();             // block for response

The synthesized adapter builds one with a literal, which reaches the private fields, so user code can neither peek nor forge one.

Fields are private.

pub fn wait(self) -> T with Subtask

Wait for the subtask to complete and return the lifted result.

pub fn cancel(self) with Subtask

Cancel the in-flight subtask. A result it returned before the cancel is lifted and dropped, since it may own handles.

impl Drop for AsyncCall<T>

fn drop(self)

Cancels a call nobody waited on, and drops a result the callee returned, which owns handles only a lift reaches.

impl Waitable for AsyncCall<T>

fn wait_on(&self) -> WaitOn

pub struct ParseIntError

Error returned by integer parsing.

kind: IntErrorKind

pub fn new(kind: IntErrorKind) -> ParseIntError

pub fn kind(&self) -> IntErrorKind

impl Display for ParseIntError

fn fmt(&self, f: &mut Formatter)

pub struct ParseFloatError

Error returned by float parsing.

kind: FloatErrorKind

pub fn new(kind: FloatErrorKind) -> ParseFloatError

pub fn kind(&self) -> FloatErrorKind

impl Display for ParseFloatError

fn fmt(&self, f: &mut Formatter)

pub struct ParseBoolError {}

Error returned by bool::from_str, which takes true and false alone.

impl Display for ParseBoolError

fn fmt(&self, f: &mut Formatter)

pub struct ParseCharError

Error returned by char parsing.

kind: CharErrorKind

pub fn new(kind: CharErrorKind) -> ParseCharError

pub fn kind(&self) -> CharErrorKind

impl Display for ParseCharError

fn fmt(&self, f: &mut Formatter)

pub struct Slice<T>

A contiguous view into a backing Array<T> over the half-open range [start, end). Holds a reference to the whole array, so creating a slice never copies elements.

A slice of a List is bound by the contract on List: once the list shrinks, the slice must not read past the list's new length.

Fields are private.

pub fn len(&self) -> i32

#[compiler_item("byte_slice_len")]

Also the byte-length anchor for the synthesised FieldSchema::lookup (on Slice<u8>), routed through #[compiler_item] so a rename here cannot silently break code generation.

pub fn slice(&self, start: i32, end: i32) -> Slice<T>

Sub-slice over [start, end) relative to this one, clamped to its bounds.

pub fn iter_value(&self) -> SliceValueIter<T>

pub fn iter_ref(&self) -> SliceRefIter<T>

pub fn windows(&self, size: i32) -> SliceWindows<T>

Overlapping windows of size consecutive elements.

pub fn chunks(&self, size: i32) -> SliceChunks<T>

Non-overlapping chunks of up to size elements; the last may be shorter.

pub fn to_array(&self) -> Array<T>

pub fn to_list(&self) -> List<T>

pub fn contains(&self, value: &T) -> bool

impl Sequence for Slice<T>

fn len(&self) -> i32
fn at(&self, index: i32) -> T

impl AsSlice for Slice<T>

fn as_slice(&self) -> Slice<T>

impl IndexValue<i32> for Slice<T>

fn index_value(&self, index: i32) -> Self::Output

#[compiler_item("byte_slice_index_value")]

Also the byte-read anchor for the synthesised FieldSchema::lookup (on Slice<u8>), as len is for byte length.

impl IndexRef<i32> for Slice<T>

fn index_ref(&self, index: i32) -> &T

impl IndexValue<RangeExclusive<i32>> for Slice<T>

fn index_value(&self, range: RangeExclusive<i32>) -> Slice<T>

impl IndexValue<RangeInclusive<i32>> for Slice<T>

fn index_value(&self, range: RangeInclusive<i32>) -> Slice<T>

impl Eq for Slice<T>

pub fn eq(&self, other: &Self) -> bool

impl Ord for Slice<T>

pub fn cmp(&self, other: &Self) -> Ordering

impl Inspect for Slice<T>

pub fn inspect(&self, f: &mut Formatter)

impl Display for Slice<T>

pub fn fmt(&self, f: &mut Formatter)

impl IntoIterator for Slice<T>

fn into_iter(&self) -> Self::Iter

pub struct SliceValueIter<T>

A by-value forward iterator over a backing Array<T> range [index, end).

Fields are private.

pub fn collect(&mut self) -> List<T>

One bulk copy of the remaining range, not an element-at-a-time loop.

impl Iterator for SliceValueIter<T>

fn next(&mut self) -> Option<Self::Item>

pub struct SliceRefIter<affine T>

A by-reference forward iterator over a backing Array<T> range. Each &T points to a fresh copy of the element — Wasm GC has no interior references — so it reads but never writes the backing array. Backs for x of &list.

Fields are private.

pub fn iter_value(&self) -> SliceValueIter<T>

The same remaining range yielded by value. Named for the axis rather than Rust's copied(): every element read in Wado is a copy already.

impl Iterator for SliceRefIter<T>

fn next(&mut self) -> Option<Self::Item>

pub struct SliceRefMutIter<T>

Fields are private.

impl Iterator for SliceRefMutIter<T>

fn next(&mut self) -> Option<Self::Item>

pub struct SliceWindows<T>

Each item is a Slice<T> viewing the backing array, not a copy of it.

Fields are private.

impl Iterator for SliceWindows<T>

fn next(&mut self) -> Option<Self::Item>

pub struct SliceChunks<T>

Each item is a Slice<T> viewing the backing array, not a copy of it.

Fields are private.

impl Iterator for SliceChunks<T>

fn next(&mut self) -> Option<Self::Item>

pub struct Utf8Error

Why a byte sequence is not valid UTF-8: where the valid part ends, and whether what follows is malformed or merely cut short.

Fields are private.

pub fn invalid(valid_up_to: i32, len: i32) -> Utf8Error

A sequence no further byte could complete, len bytes long.

pub fn incomplete(valid_up_to: i32) -> Utf8Error

A sequence the input ends in the middle of.

pub fn valid_up_to(&self) -> i32

Byte offset at which the first invalid sequence begins.

pub fn error_len(&self) -> Option<i32>

Length of the invalid sequence, or None when the input just ends short and more bytes could still complete it.

pub fn rebased(&self, base: i32) -> Utf8Error

The same failure, with its offset read from base instead of from the start of the decoded buffer. A caller decoding a stream in pieces owes this, or it reports a position into a buffer its own caller never saw.

impl Display for Utf8Error

fn fmt(&self, f: &mut Formatter)

pub struct String

A UTF-8 encoded, growable string.

Fields are private.

pub fn new() -> String

Create a new empty string.

pub fn format<T: ReflectTemplate<Holes = [..V]>, affine ..V>(t: T) -> String

#[compiler_item("string_format")]

The tag an untagged template is sugar for: every hole rendered through its specifier into one buffer. `x=${x}` is String::format`x=${x}`. See WEP 2026-01-10.

pub fn with_capacity(capacity: i32) -> String

Create an empty string with space for capacity bytes.

pub fn len(&self) -> i32

#[compiler_item("string_len")]

Get the length of the string in bytes

pub fn is_empty(&self) -> bool

Check if the string is empty

pub fn byte_at(&self, index: i32) -> u8

The byte at index.

pub fn as_bytes(&self) -> ByteSlice

Read-only view of the string's UTF-8 bytes as an Slice<u8> over [0, len()).

pub fn grow(&mut self, min_capacity: i32)

Ensure capacity for at least min_capacity bytes.

pub fn append_byte_filled(&mut self, byte: u8, n: i32)

Append n copies of byte to this string.

pub fn push_str<S: AsStrSlice>(&mut self, other: S)

#[compiler_item("string_push_str")]

Append any AsStrSlice text to this one.

pub fn push_bytes<S: AsByteSlice>(&mut self, bytes: &S)

Append the bytes of any AsByteSlice source (ByteList, ByteArray, ByteSlice, or a String), which must be valid UTF-8 on their own.

A marked call that breaks the contract leaves the string invalid, and the behavior is unconstrained.

pub fn bytes(&self) -> StrUtf8ByteIter

Returns an iterator over the UTF-8 bytes of the string.

pub fn chars(&self) -> StrCharIter

Returns an iterator over the Unicode scalar values (chars) of the string.

pub fn char_indices(&self) -> StrCharIndicesIter

Returns an iterator over characters with their byte indices.

pub fn to_chars(&self) -> List<char>

Decode the whole string into a List<char>.

pub fn char_at_byte(&self, byte_index: i32) -> char

The character starting at byte_index.

pub fn push(&mut self, c: char)

#[compiler_item("string_push_char")]

Appends a Unicode scalar value (char) to this string.

pub fn push_ascii(&mut self, byte: u8)

Appends an ASCII byte, a complete one-byte UTF-8 sequence.

pub fn truncate(&mut self, byte_len: i32)

Truncates the string to the given byte length. Round a byte budget with floor_char_boundary first.

pub fn truncate_chars(&mut self, char_count: i32)

Truncate the string to the given number of characters. If char_count >= number of characters, the string is unchanged.

pub fn is_char_boundary(&self, byte_index: i32) -> bool

Returns true if byte_index is 0, self.len(), or the start of a UTF-8 character in this string.

pub fn floor_char_boundary(&self, byte_index: i32) -> i32

The largest character boundary <= byte_index, or len() beyond it: cuts to a byte budget with truncate or substr_bytes.

pub fn ceil_char_boundary(&self, byte_index: i32) -> i32

The smallest character boundary >= byte_index, or len() beyond it.

pub fn pop(&mut self) -> Option<char>

Removes and returns the last character, or None if empty.

pub fn clear(&mut self)

Removes all contents, making the string empty.

pub fn capacity(&self) -> i32

Returns the total capacity in bytes.

pub fn reserve(&mut self, additional: i32)

Reserves capacity for at least additional more bytes.

pub fn shrink_to_fit(&mut self)

Shrinks the capacity to match the current byte length.

pub fn to_ascii_lowercase(&self) -> String

Returns a new string with all ASCII uppercase letters converted to lowercase. Non-ASCII bytes are left unchanged.

pub fn to_ascii_uppercase(&self) -> String

Returns a new string with all ASCII lowercase letters converted to uppercase. Non-ASCII bytes are left unchanged.

pub fn eq_ignore_ascii_case<S: AsStrSlice>(&self, other: S) -> bool

Checks that two strings are an ASCII case-insensitive match. Non-ASCII bytes are compared exactly.

pub fn substr_bytes(&self, start: i32, end: i32) -> String

Extract a substring by byte range [start, end). Round a byte budget with floor_char_boundary first.

pub fn contains<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if this string contains the given substring.

pub fn starts_with<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if this string starts with the given prefix.

pub fn ends_with<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if this string ends with the given suffix.

pub fn find<S: AsStrSlice>(&self, pat: S) -> Option<i32>

Returns the byte index of the first occurrence of pat, or None.

pub fn rfind<S: AsStrSlice>(&self, pat: S) -> Option<i32>

Returns the byte index of the last occurrence of pat, or None.

pub fn contains_char(&self, ch: char) -> bool

Returns true if the string contains the given character.

pub fn find_char(&self, pred: fn mut(char) -> bool with _) -> Option<i32> with _

Returns the byte index of the first character matching the predicate, or None.

pub fn insert(&mut self, byte_index: i32, ch: char)

Inserts a character at the given byte index.

pub fn insert_str<S: AsStrSlice>(&mut self, byte_index: i32, s: S)

Inserts a string at the given byte index.

pub fn remove(&mut self, byte_index: i32) -> char

Removes and returns the character at the given byte index.

pub fn repeat(&self, n: i32) -> String

Returns this string repeated n times.

pub fn replace<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T) -> String

Replaces all occurrences of from with to.

pub fn replacen<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T, count: i32) -> String

Replaces the first count occurrences of from with to. If count is negative, replaces all occurrences.

pub fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> String with _

Build a String from an iterable of chars.

pub fn try_from_utf8<S: AsByteSlice>(bytes: S) -> Result<String, Utf8Error>

Copy bytes into a String, or report where they stop being valid UTF-8. A sequence cut short at the end fails too, with error_len() == None.

pub fn from_utf8<S: AsByteSlice>(bytes: S) -> String

Copy bytes that must be valid UTF-8 into a String.

unchecked String::from_utf8(bytes) skips the validation where the build does not check contracts. A marked call on invalid bytes builds an invalid string, and the behavior is unconstrained.

pub fn from_utf8_unchecked()

#[unavailable("write `unchecked String::from_utf8(bytes)`")]

pub fn from_utf8_slice()

#[unavailable("write `String::try_from_utf8(bytes)`, which takes any `AsByteSlice`")]

pub fn push_utf8<S: AsByteSlice>(&mut self, bytes: &S) -> Result<i32, Utf8Error>

Append the longest prefix of bytes that is complete, valid UTF-8, and answer how many bytes that was. A trailing sequence cut short is left behind rather than rejected, so a caller decoding a stream carries those bytes into its next chunk.

Err names a sequence no further byte could complete, offset from the start of bytes — a stream decoder owes it Utf8Error::rebased. This string is untouched: the prefix is validated before any of it is appended.

pub fn is_valid_utf8(bytes: ByteSlice) -> bool

Whether bytes is well-formed UTF-8.

pub fn from_utf8_lossy<S: AsByteSlice>(bytes: S) -> String

Copy bytes into a String, replacing invalid UTF-8 with U+FFFD.

pub fn split<S: AsStrSlice>(&self, sep: S) -> StrSplitIter

Returns an iterator over substrings split by the given separator.

pub fn splitn<S: AsStrSlice>(&self, n: i32, sep: S) -> StrSplitNIter

Returns an iterator over at most n substrings split by the given separator.

pub fn split_once<S: AsStrSlice>(&self, sep: S) -> Option<[StrSlice, StrSlice]>

Splits at the first sep into the parts before and after it, or None when sep does not occur.

pub fn rsplit_once<S: AsStrSlice>(&self, sep: S) -> Option<[StrSlice, StrSlice]>

Splits at the last sep into the parts before and after it, or None when sep does not occur.

pub fn split_whitespace(&self) -> StrSplitWhitespaceIter

Returns an iterator over whitespace-separated substrings.

pub fn lines(&self) -> StrLinesIter

Returns an iterator over the lines of this string.

impl Add for String

pub fn add(&self, other: &Self) -> Self::Output

impl Eq for String

pub fn eq(&self, other: &Self) -> bool

impl LenientFromStr for String

fn from_str_lenient<S: AsStrSlice>(s: S) -> Result<String, LenientParseError>

Identity: any text parses to the string it spells. Never fails.

impl Ord for String

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for String

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Default for String

pub fn default() -> String

impl From<char> for String

pub fn from(value: char) -> String

impl AsStrSlice for String

fn as_str_slice(&self) -> StrSlice
fn internal_append_to(&self, out: &mut String)
fn len(&self) -> i32

The byte accessors read the backing array directly. The default builds a view per call, which a scan over a generic body's text pays per byte.

fn is_empty(&self) -> bool
fn byte_at(&self, index: i32) -> u8
fn to_string(&self) -> String

Already a String: the default would rebuild one byte by byte, which a per-field wire name pays on every serialization.

impl Eq<StrSlice> for String

pub fn eq(&self, other: &StrSlice) -> bool

pub struct StrUtf8ByteIter

Iterator over the raw UTF-8 bytes of a String, yielding each as u8.

Fields are private.

impl Iterator for StrUtf8ByteIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrCharIter

Iterator over the Unicode scalar values (chars) of a String.

Fields are private.

impl Iterator for StrCharIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrCharIndicesIter

Iterator over characters paired with their byte indices.

Fields are private.

impl Iterator for StrCharIndicesIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrSplitIter

Iterator over substrings split by a separator.

Fields are private.

impl Iterator for StrSplitIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrSplitNIter

Iterator over substrings split by a separator, limited to n parts.

Fields are private.

impl Iterator for StrSplitNIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrSplitWhitespaceIter

Iterator over whitespace-separated substrings.

Fields are private.

impl Iterator for StrSplitWhitespaceIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrLinesIter

Iterator over the lines of a string (split on \n or \r\n).

Fields are private.

impl Iterator for StrLinesIter

pub fn next(&mut self) -> Option<Self::Item>

pub struct StrSlice

A view of part of a string, its ends on UTF-8 character boundaries. Creating one copies nothing.

Fields are private.

pub fn len(&self) -> i32

Length in bytes.

pub fn is_empty(&self) -> bool

pub fn byte_at(&self, index: i32) -> u8

The byte at index, counted from the view's start.

pub fn is_char_boundary(&self, index: i32) -> bool

Returns true if index, counted from the view's start, is 0, len(), or the start of a character.

pub fn floor_char_boundary(&self, index: i32) -> i32

The largest character boundary <= index, or len() beyond it.

pub fn ceil_char_boundary(&self, index: i32) -> i32

The smallest character boundary >= index, or len() beyond it.

pub fn slice(&self, start: i32, end: i32) -> StrSlice

A sub-view over [start, end), counted from this view's start.

pub fn as_bytes(&self) -> ByteSlice

The view's UTF-8 bytes.

pub fn chars(&self) -> StrCharIter

Returns an iterator over the Unicode scalar values (chars) of the view.

pub fn bytes(&self) -> StrUtf8ByteIter

Returns an iterator over the UTF-8 bytes of the view.

pub fn to_string(&self) -> String

Copy the view into an owned String.

pub fn starts_with<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if the view starts with pat.

pub fn ends_with<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if the view ends with pat.

pub fn contains<S: AsStrSlice>(&self, pat: S) -> bool

Returns true if the view contains pat.

pub fn find<S: AsStrSlice>(&self, pat: S) -> Option<i32>

The byte index of the first occurrence of pat, counted from the view's start, or None.

pub fn rfind<S: AsStrSlice>(&self, pat: S) -> Option<i32>

The byte index of the last occurrence of pat, counted from the view's start, or None.

pub fn strip_prefix<S: AsStrSlice>(&self, prefix: S) -> Option<StrSlice>

The view with prefix removed from the front, or None when it does not start with prefix.

pub fn strip_suffix<S: AsStrSlice>(&self, suffix: S) -> Option<StrSlice>

The view with suffix removed from the end, or None when it does not end with suffix.

pub fn cmp_str<S: AsStrSlice>(&self, other: S) -> Ordering

Byte order against any text, the cmp a generic body cannot reach: Ord compares two StrSlices, and a type parameter is neither.

pub fn eq_str<S: AsStrSlice>(&self, other: S) -> bool

Byte equality against any text. == reaches a String and another StrSlice; this reaches whatever a type parameter turns out to be.

pub fn eq_ignore_ascii_case<S: AsStrSlice>(&self, other: S) -> bool

Checks that two views are an ASCII case-insensitive match. Non-ASCII bytes are compared exactly.

pub fn trim_ascii_start(&self) -> StrSlice

The view with leading ASCII whitespace removed.

pub fn trim_ascii_end(&self) -> StrSlice

The view with trailing ASCII whitespace removed.

pub fn trim_ascii(&self) -> StrSlice

The view with leading and trailing ASCII whitespace removed.

pub fn trim_start(&self) -> StrSlice

The view with leading Unicode whitespace removed.

pub fn trim_end(&self) -> StrSlice

The view with trailing Unicode whitespace removed.

pub fn trim(&self) -> StrSlice

The view with leading and trailing Unicode whitespace removed.

pub fn split<P: AsStrSlice>(&self, sep: P) -> StrSplitIter

pub fn splitn<P: AsStrSlice>(&self, n: i32, sep: P) -> StrSplitNIter

pub fn split_whitespace(&self) -> StrSplitWhitespaceIter

pub fn lines(&self) -> StrLinesIter

pub fn split_once<P: AsStrSlice>(&self, sep: P) -> Option<[StrSlice, StrSlice]>

The parts either side of the first sep, or None when it does not occur. Both parts view this one; to_string copies whichever is kept.

pub fn rsplit_once<P: AsStrSlice>(&self, sep: P) -> Option<[StrSlice, StrSlice]>

pub fn char_indices(&self) -> StrCharIndicesIter

pub fn to_chars(&self) -> List<char>

pub fn char_at_byte(&self, byte_index: i32) -> char

The character starting at byte_index, counted from the view's start.

pub fn to_ascii_lowercase(&self) -> String

pub fn to_ascii_uppercase(&self) -> String

pub fn substr_bytes(&self, start: i32, end: i32) -> String

pub fn contains_char(&self, ch: char) -> bool

pub fn find_char(&self, mut pred: fn mut(char) -> bool with _) -> Option<i32> with _

pub fn repeat(&self, n: i32) -> String

pub fn replace<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T) -> String

Replaces all occurrences of from with to.

pub fn replacen<F: AsStrSlice, T: AsStrSlice>(&self, from: F, to: T, count: i32) -> String

Replaces the first count occurrences of from with to. If count is negative, replaces all occurrences.

impl AsStrSlice for StrSlice

fn as_str_slice(&self) -> StrSlice

impl Eq for StrSlice

pub fn eq(&self, other: &Self) -> bool

impl Ord for StrSlice

pub fn cmp(&self, other: &Self) -> Ordering

impl Hash for StrSlice

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Eq<String> for StrSlice

pub fn eq(&self, other: &String) -> bool

pub struct List<affine T>

A growable sequence.

Contract: shrinking (truncate, clear, pop, remove) may release the slots past the new length, so the collector can reclaim what they held. A slice or an iterator taken before the shrink, a for loop's included, must not read those slots: what it reads is unspecified, some value of T or a trap.

Fields are private.

pub fn with_capacity(capacity: i32) -> List<T>

#[compiler_item("list_with_capacity")]

pub fn grow(&mut self)

pub fn from_tuple(elements: [..T]) -> List<T>

Collect a homogeneous tuple [T, T, ...] into a List<T>.

pub fn len(&self) -> i32

#[compiler_item("list_len")]

pub fn capacity(&self) -> i32

Returns the total number of elements the list can hold without reallocating.

pub fn push(&mut self, value: T)

#[compiler_item("list_push")]

Appends a single element to the end.

pub fn push_within_capacity(&mut self, value: T)

Appends a single element assuming the capacity was already reserved (see reserve). Skips the grow check push performs on every call, so a burst of appends after one reserve pays a single capacity check instead of one per element, when the call is marked unchecked. The Wasm array bounds check still guards the store, so an under-reserved call traps rather than corrupting memory.

pub fn pop(&mut self) -> Option<T>

Removes and returns the last element, or null when empty.

pub fn insert(&mut self, index: i32, value: T)

Inserts an element at the given index, shifting all elements after it to the right.

pub fn remove(&mut self, index: i32) -> T

Removes and returns the element at the given index, shifting all elements after it to the left. Releases the last slot, under the contract on List.

pub fn swap(&mut self, a: i32, b: i32)

Swaps two elements by index.

pub fn truncate(&mut self, len: i32)

Shortens the list to len elements; a longer len changes nothing. Releases the dropped slots, under the contract on List.

pub fn clear(&mut self)

Removes all elements, keeping the capacity. Releases every slot, under the contract on List.

pub fn reserve(&mut self, additional: i32)

Reserves capacity for at least additional more elements.

pub fn shrink_to_fit(&mut self)

Shrinks the capacity to match the current length.

pub fn reverse(&mut self)

Reverses the elements in place.

pub fn is_empty(&self) -> bool

pub fn iter_ref(&self) -> SliceRefIter<T>

The elements, each by reference.

pub fn filled(n: i32, element: T) -> List<T>

A list of n copies of element.

pub fn to_array(&self) -> Array<T>

Copy the live 0..<len() elements into a fresh fixed Array<T> of exactly len(). Hand a finished, no-longer-growing buffer to code that only indexes it: Array's [] is bounds-checked by Wasm (traps on OOB) without List[]'s power-assert diagnostic, so index-heavy readers (e.g. a generated parser over a fixed token stream) avoid that per-access cost.

pub fn extend(&mut self, other: &List<T>)

Extends this list with elements from another list.

pub fn extend_from_slice(&mut self, other: Slice<T>)

Extends this list with the elements of a slice in a single bulk copy (one array_copy, no per-element bounds checks). The slice may view a different backing array than this list. Taken by value because a slice is a cheap view (a backing reference plus two offsets), which also lets a newtype view (e.g. ByteSlice) coerce to Slice<T> at the call.

pub fn repeat(&self, n: i32) -> List<T>

Returns a new list containing this list's elements repeated n times.

pub fn copy_within_append(&mut self, src_start: i32, count: i32)

Copies count elements from self[src_start..] and appends them. Handles overlapping regions correctly for both non-overlapping and DEFLATE-style run-length expansion (where src < dst). Forward order is correct in both cases.

pub fn from_le_bytes<B: AsByteSlice>(bytes: B) -> List<T>

#[compiler_item("list_from_le_bytes")]

The Ts bytes holds, little-endian and back to back. A literal argument folds to a constant, with no decode loop.

pub fn contains(&self, value: &T) -> bool

pub fn contains_str<S: AsStrSlice>(&self, value: S) -> bool

Membership by text, so a view is looked up without a to_string copy. Walks by reference: an element yielded by value is copied out.

pub fn iter_ref_mut(&mut self) -> SliceRefMutIter<T>

Yields &mut T only where T: RefMut: a scalar element has no addressable cell, so a write through the reference would be lost.

pub fn sorted_by(&self, cmp: fn mut(&T, &T) -> Ordering with _) -> List<T> with _

pub fn sort_by(&mut self, mut cmp: fn mut(&T, &T) -> Ordering with _) with _

In-place sort with comparator. Stable, O(n log n) worst case. cmp is handed references as iter_ref hands them out: a Ref element in place, a scalar as a read-only snapshot.

pub fn sort(&mut self)

pub fn sorted(&self) -> List<T>

pub fn join(&self, separator: String) -> String

Joins elements into a string with the given separator.

impl IndexValue<i32> for List<T>

fn index_value(&self, index: i32) -> Self::Output

#[compiler_item("list_index_value")]

impl IndexAssign<i32> for List<T>

fn index_assign(&mut self, index: i32, value: Self::Output)

#[compiler_item("list_index_assign")]

impl IndexSwap<i32> for List<T>

fn index_swap(&mut self, a: i32, b: i32)

impl IndexRef<i32> for List<T>

fn index_ref(&self, index: i32) -> &T

impl IndexRefMut<i32> for List<T>

fn index_ref_mut(&mut self, index: i32) -> &mut T

impl Sequence for List<T>

fn len(&self) -> i32
fn at(&self, index: i32) -> T

impl AsSlice for List<T>

fn as_slice(&self) -> Slice<T>

impl Eq for List<T>

pub fn eq(&self, other: &Self) -> bool

impl Hash for List<T>

pub fn hash<H: Hasher>(&self, h: &mut H)

impl Ord for List<T>

pub fn cmp(&self, other: &Self) -> Ordering

impl IndexValue<RangeExclusive<i32>> for List<T>

fn index_value(&self, range: RangeExclusive<i32>) -> Slice<T>

impl IndexValue<RangeInclusive<i32>> for List<T>

fn index_value(&self, range: RangeInclusive<i32>) -> Slice<T>

impl ForOf for List<T>

fn start(self) -> ListCursor<T>

impl IntoIterator for List<T>

fn into_iter(&self) -> Self::Iter

impl FromIterator for List<T>

fn from_iter<I: Iterator<Item = T>>(iter: &mut I) -> List<T> with _

impl From<Array<T>> for List<T>

fn from(elements: Array<T>) -> List<T>

impl Default for List<T>

pub fn default() -> List<T>

impl Inspect for List<T>

pub fn inspect(&self, f: &mut Formatter)

impl Display for List<T>

pub fn fmt(&self, f: &mut Formatter)

pub struct ListCursor<affine T>

The state for-of walks a list with: the list and a position. next moves an affine element out of its slot and copies a copyable one, so the cursor never writes a list it shares; dropping it drops the elements not reached.

Fields are private.

pub fn next(&mut self) -> Option<T>

pub struct RangeExclusive<T: Ord>

Half-open range [start, end). Constructed via the ..< operator: 0..<10 produces RangeExclusive<i32>.

start: T

end: T

pub fn contains(&self, value: &T) -> bool

Returns true if the value is within [start, end).

pub fn is_empty(&self) -> bool

Returns true if the range contains no elements.

impl Iterator for RangeExclusive<T>

fn next(&mut self) -> Option<T>

impl Eq for RangeExclusive<T>

fn eq(&self, other: &Self) -> bool

impl Display for RangeExclusive<T>

pub fn fmt(&self, f: &mut Formatter)

pub struct RangeInclusive<T: Ord>

Inclusive range [start, end]. Constructed via the ..= operator: 0..=10 produces RangeInclusive<i32>.

start: T

end: T

pub fn contains(&self, value: &T) -> bool

Returns true if the value is within [start, end].

pub fn is_empty(&self) -> bool

Returns true if the range contains no elements.

impl Iterator for RangeInclusive<T>

fn next(&mut self) -> Option<T>

impl Eq for RangeInclusive<T>

fn eq(&self, other: &Self) -> bool

impl Display for RangeInclusive<T>

pub fn fmt(&self, f: &mut Formatter)

Variants

pub variant Option<T>

Optional value - either None or Some(T). The derived order puts None first, as Rust's does.

None

Some(T)

pub variant Result<T, E>

Result type - either Ok(T) or Err(E)

Ok(T)

Err(E)

pub variant WaitOn

How a WaitableSet learns that a Waitable is ready.

Host(ResourceId)

The host reports its event by this handle.

Settled(ReadyEvent)

It is ready already, with this event: the host has none left to report.

pub variant ReadyEvent

What the host reported for a WaitableSet member.

Unreported

The member has no handle for the host to report and no event of its own, so it is ready without one.

Call(CallState)

Copied(CopyResult)

A started stream or future copy settled, ending as this says.

Enums

pub enum Ordering

Result of a comparison between two values.

Less

The first value is less than the second.

Equal

The two values are equal.

Greater

The first value is greater than the second.

pub enum CaseStyle

The wire-naming policy declared by #[wire(name_policy = "...")] (casing not applied here — core:serde::wire_name resolves it). See WEP 2026-06-13.

Identity

Camel

Snake

ScreamingSnake

Pascal

Kebab

ScreamingKebab

pub enum Alignment

Text alignment for padding.

Left

Left-aligned: ${x:<5} -> "42 "

Center

Center-aligned: ${x:^5} -> " 42 "

Right-aligned (default for numbers): ${x:>5} -> " 42"

pub enum CopyResult

How one Component Model copy ended (CanonicalABI.md, CopyResult). It describes that copy, not the stream: only Dropped ends the stream.

Completed

The copy finished.

Dropped

The peer end is gone; no further copy is possible on this end.

Cancelled

A cancel finished and returned the buffer; the end stays usable.

pub enum FutureWriteResult

How a FutureWritable::write ended.

Completed

The reader took the value.

Dropped

The reader dropped first, and the value came back.

Pending

The reader has not read yet. The host holds the value and hands it to the reader, so it is no longer the writer's.

pub enum CallState

The state an async call moved to (CanonicalABI.md, Subtask.State).

Starting

Started

Returned

CancelledBeforeStarted

CancelledBeforeReturned

pub enum IntErrorKind

Kind of failure returned by integer parsing.

Empty

The input string was empty.

InvalidDigit

The input contained a character that is not a valid digit in the radix.

PosOverflow

The value was greater than the maximum representable in the target type.

NegOverflow

The value was less than the minimum representable in the target type.

pub enum FloatErrorKind

Kind of failure returned by float parsing.

Empty

The input string was empty.

Invalid

The input was malformed.

pub enum CharErrorKind

Kind of failure returned by char parsing.

Empty

The input string was empty.

TooManyChars

The input held more than one Unicode scalar.