pub struct NanValue(/* private fields */);Implementations§
Source§impl NanValue
impl NanValue
pub const FALSE: NanValue
pub const TRUE: NanValue
pub const UNIT: NanValue
pub const NONE: NanValue
pub const EMPTY_LIST: NanValue
pub const EMPTY_MAP: NanValue
pub const EMPTY_VECTOR: NanValue
pub const EMPTY_STRING: NanValue
pub fn new_float(f: f64) -> Self
pub fn as_float(self) -> f64
pub fn new_int_inline(i: i64) -> Self
pub fn new_int_arena(arena_index: u32) -> Self
pub fn new_int(i: i64, arena: &mut Arena) -> Self
pub fn as_int(self, arena: &Arena) -> i64
pub fn inline_int_value(self) -> Option<i64>
pub fn new_bool(b: bool) -> Self
pub fn as_bool(self) -> bool
pub fn new_some(inner_index: u32) -> Self
pub fn new_ok(inner_index: u32) -> Self
pub fn new_err(inner_index: u32) -> Self
pub fn wrapper_index(self) -> u32
pub fn wrapper_inner(self, arena: &Arena) -> NanValue
pub fn new_some_value(inner: NanValue, arena: &mut Arena) -> Self
pub fn new_ok_value(inner: NanValue, arena: &mut Arena) -> Self
pub fn new_err_value(inner: NanValue, arena: &mut Arena) -> Self
pub fn new_string(arena_index: u32) -> Self
pub fn new_string_value(s: &str, arena: &mut Arena) -> Self
pub fn new_list(arena_index: u32) -> Self
pub fn new_tuple(arena_index: u32) -> Self
pub fn new_map(arena_index: u32) -> Self
pub fn new_vector(arena_index: u32) -> Self
pub fn new_record(arena_index: u32) -> Self
pub fn new_variant(arena_index: u32) -> Self
pub fn new_nullary_variant(symbol_index: u32) -> Self
Sourcepub fn try_new_inline_variant(ctor_id: u32, inner: NanValue) -> Option<Self>
pub fn try_new_inline_variant(ctor_id: u32, inner: NanValue) -> Option<Self>
Try to create an inline variant (TAG 14) for a single-field variant whose inner value is a small int, bool, unit, or none. Returns None if the value can’t be inlined.
pub fn inline_variant_ctor_id(self) -> u32
pub fn inline_variant_inner(self) -> NanValue
pub fn new_fn(arena_index: u32) -> Self
pub fn new_builtin(arena_index: u32) -> Self
pub fn new_namespace(arena_index: u32) -> Self
pub fn arena_index(self) -> u32
pub fn heap_index(self) -> Option<u32>
pub fn with_heap_index(self, index: u32) -> Self
pub fn is_float(self) -> bool
pub fn is_int(self) -> bool
pub fn is_bool(self) -> bool
pub fn is_unit(self) -> bool
pub fn is_none(self) -> bool
pub fn is_some(self) -> bool
pub fn is_ok(self) -> bool
pub fn is_err(self) -> bool
pub fn is_string(self) -> bool
Sourcepub fn string_eq(self, other: NanValue, arena: &Arena) -> bool
pub fn string_eq(self, other: NanValue, arena: &Arena) -> bool
Deep string equality: compare actual string content, not NanValue bits. Handles both inline short strings and arena-allocated strings.
pub fn is_list(self) -> bool
pub fn is_record(self) -> bool
pub fn is_fn(self) -> bool
pub fn is_variant(self) -> bool
pub fn is_inline_variant(self) -> bool
pub fn is_map(self) -> bool
pub fn is_vector(self) -> bool
pub fn is_empty_vector_immediate(self) -> bool
pub fn is_tuple(self) -> bool
pub fn is_builtin(self) -> bool
pub fn is_namespace(self) -> bool
pub fn is_empty_list_immediate(self) -> bool
pub fn is_empty_map_immediate(self) -> bool
pub fn type_name(self) -> &'static str
pub fn variant_ctor_id(self, arena: &Arena) -> Option<u32>
Sourcepub fn variant_parts(self, arena: &Arena) -> Option<(u32, u16, &[NanValue])>
pub fn variant_parts(self, arena: &Arena) -> Option<(u32, u16, &[NanValue])>
Returns (type_id, variant_id, fields) for arena-backed and nullary variants.
Does NOT handle TAG_INLINE_VARIANT — use inline_variant_info for those.
Sourcepub fn variant_single_field(self, arena: &Arena) -> NanValue
pub fn variant_single_field(self, arena: &Arena) -> NanValue
Extract the single field from any 1-field variant representation. For inline variants: decode from bits. For arena variants: arena lookup. Panics if the variant has != 1 field.
Sourcepub fn inline_variant_info(self, arena: &Arena) -> Option<(u32, u16, NanValue)>
pub fn inline_variant_info(self, arena: &Arena) -> Option<(u32, u16, NanValue)>
Returns (type_id, variant_id, inner_value) for inline variants.
pub fn from_bits(bits: u64) -> Self
Sourcepub fn map_key_hash(self, arena: &Arena) -> u64
pub fn map_key_hash(self, arena: &Arena) -> u64
Content-based hash for use as map key. For inline values (int, float, bool), uses bits(). For arena-backed strings, hashes the string content so that two NanValues for the same string content produce the same key regardless of arena index.