Skip to main content

ValueWord

Struct ValueWord 

Source
pub struct ValueWord(/* private fields */);
Expand description

An 8-byte value word for the VM stack (NaN-boxed encoding).

This is NOT Copy because heap-tagged values reference an Arc<HeapValue>. Clone is implemented manually to bump the Arc refcount (no allocation). Drop is implemented to decrement the Arc refcount.

Implementations§

Source§

impl ValueWord

Source

pub fn to_typed_scalar(&self) -> Option<TypedScalar>

Convert this ValueWord to a TypedScalar, preserving type identity.

Returns None for heap-allocated values (strings, arrays, objects, etc.) which are not representable as scalars.

Source

pub fn from_typed_scalar(ts: TypedScalar) -> Self

Create a ValueWord from a TypedScalar.

Integer kinds are stored as I48 (clamped to the 48-bit range; values outside [-2^47, 2^47-1] are heap-boxed as BigInt via from_i64). Float kinds are stored as plain f64. Bool/None/Unit use their direct ValueWord constructors.

Source§

impl ValueWord

Source

pub fn from_f64(v: f64) -> Self

Create a ValueWord from an f64 value.

Normal f64 values are stored directly. NaN values are canonicalized to a single canonical NaN to avoid collisions with our tagged range.

Source

pub fn from_i64(v: i64) -> Self

Create a ValueWord from an i64 value.

Values in the range [-2^47, 2^47-1] are stored inline as i48. Values outside that range are heap-boxed as HeapValue::BigInt.

Source

pub fn from_native_scalar(value: NativeScalar) -> Self

Create a ValueWord from a width-aware native scalar.

Source

pub fn from_native_i8(v: i8) -> Self

Source

pub fn from_native_u8(v: u8) -> Self

Source

pub fn from_native_i16(v: i16) -> Self

Source

pub fn from_native_u16(v: u16) -> Self

Source

pub fn from_native_i32(v: i32) -> Self

Source

pub fn from_native_u32(v: u32) -> Self

Source

pub fn from_native_u64(v: u64) -> Self

Source

pub fn from_native_isize(v: isize) -> Self

Source

pub fn from_native_usize(v: usize) -> Self

Source

pub fn from_native_ptr(v: usize) -> Self

Source

pub fn from_native_f32(v: f32) -> Self

Source

pub fn from_c_view(ptr: usize, layout: Arc<NativeTypeLayout>) -> Self

Create a pointer-backed C view.

Source

pub fn from_c_mut(ptr: usize, layout: Arc<NativeTypeLayout>) -> Self

Create a pointer-backed mutable C view.

Source

pub fn from_bool(v: bool) -> Self

Create a ValueWord from a bool.

Source

pub fn none() -> Self

Create a ValueWord representing None.

Source

pub fn unit() -> Self

Create a ValueWord representing Unit.

Source

pub fn from_function(id: u16) -> Self

Construct a ValueWord from raw u64 bits, bumping the Arc refcount for heap-tagged values. This is equivalent to Clone::clone but works from raw bits (e.g. read via pointer arithmetic) instead of a &ValueWord. Create a ValueWord from a function ID.

Source

pub fn from_module_function(index: u32) -> Self

Create a ValueWord from a module function index.

Source

pub fn from_ref(absolute_slot: usize) -> Self

Create a ValueWord reference to an absolute stack slot.

References are inline (no heap allocation) — Clone is bitwise copy, Drop is no-op. Used for pass-by-reference semantics: the payload is the absolute stack index of the value being referenced.

Source

pub fn from_string(s: Arc<String>) -> Self

Create a ValueWord from an Arc.

Source

pub fn from_array(a: VMArray) -> Self

Create a ValueWord from a VMArray directly (no intermediate conversion).

Source

pub fn from_decimal(d: Decimal) -> Self

Create a ValueWord from Decimal directly (no intermediate conversion).

Source

