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::from_utf8([87, 97, 100, 111] as List<u8>);
assert decoded matches { Ok(s) && s == "Wado" };

Functions

pub fn ref_eq<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 format<T: ReflectTemplate<Holes = [..V]>, ..V>(t: T) -> String

The tag an untagged template means: every hole rendered through its specifier into one buffer. format`x=${x}` is `x=${x}`. See WEP 2026-01-10.

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 unreachable code.

Traits

pub 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 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 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 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 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 type_name() -> String

#[compiler_item("reflect_type_name")]

Returns the declaration's name.

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.

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::FieldTypes) -> 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 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.

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() -> String

#[compiler_item("reflect_template_tail")]

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

fn raw_tail() -> String

#[compiler_item("reflect_template_raw_tail")]

tail() with escapes preserved.

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 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 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 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 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).

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 with ()

Trait for the << operator (left shift).

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

Returns self shifted left by rhs bits.

pub trait Shr with ()

Trait for the >> operator (right shift).

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

Returns self shifted right by rhs bits.

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

Collects the remaining elements into any FromIterator target, defaulting to List<Self::Item>.

fn count(&mut self) -> i32

Counts the number of remaining elements in the iterator.

fn map<U>(&self, f: fn mut(Self::Item) -> U) -> IterMap<Self, U>

Transforms each element using a function.

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

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

Calls f for every remaining element. Consumes the iterator.

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

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) -> bool

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) -> bool

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>

Returns the nth element (0-indexed), advancing the iterator up to and including it.

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

Returns the 0-based index of the first element for which pred returns true, or None.

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

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

fn filter(&self, pred: fn mut(Self::Item) -> bool) -> IterFilter<Self>

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

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

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

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

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

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

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

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

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

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

Returns an adapter that yields all elements of self, then all elements of other.

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

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>

Multiplies the remaining elements. None for an empty iterator.

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

The smallest remaining element, the first on ties. None for an empty iterator.

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

The largest remaining element, the last on ties. None for an empty iterator.

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

The smallest remaining element under cmp, the first on ties.

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

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) -> Option<Self::Item>

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) -> Option<Self::Item>

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

pub 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. Note: Uses &self due to parser limitation (self by value not yet supported in traits).

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

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>

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>

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

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

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 trait Sequence with ()

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

Implementors supply len and get_unchecked; 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 get_unchecked(&self, index: i32) -> Self::Elem

The caller must guarantee 0 <= index < len(). Any other index is a contract violation, and the result is unspecified: some valid Elem, or a trap.

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) -> Option<i32>

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. Panics if size is not positive.

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

Non-overlapping chunks of up to size elements; the last may be shorter. Panics if size is not positive.

pub trait AsStrSlice: Eq<String> 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 get_byte_unchecked(&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 slice_unchecked(&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) -> Option<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 char_at_byte_unchecked(&self, byte_index: i32) -> char

fn to_ascii_lowercase(&self) -> String

fn to_ascii_uppercase(&self) -> String

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

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

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

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

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. Returns Some(value) when fulfilled, None if the writer dropped without writing.

fn cancel_read(&self)

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

Cancel an in-progress read. Blocks until cancellation completes. Traps if this end is still joined to a WaitableSet — leave the set first.

fn drop(self)

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

Drop the readable end of the future.

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)

#[cm("future-write")]

Fulfill the future with a value.

fn cancel_write(&self)

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

Cancel an in-progress write. Blocks until cancellation completes. Traps if this end is still joined to a WaitableSet — leave the set first.

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 read(&self, max: i32) -> StreamChunk<T>

#[cm("stream-read")]

One Component Model copy of up to max elements, blocking until at least one arrives or the writable end drops. A Dropped result can carry elements of its own, and reading an end whose result was Dropped traps, so a loop breaks on the result, never on an empty chunk. read_to_end is that loop.

fn cancel_read(&self)

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

Cancel an in-progress read. Blocks until cancellation completes. Traps if this end is still joined to a WaitableSet — leave the set first.

fn drop(self)

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

Drop the readable end of the stream.

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 resource StreamWritable<T>

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

