Skip to main content

NanValue

Struct NanValue 

Source
pub struct NanValue(/* private fields */);

Implementations§

Source§

impl NanValue

Source

pub fn eq_in(self, other: Self, arena: &Arena) -> bool

Source

pub fn hash_in<H: Hasher>(self, state: &mut H, arena: &Arena)

Source

pub fn repr(self, arena: &Arena) -> String

Source

pub fn display(self, arena: &Arena) -> Option<String>

Source§

impl NanValue

Source

pub fn from_value(val: &Value, arena: &mut Arena) -> Self

Convert old Value to NanValue, storing heap data in arena.

Source

pub fn to_value(self, arena: &Arena) -> Value

Convert NanValue back to old Value (for interop during migration).

Source§

impl NanValue

Source

pub const FALSE: NanValue

Source

pub const TRUE: NanValue

Source

pub const UNIT: NanValue

Source

pub const NONE: NanValue

Source

pub const EMPTY_LIST: NanValue

Source

pub const EMPTY_MAP: NanValue

Source

pub const EMPTY_VECTOR: NanValue

Source

pub const EMPTY_STRING: NanValue

Source

pub fn new_float(f: f64) -> Self

Source

pub fn as_float(self) -> f64

Source

pub fn new_int_inline(i: i64) -> Self

Source

pub fn new_int_arena(arena_index: u32) -> Self

Source

pub fn new_int(i: i64, arena: &mut Arena) -> Self

Source

pub fn as_int(self, arena: &Arena) -> i64

Source

pub fn inline_int_value(self) -> Option<i64>

Source

pub fn new_bool(b: bool) -> Self

Source

pub fn as_bool(self) -> bool

Source

pub fn new_some(inner_index: u32) -> Self

Source

pub fn new_ok(inner_index: u32) -> Self

Source

pub fn new_err(inner_index: u32) -> Self

Source

pub fn wrapper_index(self) -> u32

Source

pub fn wrapper_inner(self, arena: &Arena) -> NanValue

Source

pub fn new_some_value(inner: NanValue, arena: &mut Arena) -> Self

Source

pub fn new_ok_value(inner: NanValue, arena: &mut Arena) -> Self

Source

pub fn new_err_value(inner: NanValue, arena: &mut Arena) -> Self

Source

pub fn new_string(arena_index: u32) -> Self

Source

pub fn new_string_value(s: &str, arena: &mut Arena) -> Self

Source

pub fn new_list(arena_index: u32) -> Self

Source

pub fn new_tuple(arena_index: u32) -> Self

Source

pub fn new_map(arena_index: u32) -> Self

Source

pub fn new_vector(arena_index: u32) -> Self

Source

pub fn new_record(arena_index: u32) -> Self

Source

pub fn new_variant(arena_index: u32) -> Self

Source

pub fn new_nullary_variant(symbol_index: u32) -> Self

Source

pub fn new_fn(arena_index: u32) -> Self

Source

pub fn new_builtin(arena_index: u32) -> Self

Source

pub fn new_namespace(arena_index: u32) -> Self

Source

pub fn arena_index(self) -> u32

Source

pub fn heap_index(self) -> Option<u32>

Source

pub fn with_heap_index(self, index: u32) -> Self

Source

pub fn is_float(self) -> bool

Source

pub fn is_int(self) -> bool

Source

pub fn is_bool(self) -> bool

Source

pub fn is_unit(self) -> bool

Source

pub fn is_none(self) -> bool

Source

pub fn is_some(self) -> bool

Source

pub fn is_ok(self) -> bool

Source

pub fn is_err(self) -> bool

Source

pub fn is_string(self) -> bool

Source

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.

Source

pub fn is_list(self) -> bool

Source

pub fn is_record(self) -> bool

Source

pub fn is_fn(self) -> bool

Source

pub fn is_variant(self) -> bool

Source

pub fn is_map(self) -> bool

Source

pub fn is_vector(self) -> bool

Source

pub fn is_empty_vector_immediate(self) -> bool

Source

pub fn is_tuple(self) -> bool

Source

pub fn is_builtin(self) -> bool

Source

pub fn is_namespace(self) -> bool

Source

pub fn is_empty_list_immediate(self) -> bool

Source

pub fn is_empty_map_immediate(self) -> bool

Source

pub fn type_name(self) -> &'static str

Source

pub fn variant_ctor_id(self, arena: &Arena) -> Option<u32>

Source

pub fn variant_parts(self, arena: &Arena) -> Option<(u32, u16, &[NanValue])>

Source

pub fn bits(self) -> u64

Raw bits - useful for using as HashMap key (inline values only).

Source

pub fn from_bits(bits: u64) -> Self

Source

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.

Trait Implementations§

Source§

impl Clone for NanValue

Source§

fn clone(&self) -> NanValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NanValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for NanValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V