pub fn from_heap_value(v: HeapValue) -> Self

Create a ValueWord from any HeapValue directly (no intermediate conversion).

BigInt that fits i48 is unwrapped to its native ValueWord inline tag instead of being heap-allocated. All other variants are heap-boxed.

Source

pub fn from_datatable(dt: Arc<DataTable>) -> Self

Create a ValueWord from a DataTable directly.

Source

pub fn from_typed_table(schema_id: u64, table: Arc<DataTable>) -> Self

Create a ValueWord TypedTable directly.

Source

pub fn from_row_view( schema_id: u64, table: Arc<DataTable>, row_idx: usize, ) -> Self

Create a ValueWord RowView directly.

Source

pub fn from_column_ref( schema_id: u64, table: Arc<DataTable>, col_id: u32, ) -> Self

Create a ValueWord ColumnRef directly.

Source

pub fn from_indexed_table( schema_id: u64, table: Arc<DataTable>, index_col: u32, ) -> Self

Create a ValueWord IndexedTable directly.

Source

pub fn from_range( start: Option<ValueWord>, end: Option<ValueWord>, inclusive: bool, ) -> Self

Create a ValueWord Range directly.

Source

pub fn from_enum(e: EnumValue) -> Self

Create a ValueWord Enum directly.

Source

pub fn from_some(inner: ValueWord) -> Self

Create a ValueWord Some directly.

Source

pub fn from_ok(inner: ValueWord) -> Self

Create a ValueWord Ok directly.

Source

pub fn from_err(inner: ValueWord) -> Self

Create a ValueWord Err directly.

Source

pub fn from_hashmap( keys: Vec<ValueWord>, values: Vec<ValueWord>, index: HashMap<u64, Vec<usize>>, ) -> ValueWord

Create a ValueWord HashMap from keys, values, and index.

Source

pub fn empty_hashmap() -> ValueWord

Create an empty ValueWord HashMap.

Source

pub fn from_hashmap_pairs( keys: Vec<ValueWord>, values: Vec<ValueWord>, ) -> ValueWord

Create a ValueWord HashMap from keys and values, auto-building the bucket index and computing a shape for O(1) property access when all keys are strings.

Source

pub fn from_set(items: Vec<ValueWord>) -> ValueWord

Create a ValueWord Set from items (deduplicating).

Source

pub fn empty_set() -> ValueWord

Create an empty ValueWord Set.

Source

pub fn from_deque(items: Vec<ValueWord>) -> ValueWord

Create a ValueWord Deque from items.

Source

pub fn empty_deque() -> ValueWord

Create an empty ValueWord Deque.

Source

pub fn from_priority_queue(items: Vec<ValueWord>) -> ValueWord

Create a ValueWord PriorityQueue from items (heapified).

Source

pub fn empty_priority_queue() -> ValueWord

Create an empty ValueWord PriorityQueue.

Source

pub fn from_content(node: ContentNode) -> ValueWord

Create a ValueWord from a ContentNode directly.

Source

pub fn from_int_array(a: Arc<TypedBuffer<i64>>) -> Self

Create a ValueWord IntArray from an Arc<TypedBuffer>.

Source

pub fn from_float_array(a: Arc<AlignedTypedBuffer>) -> Self

Create a ValueWord FloatArray from an Arc.

Source

pub fn from_bool_array(a: Arc<TypedBuffer<u8>>) -> Self

Create a ValueWord BoolArray from an Arc<TypedBuffer>.

Source

pub fn from_i8_array(a: Arc<TypedBuffer<i8>>) -> Self

Create a ValueWord I8Array.

Source

pub fn from_i16_array(a: Arc<TypedBuffer<i16>>) -> Self

Create a ValueWord I16Array.

Source

pub fn from_i32_array(a: Arc<TypedBuffer<i32>>) -> Self

Create a ValueWord I32Array.

Source

