Enum TypeDef Copy item path Source pub enum TypeDef {
Func(FuncType ),
Struct(StructDef ),
Array(ValType ),
Map {
key: ValType ,
value: ValType ,
},
Cell(ValType ),
Iter {
key: ValType ,
value: ValType ,
},
Coroutine,
}Expand description An entry of the module’s type table.
Types refer to each other by TypeId , so recursive types (a list node
pointing at itself) are plain data and the table never nests.
§ Examples
use bytecode_lang::{FuncType, TypeDef, ValType};
let sig = TypeDef::Func(FuncType { params: vec! [ValType::I64], results: vec! [ValType::I64] });
assert_eq! (sig.to_string(), "func (i64) -> (i64)" );
assert_eq! (TypeDef::Array(ValType::Dyn).to_string(), "array dyn" );A function signature, used by functions, imports, closures, and
indirect calls.
A struct (record) type: named fields at fixed slots, named methods,
and an optional parent for single inheritance.
A growable array of one element type.
An insertion-ordered hash map (the PHP array and the Python dict).
A mutable box holding one value: how closures share a mutable
captured variable.
An iterator yielding keys and values of these types.
Fields The key type (i64 for arrays).
A coroutine handle. Values crossing a suspension (yielded, sent,
returned) are always dyn: a coroutine is stackful, so a yield in a
nested call cannot know its coroutine’s static type.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Formats the value using the given formatter.
Read more Compares and returns the maximum of two values.
Read more Compares and returns the minimum of two values.
Read more Restrict a value to a certain interval.
Read more 🔬 This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range.
Read more This method returns an ordering between
self and
other values if one exists.
Read more Tests less than (for
self and
other) and is used by the
< operator.
Read more Tests less than or equal to (for
self and
other) and is used by the
<= operator.
Read more Tests greater than (for
self and
other) and is used by the
>
operator.
Read more Tests greater than or equal to (for
self and
other) and is used by
the
>= operator.
Read more Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more Converts the given value to a
String.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.