fn write(&self, data: List<T>) -> StreamWrite

#[cm("stream-write")]

One Component Model copy of data, blocking until the reader takes at least one element or drops. The reader may take a prefix, so the count can be short of data.len(). Writing to an end whose result was Dropped traps, and an empty data is the CM's readiness signal, which blocks until a reader rendezvouses rather than writing nothing. write_all is the loop that finishes the buffer.

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 cancel_write(&self)

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

Cancel an in-progress write. Blocks until cancellation completes. Traps if this end is still joined to a WaitableSet — leave the set first.

fn drop(self)

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

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

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 WaitableSet

A set of waitable handles used for async task coordination.

Lifecycle: create with new(), join waitables into the set, wait/poll for events, then drop. A WaitableSet can only be dropped when it has no joined children — Subtask::drop() automatically removes the subtask from its joined set (via the CM spec's Waitable.join(None) semantics), so always drop subtasks before dropping the set.

fn new() -> WaitableSet

#[cm("waitable-set-new")]

Create a new waitable set.

fn wait(&self) -> WaitEvent

#[cm("waitable-set-wait")]

Block until an event occurs. Returns the event details.

fn poll(&self) -> Option<WaitEvent>

#[cm("waitable-set-poll")]

Non-blocking poll. Returns Some(event) if ready, None otherwise.

fn drop(self)

#[cm("waitable-set-drop")]

Drop the waitable set. Traps if waitables are still joined to this set.

pub resource Subtask

A raw CM subtask handle. Prefer AsyncCall<T> (see below), which pairs the handle with its result buffer.

Subtask extends Waitable in the CM spec. When dropped, it automatically removes itself from any joined WaitableSet (the CM runtime calls Waitable.join(None) internally), so WaitableSet::drop can succeed.

Correct lifecycle: let subtask = handle as Subtask; subtask.join(&ws); ws.wait(); subtask.drop(); // removes from ws ws.drop(); // safe — no children

fn drop(self)

#[cm("subtask-drop")]

Drop a completed subtask. Automatically unjoins from its WaitableSet. Traps if the subtask has not yet resolved.

fn cancel(&self)

#[cm("subtask-cancel")]

Cancel this in-progress subtask. Blocks until cancellation completes.

fn join(&self, set: &WaitableSet) -> Waitable

#[cm("waitable-join")]

Join this subtask to a waitable set for monitoring. Returns a Waitable token identifying this subtask in wait results.

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.

pub resource Task

The current async task handle.

Provides operations that apply to the currently executing async task.

fn cancel()

#[cm("task-cancel")]

Acknowledge cancellation of the current task.

Call this in response to a cancellation signal (e.g. after receiving WaitEvent { code: 6 } from WaitableSet::wait). Signals to the CM runtime that the task accepts being cancelled and will clean up.

Types

pub type Waitable = i32

Opaque token identifying a waitable handle within a WaitableSet. Obtained from Subtask::join. Compared by handle identity (==).

A newtype over the raw i32 handle: copyable, with Eq inherited from i32. It is an identity token with no lifecycle of its own — the joined Subtask / AsyncCall owns the actual handle lifecycle.

pub type ByteArray = Array<u8>

An owned, fixed-length byte buffer.

pub type ByteList = List<u8>

pub type ByteSlice = Slice<u8>

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. A NaN bound traps, as low > high does.

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 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. A NaN bound traps, as low > high does.

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 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 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 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. Traps when 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 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. Traps when low > high.

pub fn wrapping_neg(&self) -> u64

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

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. Traps when 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 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. Traps when 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 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. Traps when 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 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. Traps when low > high.

pub fn wrapping_neg(&self) -> u8

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

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. Traps when low > high.

pub fn wrapping_neg(&self) -> u16

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

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. Traps when low > high.

pub fn wrapping_neg(&self) -> u32

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

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

impl From<bool> for bool

pub fn from(value: bool) -> bool

char

pub fn from_u32(value: u32) -> Option<char>

Converts a Unicode scalar value (u32) to a char. Returns null if the value is not a valid Unicode scalar value (i.e., surrogates 0xD800..=0xDFFF or values > 0x10FFFF).

pub fn from_i32(value: i32) -> Option<char>

Converts a signed integer to a char. Returns null if the value is negative or not a valid Unicode scalar value.

pub fn from_u32_unchecked(value: u32) -> char

Converts a u32 to a char without validation. The caller must ensure the value is a valid Unicode scalar value (0..=0xD7FF or 0xE000..=0x10FFFF). Passing any other value is a contract violation, and the behavior is unconstrained.

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). Panics if the character is not a valid hex digit.

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 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<T, 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 extract(&self, v: &T) -> P

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

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().

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, V>