pub fn from_u8_array(a: Arc<TypedBuffer<u8>>) -> Self

Create a ValueWord U8Array.

Source

pub fn from_u16_array(a: Arc<TypedBuffer<u16>>) -> Self

Create a ValueWord U16Array.

Source

pub fn from_u32_array(a: Arc<TypedBuffer<u32>>) -> Self

Create a ValueWord U32Array.

Source

pub fn from_u64_array(a: Arc<TypedBuffer<u64>>) -> Self

Create a ValueWord U64Array.

Source

pub fn from_f32_array(a: Arc<TypedBuffer<f32>>) -> Self

Create a ValueWord F32Array.

Source

pub fn from_matrix(m: Box<MatrixData>) -> Self

Create a ValueWord Matrix from MatrixData.

Source

pub fn from_iterator(state: Box<IteratorState>) -> Self

Create a ValueWord Iterator from IteratorState.

Source

pub fn from_generator(state: Box<GeneratorState>) -> Self

Create a ValueWord Generator from GeneratorState.

Source

pub fn from_future(id: u64) -> Self

Create a ValueWord Future directly.

Source

pub fn from_task_group(kind: u8, task_ids: Vec<u64>) -> Self

Create a ValueWord TaskGroup directly.

Source

pub fn from_mutex(value: ValueWord) -> Self

Create a ValueWord Mutex wrapping a value.

Source

pub fn from_atomic(value: i64) -> Self

Create a ValueWord Atomic with an initial integer value.

Source

pub fn from_lazy(initializer: ValueWord) -> Self

Create a ValueWord Lazy with an initializer closure.

Source

pub fn from_channel(data: ChannelData) -> Self

Create a ValueWord Channel endpoint.

Source

pub fn from_trait_object(value: ValueWord, vtable: Arc<VTable>) -> Self

Create a ValueWord TraitObject directly.

Source

pub fn from_expr_proxy(col_name: Arc<String>) -> Self

Create a ValueWord ExprProxy directly.

Source

pub fn from_filter_expr(node: Arc<FilterNode>) -> Self

Create a ValueWord FilterExpr directly.

Source

pub fn from_instant(t: Instant) -> Self

Create a ValueWord Instant directly.

Source

pub fn from_io_handle(data: IoHandleData) -> Self

Create a ValueWord IoHandle.

Source

pub fn from_time(t: DateTime<FixedOffset>) -> Self

Create a ValueWord Time directly from a DateTime.

Source

pub fn from_time_utc(t: DateTime<Utc>) -> Self

Create a ValueWord Time from a DateTime (converts to FixedOffset).

Source

pub fn from_duration(d: Duration) -> Self

Create a ValueWord Duration directly.

Source

pub fn from_timespan(ts: Duration) -> Self

Create a ValueWord TimeSpan directly.

Source

pub fn from_timeframe(tf: Timeframe) -> Self

Create a ValueWord Timeframe directly.

Source

pub fn from_host_closure(nc: HostCallable) -> Self

Create a ValueWord HostClosure directly.

Source

pub fn from_print_result(pr: PrintResult) -> Self

Create a ValueWord PrintResult directly.

Source

pub fn from_simulation_call( name: String, params: HashMap<String, ValueWord>, ) -> Self

Create a ValueWord SimulationCall directly.

Source

pub fn from_function_ref(name: String, closure: Option<ValueWord>) -> Self

Create a ValueWord FunctionRef directly.

Source

pub fn from_data_reference( datetime: DateTime<FixedOffset>, id: String, timeframe: Timeframe, ) -> Self

Create a ValueWord DataReference directly.

Source

pub fn from_time_reference(tr: TimeReference) -> Self

Create a ValueWord TimeReference directly.

Source

pub fn from_datetime_expr(de: DateTimeExpr) -> Self

Create a ValueWord DateTimeExpr directly.

Source

pub fn from_data_datetime_ref(dr: DataDateTimeRef) -> Self

