pub struct NanValue(/* private fields */);Implementations§
Source§impl NanValue
impl NanValue
pub fn eq_in<T: ArenaTypes>(self, other: Self, arena: &Arena<T>) -> bool
pub fn hash_in<T: ArenaTypes, H: Hasher>(self, state: &mut H, arena: &Arena<T>)
pub fn repr<T: ArenaTypes>(self, arena: &Arena<T>) -> String
pub fn display<T: ArenaTypes>(self, arena: &Arena<T>) -> Option<String>
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 encode(tag: u64, payload: u64) -> Self
pub fn is_nan_boxed(self) -> bool
pub fn tag(self) -> u64
pub fn payload(self) -> u64
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<T: ArenaTypes>(i: i64, arena: &mut Arena<T>) -> Self
Sourcepub fn new_big_int<T: ArenaTypes>(value: BigInt, arena: &mut Arena<T>) -> Self
pub fn new_big_int<T: ArenaTypes>(value: BigInt, arena: &mut Arena<T>) -> Self
Store an arbitrary-precision integer and return its NaN-box. This is a
canonical-form boundary: a payload that fits i64 is demoted to the
inline / i64-overflow representation rather than boxed, so a
numerically-Small value can never enter the value space wearing a
BigInt slot (which would break Eq/Ord/Hash and Map/Set keying).
Only a genuinely out-of-i64-range value allocates a BigInt slot.
Sourcepub fn as_int<T: ArenaTypes>(self, arena: &Arena<T>) -> i64
pub fn as_int<T: ArenaTypes>(self, arena: &Arena<T>) -> i64
Materialize the stored value as i64. Valid only for inline ints and
the i64-overflow arena slot; panics on a ℤ-overflow (BigInt) slot,
which cannot be represented. Use int_ref when the value may be Big.
Sourcepub fn int_ref<T: ArenaTypes>(self, arena: &Arena<T>) -> ArenaIntRef<'_>
pub fn int_ref<T: ArenaTypes>(self, arena: &Arena<T>) -> ArenaIntRef<'_>
Borrow the stored integer, discriminating inline / i64-overflow /
ℤ-overflow without losing precision. The runtime crate maps this to a
canonical AverInt.
pub fn inline_int_payload(self) -> Option<u64>
pub fn inline_int_value(self) -> Option<i64>
pub fn new_bool(b: bool) -> Self
pub fn as_bool(self) -> bool
pub fn plain_immediate_payload(self) -> Option<u64>
pub fn wrapper_kind(self) -> u64
pub fn wrapper_inline_inner(self) -> Option<NanValue>
pub fn wrapper_parts<T: ArenaTypes>( self, arena: &Arena<T>, ) -> Option<(u64, NanValue)>
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<T: ArenaTypes>(self, arena: &Arena<T>) -> NanValue
pub fn new_some_value<T: ArenaTypes>( inner: NanValue, arena: &mut Arena<T>, ) -> Self
pub fn new_ok_value<T: ArenaTypes>( inner: NanValue, arena: &mut Arena<T>, ) -> Self
pub fn new_err_value<T: ArenaTypes>( inner: NanValue, arena: &mut Arena<T>, ) -> Self
pub fn new_string(arena_index: u32) -> Self
pub fn small_string(self) -> Option<NanString<'static>>
pub fn new_string_value<T: ArenaTypes>(s: &str, arena: &mut Arena<T>) -> 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 symbol_kind(self) -> u64
pub fn symbol_index(self) -> u32
pub fn new_nullary_variant(symbol_index: u32) -> Self
pub fn try_new_inline_variant(ctor_id: u32, inner: NanValue) -> Option<Self>
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
pub fn string_eq<T: ArenaTypes>(self, other: NanValue, arena: &Arena<T>) -> bool
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<T: ArenaTypes>(self, arena: &Arena<T>) -> Option<u32>
pub fn variant_parts<T: ArenaTypes>( self, arena: &Arena<T>, ) -> Option<(u32, u16, &[NanValue])>
pub fn variant_single_field<T: ArenaTypes>(self, arena: &Arena<T>) -> NanValue
pub fn inline_variant_info<T: ArenaTypes>( self, arena: &Arena<T>, ) -> Option<(u32, u16, NanValue)>
pub fn bits(self) -> u64
pub fn from_bits(bits: u64) -> Self
pub fn map_key_hash<T: ArenaTypes>(self, arena: &Arena<T>) -> u64
Sourcepub fn map_key_hash_deep<T: ArenaTypes>(self, arena: &Arena<T>) -> u64
pub fn map_key_hash_deep<T: ArenaTypes>(self, arena: &Arena<T>) -> u64
Structural hash that respects eq_in for every value shape:
two equal heap values (variants/tuples/records/lists/etc.) always
produce the same u64 regardless of arena layout. Used by Map
when the key type is anything beyond inline scalars.