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 panic(message: String) -> !
Logs a message to stderr and traps.
pub fn unreachable() -> !
Traps unconditionally, marking unreachable code.
Traits
pub trait Eq
Trait for equality comparisons.
Types implementing this trait can be compared with == and != operators.
fn eq(&self, other: &Self) -> bool
Returns true if self equals other.
pub trait Ord
Trait for ordering comparisons.
Types implementing this trait can be compared with <, <=, >, >= operators.
fn cmp(&self, other: &Self) -> Ordering
Compares self with other and returns an Ordering.
pub trait Index<IndexType>
Trait for immutable indexing operations.
Types implementing this trait can be indexed with the [] operator for reading.
fn index(&self, index: IndexType) -> &Self::Output
Returns a reference to the element at the given index.
pub trait IndexMut<IndexType>
Trait for mutable indexing operations.
Types implementing this trait can be indexed with the [] operator to get
a mutable reference: container[i].mutating_method().
Note: Requires Index to be implemented (supertrait relationship).
fn index_mut(&mut self, index: IndexType) -> &mut Self::Output
Returns a mutable reference to the element at the given index.
pub trait IndexAssign<IndexType>
Trait for index assignment operations.
Types implementing this trait can be assigned via the [] operator: arr[i] = value.
This is separate from IndexMut because in Wasm GC, you cannot get a mutable reference
to primitive array elements - reading and writing are fundamentally different operations.
fn index_assign(&mut self, index: IndexType, value: Self::Input)
Assigns a value to the element at the given index.
pub trait IndexValue<IndexType>
Trait for value-returning indexing operations.
Use this for containers of primitives where references cannot be returned.
Unlike Index which returns &Output, this returns Output by value (copy).
fn index_value(&self, index: IndexType) -> Self::Output
Returns a copy of the element at the given index.
pub trait Add
Trait for the + operator.
Types implementing this trait can use the + operator for addition.
fn add(&self, rhs: &Self) -> Self::Output
Adds two values and returns the result.
pub trait Sub
Trait for the - operator (binary subtraction).
Types implementing this trait can use the - operator for subtraction.
fn sub(&self, rhs: &Self) -> Self::Output
Subtracts rhs from self and returns the result.
pub trait Mul
Trait for the * operator.
Types implementing this trait can use the * operator for multiplication.
fn mul(&self, rhs: &Self) -> Self::Output
Multiplies two values and returns the result.
pub trait Div
Trait for the / operator.
Types implementing this trait can use the / operator for division.
fn div(&self, rhs: &Self) -> Self::Output
Divides self by rhs and returns the result.
pub trait Rem
Trait for the % operator.
Types implementing this trait can use the % operator for remainder.
fn rem(&self, rhs: &Self) -> Self::Output
Returns the remainder of dividing self by rhs.
pub trait Neg
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
Trait for the & operator (bitwise AND).
fn bitand(&self, rhs: &Self) -> Self::Output
Returns the bitwise AND of self and rhs.
pub trait BitOr
Trait for the | operator (bitwise OR).
fn bitor(&self, rhs: &Self) -> Self::Output
Returns the bitwise OR of self and rhs.
pub trait BitXor
Trait for the ^ operator (bitwise XOR).
fn bitxor(&self, rhs: &Self) -> Self::Output
Returns the bitwise XOR of self and rhs.
pub trait BitNot
Trait for the ~ operator (bitwise NOT).
fn bitnot(&self) -> Self::Output
Returns the bitwise NOT of self.
pub trait Shl
Trait for the << operator (left shift).
fn shl(&self, rhs: u32) -> Self::Output
Returns self shifted left by rhs bits.
pub trait Shr
Trait for the >> operator (right shift).
fn shr(&self, rhs: u32) -> Self::Output
Returns self shifted right by rhs bits.
pub trait Display
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 Binary
Trait for formatting values as binary integers.
Used with the {x:b} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as binary and writes to the given formatter.
pub trait Octal
Trait for formatting values as octal integers.
Used with the {x:o} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as octal and writes to the given formatter.
pub trait LowerHex
Trait for formatting values as lowercase hexadecimal.
Used with the {x:x} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as lowercase hex and writes to the given formatter.
pub trait UpperHex
Trait for formatting values as uppercase hexadecimal.
Used with the {x:X} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as uppercase hex and writes to the given formatter.
pub trait LowerExp
Trait for formatting values in lowercase exponential notation.
Used with the {x:e} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value in lowercase exponential notation and writes to the given formatter.
pub trait UpperExp
Trait for formatting values in uppercase exponential notation.
Used with the {x:E} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value in uppercase exponential notation and writes to the given formatter.
pub trait Iterator
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(&mut self) -> List<Self::Item>
Collects remaining elements into an List.
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 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.
pub trait IntoIterator
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 FromIterator<T>
Trait for creating a collection from an iterator.
This is a simplified version - the full Rust-style trait requires impl Iterator
syntax which is not yet supported.
fn from_iter(iter: Self::Iter) -> Self
pub trait PushDisplay
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 Eq
Trait for equality comparisons.
Types implementing this trait can be compared with == and != operators.
fn eq(&self, other: &Self) -> bool
Returns true if self equals other.
pub trait Ord
Trait for ordering comparisons.
Types implementing this trait can be compared with <, <=, >, >= operators.
fn cmp(&self, other: &Self) -> Ordering
Compares self with other and returns an Ordering.
pub trait Index<IndexType>
Trait for immutable indexing operations.
Types implementing this trait can be indexed with the [] operator for reading.
fn index(&self, index: IndexType) -> &Self::Output
Returns a reference to the element at the given index.
pub trait IndexMut<IndexType>
Trait for mutable indexing operations.
Types implementing this trait can be indexed with the [] operator to get
a mutable reference: container[i].mutating_method().
Note: Requires Index to be implemented (supertrait relationship).
fn index_mut(&mut self, index: IndexType) -> &mut Self::Output
Returns a mutable reference to the element at the given index.
pub trait IndexAssign<IndexType>
Trait for index assignment operations.
Types implementing this trait can be assigned via the [] operator: arr[i] = value.
This is separate from IndexMut because in Wasm GC, you cannot get a mutable reference
to primitive array elements - reading and writing are fundamentally different operations.
fn index_assign(&mut self, index: IndexType, value: Self::Input)
Assigns a value to the element at the given index.
pub trait IndexValue<IndexType>
Trait for value-returning indexing operations.
Use this for containers of primitives where references cannot be returned.
Unlike Index which returns &Output, this returns Output by value (copy).
fn index_value(&self, index: IndexType) -> Self::Output
Returns a copy of the element at the given index.
pub trait Add
Trait for the + operator.
Types implementing this trait can use the + operator for addition.
fn add(&self, rhs: &Self) -> Self::Output
Adds two values and returns the result.
pub trait Sub
Trait for the - operator (binary subtraction).
Types implementing this trait can use the - operator for subtraction.
fn sub(&self, rhs: &Self) -> Self::Output
Subtracts rhs from self and returns the result.
pub trait Mul
Trait for the * operator.
Types implementing this trait can use the * operator for multiplication.
fn mul(&self, rhs: &Self) -> Self::Output
Multiplies two values and returns the result.
pub trait Div
Trait for the / operator.
Types implementing this trait can use the / operator for division.
fn div(&self, rhs: &Self) -> Self::Output
Divides self by rhs and returns the result.
pub trait Rem
Trait for the % operator.
Types implementing this trait can use the % operator for remainder.
fn rem(&self, rhs: &Self) -> Self::Output
Returns the remainder of dividing self by rhs.
pub trait Neg
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
Trait for the & operator (bitwise AND).
fn bitand(&self, rhs: &Self) -> Self::Output
Returns the bitwise AND of self and rhs.
pub trait BitOr
Trait for the | operator (bitwise OR).
fn bitor(&self, rhs: &Self) -> Self::Output
Returns the bitwise OR of self and rhs.
pub trait BitXor
Trait for the ^ operator (bitwise XOR).
fn bitxor(&self, rhs: &Self) -> Self::Output
Returns the bitwise XOR of self and rhs.
pub trait BitNot
Trait for the ~ operator (bitwise NOT).
fn bitnot(&self) -> Self::Output
Returns the bitwise NOT of self.
pub trait Shl
Trait for the << operator (left shift).
fn shl(&self, rhs: u32) -> Self::Output
Returns self shifted left by rhs bits.
pub trait Shr
Trait for the >> operator (right shift).
fn shr(&self, rhs: u32) -> Self::Output
Returns self shifted right by rhs bits.
pub trait Display
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 Binary
Trait for formatting values as binary integers.
Used with the {x:b} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as binary and writes to the given formatter.
pub trait Octal
Trait for formatting values as octal integers.
Used with the {x:o} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as octal and writes to the given formatter.
pub trait LowerHex
Trait for formatting values as lowercase hexadecimal.
Used with the {x:x} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as lowercase hex and writes to the given formatter.
pub trait UpperHex
Trait for formatting values as uppercase hexadecimal.
Used with the {x:X} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value as uppercase hex and writes to the given formatter.
pub trait LowerExp
Trait for formatting values in lowercase exponential notation.
Used with the {x:e} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value in lowercase exponential notation and writes to the given formatter.
pub trait UpperExp
Trait for formatting values in uppercase exponential notation.
Used with the {x:E} format specifier.
fn fmt(&self, f: &mut Formatter)
Formats the value in uppercase exponential notation and writes to the given formatter.
pub trait Iterator
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(&mut self) -> List<Self::Item>
Collects remaining elements into an List.
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 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.
pub trait IntoIterator
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 FromIterator<T>
Trait for creating a collection from an iterator.
This is a simplified version - the full Rust-style trait requires impl Iterator
syntax which is not yet supported.
fn from_iter(iter: Self::Iter) -> Self
pub trait AsByteSlice
Zero-copy conversion to a ByteSlice.
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 without copying.
fn as_byte_slice(&self) -> ByteSlice with stores[self]
pub trait Step
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>]
Create a new future pair: [Future<T>, FutureWritable<T>].
fn read(&self) -> Option<T>
Read the value from the future. Returns Some(value) when fulfilled, None if the writer dropped without writing.
fn cancel_read(&self)
Cancel an in-progress read. Blocks until cancellation completes.
fn drop(self)
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)
Fulfill the future with a value.
fn cancel_write(&self)
Cancel an in-progress write. Blocks until cancellation completes.
fn drop(self)
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). Opaque i32 handle managed by the runtime.
Use Stream::<T>::new() to create a [Stream<T>, StreamWritable<T>] pair.
fn new() -> [Stream<T>, StreamWritable<T>]
Create a new stream pair: [Stream<T>, StreamWritable<T>].
fn read(&self, max: i32) -> List<T>
Read up to max elements from the stream.
Blocks until data is available or the writer drops.
Returns an empty array on end-of-stream.
fn cancel_read(&self)
Cancel an in-progress read. Blocks until cancellation completes.
fn drop(self)
Drop the readable end of the stream.
pub resource StreamWritable<T>
Writable end of an async sequence (WASI Component Model stream). Opaque i32 handle managed by the runtime.
fn write(&self, data: List<T>)
Write a chunk of data to the stream.
fn write_raw(&self, data: &Array<T>, len: i32)
Write raw GC array directly to the stream.
len is the number of valid elements (may be less than array capacity).
fn cancel_write(&self)
Cancel an in-progress write. Blocks until cancellation completes.
fn drop(self)
Drop the writable end, signaling end-of-stream.
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
Create a new waitable set.
fn wait(&self) -> WaitEvent
Block until an event occurs. Returns the event details.
fn poll(&self) -> Option<WaitEvent>
Non-blocking poll. Returns Some(event) if ready, None otherwise.
fn drop(self)
Drop the waitable set. Traps if waitables are still joined to this set.
pub resource Subtask
A raw CM subtask handle. Internal — most users should hold 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)
Drop a completed subtask. Automatically unjoins from its WaitableSet. Traps if the subtask has not yet resolved.
fn cancel(&self)
Cancel this in-progress subtask. Blocks until cancellation completes.
fn join(&self, set: &WaitableSet) -> Waitable
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
Create a new error context with the given message.
fn debug_message(&self) -> String
Get the debug message from this error context.
fn drop(self)
Drop the error context.
pub resource Task
The current async task handle.
Provides operations that apply to the currently executing async task.
fn 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>
An owned, growable byte buffer.
pub type ByteSlice = ArraySlice<u8>
A borrowed, zero-copy view over a byte buffer.
Primitive Types
bool
pub fn to_string(&self) -> String
impl LenientFromStr for bool
fn from_str_lenient(s: &String) -> 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 InspectAlt for bool
pub fn inspect_alt(&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 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 an invalid value results in an invalid char, which may cause incorrect behavior in string operations.
pub fn to_string(&self) -> String
pub fn is_ascii_whitespace(&self) -> bool
Returns true if the character is an ASCII whitespace character: SP (0x20), HT (0x09), LF (0x0A), VT (0x0B), FF (0x0C), CR (0x0D). Matches POSIX isspace() for the ASCII range.
pub fn is_whitespace(&self) -> bool
Returns true if the character is a Unicode whitespace character. Covers ASCII whitespace plus Unicode general category 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.
Equivalent to to_ascii_lowercase() == other.to_ascii_lowercase(),
but implemented branchlessly.
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) -> List<u8>
Encodes this character as UTF-8, returning the bytes.
impl LenientFromStr for char
fn from_str_lenient(s: &String) -> 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 InspectAlt for char
pub fn inspect_alt(&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 Default for char
pub fn default() -> char
impl Step for char
fn next_step(&self) -> Option<char>
i8
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<i8, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<i8, ParseIntError>
impl FromStr for i8
fn from_str_range(s: &String, start: i32, end: i32) -> Result<i8, ParseIntError>
impl LenientFromStr for i8
fn from_str_lenient(s: &String) -> 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 InspectAlt for i8
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for i8
pub fn fmt(&self, f: &mut Formatter)
impl Octal for i8
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for i8
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for i8
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for i8
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for i8
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for i8
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for i8
pub fn fmt_alt(&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 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 Step for i8
fn next_step(&self) -> Option<i8>
u8
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<u8, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<u8, ParseIntError>
impl FromStr for u8
fn from_str_range(s: &String, start: i32, end: i32) -> Result<u8, ParseIntError>
impl LenientFromStr for u8
fn from_str_lenient(s: &String) -> 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 InspectAlt for u8
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for u8
pub fn fmt(&self, f: &mut Formatter)
impl Octal for u8
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for u8
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for u8
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for u8
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for u8
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for u8
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for u8
pub fn fmt_alt(&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 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 Step for u8
fn next_step(&self) -> Option<u8>
i16
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<i16, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<i16, ParseIntError>
impl FromStr for i16
fn from_str_range(s: &String, start: i32, end: i32) -> Result<i16, ParseIntError>
impl LenientFromStr for i16
fn from_str_lenient(s: &String) -> 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 InspectAlt for i16
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for i16
pub fn fmt(&self, f: &mut Formatter)
impl Octal for i16
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for i16
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for i16
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for i16
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for i16
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for i16
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for i16
pub fn fmt_alt(&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 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 Step for i16
fn next_step(&self) -> Option<i16>
u16
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<u16, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<u16, ParseIntError>
impl FromStr for u16
fn from_str_range(s: &String, start: i32, end: i32) -> Result<u16, ParseIntError>
impl LenientFromStr for u16
fn from_str_lenient(s: &String) -> 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 InspectAlt for u16
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for u16
pub fn fmt(&self, f: &mut Formatter)
impl Octal for u16
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for u16
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for u16
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for u16
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for u16
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for u16
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for u16
pub fn fmt_alt(&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 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 Step for u16
fn next_step(&self) -> Option<u16>
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 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: &String) -> Result<i32, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<i32, ParseIntError>
impl FromStr for i32
fn from_str_range(s: &String, start: i32, end: i32) -> Result<i32, ParseIntError>
impl LenientFromStr for i32
fn from_str_lenient(s: &String) -> 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 InspectAlt for i32
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for i32
pub fn fmt(&self, f: &mut Formatter)
impl Octal for i32
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for i32
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for i32
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for i32
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for i32
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for i32
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for i32
pub fn fmt_alt(&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 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 Step for i32
fn next_step(&self) -> Option<i32>
u32
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<u32, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<u32, ParseIntError>
impl FromStr for u32
fn from_str_range(s: &String, start: i32, end: i32) -> Result<u32, ParseIntError>
impl LenientFromStr for u32
fn from_str_lenient(s: &String) -> 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 InspectAlt for u32
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for u32
pub fn fmt(&self, f: &mut Formatter)
impl Octal for u32
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for u32
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for u32
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for u32
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for u32
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for u32
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for u32
pub fn fmt_alt(&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 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 Step for u32
fn next_step(&self) -> Option<u32>
i64
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 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: &String) -> Result<i64, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<i64, ParseIntError>
impl FromStr for i64
fn from_str_range(s: &String, start: i32, end: i32) -> Result<i64, ParseIntError>
impl LenientFromStr for i64
fn from_str_lenient(s: &String) -> 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 InspectAlt for i64
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for i64
pub fn fmt(&self, f: &mut Formatter)
impl Octal for i64
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for i64
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for i64
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for i64
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for i64
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for i64
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for i64
pub fn fmt_alt(&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 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 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 Step for i64
fn next_step(&self) -> Option<i64>
u64
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 to_string(&self) -> String
pub fn from_str_hex(s: &String) -> Result<u64, ParseIntError>
pub fn from_str_radix(s: &String, radix: u32) -> Result<u64, ParseIntError>
impl FromStr for u64
fn from_str_range(s: &String, start: i32, end: i32) -> Result<u64, ParseIntError>
impl LenientFromStr for u64
fn from_str_lenient(s: &String) -> 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 InspectAlt for u64
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for u64
pub fn fmt(&self, f: &mut Formatter)
impl Octal for u64
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for u64
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for u64
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for u64
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for u64
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for u64
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for u64
pub fn fmt_alt(&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 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 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 Step for u64
fn next_step(&self) -> Option<u64>
f32
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 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 even
pub fn sqrt(x: f32) -> f32
Square root
pub fn min(x: f32, y: f32) -> f32
Minimum of two values
pub fn max(x: f32, y: f32) -> f32
Maximum of two values
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 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 is_nan(&self) -> bool
pub fn is_finite(&self) -> bool
pub fn to_bits(&self) -> i32
Reinterprets the bits of this f32 as an i32.
pub fn from_bits(bits: i32) -> f32
Creates an f32 from its bit representation.
impl FromStr for f32
fn from_str_range(s: &String, start: i32, end: i32) -> Result<f32, ParseFloatError>
impl LenientFromStr for f32
fn from_str_lenient(s: &String) -> 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 InspectAlt for f32
pub fn inspect_alt(&self, f: &mut Formatter)
impl LowerExp for f32
pub fn fmt(&self, f: &mut Formatter)
impl UpperExp for f32
pub fn fmt(&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 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>
f64
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_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 even
pub fn sqrt(x: f64) -> f64
Square root
pub fn min(x: f64, y: f64) -> f64
Minimum of two values
pub fn max(x: f64, y: f64) -> f64
Maximum of two values
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 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 is_nan(&self) -> bool
pub fn is_finite(&self) -> bool
pub fn to_bits(&self) -> i64
Reinterprets the bits of this f64 as an i64.
pub fn from_bits(bits: i64) -> f64
Creates an f64 from its bit representation.
impl FromStr for f64
fn from_str_range(s: &String, start: i32, end: i32) -> Result<f64, ParseFloatError>
impl LenientFromStr for f64
fn from_str_lenient(s: &String) -> 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 InspectAlt for f64
pub fn inspect_alt(&self, f: &mut Formatter)
impl LowerExp for f64
pub fn fmt(&self, f: &mut Formatter)
impl UpperExp for f64
pub fn fmt(&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 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>
Structs
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 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
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
Width uses -1 for "not specified"; precision uses 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
zero_pad: bool
Whether to use zero-padding (0 flag)
width: i32
Minimum field width (-1 = no minimum)
precision: i32
Decimal places for floats; max rendered length for sequences (chars /
elements). Negative values are the sentinels on impl Formatter.
indent: i32
Current indentation level for pretty-printing (used by InspectAlt)
buf: &mut String
Reference to the output buffer
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 with stores[buf]
Create a Formatter with the default spec, writing into the given buffer.
pub fn write_str(&mut self, s: &String)
Write a string to the output buffer.
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(&mut self, content: String)
Pad a pre-formatted content string to the configured width. If no width is set or content is already at least as wide, writes content as-is.
pub fn mark(&self) -> i32
Return the current byte position in the output buffer.
Used with apply_padding for the speculative-write pattern:
- Call
mark()to record the start position - Write content directly to
buf_mut() - 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.
The fill character must be ASCII (single byte); non-ASCII fill is not supported.
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(&mut self, is_negative: bool, prefix: String, 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.
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(&mut self, open: String)
Open a pretty-printed brace: write opening delimiter, increase indent.
pub fn close_brace(&mut self, close: String)
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 fn from_u64(value: u64) -> u128
Create a u128 from a u64 value (zero-extended)
pub fn from_pair(low: u64, high: u64) -> u128
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: &String) -> Result<u128, ParseIntError>
Parse a hexadecimal u128 from a string (equivalent to from_str_radix(s, 16)).
pub fn from_str_radix(s: &String, 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_range(s: &String, start: i32, end: i32, radix: u32) -> Result<u128, ParseIntError>
Range variant of from_str_radix. Parses s[start..end) as a u128
in the given radix without allocating a substring.
pub fn zero() -> u128
Creates a zero u128
pub fn one() -> u128
Creates a u128 with value 1
pub fn low(&self) -> u64
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
Create a u128 from an i128 (reinterpret bits)
Used by the compiler to lower i128 as u128 casts.
pub fn as_f64(&self) -> 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
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) Uses binary long division algorithm (shift-subtract) Panics if divisor is zero
pub fn get_bit(&self, i: i32) -> bool
Get the bit at position i (0 = LSB, 127 = MSB)
pub fn set_bit(&self, i: i32) -> u128
Set the bit at position i to 1, returning a new u128
pub fn to_string(&self) -> String
Convert u128 to String (for template string interpolation)
impl FromStr for u128
fn from_str_range(s: &String, start: i32, end: i32) -> Result<u128, ParseIntError>
impl LenientFromStr for u128
fn from_str_lenient(s: &String) -> Result<u128, LenientParseError>
impl Display for u128
pub fn fmt(&self, f: &mut Formatter)
impl Inspect for u128
pub fn inspect(&self, f: &mut Formatter)
impl InspectAlt for u128
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for u128
pub fn fmt(&self, f: &mut Formatter)
impl Octal for u128
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for u128
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for u128
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for u128
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for u128
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for u128
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for u128
pub fn fmt_alt(&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 fn from_i64(value: i64) -> i128
Create an i128 from an i64 value (sign-extended)
pub fn from_pair(low: u64, high: i64) -> i128
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: &String) -> Result<i128, ParseIntError>
Parse a hexadecimal i128 from a string (equivalent to from_str_radix(s, 16)).
pub fn from_str_radix(s: &String, 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_range(s: &String, start: i32, end: i32, radix: u32) -> Result<i128, ParseIntError>
Range variant of from_str_radix. Parses s[start..end) as an i128
in the given radix without allocating a substring.
pub fn zero() -> i128
Creates a zero i128
pub fn one() -> i128
Creates an i128 with value 1
pub fn low(&self) -> u64
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
Create i128 from u128 (reinterpret bits)
Used by the compiler to lower u128 as i128 casts.
pub fn as_f64(&self) -> 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
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:
- quotient is negative if signs differ
- remainder has the same sign as dividend Panics if divisor is zero
pub fn to_string(&self) -> String
Convert i128 to String (for template string interpolation)
impl FromStr for i128
fn from_str_range(s: &String, start: i32, end: i32) -> Result<i128, ParseIntError>
impl LenientFromStr for i128
fn from_str_lenient(s: &String) -> Result<i128, LenientParseError>
impl Display for i128
pub fn fmt(&self, f: &mut Formatter)
impl Inspect for i128
pub fn inspect(&self, f: &mut Formatter)
impl InspectAlt for i128
pub fn inspect_alt(&self, f: &mut Formatter)
impl Binary for i128
pub fn fmt(&self, f: &mut Formatter)
impl Octal for i128
pub fn fmt(&self, f: &mut Formatter)
impl LowerHex for i128
pub fn fmt(&self, f: &mut Formatter)
impl UpperHex for i128
pub fn fmt(&self, f: &mut Formatter)
impl BinaryAlt for i128
pub fn fmt_alt(&self, f: &mut Formatter)
impl OctalAlt for i128
pub fn fmt_alt(&self, f: &mut Formatter)
impl LowerHexAlt for i128
pub fn fmt_alt(&self, f: &mut Formatter)
impl UpperHexAlt for i128
pub fn fmt_alt(&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
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 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
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)
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
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
Returns the kind of this error.
pub struct ParseFloatError
Error returned by float parsing.
kind: FloatErrorKind
pub fn new(kind: FloatErrorKind) -> ParseFloatError
pub fn kind(&self) -> FloatErrorKind
Returns the kind of this error.
pub struct ArraySlice<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.
Fields are private.
pub fn len(&self) -> i32
Returns the number of elements in the slice.
Also the byte-length anchor for the synthesised FieldSchema::lookup
(on ArraySlice<u8>), routed through #[compiler_item] so a rename
here cannot silently break code generation.
pub fn is_empty(&self) -> bool
Returns true if the slice has no elements.
pub fn get(&self, index: i32) -> Option<T>
Returns a copy of the element at index, or None if out of bounds.
pub fn get_unchecked(&self, index: i32) -> T
Returns the element at index without bounds checking.
The caller must guarantee 0 <= index < len(); an out-of-range
index reads past the view into the backing array or traps.
Also the byte-read anchor for the synthesised FieldSchema::lookup
(on ArraySlice<u8>), routed through #[compiler_item] for the same
rename-safety reason as len.
pub fn slice(&self, start: i32, end: i32) -> ArraySlice<T>
Returns a sub-slice over [start, end) relative to this slice, clamped
to its bounds.
pub fn iter(&self) -> ArrayIter<T>
Returns a by-value iterator over the slice.
pub fn to_array(&self) -> Array<T>
Copies the slice's elements into a new Array<T>.
impl IndexValue<i32> for ArraySlice<T>
fn index_value(&self, index: i32) -> Self::Output
impl IntoIterator for ArraySlice<T>
fn into_iter(&self) -> Self::Iter
pub struct ArrayIter<T>
A by-value forward iterator over a backing Array<T> range [index, end).
Fields are private.
pub fn collect(&mut self) -> List<T>
Collects the remaining elements into a new List<T> with a single bulk
copy of the underlying range.
pub fn sum(&mut self) -> Option<T>
pub fn min(&mut self) -> Option<T>
pub fn max(&mut self) -> Option<T>
impl Iterator for ArrayIter<T>
fn next(&mut self) -> Option<Self::Item>
impl IntoIterator for ArrayIter<T>
fn into_iter(&self) -> ArrayIter<T>
pub struct ArrayRefIter<T>
A by-reference forward iterator over a backing Array<T> range, yielding
&T. The yielded reference points to a fresh copy of each element (Wasm GC
has no interior references), so it is a read-only view and cannot mutate the
backing array. Backs for x of &list.
Fields are private.
pub fn copied(&self) -> ArrayIter<T>
Value ("copied") view over the same backing: yields T instead of &T.
Mirrors Rust's iter().copied(), letting a reference iterator over a
primitive list read as values (xs.iter().copied()).
impl Iterator for ArrayRefIter<T>
fn next(&mut self) -> Option<Self::Item>
pub struct ArrayWindows<T>
An iterator over overlapping windows of size consecutive elements. Each
item is a ArraySlice<T> viewing the backing array.
Fields are private.
impl Iterator for ArrayWindows<T>
fn next(&mut self) -> Option<Self::Item>
impl IntoIterator for ArrayWindows<T>
fn into_iter(&self) -> ArrayWindows<T>
pub struct ArrayChunks<T>
An iterator over non-overlapping chunks of up to size elements. The last
chunk may be shorter. Each item is a ArraySlice<T> viewing the backing array.
Fields are private.
impl Iterator for ArrayChunks<T>
fn next(&mut self) -> Option<Self::Item>
impl IntoIterator for ArrayChunks<T>
fn into_iter(&self) -> ArrayChunks<T>
pub struct String
UTF-8 encoded string type with O(1) amortized push_str
Fields are private.
pub fn new() -> String
Create a new empty string with no allocated capacity.
pub fn with_capacity(capacity: i32) -> String
Create a new empty string with the specified capacity
The string starts empty but has space for capacity bytes
pub fn len(&self) -> i32
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
Read the byte at index without bounds checks.
Safety (caller-side preconditions)
0 <= index < self.len().
For safe byte access, use bytes() iterator instead. This method is
reserved for performance-critical code where bounds have been proven.
pub fn as_bytes(&self) -> ArraySlice<u8> with stores[self]
Zero-copy view of the string's UTF-8 bytes as an ArraySlice<u8>.
No allocation: the slice references the string's backing buffer over
[0, len()). Used by the byte-based deserializers to hand a wire key
to FieldSchema::lookup without a String copy. The AsByteSlice
trait impl (in core:prelude/bytes.wado) wraps this as a ByteSlice.
pub fn set_byte_unchecked(&mut self, index: i32, value: u8)
Write the byte at index without bounds or UTF-8 checks.
Safety (caller-side preconditions)
0 <= index < self.len().- The resulting byte sequence must remain valid UTF-8. This is the
caller's responsibility (cf. Rust's
as_bytes_mut, which isunsafe).
pub fn grow(&mut self, min_capacity: i32)
Ensure the string has capacity for at least min_capacity bytes.
If the current capacity is less than min_capacity, grows the buffer.
Uses amortized doubling strategy for efficiency.
pub fn append_byte_filled(&mut self, byte: u8, n: i32)
Append n copies of byte to this string using array.fill.
Much faster than a loop for large n (e.g., trailing zeros in large integers).
pub fn push_str(&mut self, other: &String)
Appends another string to this string. Grows the string if necessary (O(1) amortized).
pub fn push_bytes_unchecked(&mut self, bytes: List<u8>)
Append all bytes of bytes to this string (bulk-copy, single array_copy).
Safety (caller-side preconditions)
- The resulting byte sequence (existing bytes + new bytes) must be valid UTF-8.
pub fn push_str_range_unchecked(&mut self, s: &String, start: i32, end: i32)
Append the byte range [start, end) of s to this string
(bulk-copy, single array_copy).
Safety (caller-side preconditions)
0 <= start <= end <= s.len().startandendmust lie on UTF-8 character boundaries ofs.- The resulting byte sequence must remain valid UTF-8.
pub fn push_byte_slice_unchecked(&mut self, bytes: ByteSlice)
Append the bytes of bytes to this string in one bulk array_copy.
Safety (caller-side preconditions)
- The resulting byte sequence must remain valid UTF-8.
pub fn bytes(&self) -> StrUtf8ByteIter with stores[self]
Returns an iterator over the UTF-8 bytes of the string.
pub fn chars(&self) -> StrCharIter with stores[self]
Returns an iterator over the Unicode scalar values (chars) of the string.
pub fn to_chars(&self) -> List<char>
Decode the whole string into an owned 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.
Safety (caller-side preconditions)
byte_indexlies on a UTF-8 character boundary.- The full multi-byte sequence (1–4 bytes) starting at
byte_indexis in range[0, self.len()).
pub fn push(&mut self, c: char)
Appends a Unicode scalar value (char) to this string.
pub fn truncate(&mut self, byte_len: i32)
Truncates the string to the given byte length.
Panics if byte_len is negative or not on a UTF-8 character boundary.
pub fn truncate_unchecked(&mut self, byte_len: i32)
Truncate without bounds or UTF-8 boundary checks.
Safety (caller-side preconditions)
0 <= byte_len <= self.len().byte_lenlies on a UTF-8 character boundary.
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. Mirrors Rust's str::is_char_boundary.
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 trim_ascii_start(&self) -> String
Returns a new string with leading ASCII whitespace removed.
pub fn trim_ascii_end(&self) -> String
Returns a new string with trailing ASCII whitespace removed.
pub fn trim_ascii(&self) -> String
Returns a new string with leading and trailing ASCII whitespace removed.
pub fn trim_start(&self) -> String
Returns a new string with leading Unicode whitespace removed.
pub fn trim_end(&self) -> String
Returns a new string with trailing Unicode whitespace removed.
pub fn trim(&self) -> String
Returns a new string with leading and trailing Unicode whitespace removed.
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(&self, other: String) -> 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 either end is not on a UTF-8 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.
Safety (caller-side preconditions)
0 <= start <= end <= self.len().startandendlie on UTF-8 character boundaries.
pub fn contains(&self, pat: String) -> bool
Returns true if this string contains the given substring.
pub fn starts_with(&self, pat: String) -> bool
Returns true if this string starts with the given prefix.
pub fn ends_with(&self, pat: String) -> bool
Returns true if this string ends with the given suffix.
pub fn strip_prefix(&self, prefix: String) -> Option<String>
Returns the string with prefix removed from the front, or None when it
does not start with prefix.
pub fn strip_suffix(&self, suffix: String) -> Option<String>
Returns the string with suffix removed from the end, or None when it
does not end with suffix.
pub fn find(&self, pat: String) -> Option<i32>
Returns the byte index of the first occurrence of pat, or None.
pub fn rfind(&self, pat: String) -> 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, mut 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.
Safety (caller-side preconditions)
0 <= byte_index <= self.len().byte_indexlies on a UTF-8 character boundary.
pub fn insert_str(&mut self, byte_index: i32, s: String)
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(&mut self, byte_index: i32, s: String)
Inserts a string at byte_index without bounds or UTF-8 boundary checks.
Safety (caller-side preconditions)
0 <= byte_index <= self.len().byte_indexlies on a UTF-8 character boundary.
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.
Safety (caller-side preconditions)
0 <= byte_index < self.len().byte_indexlies on a UTF-8 character boundary.
pub fn repeat(&self, n: i32) -> String
Returns this string repeated n times.
pub fn replace(&self, from: String, to: String) -> String
Replaces all occurrences of from with to.
pub fn replacen(&self, from: String, to: String, 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 any iterable of chars.
pub fn from_utf8<I: IntoIterator<Item = u8>>(bytes: I) -> Result<String, String>
Build a String from any iterable of bytes, validating that they form valid UTF-8. Returns Ok(String) on success, or Err(String) with an error message on failure.
Accepts any IntoIterator whose item is u8: List<u8>, StrUtf8ByteIter, etc.
pub fn from_utf8_slice(bytes: ByteSlice) -> Result<String, String>
Validate a contiguous byte slice as UTF-8 and wrap it as a String with
a single bulk copy — no per-codepoint decode-and-re-encode.
The validation core that from_utf8 and the JSON deserializer route
through: one forward pass over decode_utf8_scalar, then one to_array
copy wrapped via internal_from_utf8_raw. Cheaper than from_utf8's old
codepoint-by-codepoint rebuild whenever the bytes already live in one
buffer (e.g. a JSON string token sliced out of the borrowed input).
pub fn is_valid_utf8(bytes: ByteSlice) -> bool
Whether bytes is well-formed UTF-8, in one forward decode_utf8_scalar
pass. Splits validation from the copy so callers that already own a
buffer can validate in place (e.g. the JSON deserializer appending a
scanned run straight into its result).
pub fn from_utf8_lossy<I: IntoIterator<Item = u8>>(bytes: I) -> String
Build a String from any iterable of bytes, replacing invalid UTF-8 sequences with U+FFFD.
Accepts any IntoIterator whose item is u8: List<u8>, StrUtf8ByteIter, etc.
pub fn from_utf8_unchecked<I: IntoIterator<Item = u8>>(bytes: I) -> String
Build a String from any iterable of bytes without UTF-8 validation.
Accepts any IntoIterator whose item is u8: List<u8>, StrUtf8ByteIter, etc.
Safety
The caller must ensure the bytes form valid UTF-8, otherwise the resulting String will contain invalid UTF-8, which may cause undefined behavior.
pub fn split(&self, sep: String) -> StrSplitIter with stores[self]
Returns an iterator over substrings split by the given separator.
pub fn splitn(&self, n: i32, sep: String) -> StrSplitNIter with stores[self]
Returns an iterator over at most n substrings split by the given separator.
pub fn split_whitespace(&self) -> StrSplitWhitespaceIter with stores[self]
Returns an iterator over whitespace-separated substrings.
pub fn lines(&self) -> StrLinesIter with stores[self]
Returns an iterator over the lines of this string.
pub fn char_indices(&self) -> StrCharIndicesIter with stores[self]
Returns an iterator over characters with their byte indices.
impl Add for String
pub fn add(&self, other: &Self) -> Self::Output
impl Eq for String
pub fn eq(&self, other: &Self) -> bool
fn eq_bytes(a: &Array<u8>, b: &Array<u8>, len: i32) -> bool
impl LenientFromStr for String
fn from_str_lenient(s: &String) -> Result<String, LenientParseError>
Identity: any string parses to itself. Never fails.
impl Ord for String
pub fn cmp(&self, other: &Self) -> Ordering
impl Default for String
pub fn default() -> String
impl From<char> for String
pub fn from(value: char) -> String
pub struct StrUtf8ByteIter
Iterator over UTF-8 bytes of a String. Yields each byte as u8.
Fields are private.
impl Iterator for StrUtf8ByteIter
pub fn next(&mut self) -> Option<Self::Item>
pub struct StrCharIter
Iterator over Unicode scalar values (chars) of a String. Decodes UTF-8 and yields each character.
Fields are private.
impl Iterator for StrCharIter
pub fn next(&mut self) -> Option<Self::Item>
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 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
pub struct List<T>
Fields are private.
pub fn with_capacity(capacity: i32) -> List<T>
pub fn grow(&mut self)
pub fn filled(n: i32, element: T) -> List<T>
pub fn from_tuple<..Elems>(elements: [..Elems]) -> List<T>
Collect a homogeneous tuple [T, T, ...] into a List<T>.
pub fn len(&self) -> i32
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> i32
Returns the total number of elements the list can hold without reallocating.
pub fn push(&mut self, value: T) with stores[value]
Appends a single element to the end.
pub fn push_within_capacity(&mut self, value: T) with stores[value]
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 first(&self) -> Option<T>
Returns the first element, or None if empty.
pub fn last(&self) -> Option<T>
pub fn get(&self, index: i32) -> Option<T>
pub fn get_unchecked(&self, index: i32) -> T
Element at index without the [] power-assert. The caller must
guarantee 0 <= index < len(); out of range reads a stale slot or traps.
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) with stores[value]
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().
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)
pub fn clear(&mut self)
Removes all elements.
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: ArraySlice<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 ArraySlice<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 contains(&self, value: &T) -> bool
Returns true if the list contains the given value.
pub fn slice(&self, start: i32, end: i32) -> ArraySlice<T>
Returns a zero-copy view over [start, end), clamped to [0, len()).
pub fn as_slice(&self) -> ArraySlice<T>
Returns a view over the whole list.
pub fn iter(&self) -> ArrayRefIter<T>
Returns an iterator over references to the list's elements (&T),
mirroring Rust's iter(). For owned values use into_iter() or
for let x of list (both yield T); to turn a reference iterator back
into values, chain copied().
pub fn windows(&self, size: i32) -> ArrayWindows<T>
Returns an iterator over overlapping windows of size consecutive
elements. Panics if size is not positive.
pub fn chunks(&self, size: i32) -> ArrayChunks<T>
Returns an iterator over non-overlapping chunks of up to size
elements. The last chunk may be shorter. Panics if size is not
positive.
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.
pub fn get_byte_unchecked(&self, index: i32) -> u8
Returns the byte at index without bounds checking — the List<u8>
parallel to String::get_byte_unchecked.
The caller must guarantee 0 <= index < len(); an out-of-range index
reads past the buffer or traps. Intended for hot byte-scanning loops that
have already range-checked index (e.g. a forthcoming core:cbor
decoder over an owned ByteList).
pub fn to_hex(&self) -> String
Renders the bytes as a lowercase hexadecimal string, two digits per
byte (e.g. [0x0f, 0xa0] -> "0fa0").
impl IndexValue<i32> for List<T>
fn index_value(&self, index: i32) -> Self::Output
impl IndexAssign<i32> for List<T>
fn index_assign(&mut self, index: i32, value: Self::Input) with stores[value]
impl Eq for List<T>
pub fn eq(&self, other: &Self) -> bool
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>) -> ArraySlice<T>
impl IndexValue<RangeInclusive<i32>> for List<T>
fn index_value(&self, range: RangeInclusive<i32>) -> ArraySlice<T>
impl IntoIterator for List<T>
fn into_iter(&self) -> Self::Iter
impl FromIterator<T> for List<T>
fn from_iter(iter: ArrayIter<T>) -> List<T>
impl SequenceLiteralBuilder for List<T>
fn new_literal(capacity: i32) -> List<T>
fn push_literal(&mut self, value: T) with stores[value]
fn build(&self) -> 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)
impl InspectAlt for List<T>
pub fn inspect_alt(&self, f: &mut Formatter)
impl DisplayAlt for List<T>
pub fn fmt_alt(&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 Some(T) or None
Some(T)
None
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 Alignment
Text alignment for padding.
Left
Left-aligned: {x:<5} -> "42 "
Center
Center-aligned: {x:^5} -> " 42 "
Right
Right-aligned (default for numbers): {x:>5} -> " 42"
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 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.