Create a ValueWord DataDateTimeRef directly.

Source

pub fn from_type_annotation(ta: TypeAnnotation) -> Self

Create a ValueWord TypeAnnotation directly.

Source

pub fn from_type_annotated_value(type_name: String, value: ValueWord) -> Self

Create a ValueWord TypeAnnotatedValue directly.

Source

pub unsafe fn clone_from_bits(bits: u64) -> Self

Create a ValueWord by “cloning” from raw bits read from a stack slot.

For inline values (f64, i48, bool, none, unit, function), this simply wraps the bits. For heap values (without gc), it bumps the Arc refcount. With gc, it’s a pure bitwise copy (GC handles liveness).

§Safety

bits must be a valid ValueWord representation (either an inline value or a heap-tagged value with a valid Arc / GC pointer).

Source

pub fn is_f64(&self) -> bool

Returns true if this value is an inline f64 (not a tagged value).

Source

pub fn is_i64(&self) -> bool

Returns true if this value is an inline i48 integer.

Source

pub fn is_bool(&self) -> bool

Returns true if this value is a bool.

Source

pub fn is_none(&self) -> bool

Returns true if this value is None.

Source

pub fn is_unit(&self) -> bool

Returns true if this value is Unit.

Source

pub fn is_function(&self) -> bool

Returns true if this value is a function reference.

Source

pub fn is_heap(&self) -> bool

Returns true if this value is a heap-boxed HeapValue.

Source

pub fn is_ref(&self) -> bool

Returns true if this value is a stack reference.

Source

pub fn as_ref_slot(&self) -> Option<usize>

Extract the absolute stack slot index from a reference. Returns None if this is not a reference.

Source

pub fn as_f64(&self) -> Option<f64>

Extract as f64, returning None if this is not an inline f64.

Source

pub fn as_i64(&self) -> Option<i64>

Extract as i64, returning None if this is not an exact signed integer.

Accepts inline i48 values, heap BigInt, and signed-compatible native scalars.

Source

pub fn as_u64(&self) -> Option<u64>

Extract as u64 when the value is an exact non-negative integer.

Source

pub fn as_i128_exact(&self) -> Option<i128>

Extract exact integer domain as i128 (used for width-aware arithmetic/comparison).

Source

pub fn as_number_strict(&self) -> Option<f64>

Extract numeric values as f64, including lossless i48→f64 coercion.

Source

pub fn as_bool(&self) -> Option<bool>

Extract as bool, returning None if this is not a bool.

Source

pub fn as_function(&self) -> Option<u16>

Extract as function ID, returning None if this is not a function.

Source

pub unsafe fn as_f64_unchecked(&self) -> f64

Extract f64 without type checking. Safely handles inline i48 ints via lossless coercion.

§Safety

Caller must ensure the value is numeric (f64 or i48).

Source

pub unsafe fn as_i64_unchecked(&self) -> i64

Extract i64 without type checking. Safely handles f64 values via truncation.

§Safety

Caller must ensure the value is numeric (i48 or f64).

Source

pub unsafe fn as_bool_unchecked(&self) -> bool

Extract bool without type checking.

§Safety

Caller must ensure self.is_bool() is true.

Source

pub unsafe fn as_function_unchecked(&self) -> u16

Extract function ID without type checking.

§Safety

Caller must ensure self.is_function() is true.

Source

pub fn as_heap_ref(&self) -> Option<&HeapValue>

Get a reference to the heap-boxed HeapValue without cloning. Returns None if this is not a heap value.

Source

pub fn as_heap_mut(&mut self) -> Option<&mut HeapValue>

Get a mutable reference to the heap-boxed HeapValue, cloning if shared. Returns None if this is not a heap value.

Without gc: Uses Arc::make_mut semantics (clones if refcount > 1). With gc: Direct mutable access (GC objects are not refcounted).

