pub struct VariantData {
pub tag: u32,
pub fields: Box<[Value]>,
}Expand description
VariantData: Composite values (sum types)
Fields are stored in a heap-allocated array, NOT linked via next pointers. This is the key difference from cem2, which used StackCell.next for field linking.
§Arc and Reference Cycles
Variants use Arc<VariantData> for O(1) cloning, which could theoretically
create reference cycles. However, cycles are prevented by design:
- VariantData.fields is immutable (no mutation after creation)
- All variant operations create new variants rather than modifying existing ones
- The Seq language has no mutation primitives for variant fields
This functional/immutable design ensures Arc reference counts always reach zero.
Fields§
§tag: u32Tag identifies which variant constructor was used
fields: Box<[Value]>Fields stored as an owned array of values This is independent of any stack structure
Implementations§
Trait Implementations§
Source§impl Clone for VariantData
impl Clone for VariantData
Source§fn clone(&self) -> VariantData
fn clone(&self) -> VariantData
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariantData
impl Debug for VariantData
Source§impl PartialEq for VariantData
impl PartialEq for VariantData
impl StructuralPartialEq for VariantData
Auto Trait Implementations§
impl Freeze for VariantData
impl RefUnwindSafe for VariantData
impl Send for VariantData
impl Sync for VariantData
impl Unpin for VariantData
impl UnwindSafe for VariantData
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)