#[repr(u32)]pub enum ValueKind {
Show 21 variants
Nil = 0,
Bool = 1,
Int = 2,
BigInt = 3,
Float = 4,
Rational = 5,
String = 6,
List = 7,
Tuple = 8,
Dict = 9,
Set = 10,
Range = 11,
StopIteration = 12,
Instance = 13,
Class = 14,
Function = 15,
Module = 16,
Exception = 17,
Generator = 18,
Iterator = 19,
Other = 20,
}Expand description
Value kinds returned by HostApi::value_kind.
Over the FFI these travel as plain u32 - convert with as u32 /
ValueKind::from_u32. The host-side mapping (and the coverage test
guarding that every interpreter value maps to one of these) lives in
the feature-gated plugin module in the interpreter crate.
Variants§
Nil = 0
The nil value.
Bool = 1
A boolean.
Int = 2
An integer that fits in an i64 (int_get succeeds).
BigInt = 3
An integer that does not fit in an i64 (int_get fails; use
value_display/value_str).
Float = 4
A float.
Rational = 5
A rational number.
String = 6
A string (string_get succeeds).
List = 7
A list (list_len/list_get succeed).
Tuple = 8
A tuple.
Dict = 9
A dict.
Set = 10
A set.
Range = 11
A range.
StopIteration = 12
The StopIteration sentinel - what __next__ returns when an
iterator is exhausted.
Instance = 13
A plain class instance (fields via attr_get/attr_set, methods
via invoke_method).
Class = 14
A class (instantiate via call_value).
Function = 15
A callable function value (closure, native function, or bound
method) - use call_value.
Module = 16
A module.
Exception = 17
An exception instance.
Generator = 18
A generator.
Iterator = 19
A list/tuple/range/template iterator (drive via invoke_method
with __next__).
Other = 20
VM-internal values a plugin should never meaningfully receive.
Implementations§
Source§impl ValueKind
impl ValueKind
Sourcepub const fn from_u32(code: u32) -> Self
pub const fn from_u32(code: u32) -> Self
Decode a raw kind code from HostApi::value_kind; unknown codes
map to ValueKind::Other.