Source

pub fn is_truthy(&self) -> bool

Check truthiness without materializing HeapValue.

Source

pub fn as_number_coerce(&self) -> Option<f64>

Extract as f64 using safe coercion.

This accepts:

  • explicit floating-point values (number, f32)
  • inline int values (i48)

It intentionally does not coerce BigInt, i64, or u64 native scalars into f64 to avoid lossy conversion.

Source

pub fn is_module_function(&self) -> bool

Check if this ValueWord is a module function tag.

Source

pub fn as_module_function(&self) -> Option<usize>

Extract module function index.

Source

pub fn heap_kind(&self) -> Option<HeapKind>

Get the HeapKind discriminator without cloning. Returns None if this is not a heap value.

Source

pub fn tag(&self) -> NanTag

Tag discriminator for ValueWord values. Used for fast dispatch without materializing HeapValue.

Source

pub fn as_str(&self) -> Option<&str>

Get a reference to a heap String without cloning. Returns None if this is not a heap-boxed String.

Source

pub fn as_decimal(&self) -> Option<Decimal>

Extract a Decimal from a heap-boxed Decimal value. Returns None if this is not a heap-boxed Decimal.

Source

pub unsafe fn as_decimal_unchecked(&self) -> Decimal

Extract a Decimal without type checking.

§Safety

Caller must ensure this is a heap-boxed Decimal value.

Source

pub fn as_array(&self) -> Option<&VMArray>

👎Deprecated: Use as_any_array() instead for unified typed array dispatch

Get a reference to a heap Array without cloning. Returns None if this is not a heap-boxed Array.

Source

pub fn as_any_array(&self) -> Option<ArrayView<'_>>

Get a unified read-only view over any array variant (Generic, Int, Float, Bool, width-specific).

Source

pub fn as_any_array_mut(&mut self) -> Option<ArrayViewMut<'_>>

Get a unified mutable view over any array variant. Uses Arc::make_mut for COW.

Source

pub fn as_datatable(&self) -> Option<&Arc<DataTable>>

Extract a reference to a DataTable.

Source

pub fn as_typed_table(&self) -> Option<(u64, &Arc<DataTable>)>

Extract TypedTable fields.

Source

pub fn as_row_view(&self) -> Option<(u64, &Arc<DataTable>, usize)>

Extract RowView fields.

Source

pub fn as_column_ref(&self) -> Option<(u64, &Arc<DataTable>, u32)>

Extract ColumnRef fields.

Source

pub fn as_indexed_table(&self) -> Option<(u64, &Arc<DataTable>, u32)>

Extract IndexedTable fields.

Source

pub fn as_typed_object(&self) -> Option<(u64, &[ValueSlot], u64)>

Extract TypedObject fields (schema_id, slots, heap_mask).

Source

pub fn as_closure(&self) -> Option<(u16, &[Upvalue])>

Extract Closure fields (function_id, upvalues).

Source

pub fn as_some_inner(&self) -> Option<&ValueWord>

Extract the inner value from a Some variant.

Source

pub fn as_ok_inner(&self) -> Option<&ValueWord>

Extract the inner value from an Ok variant.

Source

pub fn as_err_inner(&self) -> Option<&ValueWord>

Extract the inner value from an Err variant.

Source

pub fn as_err_payload(&self) -> Option<ValueWord>

Extract the original payload from an Err variant, unwrapping AnyError normalization if present.

When Err(x) is constructed at runtime, x is wrapped in an AnyError TypedObject (slot layout: [category, payload, cause, trace, message, code]). This method detects that wrapper and returns the original payload from slot 1 rather than the full AnyError struct.

Source

pub fn as_future(&self) -> Option<u64>

Extract a Future ID.

Source

pub fn as_trait_object(&self) -> Option<(&ValueWord, &Arc<VTable>)>

Extract TraitObject fields.

Source

