#[repr(u8)]pub enum Kind {
Show 15 variants
Nil = 0,
Bool = 1,
Int = 2,
Float = 3,
Char = 4,
Str = 5,
Array = 6,
Map = 7,
Object = 8,
Function = 9,
Cell = 10,
Iter = 11,
Error = 12,
Coroutine = 13,
Reference = 14,
}Expand description
The kind of a dynamic value: what Inst::TypeOf
returns and Inst::IsKind tests.
Dynamic integers are 64-bit signed and dynamic floats are binary64, whatever their boxed representation.
§Examples
use bytecode_lang::Kind;
assert_eq!(Kind::Map.code(), 7);
assert_eq!(Kind::from_code(5), Some(Kind::Str));
assert_eq!(Kind::Object.to_string(), "object");Variants§
Nil = 0
nil: the absent value, and the null reference.
Bool = 1
A boolean.
Int = 2
A 64-bit signed integer.
Float = 3
A binary64 float.
Char = 4
A Unicode scalar value.
Str = 5
An immutable byte string.
Array = 6
An array.
Map = 7
An ordered hash map.
Object = 8
A struct instance.
Function = 9
A callable: a closure, a function, or a host function.
Cell = 10
A mutable cell.
Iter = 11
An iterator.
Error = 12
A runtime error value (see Inst::ErrCode).
Coroutine = 13
A coroutine: a suspendable stack of frames (generators, async
tasks; see Inst::CoroNew).
Reference = 14
A reference (PHP &): a box holding one dynamic value, made by
Inst::NewRef or by taking a reference to
a container slot (Inst::DRefIndex,
Inst::DRefProp). It is a cell of dyn
(cell_get/cell_set read and write it), and a container slot
holding one is transparent: reads and writes of the slot go
through to the reference’s value (specs/LSB.md §5.16).