pub enum WasmType {
I32,
Bool,
Ratio,
StringRef,
SymbolRef,
Commodity,
PairRef(PairElement),
AnyRef,
EntityRef(EntityKind),
StructRef(StructId),
Closure(ClosureSigId),
}Variants§
I32
Bool
Boolean: a comparison / predicate / and / or result, or a runtime
t / nil. Wasm representation is identical to I32 (0 = nil,
nonzero = t), so it composes with if / br_if and boxes via
ref.i31 exactly like I32. It is a DISTINCT compile-time type only
so the debug serializer can surface it as Nil / T rather than
Number: an I32 is a raw count (tag-count, split-count, …) that
serializes as a number, whereas a Bool is a truth value. Refused by
arithmetic like every non-numeric type.
Ratio
StringRef
SymbolRef
Runtime symbol or keyword: (ref null $symbol) carrying its printed name.
Commodity
Commodity-bearing numeric: rational amount + originating commodity
uuid. Distinct from Ratio so the compiler can refuse mixing money
and pure-rational arithmetic at compile time. Wasm representation:
(i64 numer, i64 denom, i64 commodity_hi, i64 commodity_lo).
PairRef(PairElement)
Homogeneous list cell: $pair WasmGC struct with an anyref car
and a nullable $pair cdr. The PairElement records the car’s
type at compile time so CAR/CDR can emit the correct downcast and
CONS refuses heterogeneous mixing. Retires the i32-only $cons —
every runtime list shape in the compiler routes through this type.
AnyRef
Raw anyref car payload extracted from a PairRef(AnyRef) or
produced by a host fn that returns a heterogeneous value
(ADR-0025). Refused by arithmetic / numeric comparison / closure
call / typed pair construction; the script must downcast via
type-test natives (e.g. ok?, err-code) before consuming.
EntityRef(EntityKind)
Typed server-entity reference: a (ref null $<kind>) GC struct
whose field layout matches the nomi_entity! declaration for the
kind. Refused by arithmetic / list-CONS / numeric comparison; the
only legal operations are the entity-specific accessor natives
(account-id, commodity-name, etc.) registered alongside the
struct type.
StructRef(StructId)
A DEFSTRUCT instance: (ref null $struct), one shape for every
layout. Identity is reference identity; only the struct natives read
or write it, and nil is ref.null.
Closure(ClosureSigId)
First-class closure value: (ref null $closure_<sig>) carrying a
typed funcref + nullable env ref. The ClosureSigId indexes the
per-context registry that owns the wasm types and per-call-site
env-struct layouts. Eligible for FUNCALL / APPLY via call_ref;
refused by arithmetic / numeric comparison / pair construction.
Trait Implementations§
impl Copy for WasmType
impl Eq for WasmType
Source§impl Ord for WasmType
impl Ord for WasmType
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for WasmType
impl PartialOrd for WasmType
impl StructuralPartialEq for WasmType
Auto Trait Implementations§
impl Freeze for WasmType
impl RefUnwindSafe for WasmType
impl Send for WasmType
impl Sync for WasmType
impl Unpin for WasmType
impl UnsafeUnpin for WasmType
impl UnwindSafe for WasmType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.