Module prelude
Prelude — automatically imported into every Yo source file.
Provides core language primitives: traits (Comptime, Runtime, Clone,
Eq, Ord, Hash, …), fundamental types (Option, Result, Box,
Slice, Range, String, …), operator traits (Add, Sub, …), type
reflection (TypeInfo), conversion (Into, From), the async runtime
(Io, Future, JoinHandle), and derive rules.
Do NOT import std/prelude — it is loaded automatically and an
explicit import will produce a compile error.
Stability
The prelude is the one module whose surface is a language decision, not a library one: every name here is in scope in every Yo file, so adding one can shadow a user's binding and removing one breaks every program. Treat additions as breaking changes in review even though the compiler will not call them that.
Broadly stable: the core traits (Clone, Eq, Ord, Hash, Dispose,
Send, Rc, the operator traits), Option, Result, Box, Range,
the numeric types and their inherent methods, and the async vocabulary
(Io, Future, JoinHandle). These have Rust's names and meanings and
are not expected to move.
Known to move: the byte-conversion battery. to_be_bytes, to_le_bytes,
from_be_bytes and from_le_bytes are written ten times, once per integer
type, because the return type is Array(u8, N) with N the receiver's
width — and an associated constant in a LENGTH position is not
substitutable
(issues/associated-constant-in-a-type-position-resolves-to-zero.md, now a
diagnostic rather than a silent zero). usize/isize deliberately have
none, because their width is the target's. When the value half of
substitute() lands
(plans/backlog/VALUE_SUBSTITUTION_IN_TYPE_POSITIONS.md) these collapse
onto one blanket impl and usize/isize gain them, which is additive for
callers but changes where the methods are defined.
Types
File-level privilege flag for the pragma(...) builtin. Declared
at the top of a Yo file (e.g. pragma(Pragma.AllowUnsafe);) to
opt the file into compiler-recognized behaviors. See
plans/reference/MEMORY_SAFETY.md.
Variants
| Variant | Fields | Description |
|---|---|---|
AllowUnsafe | File is permitted to use raw pointer ops, | |
AllowMacroDef | File is permitted to DEFINE macro functions — | |
SkipPrelude | Disable the auto-import of | |
SkipWasm | Test-runner directive: skip this test file on ALL WASM targets. | |
SkipWasm32Emscripten | Test-runner directive: skip when target is wasm32-unknown-emscripten. | |
SkipWasm32Wasi | Test-runner directive: skip when target is wasm32-wasip1. | |
SkipWindows | File is skipped by the test runner when the target OS is Windows. For tests that depend on a POSIX-only or not-yet-ported platform facility (e.g. std/crypto/tls needs OpenSSL, absent on the Windows runners — Schannel is the deferred Windows path). Mirrors the SkipWasm32* variants. | |
Verify | Formal verification: contracts in this file are proof obligations. Phase 0 only registers the pragma; later phases will hook in verification. See plans/backlog/FORMAL_VERIFICATION.md. | |
VerifyOrAssert | Formal verification: try to prove, fall back to runtime assert when proof times out. The production mode for verified code. | |
NoContracts | Formal verification: erase contract clauses entirely (no proof, no runtime assert). For release/benchmark builds. | |
StrictBorrow | Strict borrowed loops: inside |
Trait Implementations
=== Cycle-GC tracing ===
GcTracer carries the cycle collector's edge-registration callback (an opaque
raw pointer). A Trace impl calls tracer.visit(slot) once per outgoing edge,
passing a POINTER to where the child lives (a struct field or a container buffer
element). The raw callback is never touched directly.
Fields
| Name | Type | Description |
|---|---|---|
_callback | *(u8) |
impl(GcTracer, ...)
visit : (GcTracer) fn(generic(T) self : GcTracer, slot : *(T)) -> unitTrace one outgoing edge. slot points at where the child lives; the collector
reads *slot WITHOUT touching its reference count — registering the edge if it
is a managed handle and recursing inline through value structure otherwise.
Passing the slot pointer (not the element by value) keeps tracing RC-neutral: a
by-value managed handle would be dup'd then dropped, freeing a live element
mid-collection.
Parameters
| Name | Type | Notes |
|---|---|---|
self | GcTracer | |
slot | *(T) |
Returns: unit
Ordering — result of a comparison.
Variants
| Variant | Fields | Description |
|---|---|---|
Less | Left-hand side is less than right-hand side. | |
Equal | Both sides are equal. | |
Greater | Left-hand side is greater than right-hand side. |
ComptimeValue — a data document read at COMPILE time (plans/BUILD_AND_DEPENDENCY_SYSTEM_REDESIGN.md §5.2).
comptime_json_parse and comptime_toml_parse return one of these. No
runtime container can exist at compile time, so the tree is built from
ComptimeList and comptime scalars only.
A table keeps PARALLEL key and value lists, the shape std/encoding/json's
JsonValue.Object and std/encoding/toml's TomlValue.Table already use.
The plan sketched a separate ComptimeEntry struct instead; that shape is
not expressible, because ComptimeEntry.value : ComptimeValue and
ComptimeValue.Table(… ComptimeEntry) are mutually recursive TYPE
definitions and the evaluator rejects those ("cyclic definition"). Parallel
lists need only Self, which is fine. Keys are in document order.
Variants
| Variant | Fields | Description |
|---|---|---|
Null | JSON | |
Bool | v: bool |
|
Int | v: comptime_int | An integer. JSON numbers that are whole become |
Float | v: comptime_float | A non-integral number. |
Str | v: comptime_str |
|
List | items: ComptimeList(<enum:enum_decl_31209__home_runner_work_Yo_Yo_std_prelude_yo>) | An array, in document order. |
Table | keys: ComptimeList(comptime_str), values: ComptimeList(<enum:enum_decl_31209__home_runner_work_Yo_Yo_std_prelude_yo>) | A table/object: |
Trait Implementations
impl(ComptimeValue, Comptime())
impl(ComptimeValue, Acyclic())
impl(ComptimeValue, ...)
get : (ComptimeValue) fn(self : ComptimeValue, key : comptime_str) -> ComptimeValueThe value under key, or .Null when this is not a table or has no such
key. .Null rather than an Option because an Option of a comptime value
is itself awkward to match at compile time, and a missing key and a JSON
null behave the same way for every use this exists for.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
key | comptime_str | comptime |
Returns: ComptimeValue
at : (ComptimeValue) fn(self : ComptimeValue, i : usize) -> ComptimeValueThe element at i, or .Null when this is not a list or i is past its
end.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
i | usize | comptime |
Returns: ComptimeValue
len : (ComptimeValue) fn(self : ComptimeValue) -> usizeThe number of elements of a list, or entries of a table; 0 otherwise.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
Returns: usize
as_str : (ComptimeValue) fn(self : ComptimeValue, fallback : comptime_str) -> comptime_strThe string this holds, or fallback when it holds anything else.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
fallback | comptime_str | comptime |
Returns: comptime_str
as_int : (ComptimeValue) fn(self : ComptimeValue, fallback : comptime_int) -> comptime_intThe integer this holds, or fallback when it holds anything else.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
fallback | comptime_int | comptime |
Returns: comptime_int
as_bool : (ComptimeValue) fn(self : ComptimeValue, fallback : bool) -> boolThe boolean this holds, or fallback when it holds anything else.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
fallback | bool | comptime |
Returns: bool
is_null : (ComptimeValue) fn(self : ComptimeValue) -> boolTrue when this is .Null — a missing key or an explicit JSON null.
Parameters
| Name | Type | Notes |
|---|---|---|
self | ComptimeValue | comptime |
Returns: bool
ExprList
Type reflection metadata structs — used by Type.get_info().
StructKind — discriminant for struct flavors.
Variants
| Variant | Fields | Description |
|---|---|---|
Struct | Regular value struct. | |
Object | Reference-counted object. | |
AtomicObject | Atomic reference-counted object. | |
NewType | Single-field newtype wrapper. |
Trait Implementations
impl(StructKind, Comptime())
TypeFieldInfo — metadata for a single struct/object field.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
field_type | Type | Field type. |
Trait Implementations
impl(TypeFieldInfo, Comptime())
impl(TypeFieldInfo, ...)
to_expr : (TypeFieldInfo) fn(self : TypeFieldInfo) -> ExprConvert the field name to a quoted expression.
Parameters
| Name | Type | Notes |
|---|---|---|
self | TypeFieldInfo | comptime |
Returns: Expr
TraitInfo — lightweight reference to a trait type.
Fields
| Name | Type | Description |
|---|---|---|
trait_type | Type | The trait's |
Trait Implementations
impl(TraitInfo, Comptime())
TraitFieldInfo — metadata for a single trait field.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
field_type | Type | Field type. |
is_associated_type | bool |
|
Trait Implementations
impl(TraitFieldInfo, Comptime())
ParamInfo — metadata for a function parameter.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
param_type | Type | Parameter type. |
is_comptime | bool |
|
is_quote | bool |
|
is_variadic | bool |
|
Trait Implementations
impl(ParamInfo, Comptime())
ForallParamInfo — metadata for a generic type parameter.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
param_type | Type | Parameter type. |
Trait Implementations
impl(ForallParamInfo, Comptime())
ImplicitParamInfo — metadata for a using/effect parameter.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
param_type | Type | Parameter type. |
Trait Implementations
impl(ImplicitParamInfo, Comptime())
FunctionInfo — metadata for a function type.
Fields
| Name | Type | Description |
|---|---|---|
params | ComptimeList(ParamInfo) | Regular parameters. |
return_type | Type | Return type. |
forall_params | ComptimeList(ForallParamInfo) | Optional generic parameters for generic types. |
implicit_params | ComptimeList(ImplicitParamInfo) | Implicit |
is_closure | bool |
|
Trait Implementations
impl(FunctionInfo, Comptime())
TraitKind — discriminant for different trait flavors.
Variants
| Variant | Fields | Description |
|---|---|---|
Future | child: Type, effects: ComptimeList(TraitInfo) | A Future trait with child type and effects. |
Fn | call: FunctionInfo | A callable |
Normal | A normal user-defined trait. |
Trait Implementations
impl(TraitKind, Comptime())
VariantInfo — metadata for an enum variant.
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
fields | ComptimeList(TypeFieldInfo) | Variant fields (may be empty for unit variants). |
_enum_type | Type | |
_variant_index | usize |
Trait Implementations
impl(VariantInfo, Comptime())
TypeInfo — compile-time enum representing rich type metadata.
Returned by Type.get_info() for compile-time type reflection.
Variants
| Variant | Fields | Description |
|---|---|---|
Unit | ||
Bool |
| |
Usize | ||
Isize | ||
U8 | ||
I8 | ||
U16 | ||
I16 | ||
U32 | ||
I32 | ||
U64 | ||
I64 | ||
F32 | ||
F64 | ||
Char | ||
Short | ||
UShort | ||
Int | An integer. JSON numbers that are whole become | |
UInt | ||
Long | ||
ULong | ||
LongLong | ||
ULongLong | ||
LongDouble | ||
Void | ||
Str |
| |
Array | element: Type, length: comptime_int | |
Tuple | fields: ComptimeList(TypeFieldInfo) | |
Struct | fields: ComptimeList(TypeFieldInfo), kind: StructKind | Regular value struct. |
Enum | variants: ComptimeList(VariantInfo) | |
Union | fields: ComptimeList(TypeFieldInfo) | |
Function | info: FunctionInfo | |
Ptr | pointee: Type | |
Iso | child: Type | |
Dyn | required_traits: ComptimeList(TraitInfo), negative_traits: ComptimeList(TraitInfo) | |
Trait | fields: ComptimeList(TraitFieldInfo), kind: TraitKind | |
Type | level: comptime_int | |
Some | name: comptime_str, required_traits: ComptimeList(TraitInfo), negative_traits: ComptimeList(TraitInfo), resolved_type: Type | |
ComptimeInt | ||
ComptimeFloat | ||
ComptimeStr | ||
ComptimeList | element: Type | |
Expr | ||
EffectsRow | ||
TypeApplication |
Trait Implementations
impl(TypeInfo, Comptime())
impl(TypeInfo, ...)
is_struct : (TypeInfo) fn(self : TypeInfo) -> boolis_enum : (TypeInfo) fn(self : TypeInfo) -> boolis_union : (TypeInfo) fn(self : TypeInfo) -> boolis_tuple : (TypeInfo) fn(self : TypeInfo) -> boolis_array : (TypeInfo) fn(self : TypeInfo) -> boolis_str : (TypeInfo) fn(self : TypeInfo) -> boolis_function : (TypeInfo) fn(self : TypeInfo) -> boolis_pointer : (TypeInfo) fn(self : TypeInfo) -> boolis_trait : (TypeInfo) fn(self : TypeInfo) -> boolis_void : (TypeInfo) fn(self : TypeInfo) -> boolis_primitive : (TypeInfo) fn(self : TypeInfo) -> boolis_integer : (TypeInfo) fn(self : TypeInfo) -> boolis_float : (TypeInfo) fn(self : TypeInfo) -> boolis_comptime : (TypeInfo) fn(self : TypeInfo) -> booltrue if the parameter is compile-time (comptime).
Parameters
| Name | Type | Notes |
|---|---|---|
self | TypeInfo | comptime |
Returns: bool
is_numeric : (TypeInfo) fn(self : TypeInfo) -> boolFieldInfo — compile-time struct field metadata for derive rules (legacy alias).
Fields
| Name | Type | Description |
|---|---|---|
name | comptime_str | Variant name. |
field_type | Type | Field type. |
Trait Implementations
impl(FieldInfo, Comptime())
impl(FieldInfo, ...)
to_expr : (FieldInfo) fn(self : FieldInfo) -> ExprConvert the field name to a quoted expression.
Parameters
| Name | Type | Notes |
|---|---|---|
self | FieldInfo | comptime |
Returns: Expr
Function type for mapping over struct fields during derive.
Function type for mapping over enum variants during derive.
DeriveContext — context passed to derive rule functions (needs Option).
Used by the derive macro to generate trait implementations.
Fields
| Name | Type | Description |
|---|---|---|
target | Expr | The AST expression for the target type. |
forall_params | Option(Expr) | Optional generic parameters for generic types. |
where_clause | Option(Expr) | Optional where clause for constrained generics. |
Trait Implementations
impl(DeriveContext, Comptime())
impl(DeriveContext, ...)
make_impl : (DeriveContext) fn(self : DeriveContext, trait_body : Expr) -> ExprFutureState — the state of an async Future.
Variants
| Variant | Fields | Description |
|---|---|---|
Pending | The future has been created but not yet started. | |
Running | The future is actively running. | |
Completed | The future completed successfully. | |
Aborted | The future was aborted (e.g., via |
Trait Implementations
impl(FutureState, Acyclic())
impl(FutureState, Runtime())
impl(FutureState, Send())
impl(FutureState, Eq(FutureState))
Methods
== : (FutureState) fn(lhs : FutureState, rhs : FutureState) -> bool!= : (FutureState) fn(lhs : FutureState, rhs : FutureState) -> boolIo module — the async runtime effect.
Provides io.async, io.await, io.spawn, and io.state operations.
Automatically injected into main when declared with io : Io.
Fields
| Name | Type | Description |
|---|---|---|
async | fn(generic(T, E) action : Impl : (Fn(E) -> T)) -> Impl : (Future[Future](T) E : E) | Create a new |
await | fn(generic(T, E) fut : Impl : (Future[Future](T) E : E), e : E) -> T | Await a |
state | fn(generic(T, E) fut : Impl : (Future[Future](T) E : E)) -> FutureState | The task's current |
spawn | fn(generic(T, E) fut : Impl : (Future[Future](T) E : E), e : E) -> JoinHandle(T) | Spawn a |
Traits / Modules
Comptime trait — indicates a type that can be used at compile-time.
Examples: i32, bool, Type, comptime_int, comptime_float, comptime_str.
Non-examples: int, ushort (runtime-only types).
Implementors
Runtime trait — indicates a type that can be used at runtime.
Examples: i32, bool, *(i32), void.
Non-examples: comptime_int, comptime_float, comptime_str, Type (compile-time-only types).
Implementors
Send trait — indicates a type that can be safely transferred between threads.
Implementors
Acyclic trait - indicates a type that cannot form reference cycles. Types that implement Acyclic don't need cycle collection tracking. Primitive types, value types without object fields, and objects that don't reference back to themselves (directly or indirectly) are Acyclic.
Implementors
The Rc trait means the type is reference counted object type.
Dispose trait - defines a dispose method for cleaning up resources.
Methods
dispose : fn(self : Self : (Rc)) -> unitRelease the resources self owns — a file descriptor, a socket, a lock,
a buffer the allocator handed out. Called automatically when the last
reference to the value goes away, so an implementor never calls it
directly and must tolerate being the only one who ever does.
It must be safe to run exactly once: the runtime calls it at refcount
zero, and a type that also exposes an explicit close/release is
responsible for making the second call a no-op.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self : (Rc) |
Returns: unit
Implementors
Trace trait — mandatory for every reference type that can transitively hold a
managed reference. Auto-derived by the compiler for structs/enums (incl.
Option and all value types); hand-implemented for containers whose elements
live in a heap buffer (ArrayList, HashMap, …). The constructor wires
header.traverse_fn to this trace.
Methods
trace : fn(self : Self : (Rc), tracer : GcTracer) -> unitImplementors
RangeOp trait — enables start..end operator syntax.
Methods
.. : fn(start : Self, end : Self) -> Range(Self)RangeInclusiveOp trait — enables start..=end operator syntax.
Methods
..= : fn(start : Self, end : Self) -> RangeInclusive(Self)Methods
..= : fn(start : Self : (Comptime), end : Self) -> RangeInclusive(Self : (Comptime))Parameters
| Name | Type | Notes |
|---|---|---|
start | Self : (Comptime) | comptime |
end | Self : (Comptime) | comptime |
Returns: RangeInclusive(Self : (Comptime))
Negate trait — enables unary -value operator.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Output | Type | The output type of the addition. |
Methods
neg : fn(self : Self) -> OutputLogicalNot trait — enables !value boolean negation.
Methods
! : fn(self : Self) -> boolParameters
| Name | Type | Notes |
|---|---|---|
self | Self |
Returns: bool
Methods
! : fn(self : Self : (Comptime)) -> boolBitNot trait — enables ~value bitwise complement.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Output | Type | The output type of the addition. |
Methods
~ : fn(self : Self) -> OutputHasher — turns a stream of bytes into a u64 (Rust's std::hash::Hasher).
A Hash impl feeds a value's identity bytes to a hasher through the
write* methods; finish reads the hash of everything written so far
(it does not reset the hasher). write and finish are required; the
fixed-width write_* methods default to the value's native-endian bytes,
and an algorithm with a fast word path overrides them (std/hash's
SipHasher13 overrides write_u64).
Implementations live in std/hash: SipHasher13 (keyed, the HashMap
default), Fnv1aHasher, and the hash_one helper.
Methods
write : fn(self : Self, buf : *(u8), size : usize) -> unitFeed size bytes starting at buf.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
buf | *(u8) | |
size | usize |
Returns: unit
finish : fn(self : Self) -> u64The hash of everything written so far.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self |
Returns: u64
write_u8 : fn(self : Self, v : u8) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | u8 |
Returns: unit
write_u16 : fn(self : Self, v : u16) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | u16 |
Returns: unit
write_u32 : fn(self : Self, v : u32) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | u32 |
Returns: unit
write_u64 : fn(self : Self, v : u64) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | u64 |
Returns: unit
write_usize : fn(self : Self, v : usize) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | usize |
Returns: unit
write_i8 : fn(self : Self, v : i8) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | i8 |
Returns: unit
write_i16 : fn(self : Self, v : i16) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | i16 |
Returns: unit
write_i32 : fn(self : Self, v : i32) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | i32 |
Returns: unit
write_i64 : fn(self : Self, v : i64) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | i64 |
Returns: unit
write_isize : fn(self : Self, v : isize) -> unitParameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
v | isize |
Returns: unit
Implementors
Hash trait - Similar to Rust's std:#️⃣:Hash
A type says which bytes make up its identity by feeding them to a
Hasher; the hasher (any Hasher, chosen by the caller) turns them into
a u64. Types that implement Hash can be used as keys in HashMap and
HashSet.
The contract, as in Rust:
- Consistent with Eq: if a == b, then a and b feed identical bytes.
- Prefix-free where it matters: variable-length data writes a length or
a terminator (String writes its bytes then 0xFF), so
("ab","c")and("a","bc")differ.
To hash a single value use std/hash's hash_one(value); to hash into a
hasher you already hold, call value.hash(hasher).
Methods
hash : fn(generic(H) self : Self, hasher : H : (Hasher)) -> unitFeed this value's identity into hasher.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self | |
hasher | H : (Hasher) |
Returns: unit
Implementors
Default trait — the type's default value (Rust's Default).
Call explicitly via (T <: Default).default() in generic code, or
MyType.default() on a concrete type. Unblocks
Option.unwrap_or_default and map or_default-style helpers
(plans/archive/STD_API_AUDIT.md D3.1).
Methods
default : fn() -> SelfThe default value of the type.
Returns: Self
Implementors
Isolation trait — runtime check whether a value can be safely transferred.
Methods
can_isolate : fn(self : Self) -> boolParameters
| Name | Type | Notes |
|---|---|---|
self | Self |
Returns: bool
ComptimeToString trait — compile-time string conversion.
Methods
to_comptime_string : fn(self : Self : (Comptime)) -> comptime_strRender this type for DISPLAY — diagnostics, comptime_assert messages, generated comments.
NOT a source renderer: the result is not guaranteed to reparse. An
instantiated generic has no written name to return, so it renders as a
placeholder (<struct:struct_yo_id_5916>, <enum:enum_yo_id_3586>).
Metaprogramming that needs to NAME a type in generated code must not use
this — construct through Self, or reach the type as a value via
Type.get_struct_fields(Self).get(i).field_type, which needs no name and
no import at the use site.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self : (Comptime) | comptime |
Returns: comptime_str
Integer — marker for the ten built-in integer types, so the arithmetic
below can be written ONCE over T instead of ten times per method.
It exists because those bodies need T.MIN/T.MAX and ordering, which a
where(T <: Integer) impl resolves through the type parameter. f32/f64
are deliberately NOT members: float arithmetic saturates to infinity rather
than overflowing, so checked_* would be meaningless on them.
Marks the SIGNED integers. abs and signum exist only for them — Rust
omits both on unsigned types, where abs would be the identity and
signum could only ever answer 0 or 1. A marker trait is how a blanket
impl gets restricted to half the integers, since where(T <: Integer)
covers all ten.
The same-width UNSIGNED counterpart of a signed integer type.
An ASSOCIATED TYPE, which is the whole point: unsigned_abs needs to name
"the unsigned type of the same width" in its RESULT position, and
T.Unsigned is exactly that name. Without it the method would have to be
written out once per signed type — five copies of one body, differing only
in a cast.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Unsigned | Type |
Marks the UNSIGNED integers — the mirror of SignedInteger, and what
restricts the power-of-two blanket below to the half of the integers Rust
defines it on. is_power_of_two on a signed type would have to answer for
negative receivers, and Rust simply does not offer it there.
Iterator trait — lazy, pull-based sequence traversal.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Item | Type | The type of elements yielded — must equal |
Methods
next : fn(self : Self) -> Option(Item)Advance the iterator and return the next value, or None when exhausted.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self |
Returns: Option(Item)
Implementors
DoubleEndedIterator trait — an Iterator that can also be advanced from the
BACK. next and next_back consume from opposite ends of the same sequence
and meet in the middle; once they meet, both return .None.
Declares its own Item, which is how next_back's signature can name it.
It deliberately carries NO where-clause tying it to Iterator: a trait
cannot constrain another trait's associated type to its OWN
(where(Self <: Iterator(Item := Self.Item)) is rejected — the constraint
value must be a type, not an associated-type projection of Self).
COHERENCE RULE (not compiler-checked): an impl's DoubleEndedIterator.Item
MUST equal its Iterator.Item. The associated-type registry is keyed by
(type id, label) with no trait discrimination and takes the FIRST match, so a
mismatch is silently first-wins rather than diagnosed. Every impl in std
pairs the two traits on the same type with the same Item.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Item | Type | The type of elements yielded — must equal |
Methods
next_back : fn(self : Self) -> Option(Item)Advance the iterator from the back and return the previous value, or
None when the two ends have met.
Parameters
| Name | Type | Notes |
|---|---|---|
self | Self |
Returns: Option(Item)
Implementors
IntoIterator trait — convert a collection into an iterator.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Item | Type | The type of elements yielded — must equal |
IntoIter | Type |
Methods
into_iter : fn(self : Self) -> IntoIter : (Iterator)Implementors
FromIterator trait — build Self from a sequence of Self.Elem values.
The iteration loop lives in the blanket collect below, not here, so this
trait stays MONOMORPHIC: a seed constructor plus one element-at-a-time step,
both statics, dispatched the way sum calls (A <: Default).default().
That is what removes the need for a trait method carrying its own
generic(...) + where.
The element type is deliberately named Elem, NOT Item: the assoc-type
registry is keyed by (type id, label) with no trait discrimination, so an
Item here would collide with the collection's own IntoIterator.Item and
resolve first-wins by load order — benign for ArrayList, but genuinely
divergent for HashMap, whose IntoIterator.Item is MapEntry(K, V).
from_iter_add RETURNS the accumulator instead of mutating it so that one
signature covers reference collections (mutate acc, return it — the return
is a rebind of the same object) and value types such as String.
Associated Types
| Name | Constraint | Description |
|---|---|---|
Elem | Type | The element type this collection is built from. |
Methods
from_iter_new : fn() -> SelfThe empty collection collect starts from.
Returns: Self
from_iter_add : fn(acc : Self, item : Elem) -> SelfAdd one element to a partially-built collection and return it.
Parameters
| Name | Type | Notes |
|---|---|---|
acc | Self | |
item | Elem |
Returns: Self
Implementors
Constants
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_int>
Value: <unknown: comptime_int>
Value: <unknown: comptime_int>
Value: <unknown: comptime_int>
Value: <unknown: comptime_int>
Value: <unknown: comptime_int>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: <unknown: comptime_float>
Value: <unknown: comptime_float>
Value: <unknown: comptime_float>
Value: <unknown: comptime_float>
Value: <unknown: comptime_float>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: <unknown: comptime_str>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: bool>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: i8>
Value: <unknown: comptime_str>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: bool>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: i16>
Value: <unknown: comptime_str>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: bool>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: i32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: bool>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: i64>
Value: <unknown: comptime_str>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: bool>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: u8>
Value: <unknown: comptime_str>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: bool>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: u16>
Value: <unknown: comptime_str>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: bool>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: u32>
Value: <unknown: comptime_str>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: bool>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: u64>
Value: <unknown: comptime_str>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: f32>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: f64>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: comptime_str>
Value: false
Value: -9223372036854775808
Value: false
Value: 9223372036854775807
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: bool>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: isize>
Value: <unknown: comptime_str>
Value: false
Value: -1
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: bool>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: usize>
Value: <unknown: comptime_str>
Value: false
Value: 64
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: bool>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: char>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: char>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: bool>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: int>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: int>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: bool>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: uint>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: uint>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: bool>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: short>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: short>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: bool>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: ushort>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: ushort>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: bool>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: long>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: long>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: bool>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: ulong>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: ulong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: bool>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: longlong>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: longlong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: bool>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: ulonglong>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: ulonglong>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: bool>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: longdouble>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: <unknown: longdouble>
Value: <unknown: bool>
Value: <unknown: bool>
Value: .Less
Value: .Equal
Value: .Greater
Value: <unknown: Ordering>
Value: DeriveContext(target: <expr>, forall_params: .None, where_clause: .None)
Value: <unknown: bool>
Value: <unknown: bool>
Value: <unknown: bool>
Value: Io(async: <unknown: fn(generic(T, E) action : Impl : (Fn(E) -> T)) -> Impl : (Future[Future](T) E : E)>, await: <unknown: fn(generic(T, E) fut : Impl : (Future[Future](T) E : E), e : E) -> T>, state: <unknown: fn(generic(T, E) fut : Impl : (Future[Future](T) E : E)) -> FutureState>, spawn: <unknown: fn(generic(T, E) fut : Impl : (Future[Future](T) E : E), e : E) -> JoinHandle(T)>)
The unsafe module — provides low-level unwind hatches.
Value: source_namespace_yo_id_3(drop: <fn(value)>, cast: <unknown: fn(generic(_Self) self : _Self, Target : Type) -> Target>)
Index trait — enables container(idx) subscript syntax at runtime.
The Idx parameter is the index type (e.g., usize, Range(usize)).
Implementations must define an Output associated type and an index method.
Value: <fn(Idx)>
ComptimeIndex — compile-time indexing trait for constant expressions.
Value: <fn(Idx)>
Half-open range start..end (excludes end).
Value: <fn(T)>
Inclusive range start..=end (includes end).
Value: <fn(T)>
Add trait — enables lhs + rhs operator. Parameterized by Rhs type.
Value: <fn(Rhs)>
Compile-time variant of Add.
Value: <fn(Rhs)>
Sub trait — enables lhs - rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
Mul trait — enables lhs * rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
Div trait — enables lhs / rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
Mod trait — enables lhs % rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
BitLeftShift trait — enables lhs << rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
BitRightShift trait — enables lhs >> rhs operator.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
BitAnd trait — enables lhs & rhs bitwise AND.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
BitOr trait — enables lhs | rhs bitwise OR.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
BitXor trait — enables lhs ^ rhs bitwise XOR.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
Value: source_namespace_yo_id_112(Call: (<fn(self)>, <fn(self)>))
Value: source_namespace_yo_id_112(Call: (<fn(self)>, <fn(self)>))
Value: source_namespace_yo_id_119(Call: (<fn(self)>, <fn(self)>))
Value: source_namespace_yo_id_126(Call: (<fn(self)>, <fn(self)>))
Eq trait — enables == and != comparison operators.
The != method has a default implementation that negates ==.
Value: <fn(Rhs)>
Value: <fn(Rhs)>
Ord trait — enables <, <=, >, >= comparison operators.
Requires the type to also implement Eq.
cmp is contractually a TOTAL order for every std impl (the audit's
no-PartialOrd decision, plans/archive/STD_API_AUDIT.md D3.3): the default is
derived from </==, and types whose operators are only partial
(floats: NaN is incomparable under IEEE <) OVERRIDE cmp with a
total order instead of splitting the trait.
Value: <fn(Rhs)>
Reverse(T) — a wrapper whose Ord is T's, inverted (Rust's
core::cmp::Reverse).
It turns any max-ordered structure into a min-ordered one without a second
implementation. PriorityQueue is a MAX-heap (D11), so a min-heap is:
pq := PriorityQueue(Reverse(i32)).new();
pq.push(Reverse(i32)(i32(5)));
pq.push(Reverse(i32)(i32(1)));
pq.pop().unwrap().value; // 1 — the SMALLEST
It is equally the way to sort descending: list.sort_by((a, b) -> (Reverse(i32)(a) < Reverse(i32)(b))).
Value: <fn(T)>
Value: <fn(Rhs)>
Option — a value that may or may not be present.
Option(T) has two variants:
.Some(value)— contains a value of typeT.None— contains no value
Example
(x : Option(i32)) = .Some(i32(42));
assert(x.is_some(), "expected Some");
assert((x.unwrap() == i32(42)), "expected 42");
Value: <fn(T)>
Population count over all 64 bits — SWAR, no per-word loop.
Value: <fn(x)>
Number of leading zero bits in a 64-bit word (64 for zero).
Value: <fn(x)>
Number of trailing zero bits in a 64-bit word (64 for zero).
Value: <fn(x)>
Reverse all 64 bits.
Value: <fn(x)>
Reverse the byte order of a 64-bit word.
Value: <fn(x)>
Mask of the low bits bits. bits == 64 would make 1 << 64 undefined,
so the full width is spelled out instead of computed.
Value: <fn(bits)>
x rotated left by n within a bits-wide field.
Value: <fn(x, n, bits)>
x rotated right by n within a bits-wide field.
Value: <fn(x, n, bits)>
Value: 64
RawSlice — a plain ptr+len pair for PRIVILEGED (pragma'd) code: C interop and std internals. Carries a raw pointer, so the existing raw-pointer gates apply: safe code cannot name or construct it. Replaces the builtin Slice(T) for internal plumbing (plans/archive/SLICE_REWORK.md step 4).
Value: <fn(T)>
Walk a table's parallel lists for key. Written in Yo rather than as a
builtin on purpose: a prelude binding that names a builtin the SEED lacks
fails the bootstrap, and this needs no evaluator support beyond what
ComptimeList already has. Self-recursive, which a (fn(...) -> R)(body)
definition may be — its signature binds before its body evaluates.
Value: <fn(ks, vs, key, i)>
Var — compile-time variable introspection utilities.
Provides macros for querying metadata about a variable at compile-time, such as ownership status and alias information.
Value: source_namespace_yo_id_5608(print_info: <fn(variable)>, is_owning_the_rc_value: <fn(variable)>, has_other_aliases: <fn(variable)>)
Value: <fn(T)>
Value: <fn(a, b)>
Value: <fn(a, b, c)>
Value: <fn(a, b, c, d)>
Value: <fn(a, b, c, d, e)>
Value: <fn(T, ctx, trait_params)>
Value: <fn(T, ctx, trait_params)>
Value: <fn(T, ctx, trait_params)>
Value: <fn(T, op)>
Value: <fn(v, op)>
Value: <fn(T, ctx, trait_params)>
derive(Default) for structs: every field takes its own type's default.
Each field's type is named by INDEXING the struct's own field list —
(Type.get_struct_fields(Self).get(i).field_type <: Default).default() —
rather than by rendering the type back to source. Rendering does not work
here: Type.to_comptime_string returns an unusable <struct:…> / <enum:…>
placeholder for every INSTANTIATED generic (Option(i32), ArrayList(i32),
any user generic), so a rendered Option(String) field would not reparse.
Indexing sidesteps that entirely and needs no field type to be in scope at
the impl site. See issues/type-to-comptime-string-placeholder-for-generics.md.
Structs only. An enum has no canonical default variant — Rust needs an
explicit #[default] attribute to pick one, and Yo has no such attribute,
so guessing (say, the first variant) would be a silent choice rather than a
declared one.
Value: <fn(T, ctx, trait_params)>
Result — a value that is either success (Ok) or failure (Err).
Result(OkType, ErrorType) has two variants:
.Ok(value)— contains a success value of typeOkType.Err(error)— contains an error value of typeErrorType
Example
(r : Result(i32, str)) = .Ok(i32(42));
assert(r.is_ok(), "expected Ok");
Value: <fn(OkType, ErrorType)>
Box — a heap-allocated, reference-counted container for a single value.
⚠️ Box is Rust's Rc, NOT Rust's Box
Read this before assuming move semantics. In Rust, Box<T> is a
UNIQUE owner: cloning it deep-copies, and passing it moves. Yo's Box(V)
is a ref type — copying the handle shares one heap value and bumps a
refcount, exactly like Rust's Rc<T>:
a := box(i32(42));
b := a; // NOT a copy of the value — a second handle to it
consume(b.* = i32(7));
assert((a.* == i32(7)), "a and b name the SAME value");
The name is kept deliberately: Rc is already a trait in this prelude
(the "this type is a reference-counted object type" bound used by
where(Self <: Rc)), so Box cannot be renamed to Rc without colliding
with it — and reference counting is Yo's universal object model rather
than one container's opt-in policy, so a distinct name for "the RC one"
would be misleading in the other direction. Every ref(struct(...)) in
this language is refcounted; Box is simply the one-field case of that.
Consequences worth knowing:
- Sharing is silent. Two
Boxhandles to one value is the normal case. - A
Boxcycle leaks unless broken (seeIsolation/ the cycle collector); Rust'sBoxcannot form a cycle at all. rc(b)reports the current reference count (the optimizer may cancel a dup against a scope-end drop, so it is the live count, not a count of names);Iso/can_isolateis how you ask for uniqueness.
Use box(value) to allocate. Access the inner value with b.*.
Example
b := box(i32(42));
assert((b.* == i32(42)), "inner value is 42");
Value: <fn(V)>
Allocate a value on the heap, returning a Box(V).
Value: <fn(value)>
Value: <fn(v)>
=== Arc === Arc — an atomically reference-counted, thread-safe container for a single value.
Use arc(value) to allocate. Access the inner value with a.*.
Example
a := arc(i32(42));
assert((a.* == i32(42)), "inner value is 42");
Value: <fn(V)>
Allocate a value inside an Arc, returning an Arc(V).
Value: <fn(value)>
MaybeUninit — a wrapper that allows holding an uninitialized value.
Useful for FFI or low-level patterns where a value must be allocated first and initialized later (e.g., by a C function).
Example
extern "C",
time_t : Type,
time : fn(timer: ?(*(time_t))) -> time_t
;
uninitialized_timer := MaybeUninit(time_t).new();
ptr := uninitialized_timer.as_ptr();
time(.Some(ptr));
timer := uninitialized_timer.assume_init();
Value: <fn(BaseType)>
=== Array Iterator ===
Value iterator for Array(T, N) — yields elements by value. Backs
the for-macro value form for(arr, (x) => body) via into_iter.
Value: <fn(T, N)>
TryFrom trait — fallible conversion from one type to another.
From trait — infallible conversion FROM another type
(plans/archive/STD_API_AUDIT.md D3.2; the fallible pair is TryFrom below).
Value: <fn(Source)>
Into trait — infallible conversion of Self INTO another type.
Called with the target type, mirroring try_into:
wide := narrow.into(i64);
Value: <fn(To)>
Value: <fn(Source)>
TryInto trait — fallible conversion of Self into another type.
Value: <fn(To)>
The borrowed for's loop-scoped borrow flag: __borrow_guard(coll)
acquires coll's borrow_count and the guard's Dispose releases it
when the loop's block ends — on fall-through, break, return and effect
unwind alike (the same scope-exit path Mutex.with_lock's unlocker
rides). While the flag is held, every container operation that could
invalidate an element panics deterministically (__yo_borrow_assert_unborrowed).
Value: <fn(C)>
Value: <fn(c)>
for macro — iterate over a collection.
for(coll, (x) => body) — calls coll.into_iter() and binds x
to each yielded value. The collection is moved into the
iterator; object elements are handles, so mutating x in the
body mutates the element in place.
The old borrow form for(coll, inout(x) => body) was REMOVED: it
required refs into reallocatable storage, which is no longer
expressible. Object elements mutate in place through the value
handle; struct elements use an index loop with get/set.
Combinator chains (coll.into_iter().map(f), etc.) work
transparently: a blanket into_iter impl on Iterator (below)
makes every iterator its own IntoIterator.
Examples
// Object elements — mutate in place through the handle.
for(names, (s) => {
s.push_str("!");
});
// Consume an iterator chain.
for(list.into_iter(), (x) => print(x));
Value: <fn(coll, handle)>
IterPair — a two-element product type used by enumerate and zip.
Value: <fn(A, B)>
Lazy iterator that maps each element through a function F.
Created by calling .map(f) on any iterator.
I is the source iterator type, B is the output element type,
F is the mapper closure type satisfying Fn(item : A) -> B.
Value: <fn(I, B, F)>
Lazy iterator that skips elements for which the predicate returns false.
Created by calling .filter(pred) on any iterator.
I is the source iterator type, F is the predicate closure type
satisfying Fn(item : A) -> bool — by value, symmetric with map
(plans/archive/STD_API_AUDIT.md D3.4's callback-asymmetry fix).
Value: <fn(I, F)>
Lazy iterator that yields at most n elements from the source.
Created by calling .take(n) on any iterator.
Value: <fn(I)>
Lazy iterator that skips the first n elements of the source, then yields
all remaining elements.
Created by calling .skip(n) on any iterator.
Value: <fn(I)>
Lazy iterator that pairs each element with its zero-based index.
Created by calling .enumerate() on any iterator.
Yields IterPair(usize, A) values where _0 is the index and _1 is
the original element.
Value: <fn(I)>
Lazy iterator that combines two iterators element-by-element into pairs. Stops as soon as either iterator is exhausted.
Created by calling .zip(other) on any iterator.
Yields IterPair(A, B) values.
Value: <fn(I, J)>
Lazy iterator that yields all of the first iterator, then all of the second.
Created by calling .chain(other) on any iterator. Both iterators must
yield the same Item type.
Value: <fn(I, J)>
Lazy iterator that yields elements while pred holds, then stops forever.
Created by calling .take_while(pred) on any iterator.
Value: <fn(I, F)>
Lazy iterator that skips elements while pred holds, then yields the rest.
Created by calling .skip_while(pred) on any iterator.
Value: <fn(I, F)>
Lazy iterator that maps each element to an Option and yields the Somes.
Created by calling .filter_map(f) on any iterator. B is the output
element type, F satisfies Fn(item : A) -> Option(B).
Value: <fn(I, B, F)>
Iterator wrapper that can look at the next element without consuming it.
Created by calling .peekable() on any iterator. A is the element type.
Value: <fn(I, A)>
Lazy iterator that yields the source's elements back-to-front.
Created by calling .rev() on any DoubleEndedIterator. next pulls from
the source's BACK and next_back from its FRONT, so .rev().rev() restores
the original order.
Value: <fn(I)>
JoinHandle — a handle to a spawned async task.
Wraps a raw pointer to the spawned future's state machine.
Generic over T, the return type of the spawned task.
Value: <fn(T)>