runmat_runtime/native/
root.rs1use super::NativeValueRef;
2
3#[repr(transparent)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5pub struct NativeRootKind(pub u32);
6
7impl NativeRootKind {
8 pub const LOCAL: Self = Self(0);
9 pub const OPERAND: Self = Self(1);
10 pub const TEMPORARY: Self = Self(2);
11 pub const CLOSURE: Self = Self(3);
12 pub const CONTINUATION: Self = Self(4);
13 pub const HOST: Self = Self(5);
14
15 pub const fn is_known(self) -> bool {
16 self.0 <= Self::HOST.0
17 }
18}
19
20#[repr(C)]
22#[derive(Clone, Copy, Debug, Eq, PartialEq)]
23pub struct NativeRoot {
24 pub value: NativeValueRef,
25 pub kind: NativeRootKind,
26 pub slot: u32,
27}
28
29#[repr(C)]
31#[derive(Clone, Copy, Debug)]
32pub struct NativeRootSet {
33 pub roots: *const NativeRoot,
34 pub count: usize,
35}
36
37impl Default for NativeRootSet {
38 fn default() -> Self {
39 Self {
40 roots: std::ptr::null(),
41 count: 0,
42 }
43 }
44}