#[repr(u8)]pub enum Kind {
Show 14 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,
}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).
Implementations§
Trait Implementations§
impl Copy for Kind
impl Eq for Kind
Source§impl Ord for Kind
impl Ord for Kind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Kind
impl PartialOrd for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Freeze for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnsafeUnpin for Kind
impl UnwindSafe for Kind
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
Mutably borrows from an owned value. Read more