Skip to main content

Value

Struct Value 

Source
pub struct Value(/* 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) -> ValueWord

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) -> ValueWord

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) -> ValueWord

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) -> ValueWord

Create a ValueWord from a width-aware native scalar.

Source

pub fn from_native_i8(v: i8) -> ValueWord

Source

pub fn from_native_u8(v: u8) -> ValueWord

Source

pub fn from_native_i16(v: i16) -> ValueWord

Source

pub fn from_native_u16(v: u16) -> ValueWord

Source

pub fn from_native_i32(v: i32) -> ValueWord

Source

pub fn from_native_u32(v: u32) -> ValueWord

Source

pub fn from_native_u64(v: u64) -> ValueWord

Source

pub fn from_native_isize(v: isize) -> ValueWord

Source

pub fn from_native_usize(v: usize) -> ValueWord

Source

pub fn from_native_ptr(v: usize) -> ValueWord

Source

pub fn from_native_f32(v: f32) -> ValueWord

Source

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

Create a pointer-backed C view.

Source

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

Create a pointer-backed mutable C view.

Source

pub fn from_bool(v: bool) -> ValueWord

Create a ValueWord from a bool.

Source

pub fn none() -> ValueWord

Create a ValueWord representing None.

Source

pub fn unit() -> ValueWord

Create a ValueWord representing Unit.

Source

pub fn from_function(id: u16) -> ValueWord

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) -> ValueWord

Create a ValueWord from a module function index.

Source

pub fn from_ref(absolute_slot: usize) -> ValueWord

Create a ValueWord reference to an absolute stack slot.

Source

pub fn from_module_binding_ref(binding_idx: usize) -> ValueWord

Create a ValueWord reference to a module binding slot.

Source

pub fn from_projected_ref( base: ValueWord, projection: RefProjection, ) -> ValueWord

Create a projected reference backed by heap metadata.

Source

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

Create a ValueWord from an Arc.

Source

pub fn from_char(c: char) -> ValueWord

Create a ValueWord from a char.

Source

pub fn as_char(&self) -> Option<char>

Extract a char if this is a HeapValue::Char.

Source

pub fn from_array(a: Arc<Vec<ValueWord>>) -> ValueWord

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

Source

pub fn from_decimal(d: Decimal) -> ValueWord

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

Source

pub fn from_heap_value(v: HeapValue) -> ValueWord

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>) -> ValueWord

Create a ValueWord from a DataTable directly.

Source

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

Create a ValueWord TypedTable directly.

Source

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

Create a ValueWord RowView directly.

Source

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

Create a ValueWord ColumnRef directly.

Source

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

Create a ValueWord IndexedTable directly.

Source

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

Create a ValueWord Range directly.

Source

pub fn from_enum(e: EnumValue) -> ValueWord

Create a ValueWord Enum directly.

Source

pub fn from_some(inner: ValueWord) -> ValueWord

Create a ValueWord Some directly.

Source

pub fn from_ok(inner: ValueWord) -> ValueWord

Create a ValueWord Ok directly.

Source

pub fn from_err(inner: ValueWord) -> ValueWord

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>>) -> ValueWord

Create a ValueWord IntArray from an Arc<TypedBuffer>.

Source

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

Create a ValueWord FloatArray from an Arc.

Source

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

Create a ValueWord BoolArray from an Arc<TypedBuffer>.

Source

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

Create a ValueWord I8Array.

Source

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

Create a ValueWord I16Array.

Source

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

Create a ValueWord I32Array.

Source

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

Create a ValueWord U8Array.

Source

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

Create a ValueWord U16Array.

Source

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

Create a ValueWord U32Array.

Source

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

Create a ValueWord U64Array.

Source

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

Create a ValueWord F32Array.

Source

pub fn from_matrix(m: Arc<MatrixData>) -> ValueWord

Create a ValueWord Matrix from MatrixData.

Source

pub fn from_float_array_slice( parent: Arc<MatrixData>, offset: u32, len: u32, ) -> ValueWord

Create a ValueWord FloatArraySlice — a zero-copy view into a parent matrix.

Source

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

Create a ValueWord Iterator from IteratorState.

Source

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

Create a ValueWord Generator from GeneratorState.

Source

pub fn from_future(id: u64) -> ValueWord

Create a ValueWord Future directly.

Source

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

Create a ValueWord TaskGroup directly.

Source

pub fn from_mutex(value: ValueWord) -> ValueWord

Create a ValueWord Mutex wrapping a value.

Source

pub fn from_atomic(value: i64) -> ValueWord

Create a ValueWord Atomic with an initial integer value.

Source

pub fn from_lazy(initializer: ValueWord) -> ValueWord

Create a ValueWord Lazy with an initializer closure.

Source

pub fn from_channel(data: ChannelData) -> ValueWord

Create a ValueWord Channel endpoint.

Source

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

Create a ValueWord TraitObject directly.

Source

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

Create a ValueWord ExprProxy directly.

Source

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

Create a ValueWord FilterExpr directly.

Source

pub fn from_instant(t: Instant) -> ValueWord

Create a ValueWord Instant directly.

Source

pub fn from_io_handle(data: IoHandleData) -> ValueWord

Create a ValueWord IoHandle.

Source

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

Create a ValueWord Time directly from a DateTime.

Source

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

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

Source

pub fn from_duration(d: Duration) -> ValueWord

Create a ValueWord Duration directly.

Source

pub fn from_timespan(ts: TimeDelta) -> ValueWord

Create a ValueWord TimeSpan directly.

Source

pub fn from_timeframe(tf: Timeframe) -> ValueWord

Create a ValueWord Timeframe directly.

Source

pub fn from_host_closure(nc: HostCallable) -> ValueWord

Create a ValueWord HostClosure directly.

Source

pub fn from_print_result(pr: PrintResult) -> ValueWord

Create a ValueWord PrintResult directly.

Source

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

Create a ValueWord SimulationCall directly.

Source

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

Create a ValueWord FunctionRef directly.

Source

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

Create a ValueWord DataReference directly.

Source

pub fn from_time_reference(tr: TimeReference) -> ValueWord

Create a ValueWord TimeReference directly.

Source

pub fn from_datetime_expr(de: DateTimeExpr) -> ValueWord

Create a ValueWord DateTimeExpr directly.

Source

pub fn from_data_datetime_ref(dr: DataDateTimeRef) -> ValueWord

Create a ValueWord DataDateTimeRef directly.

Source

pub fn from_type_annotation(ta: TypeAnnotation) -> ValueWord

Create a ValueWord TypeAnnotation directly.

Source

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

Create a ValueWord TypeAnnotatedValue directly.

Source

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

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_target(&self) -> Option<RefTarget>

Extract the reference target.

Source

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

Extract the absolute stack slot index from a stack 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<&Arc<Vec<ValueWord>>>

👎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<TimeDelta>

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<Arc<Vec<ValueWord>>>

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: &ValueWord, b: &ValueWord) -> ValueWord

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: &ValueWord, b: &ValueWord) -> ValueWord

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: &ValueWord, b: &ValueWord) -> ValueWord

Subtract two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

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

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: &ValueWord, b: &ValueWord) -> ValueWord

Multiply two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

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

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: &ValueWord, b: &ValueWord) -> ValueWord

Divide two inline f64 values.

§Safety

Both a and b must be inline f64 values.

Source

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

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: &ValueWord, b: &ValueWord) -> ValueWord

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: &ValueWord, b: &ValueWord) -> ValueWord

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) -> ValueWord

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<(), Error>

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

impl Display for ValueWord

Source§

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

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 From<ValueWord> for TypedValue

Convert ValueWord to TypedValue with inferred type

Note: This performs basic type inference from the runtime value. For precise typing, use explicit TypedValue constructors.

Source§

fn from(nb: ValueWord) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ValueWord

Source§

fn eq(&self, other: &ValueWord) -> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,