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
impl ValueWord
Sourcepub fn to_typed_scalar(&self) -> Option<TypedScalar>
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.
Sourcepub fn from_typed_scalar(ts: TypedScalar) -> ValueWord
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
impl ValueWord
Sourcepub fn from_f64(v: f64) -> ValueWord
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.
Sourcepub fn from_i64(v: i64) -> ValueWord
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.
Sourcepub fn from_native_scalar(value: NativeScalar) -> ValueWord
pub fn from_native_scalar(value: NativeScalar) -> ValueWord
Create a ValueWord from a width-aware native scalar.
pub fn from_native_i8(v: i8) -> ValueWord
pub fn from_native_u8(v: u8) -> ValueWord
pub fn from_native_i16(v: i16) -> ValueWord
pub fn from_native_u16(v: u16) -> ValueWord
pub fn from_native_i32(v: i32) -> ValueWord
pub fn from_native_u32(v: u32) -> ValueWord
pub fn from_native_u64(v: u64) -> ValueWord
pub fn from_native_isize(v: isize) -> ValueWord
pub fn from_native_usize(v: usize) -> ValueWord
pub fn from_native_ptr(v: usize) -> ValueWord
pub fn from_native_f32(v: f32) -> ValueWord
Sourcepub fn from_c_view(ptr: usize, layout: Arc<NativeTypeLayout>) -> ValueWord
pub fn from_c_view(ptr: usize, layout: Arc<NativeTypeLayout>) -> ValueWord
Create a pointer-backed C view.
Sourcepub fn from_c_mut(ptr: usize, layout: Arc<NativeTypeLayout>) -> ValueWord
pub fn from_c_mut(ptr: usize, layout: Arc<NativeTypeLayout>) -> ValueWord
Create a pointer-backed mutable C view.
Sourcepub fn from_function(id: u16) -> ValueWord
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.
Sourcepub fn from_module_function(index: u32) -> ValueWord
pub fn from_module_function(index: u32) -> ValueWord
Create a ValueWord from a module function index.
Sourcepub fn from_ref(absolute_slot: usize) -> ValueWord
pub fn from_ref(absolute_slot: usize) -> ValueWord
Create a ValueWord reference to an absolute stack slot.
Sourcepub fn from_module_binding_ref(binding_idx: usize) -> ValueWord
pub fn from_module_binding_ref(binding_idx: usize) -> ValueWord
Create a ValueWord reference to a module binding slot.
Sourcepub fn from_projected_ref(
base: ValueWord,
projection: RefProjection,
) -> ValueWord
pub fn from_projected_ref( base: ValueWord, projection: RefProjection, ) -> ValueWord
Create a projected reference backed by heap metadata.
Sourcepub fn from_string(s: Arc<String>) -> ValueWord
pub fn from_string(s: Arc<String>) -> ValueWord
Create a ValueWord from an Arc
Sourcepub fn from_array(a: Arc<Vec<ValueWord>>) -> ValueWord
pub fn from_array(a: Arc<Vec<ValueWord>>) -> ValueWord
Create a ValueWord from a VMArray directly (no intermediate conversion).
Sourcepub fn from_decimal(d: Decimal) -> ValueWord
pub fn from_decimal(d: Decimal) -> ValueWord
Create a ValueWord from Decimal directly (no intermediate conversion).
Sourcepub fn from_heap_value(v: HeapValue) -> ValueWord
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.
Sourcepub fn from_datatable(dt: Arc<DataTable>) -> ValueWord
pub fn from_datatable(dt: Arc<DataTable>) -> ValueWord
Create a ValueWord from a DataTable directly.
Sourcepub fn from_typed_table(schema_id: u64, table: Arc<DataTable>) -> ValueWord
pub fn from_typed_table(schema_id: u64, table: Arc<DataTable>) -> ValueWord
Create a ValueWord TypedTable directly.
Sourcepub fn from_row_view(
schema_id: u64,
table: Arc<DataTable>,
row_idx: usize,
) -> ValueWord
pub fn from_row_view( schema_id: u64, table: Arc<DataTable>, row_idx: usize, ) -> ValueWord
Create a ValueWord RowView directly.
Sourcepub fn from_column_ref(
schema_id: u64,
table: Arc<DataTable>,
col_id: u32,
) -> ValueWord
pub fn from_column_ref( schema_id: u64, table: Arc<DataTable>, col_id: u32, ) -> ValueWord
Create a ValueWord ColumnRef directly.
Sourcepub fn from_indexed_table(
schema_id: u64,
table: Arc<DataTable>,
index_col: u32,
) -> ValueWord
pub fn from_indexed_table( schema_id: u64, table: Arc<DataTable>, index_col: u32, ) -> ValueWord
Create a ValueWord IndexedTable directly.
Sourcepub fn from_range(
start: Option<ValueWord>,
end: Option<ValueWord>,
inclusive: bool,
) -> ValueWord
pub fn from_range( start: Option<ValueWord>, end: Option<ValueWord>, inclusive: bool, ) -> ValueWord
Create a ValueWord Range directly.
Sourcepub fn from_hashmap(
keys: Vec<ValueWord>,
values: Vec<ValueWord>,
index: HashMap<u64, Vec<usize>>,
) -> ValueWord
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.
Sourcepub fn empty_hashmap() -> ValueWord
pub fn empty_hashmap() -> ValueWord
Create an empty ValueWord HashMap.
Sourcepub fn from_hashmap_pairs(
keys: Vec<ValueWord>,
values: Vec<ValueWord>,
) -> ValueWord
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.
Sourcepub fn from_set(items: Vec<ValueWord>) -> ValueWord
pub fn from_set(items: Vec<ValueWord>) -> ValueWord
Create a ValueWord Set from items (deduplicating).
Sourcepub fn from_deque(items: Vec<ValueWord>) -> ValueWord
pub fn from_deque(items: Vec<ValueWord>) -> ValueWord
Create a ValueWord Deque from items.
Sourcepub fn empty_deque() -> ValueWord
pub fn empty_deque() -> ValueWord
Create an empty ValueWord Deque.
Sourcepub fn from_priority_queue(items: Vec<ValueWord>) -> ValueWord
pub fn from_priority_queue(items: Vec<ValueWord>) -> ValueWord
Create a ValueWord PriorityQueue from items (heapified).
Sourcepub fn empty_priority_queue() -> ValueWord
pub fn empty_priority_queue() -> ValueWord
Create an empty ValueWord PriorityQueue.
Sourcepub fn from_content(node: ContentNode) -> ValueWord
pub fn from_content(node: ContentNode) -> ValueWord
Create a ValueWord from a ContentNode directly.
Sourcepub fn from_int_array(a: Arc<TypedBuffer<i64>>) -> ValueWord
pub fn from_int_array(a: Arc<TypedBuffer<i64>>) -> ValueWord
Create a ValueWord IntArray from an Arc<TypedBuffer
Sourcepub fn from_float_array(a: Arc<AlignedTypedBuffer>) -> ValueWord
pub fn from_float_array(a: Arc<AlignedTypedBuffer>) -> ValueWord
Create a ValueWord FloatArray from an Arc
Sourcepub fn from_bool_array(a: Arc<TypedBuffer<u8>>) -> ValueWord
pub fn from_bool_array(a: Arc<TypedBuffer<u8>>) -> ValueWord
Create a ValueWord BoolArray from an Arc<TypedBuffer
Sourcepub fn from_i8_array(a: Arc<TypedBuffer<i8>>) -> ValueWord
pub fn from_i8_array(a: Arc<TypedBuffer<i8>>) -> ValueWord
Create a ValueWord I8Array.
Sourcepub fn from_i16_array(a: Arc<TypedBuffer<i16>>) -> ValueWord
pub fn from_i16_array(a: Arc<TypedBuffer<i16>>) -> ValueWord
Create a ValueWord I16Array.
Sourcepub fn from_i32_array(a: Arc<TypedBuffer<i32>>) -> ValueWord
pub fn from_i32_array(a: Arc<TypedBuffer<i32>>) -> ValueWord
Create a ValueWord I32Array.
Sourcepub fn from_u8_array(a: Arc<TypedBuffer<u8>>) -> ValueWord
pub fn from_u8_array(a: Arc<TypedBuffer<u8>>) -> ValueWord
Create a ValueWord U8Array.
Sourcepub fn from_u16_array(a: Arc<TypedBuffer<u16>>) -> ValueWord
pub fn from_u16_array(a: Arc<TypedBuffer<u16>>) -> ValueWord
Create a ValueWord U16Array.
Sourcepub fn from_u32_array(a: Arc<TypedBuffer<u32>>) -> ValueWord
pub fn from_u32_array(a: Arc<TypedBuffer<u32>>) -> ValueWord
Create a ValueWord U32Array.
Sourcepub fn from_u64_array(a: Arc<TypedBuffer<u64>>) -> ValueWord
pub fn from_u64_array(a: Arc<TypedBuffer<u64>>) -> ValueWord
Create a ValueWord U64Array.
Sourcepub fn from_f32_array(a: Arc<TypedBuffer<f32>>) -> ValueWord
pub fn from_f32_array(a: Arc<TypedBuffer<f32>>) -> ValueWord
Create a ValueWord F32Array.
Sourcepub fn from_matrix(m: Arc<MatrixData>) -> ValueWord
pub fn from_matrix(m: Arc<MatrixData>) -> ValueWord
Create a ValueWord Matrix from MatrixData.
Sourcepub fn from_float_array_slice(
parent: Arc<MatrixData>,
offset: u32,
len: u32,
) -> ValueWord
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.
Sourcepub fn from_iterator(state: Box<IteratorState>) -> ValueWord
pub fn from_iterator(state: Box<IteratorState>) -> ValueWord
Create a ValueWord Iterator from IteratorState.
Sourcepub fn from_generator(state: Box<GeneratorState>) -> ValueWord
pub fn from_generator(state: Box<GeneratorState>) -> ValueWord
Create a ValueWord Generator from GeneratorState.
Sourcepub fn from_future(id: u64) -> ValueWord
pub fn from_future(id: u64) -> ValueWord
Create a ValueWord Future directly.
Sourcepub fn from_task_group(kind: u8, task_ids: Vec<u64>) -> ValueWord
pub fn from_task_group(kind: u8, task_ids: Vec<u64>) -> ValueWord
Create a ValueWord TaskGroup directly.
Sourcepub fn from_mutex(value: ValueWord) -> ValueWord
pub fn from_mutex(value: ValueWord) -> ValueWord
Create a ValueWord Mutex wrapping a value.
Sourcepub fn from_atomic(value: i64) -> ValueWord
pub fn from_atomic(value: i64) -> ValueWord
Create a ValueWord Atomic with an initial integer value.
Sourcepub fn from_lazy(initializer: ValueWord) -> ValueWord
pub fn from_lazy(initializer: ValueWord) -> ValueWord
Create a ValueWord Lazy with an initializer closure.
Sourcepub fn from_channel(data: ChannelData) -> ValueWord
pub fn from_channel(data: ChannelData) -> ValueWord
Create a ValueWord Channel endpoint.
Sourcepub fn from_trait_object(value: ValueWord, vtable: Arc<VTable>) -> ValueWord
pub fn from_trait_object(value: ValueWord, vtable: Arc<VTable>) -> ValueWord
Create a ValueWord TraitObject directly.
Sourcepub fn from_expr_proxy(col_name: Arc<String>) -> ValueWord
pub fn from_expr_proxy(col_name: Arc<String>) -> ValueWord
Create a ValueWord ExprProxy directly.
Sourcepub fn from_filter_expr(node: Arc<FilterNode>) -> ValueWord
pub fn from_filter_expr(node: Arc<FilterNode>) -> ValueWord
Create a ValueWord FilterExpr directly.
Sourcepub fn from_instant(t: Instant) -> ValueWord
pub fn from_instant(t: Instant) -> ValueWord
Create a ValueWord Instant directly.
Sourcepub fn from_io_handle(data: IoHandleData) -> ValueWord
pub fn from_io_handle(data: IoHandleData) -> ValueWord
Create a ValueWord IoHandle.
Sourcepub fn from_time(t: DateTime<FixedOffset>) -> ValueWord
pub fn from_time(t: DateTime<FixedOffset>) -> ValueWord
Create a ValueWord Time directly from a DateTime
Sourcepub fn from_time_utc(t: DateTime<Utc>) -> ValueWord
pub fn from_time_utc(t: DateTime<Utc>) -> ValueWord
Create a ValueWord Time from a DateTime
Sourcepub fn from_duration(d: Duration) -> ValueWord
pub fn from_duration(d: Duration) -> ValueWord
Create a ValueWord Duration directly.
Sourcepub fn from_timespan(ts: TimeDelta) -> ValueWord
pub fn from_timespan(ts: TimeDelta) -> ValueWord
Create a ValueWord TimeSpan directly.
Sourcepub fn from_timeframe(tf: Timeframe) -> ValueWord
pub fn from_timeframe(tf: Timeframe) -> ValueWord
Create a ValueWord Timeframe directly.
Sourcepub fn from_host_closure(nc: HostCallable) -> ValueWord
pub fn from_host_closure(nc: HostCallable) -> ValueWord
Create a ValueWord HostClosure directly.
Sourcepub fn from_print_result(pr: PrintResult) -> ValueWord
pub fn from_print_result(pr: PrintResult) -> ValueWord
Create a ValueWord PrintResult directly.
Sourcepub fn from_simulation_call(
name: String,
params: HashMap<String, ValueWord>,
) -> ValueWord
pub fn from_simulation_call( name: String, params: HashMap<String, ValueWord>, ) -> ValueWord
Create a ValueWord SimulationCall directly.
Sourcepub fn from_function_ref(name: String, closure: Option<ValueWord>) -> ValueWord
pub fn from_function_ref(name: String, closure: Option<ValueWord>) -> ValueWord
Create a ValueWord FunctionRef directly.
Sourcepub fn from_data_reference(
datetime: DateTime<FixedOffset>,
id: String,
timeframe: Timeframe,
) -> ValueWord
pub fn from_data_reference( datetime: DateTime<FixedOffset>, id: String, timeframe: Timeframe, ) -> ValueWord
Create a ValueWord DataReference directly.
Sourcepub fn from_time_reference(tr: TimeReference) -> ValueWord
pub fn from_time_reference(tr: TimeReference) -> ValueWord
Create a ValueWord TimeReference directly.
Sourcepub fn from_datetime_expr(de: DateTimeExpr) -> ValueWord
pub fn from_datetime_expr(de: DateTimeExpr) -> ValueWord
Create a ValueWord DateTimeExpr directly.
Sourcepub fn from_data_datetime_ref(dr: DataDateTimeRef) -> ValueWord
pub fn from_data_datetime_ref(dr: DataDateTimeRef) -> ValueWord
Create a ValueWord DataDateTimeRef directly.
Sourcepub fn from_type_annotation(ta: TypeAnnotation) -> ValueWord
pub fn from_type_annotation(ta: TypeAnnotation) -> ValueWord
Create a ValueWord TypeAnnotation directly.
Sourcepub fn from_type_annotated_value(
type_name: String,
value: ValueWord,
) -> ValueWord
pub fn from_type_annotated_value( type_name: String, value: ValueWord, ) -> ValueWord
Create a ValueWord TypeAnnotatedValue directly.
Sourcepub unsafe fn clone_from_bits(bits: u64) -> ValueWord
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
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Returns true if this value is a function reference.
Sourcepub fn as_ref_target(&self) -> Option<RefTarget>
pub fn as_ref_target(&self) -> Option<RefTarget>
Extract the reference target.
Sourcepub fn as_ref_slot(&self) -> Option<usize>
pub fn as_ref_slot(&self) -> Option<usize>
Extract the absolute stack slot index from a stack reference.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Extract as f64, returning None if this is not an inline f64.
Sourcepub fn as_i64(&self) -> Option<i64>
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.
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Extract as u64 when the value is an exact non-negative integer.
Sourcepub fn as_i128_exact(&self) -> Option<i128>
pub fn as_i128_exact(&self) -> Option<i128>
Extract exact integer domain as i128 (used for width-aware arithmetic/comparison).
Sourcepub fn as_number_strict(&self) -> Option<f64>
pub fn as_number_strict(&self) -> Option<f64>
Extract numeric values as f64, including lossless i48→f64 coercion.
Sourcepub fn as_function(&self) -> Option<u16>
pub fn as_function(&self) -> Option<u16>
Extract as function ID, returning None if this is not a function.
Sourcepub unsafe fn as_f64_unchecked(&self) -> f64
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).
Sourcepub unsafe fn as_i64_unchecked(&self) -> i64
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).
Sourcepub unsafe fn as_bool_unchecked(&self) -> bool
pub unsafe fn as_bool_unchecked(&self) -> bool
Sourcepub unsafe fn as_function_unchecked(&self) -> u16
pub unsafe fn as_function_unchecked(&self) -> u16
Sourcepub fn as_heap_ref(&self) -> Option<&HeapValue>
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.
Sourcepub fn as_heap_mut(&mut self) -> Option<&mut HeapValue>
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).
Sourcepub fn as_number_coerce(&self) -> Option<f64>
pub fn as_number_coerce(&self) -> Option<f64>
Extract as f64 using safe coercion.
This accepts:
- explicit floating-point values (
number,f32) - inline
intvalues (i48)
It intentionally does not coerce BigInt, i64, or u64
native scalars into f64 to avoid lossy conversion.
Sourcepub fn is_module_function(&self) -> bool
pub fn is_module_function(&self) -> bool
Check if this ValueWord is a module function tag.
Sourcepub fn as_module_function(&self) -> Option<usize>
pub fn as_module_function(&self) -> Option<usize>
Extract module function index.
Sourcepub fn heap_kind(&self) -> Option<HeapKind>
pub fn heap_kind(&self) -> Option<HeapKind>
Get the HeapKind discriminator without cloning. Returns None if this is not a heap value.
Sourcepub fn tag(&self) -> NanTag
pub fn tag(&self) -> NanTag
Tag discriminator for ValueWord values. Used for fast dispatch without materializing HeapValue.
Sourcepub fn as_str(&self) -> Option<&str>
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.
Sourcepub fn as_decimal(&self) -> Option<Decimal>
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.
Sourcepub unsafe fn as_decimal_unchecked(&self) -> Decimal
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.
Sourcepub fn as_array(&self) -> Option<&Arc<Vec<ValueWord>>>
👎Deprecated: Use as_any_array() instead for unified typed array dispatch
pub fn as_array(&self) -> Option<&Arc<Vec<ValueWord>>>
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.
Sourcepub fn as_any_array(&self) -> Option<ArrayView<'_>>
pub fn as_any_array(&self) -> Option<ArrayView<'_>>
Get a unified read-only view over any array variant (Generic, Int, Float, Bool, width-specific).
Sourcepub fn as_any_array_mut(&mut self) -> Option<ArrayViewMut<'_>>
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.
Sourcepub fn as_datatable(&self) -> Option<&Arc<DataTable>>
pub fn as_datatable(&self) -> Option<&Arc<DataTable>>
Extract a reference to a DataTable.
Sourcepub fn as_indexed_table(&self) -> Option<(u64, &Arc<DataTable>, u32)>
pub fn as_indexed_table(&self) -> Option<(u64, &Arc<DataTable>, u32)>
Extract IndexedTable fields.
Sourcepub fn as_typed_object(&self) -> Option<(u64, &[ValueSlot], u64)>
pub fn as_typed_object(&self) -> Option<(u64, &[ValueSlot], u64)>
Extract TypedObject fields (schema_id, slots, heap_mask).
Sourcepub fn as_closure(&self) -> Option<(u16, &[Upvalue])>
pub fn as_closure(&self) -> Option<(u16, &[Upvalue])>
Extract Closure fields (function_id, upvalues).
Sourcepub fn as_some_inner(&self) -> Option<&ValueWord>
pub fn as_some_inner(&self) -> Option<&ValueWord>
Extract the inner value from a Some variant.
Sourcepub fn as_ok_inner(&self) -> Option<&ValueWord>
pub fn as_ok_inner(&self) -> Option<&ValueWord>
Extract the inner value from an Ok variant.
Sourcepub fn as_err_inner(&self) -> Option<&ValueWord>
pub fn as_err_inner(&self) -> Option<&ValueWord>
Extract the inner value from an Err variant.
Sourcepub fn as_err_payload(&self) -> Option<ValueWord>
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.
Sourcepub fn as_trait_object(&self) -> Option<(&ValueWord, &Arc<VTable>)>
pub fn as_trait_object(&self) -> Option<(&ValueWord, &Arc<VTable>)>
Extract TraitObject fields.
Sourcepub fn as_expr_proxy(&self) -> Option<&Arc<String>>
pub fn as_expr_proxy(&self) -> Option<&Arc<String>>
Extract ExprProxy column name.
Sourcepub fn as_filter_expr(&self) -> Option<&Arc<FilterNode>>
pub fn as_filter_expr(&self) -> Option<&Arc<FilterNode>>
Extract FilterExpr node.
Sourcepub fn as_host_closure(&self) -> Option<&HostCallable>
pub fn as_host_closure(&self) -> Option<&HostCallable>
Extract a HostClosure reference.
Sourcepub fn as_duration(&self) -> Option<&Duration>
pub fn as_duration(&self) -> Option<&Duration>
Extract a Duration reference.
Sourcepub fn as_range(&self) -> Option<(Option<&ValueWord>, Option<&ValueWord>, bool)>
pub fn as_range(&self) -> Option<(Option<&ValueWord>, Option<&ValueWord>, bool)>
Extract a Range (start, end, inclusive).
Sourcepub fn as_timespan(&self) -> Option<TimeDelta>
pub fn as_timespan(&self) -> Option<TimeDelta>
Extract a TimeSpan (chrono::Duration).
Sourcepub fn as_timeframe(&self) -> Option<&Timeframe>
pub fn as_timeframe(&self) -> Option<&Timeframe>
Extract a Timeframe reference.
Sourcepub fn as_hashmap(
&self,
) -> Option<(&Vec<ValueWord>, &Vec<ValueWord>, &HashMap<u64, Vec<usize>>)>
pub fn as_hashmap( &self, ) -> Option<(&Vec<ValueWord>, &Vec<ValueWord>, &HashMap<u64, Vec<usize>>)>
Get the HashMap contents if this is a HashMap.
Sourcepub fn as_hashmap_data(&self) -> Option<&HashMapData>
pub fn as_hashmap_data(&self) -> Option<&HashMapData>
Get read-only access to the full HashMapData (includes shape_id).
Sourcepub fn as_hashmap_mut(&mut self) -> Option<&mut HashMapData>
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).
Sourcepub fn as_set_mut(&mut self) -> Option<&mut SetData>
pub fn as_set_mut(&mut self) -> Option<&mut SetData>
Get mutable access to the SetData.
Sourcepub fn as_deque_mut(&mut self) -> Option<&mut DequeData>
pub fn as_deque_mut(&mut self) -> Option<&mut DequeData>
Get mutable access to the DequeData.
Sourcepub fn as_priority_queue(&self) -> Option<&PriorityQueueData>
pub fn as_priority_queue(&self) -> Option<&PriorityQueueData>
Get the PriorityQueue data if this is a PriorityQueue.
Sourcepub fn as_priority_queue_mut(&mut self) -> Option<&mut PriorityQueueData>
pub fn as_priority_queue_mut(&mut self) -> Option<&mut PriorityQueueData>
Get mutable access to the PriorityQueueData.
Sourcepub fn as_content(&self) -> Option<&ContentNode>
pub fn as_content(&self) -> Option<&ContentNode>
Extract a ContentNode reference.
Sourcepub fn as_time(&self) -> Option<DateTime<FixedOffset>>
pub fn as_time(&self) -> Option<DateTime<FixedOffset>>
Extract a DateTime
Sourcepub fn as_instant(&self) -> Option<&Instant>
pub fn as_instant(&self) -> Option<&Instant>
Extract a reference to the Instant.
Sourcepub fn as_io_handle(&self) -> Option<&IoHandleData>
pub fn as_io_handle(&self) -> Option<&IoHandleData>
Extract a reference to the IoHandleData.
Sourcepub fn as_native_scalar(&self) -> Option<NativeScalar>
pub fn as_native_scalar(&self) -> Option<NativeScalar>
Extract a width-aware native scalar value.
Sourcepub fn as_native_view(&self) -> Option<&NativeViewData>
pub fn as_native_view(&self) -> Option<&NativeViewData>
Extract a pointer-backed native view.
Sourcepub fn as_datetime(&self) -> Option<&DateTime<FixedOffset>>
pub fn as_datetime(&self) -> Option<&DateTime<FixedOffset>>
Extract a reference to the DateTime
Sourcepub fn as_arc_string(&self) -> Option<&Arc<String>>
pub fn as_arc_string(&self) -> Option<&Arc<String>>
Extract an Arc
Sourcepub fn as_int_array(&self) -> Option<&Arc<TypedBuffer<i64>>>
pub fn as_int_array(&self) -> Option<&Arc<TypedBuffer<i64>>>
Extract a reference to an IntArray.
Sourcepub fn as_float_array(&self) -> Option<&Arc<AlignedTypedBuffer>>
pub fn as_float_array(&self) -> Option<&Arc<AlignedTypedBuffer>>
Extract a reference to a FloatArray.
Sourcepub fn as_bool_array(&self) -> Option<&Arc<TypedBuffer<u8>>>
pub fn as_bool_array(&self) -> Option<&Arc<TypedBuffer<u8>>>
Extract a reference to a BoolArray.
Sourcepub fn as_matrix(&self) -> Option<&MatrixData>
pub fn as_matrix(&self) -> Option<&MatrixData>
Extract a reference to MatrixData.
Sourcepub fn as_iterator(&self) -> Option<&IteratorState>
pub fn as_iterator(&self) -> Option<&IteratorState>
Extract a reference to IteratorState.
Sourcepub fn as_generator(&self) -> Option<&GeneratorState>
pub fn as_generator(&self) -> Option<&GeneratorState>
Extract a reference to GeneratorState.
Sourcepub fn typed_array_len(&self) -> Option<usize>
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.
Sourcepub fn coerce_to_float_array(&self) -> Option<Arc<AlignedTypedBuffer>>
pub fn coerce_to_float_array(&self) -> Option<Arc<AlignedTypedBuffer>>
Coerce a typed array to a FloatArray (zero-copy for FloatArray, convert for IntArray).
Sourcepub fn to_generic_array(&self) -> Option<Arc<Vec<ValueWord>>>
pub fn to_generic_array(&self) -> Option<Arc<Vec<ValueWord>>>
Convert a typed array to a generic Array of ValueWord values.
Sourcepub fn vw_equals(&self, other: &ValueWord) -> bool
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.
Sourcepub fn vw_hash(&self) -> u64
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.
Sourcepub unsafe fn add_i64(a: &ValueWord, b: &ValueWord) -> ValueWord
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).
Sourcepub unsafe fn sub_i64(a: &ValueWord, b: &ValueWord) -> ValueWord
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.
Sourcepub unsafe fn mul_i64(a: &ValueWord, b: &ValueWord) -> ValueWord
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.
Sourcepub 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
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.
Sourcepub unsafe fn gt_i64(a: &ValueWord, b: &ValueWord) -> ValueWord
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.
Sourcepub unsafe fn lt_i64(a: &ValueWord, b: &ValueWord) -> ValueWord
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.
Sourcepub fn to_number(&self) -> Option<f64>
pub fn to_number(&self) -> Option<f64>
Extract as f64, coercing i48 to f64 if needed.
Alias for as_number_coerce() — convenience method.
Sourcepub fn to_bool(&self) -> Option<bool>
pub fn to_bool(&self) -> Option<bool>
Extract as bool.
Alias for as_bool() — convenience method.
Sourcepub fn as_usize(&self) -> Option<usize>
pub fn as_usize(&self) -> Option<usize>
Convert Int or Number to usize (for indexing operations).
Sourcepub fn to_json_value(&self) -> Value
pub fn to_json_value(&self) -> Value
Convert this value to a JSON value for serialization.
Trait Implementations§
Source§impl From<ValueWord> for TypedValue
Convert ValueWord to TypedValue with inferred type
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.
impl Eq for ValueWord
Auto Trait Implementations§
impl Freeze for ValueWord
impl RefUnwindSafe for ValueWord
impl Send for ValueWord
impl Sync for ValueWord
impl Unpin for ValueWord
impl UnsafeUnpin for ValueWord
impl UnwindSafe for ValueWord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.