A hole handle minted by ReflectTemplate::members(): the literal text before the hole, the hole's source text and specifier presence are constants, and get / fmt reach the hole's value in a template. See WEP 2026-01-10.

Fields are private.

pub fn index(&self) -> i32

The hole's position in the template.

pub fn lit(&self) -> String

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

pub fn raw(&self) -> String

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

pub fn source(&self) -> String

The hole's expression as written: "user.name".

pub fn has_spec(&self) -> bool

Whether the hole wrote a :spec.

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

The hole's value in t.

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

Renders the value as the untagged template would: 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 struct StructField<T, 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(&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<I: Iterator, U>

Generic map iterator adapter that wraps any Iterator.

inner: I

f: fn mut(I::Item) -> U

impl Iterator for IterMap<I, U>

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

impl IntoIterator for IterMap<I, U>

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

pub struct IterFilter<I: Iterator>

Generic filter iterator adapter that wraps any Iterator.

inner: I

pred: fn mut(I::Item) -> bool

impl Iterator for IterFilter<I>

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

impl IntoIterator for IterFilter<I>

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

pub struct IterEnumerate<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>

impl IntoIterator for IterEnumerate<I>

fn into_iter(&self) -> IterEnumerate<I>

pub struct IterTake<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>

impl IntoIterator for IterTake<I>

fn into_iter(&self) -> IterTake<I>

pub struct IterSkip<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>

impl IntoIterator for IterSkip<I>

fn into_iter(&self) -> IterSkip<I>

pub struct IterStepBy<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>

impl IntoIterator for IterStepBy<I>

fn into_iter(&self) -> IterStepBy<I>

pub struct IterChain<I: Iterator, 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>

impl IntoIterator for IterChain<I, J>

fn into_iter(&self) -> IterChain<I, J>

pub struct IterZip<I: Iterator, 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>

impl IntoIterator for IterZip<I, J>

fn into_iter(&self) -> IterZip<I, J>

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. radix must be in 2..=36.

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. Traps when low > high.

pub fn wrapping_neg(&self) -> u128

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

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: u32) -> Self::Output

impl Shr for u128

pub fn shr(&self, rhs: u32) -> 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. radix must be in 2..=36.

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. Traps when 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 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: u32) -> Self::Output

impl Shr for i128

pub fn shr(&self, rhs: u32) -> 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 StreamChunk<T>

What one Stream::read copied, 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

What one StreamWritable::write copied, and how that copy ended. A reader may take a prefix, so count can be short of what was offered.

count: i32

result: CopyResult

pub struct WaitEvent

Event returned by WaitableSet::wait or WaitableSet::poll.

code: i32

CM event code: 1 = subtask, 2 = stream-read, 3 = stream-write, 4 = future-read, 5 = future-write, 6 = cancelled

handle: Waitable

Which waitable handle triggered the event.

payload: u32

Event-specific data (e.g. count|status for streams).

pub struct AsyncCall<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> pairs the raw CM subtask handle with the linear-memory buffer into which the host writes the async result. Use wait(self) to block until the call returns and take the lifted result; use cancel(self) to abort the in-flight call.

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(body_bytes);          // rendezvous with host read
body_tx.drop();
let resp = task.wait();             // block for response

Fields are private.

pub fn wait(&self) -> T with (Subtask, WaitableSet)

Wait for the subtask to complete and return the lifted result. Drops the CM subtask handle and frees the result buffer before returning. After wait returns, the AsyncCall<T> value must not be used again — doing so is a use-after-free (the backing buffer has been released).

