Skip to main content

shape_value/
lib.rs

1//! Core value types for Shape
2//!
3//! This crate contains the foundational value types and core data structures
4//! used throughout the Shape language implementation. The canonical runtime
5//! representation is `ValueWord` — an 8-byte NaN-boxed value.
6//!
7//! Dependency hierarchy:
8//! - shape-value → shape-ast (no circular dependencies)
9//! - shape-runtime → shape-value (for types)
10//! - shape-vm → shape-value (for types)
11
12// Re-export core types
13pub mod aligned_vec;
14pub mod closure;
15pub mod content;
16pub mod context;
17pub mod datatable;
18pub mod enums;
19pub mod external_value;
20pub mod extraction;
21pub mod heap_header;
22#[macro_use]
23pub mod heap_variants;
24pub mod heap_value;
25pub mod ids;
26pub mod method_id;
27pub mod scalar;
28pub mod value_word;
29/// Backward-compatibility alias for the renamed module.
30pub mod nanboxed {
31    pub use crate::value_word::*;
32    /// Backward-compatibility alias: `NanBoxed` is now `ValueWord`.
33    pub type NanBoxed = super::value_word::ValueWord;
34}
35pub mod shape_array;
36pub mod shape_graph;
37pub mod slot;
38pub mod tags;
39pub mod typed_buffer;
40pub mod value;
41
42pub use aligned_vec::AlignedVec;
43pub use closure::Closure;
44pub use content::{
45    BorderStyle, ChartChannel, ChartSeries, ChartSpec, ChartType, Color, ContentNode, ContentTable,
46    NamedColor, Style, StyledSpan, StyledText,
47};
48pub use context::{ErrorLocation, LocatedVMError, VMContext, VMError};
49pub use datatable::{ColumnPtrs, DataTable, DataTableBuilder};
50pub use enums::{EnumPayload, EnumValue};
51pub use external_value::{
52    ExternalValue, NoSchemaLookup, SchemaLookup, external_to_nb, nb_to_external,
53};
54pub use extraction::{
55    nb_to_display_string, require_arc_string, require_array, require_bool, require_closure,
56    require_datatable, require_f64, require_int, require_number, require_string,
57    require_typed_object,
58};
59pub use heap_header::{FLAG_MARKED, FLAG_PINNED, FLAG_READONLY, HeapHeader};
60pub use heap_value::{
61    ChannelData, DataReferenceData, DequeData, HashMapData, HeapKind, HeapValue, PriorityQueueData,
62    ProjectedRefData, RefProjection, SetData, SimulationCallData,
63};
64pub use ids::{FunctionId, SchemaId, StackSlotIdx, StringId};
65pub use method_id::MethodId;
66pub use scalar::{ScalarKind, TypedScalar};
67pub use value_word::{ArrayView, ArrayViewMut, NanTag, RefTarget, ValueWord};
68/// Backward-compatibility alias: `NanBoxed` is now `ValueWord`.
69pub type NanBoxed = ValueWord;
70pub use shape_array::ShapeArray;
71pub use shape_graph::{
72    Shape, ShapeId, ShapeTransitionTable, drain_shape_transitions, hash_property_name,
73    shape_for_hashmap_keys, shape_property_index, shape_transition,
74};
75pub use slot::ValueSlot;
76pub use typed_buffer::{AlignedTypedBuffer, TypedBuffer};
77pub use value::{
78    FilterLiteral, FilterNode, FilterOp, HostCallable, PrintResult, PrintSpan, Upvalue, VMArray,
79    VTable, VTableEntry, vmarray_from_nanboxed, vmarray_from_value_words,
80};