pub fn as_expr_proxy(&self) -> Option<&Arc<String>>

Extract ExprProxy column name.

Source

pub fn as_filter_expr(&self) -> Option<&Arc<FilterNode>>

Extract FilterExpr node.

Source

pub fn as_host_closure(&self) -> Option<&HostCallable>

Extract a HostClosure reference.

Source

pub fn as_duration(&self) -> Option<&Duration>

Extract a Duration reference.

Source

pub fn as_range(&self) -> Option<(Option<&ValueWord>, Option<&ValueWord>, bool)>

Extract a Range (start, end, inclusive).

Source

pub fn as_timespan(&self) -> Option<Duration>

Extract a TimeSpan (chrono::Duration).

Source

pub fn as_enum(&self) -> Option<&EnumValue>

Extract an EnumValue reference.

Source

pub fn as_timeframe(&self) -> Option<&Timeframe>

Extract a Timeframe reference.

Source

pub fn as_hashmap( &self, ) -> Option<(&Vec<ValueWord>, &Vec<ValueWord>, &HashMap<u64, Vec<usize>>)>

Get the HashMap contents if this is a HashMap.

Source

pub fn as_hashmap_data(&self) -> Option<&HashMapData>

Get read-only access to the full HashMapData (includes shape_id).

Source

pub fn as_hashmap_mut(&mut self) -> Option<&mut HashMapData>

Get mutable access to the HashMapData. Uses copy-on-write via as_heap_mut() (clones if Arc refcount > 1).

Source

pub fn as_set(&self) -> Option<&SetData>

Get the Set data if this is a Set.

Source

pub fn as_set_mut(&mut self) -> Option<&mut SetData>

Get mutable access to the SetData.

Source

pub fn as_deque(&self) -> Option<&DequeData>

Get the Deque data if this is a Deque.

Source

pub fn as_deque_mut(&mut self) -> Option<&mut DequeData>

Get mutable access to the DequeData.

Source

pub fn as_priority_queue(&self) -> Option<&PriorityQueueData>

Get the PriorityQueue data if this is a PriorityQueue.

Source

pub fn as_priority_queue_mut(&mut self) -> Option<&mut PriorityQueueData>

Get mutable access to the PriorityQueueData.

Source

pub fn as_content(&self) -> Option<&ContentNode>

Extract a ContentNode reference.

Source

pub fn as_time(&self) -> Option<DateTime<FixedOffset>>

Extract a DateTime.

Source

pub fn as_instant(&self) -> Option<&Instant>

Extract a reference to the Instant.

Source

pub fn as_io_handle(&self) -> Option<&IoHandleData>

Extract a reference to the IoHandleData.

Source

pub fn as_native_scalar(&self) -> Option<NativeScalar>

Extract a width-aware native scalar value.

Source

pub fn as_native_view(&self) -> Option<&NativeViewData>

Extract a pointer-backed native view.

Source

pub fn as_datetime(&self) -> Option<&DateTime<FixedOffset>>

Extract a reference to the DateTime.

Source

pub fn as_arc_string(&self) -> Option<&Arc<String>>

Extract an Arc from a heap String.

Source

pub fn as_int_array(&self) -> Option<&Arc<TypedBuffer<i64>>>

Extract a reference to an IntArray.

Source

pub fn as_float_array(&self) -> Option<&Arc<AlignedTypedBuffer>>

Extract a reference to a FloatArray.

Source

pub fn as_bool_array(&self) -> Option<&Arc<TypedBuffer<u8>>>

Extract a reference to a BoolArray.

Source

pub fn as_matrix(&self) -> Option<&MatrixData>

Extract a reference to MatrixData.

Source

pub fn as_iterator(&self) -> Option<&IteratorState>

Extract a reference to IteratorState.

Source

pub fn as_generator(&self) -> Option<&GeneratorState>

Extract a reference to GeneratorState.

Source

pub fn typed_array_len(&self) -> Option<usize>