pub fn cancel(&self) with Subtask

Cancel the in-flight subtask and free the result buffer. Any partially-written result is discarded. Same single-use contract as wait — the AsyncCall<T> must not be used again after cancel.

pub fn join(&self, set: &WaitableSet) -> Waitable with Subtask

Join this subtask to a waitable set for manual polling (use when the caller wants to wait on multiple subtasks and/or streams simultaneously). Returns a Waitable token identifying this subtask in wait events. The caller remains responsible for eventual wait/cancel on this AsyncCall<T>.

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 get_unchecked(&self, index: i32) -> T

#[compiler_item("byte_slice_get_unchecked")]

The caller must guarantee 0 <= index < len(). Any other index is a contract violation, and the result is unspecified: an element of the backing array outside the view, or a trap. Also the byte-read anchor for FieldSchema::lookup, as len is for byte length.

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. Panics if size is not positive.

pub fn chunks(&self, size: i32) -> SliceChunks<T>

Non-overlapping chunks of up to size elements; the last may be shorter. Panics if size is not positive.

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 get_unchecked(&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

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>

impl IntoIterator for SliceValueIter<T>

fn into_iter(&self) -> SliceValueIter<T>

pub struct SliceRefIter<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>

impl IntoIterator for SliceWindows<T>

fn into_iter(&self) -> SliceWindows<T>

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>

impl IntoIterator for SliceChunks<T>

fn into_iter(&self) -> SliceChunks<T>

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 raw<T: ReflectTemplate<Holes = [..V]>, ..V>(t: T) -> String

The tag keeping a template's escapes as written: String::raw`a\nb` is "a\\nb", its holes rendered as the untagged template renders them. See WEP 2026-01-10.

pub fn with_capacity(capacity: i32) -> String

#[compiler_item("string_with_capacity")]

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 get_byte_unchecked(&self, index: i32) -> u8

#[compiler_item("string_get_byte_unchecked")]

Read the byte at index without bounds checks. For safe access use bytes().

Contract

Any other index is a contract violation, and the result is unspecified: a byte of the backing array past len(), or a trap.

pub fn set_byte_unchecked(&mut self, index: i32, value: u8)

#[compiler_item("string_set_byte_unchecked")]

Write the byte at index without bounds or UTF-8 checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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_unchecked<S: AsByteSlice>(&mut self, bytes: &S)

Append the bytes of any AsByteSlice source (ByteList, ByteArray, ByteSlice, or a String).

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

pub fn push_str_range_unchecked<S: AsStrSlice>(&mut self, s: S, start: i32, end: i32)

Append the byte range [start, end) of s to this string.

Contract

Breaking it is a contract violation, 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) -> Option<char>

Decodes the UTF-8 character starting at the given byte index. Returns None if byte_index is past the end of the string or there aren't enough bytes to form a full UTF-8 sequence. Assumes byte_index is on a character boundary (the string is valid UTF-8).

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

Decodes the UTF-8 character starting at byte_index without bounds checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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_unchecked(&mut self, byte: u8)

#[compiler_item("string_push_ascii")]

Appends a single byte, assumed to be a complete one-byte UTF-8 sequence (byte < 0x80). A larger byte breaks the String's UTF-8 invariant: a contract violation, and the behavior is unconstrained.

push routes its ASCII fast path here, and the optimizer's nir/const_ascii_push rewrite retargets push(<const char < 0x80>) here directly, skipping encode_char's width dispatch.

pub fn truncate(&mut self, byte_len: i32)

Truncates the string to the given byte length. Panics if byte_len is negative or off a character boundary; round a budget with floor_char_boundary.

pub fn truncate_unchecked(&mut self, byte_len: i32)

Truncate without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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. Panics if negative.

pub fn ceil_char_boundary(&self, byte_index: i32) -> i32

The smallest character boundary >= byte_index, or len() beyond it. Panics if byte_index is negative.

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). Panics if the range is out of bounds or off a character boundary; round a budget with floor_char_boundary.

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

Extract a substring by byte range [start, end) without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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) -> Option<i32>

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. Panics if byte_index is out of bounds or not on a UTF-8 character boundary.

pub fn insert_unchecked(&mut self, byte_index: i32, ch: char)

Inserts a character at byte_index without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

pub fn insert_str<S: AsStrSlice>(&mut self, byte_index: i32, s: S)

Inserts a string at the given byte index. Panics if byte_index is out of bounds or not on a UTF-8 character boundary.

pub fn insert_str_unchecked<S: AsStrSlice>(&mut self, byte_index: i32, s: S)

Inserts a string at byte_index without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

pub fn remove(&mut self, byte_index: i32) -> char

Removes and returns the character at the given byte index. Panics if the index is out of bounds or not on a UTF-8 character boundary.

pub fn remove_unchecked(&mut self, byte_index: i32) -> char

Removes and returns the character at byte_index without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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

Build a String from an iterable of chars.

pub fn from_utf8<I: IntoIterator<Item = u8>>(bytes: I) -> Result<String, Utf8Error>

Build a String from an iterable of bytes, validating UTF-8.

pub fn from_utf8_slice(bytes: ByteSlice) -> Result<String, Utf8Error>

Validate a contiguous byte slice as UTF-8 and wrap it as a String. A sequence cut short at the end fails too, with error_len() == None.

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<I: IntoIterator<Item = u8>>(bytes: I) -> String

Build a String from an iterable of bytes, replacing invalid UTF-8 with U+FFFD.

pub fn from_utf8_unchecked<I: IntoIterator<Item = u8>>(bytes: I) -> String

Build a String from an iterable of bytes without UTF-8 validation.

Contract

The caller must ensure the bytes form valid UTF-8. Breaking it is a contract violation, and the behavior is unconstrained.

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 get_byte_unchecked(&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 get_byte_unchecked(&self, index: i32) -> u8

Read the byte at index, counted from the view's start, without bounds checks.

Contract

Any other index is a contract violation, and the result is unspecified: a byte of the backing array outside the view, or a trap.

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. Panics if index is negative.

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

The smallest character boundary >= index, or len() beyond it. Panics if index is negative.

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

A sub-view over [start, end), counted from this view's start. Panics if the range is out of bounds or either end is off a character boundary.

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

A sub-view without bounds or UTF-8 boundary checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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 char_at_byte(&self, byte_index: i32) -> Option<char>

The character starting at byte_index, counted from the view's start, or None past the end.

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_unchecked(&self, byte_index: i32) -> char

Decodes the UTF-8 character starting at byte_index, counted from the view's start, without checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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 substr_bytes_unchecked(&self, start: i32, end: i32) -> String

Copies out the byte range [start, end) of the view without checks.

Contract

Breaking it is a contract violation, and the behavior is unconstrained.

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

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

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<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 filled(n: i32, element: T) -> List<T>

pub fn from_tuple<..Elems>(elements: [..Elems]) -> List<T>

#[compiler_item("list_from_tuple")]

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

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. Unlike internal_raw_data, the result is sized to len(), not capacity.

pub fn insert(&mut self, index: i32, value: T)

Inserts an element at the given index, shifting all elements after it to the right. Panics if index > len().

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. Panics if index >= len(). Releases the last slot, under the contract on List.

pub fn swap(&mut self, a: i32, b: i32)

Swaps two elements by index. Panics if either index is out of bounds.

pub fn truncate(&mut self, len: i32)

Shortens the list to len elements; a longer len changes nothing. Panics if len is negative. 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 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 reverse(&mut self)

Reverses the elements in place.

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; panics on a partial T. 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 sort_by(&mut self, mut cmp: fn mut(&T, &T) -> Ordering)

In-place sort with comparator. Stable, O(n log n) worst case.

pub fn sorted_by(&self, cmp: fn mut(&T, &T) -> Ordering) -> List<T>

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)

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 get_unchecked(&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 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>

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 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 IntoIterator for RangeExclusive<T>

fn into_iter(&self) -> RangeExclusive<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 IntoIterator for RangeInclusive<T>

fn into_iter(&self) -> RangeInclusive<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)

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