Get the length of a typed array (IntArray, FloatArray, BoolArray, width-specific). Returns None for non-typed-array values.

Source

pub fn coerce_to_float_array(&self) -> Option<Arc<AlignedTypedBuffer>>

Coerce a typed array to a FloatArray (zero-copy for FloatArray, convert for IntArray).

Source

pub fn to_generic_array(&self) -> Option<VMArray>

Convert a typed array to a generic Array of ValueWord values.

Source

pub fn vw_equals(&self, other: &ValueWord) -> bool

Fast equality comparison without materializing HeapValue. For inline types (f64, i48, bool, none, unit, function), compares bits directly. For heap types, falls back to HeapValue equality.

Source

pub fn vw_hash(&self) -> u64

Compute a hash for a ValueWord value, suitable for HashMap key usage. Uses the existing tag dispatch for O(1) inline types.

Source

pub unsafe fn add_f64(a: &Self, b: &Self) -> Self

Add two inline f64 values.

§Safety

Both a and b must be inline f64 values (is_f64() is true).

Source

pub unsafe fn add_i64(a: &Self, b: &Self) -> Self

Add two inline i48 values with overflow promotion to f64.

§Safety

Both a and b must be inline i48 values (is_i64() is true).

Source

pub unsafe fn sub_f64(a: &Self, b: &Self) -> Self

Subtract two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

pub unsafe fn sub_i64(a: &Self, b: &Self) -> Self

Subtract two inline i48 values with overflow promotion to f64.

§Safety

Both a and b must be inline i48 values.

Source

pub unsafe fn mul_f64(a: &Self, b: &Self) -> Self

Multiply two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

pub unsafe fn mul_i64(a: &Self, b: &Self) -> Self

Multiply two inline i48 values with overflow promotion to f64.

§Safety

Both a and b must be inline i48 values.

Source

pub unsafe fn div_f64(a: &Self, b: &Self) -> Self

Divide two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

pub fn binary_int_preserving( a: &Self, b: &Self, a_num: f64, b_num: f64, int_op: impl FnOnce(i64, i64) -> Option<i64>, float_op: impl FnOnce(f64, f64) -> f64, ) -> Self

Binary arithmetic with integer-preserving semantics and overflow promotion.

If both operands are inline I48, applies int_op (checked) to the i64 values. On overflow (None), falls back to float_op with the f64 coercions. If either operand is f64, applies float_op directly. Callers must ensure a_num and b_num are the as_number_coerce() results from the same a/b operands.

Source

pub unsafe fn gt_i64(a: &Self, b: &Self) -> Self

Compare two inline i48 values (greater than), returning a ValueWord bool.

§Safety

Both a and b must be inline i48 values.

Source

pub unsafe fn lt_i64(a: &Self, b: &Self) -> Self

Compare two inline i48 values (less than), returning a ValueWord bool.

§Safety

Both a and b must be inline i48 values.

Source

pub fn raw_bits(&self) -> u64

Returns the raw u64 bits (for debugging/testing).

Source

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

Get the type name of this value.

Source

pub fn to_number(&self) -> Option<f64>

Extract as f64, coercing i48 to f64 if needed. Alias for as_number_coerce() — convenience method.

Source

pub fn to_bool(&self) -> Option<bool>

Extract as bool. Alias for as_bool() — convenience method.

Source

pub fn as_usize(&self) -> Option<usize>

Convert Int or Number to usize (for indexing operations).

Source

pub fn to_json_value(&self) -> Value

Convert this value to a JSON value for serialization.

Trait Implementations§

Source§

impl Clone for ValueWord

Available on non-crate feature gc only.
Source§

fn clone(&self) -> Self

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 ValueWord

Source§

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

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

impl Display for ValueWord

Source§

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

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

impl Drop for ValueWord

Available on non-crate feature gc only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for ValueWord

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ValueWord

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,