pub struct Arena<T: ArenaTypes> {
pub type_names: Vec<String>,
pub type_field_names: Vec<Vec<String>>,
pub type_variant_names: Vec<Vec<String>>,
pub type_variant_ctor_ids: Vec<Vec<u32>>,
pub ctor_to_type_variant: Vec<(u32, u16)>,
pub symbol_entries: Vec<ArenaSymbol<T>>,
/* private fields */
}Fields§
§type_names: Vec<String>§type_field_names: Vec<Vec<String>>§type_variant_names: Vec<Vec<String>>§type_variant_ctor_ids: Vec<Vec<u32>>§ctor_to_type_variant: Vec<(u32, u16)>§symbol_entries: Vec<ArenaSymbol<T>>Implementations§
Source§impl<T: ArenaTypes> Arena<T>
impl<T: ArenaTypes> Arena<T>
pub fn new() -> Self
Sourcepub fn clone_static(&self) -> Self
pub fn clone_static(&self) -> Self
Create a fresh Arena with only the static context (symbols, type metadata, stable constants) from this Arena. Dynamic runtime entries are empty. Used for independent product threads: each gets a clean Arena with just the compile-time context needed to execute functions and builtins.
Sourcepub fn deep_import(&mut self, value: NanValue, source: &Arena<T>) -> NanValue
pub fn deep_import(&mut self, value: NanValue, source: &Arena<T>) -> NanValue
Deep-import a NanValue from source arena into self.
Inline values (int, float, bool, unit, none, empty containers) are returned as-is.
Heap-referenced values are recursively copied into self with new indices.
pub fn push(&mut self, entry: ArenaEntry<T>) -> u32
pub fn push_symbol(&mut self, symbol: ArenaSymbol<T>) -> u32
pub fn get(&self, index: u32) -> &ArenaEntry<T>
pub fn get_mut(&mut self, index: u32) -> &mut ArenaEntry<T>
pub fn is_stable_index(index: u32) -> bool
pub fn is_yard_index_in_region(&self, index: u32, mark: u32) -> bool
pub fn is_handoff_index_in_region(&self, index: u32, mark: u32) -> bool
pub fn is_young_index_in_region(&self, index: u32, mark: u32) -> bool
pub fn young_len(&self) -> usize
pub fn yard_len(&self) -> usize
pub fn handoff_len(&self) -> usize
pub fn stable_len(&self) -> usize
pub fn usage(&self) -> ArenaUsage
pub fn peak_usage(&self) -> ArenaUsage
pub fn is_frame_local_index( &self, index: u32, arena_mark: u32, yard_mark: u32, handoff_mark: u32, ) -> bool
pub fn with_alloc_space<R>( &mut self, space: AllocSpace, f: impl FnOnce(&mut Arena<T>) -> R, ) -> R
pub fn push_i64(&mut self, val: i64) -> u32
pub fn push_string(&mut self, s: &str) -> u32
pub fn push_boxed(&mut self, val: NanValue) -> u32
pub fn push_record(&mut self, type_id: u32, fields: Vec<NanValue>) -> u32
pub fn push_variant( &mut self, type_id: u32, variant_id: u16, fields: Vec<NanValue>, ) -> u32
pub fn push_list(&mut self, items: Vec<NanValue>) -> u32
pub fn push_map(&mut self, map: T::Map) -> u32
pub fn push_tuple(&mut self, items: Vec<NanValue>) -> u32
pub fn push_vector(&mut self, items: Vec<NanValue>) -> u32
pub fn push_fn(&mut self, f: Rc<T::Fn>) -> u32
pub fn push_builtin(&mut self, name: &str) -> u32
pub fn push_nullary_variant_symbol(&mut self, ctor_id: u32) -> u32
pub fn get_i64(&self, index: u32) -> i64
pub fn get_string(&self, index: u32) -> &str
pub fn get_string_value(&self, value: NanValue) -> NanString<'_>
pub fn get_boxed(&self, index: u32) -> NanValue
pub fn get_record(&self, index: u32) -> (u32, &[NanValue])
pub fn get_variant(&self, index: u32) -> (u32, u16, &[NanValue])
pub fn get_list(&self, index: u32) -> &ArenaList
pub fn get_tuple(&self, index: u32) -> &[NanValue]
pub fn get_vector(&self, index: u32) -> &[NanValue]
pub fn get_vector_mut(&mut self, index: u32) -> &mut Vec<NanValue>
pub fn vector_ref_value(&self, value: NanValue) -> &[NanValue]
pub fn clone_vector_value(&self, value: NanValue) -> Vec<NanValue>
Sourcepub fn take_vector_value(&mut self, value: NanValue) -> Vec<NanValue>
pub fn take_vector_value(&mut self, value: NanValue) -> Vec<NanValue>
Take ownership of a vector, replacing the arena slot with an empty vec.
pub fn get_map(&self, index: u32) -> &T::Map
pub fn get_map_mut(&mut self, index: u32) -> &mut T::Map
pub fn map_ref_value(&self, map: NanValue) -> &T::Map
pub fn clone_map_value(&self, map: NanValue) -> T::Map
Sourcepub fn take_map_value(&mut self, map: NanValue) -> T::Map
pub fn take_map_value(&mut self, map: NanValue) -> T::Map
Take ownership of a map value, replacing it with an empty map in the arena.
Use when the caller is the sole owner (reuse analysis says owned = true).
Avoids the O(n) clone — the original slot becomes empty.
pub fn get_fn(&self, index: u32) -> &T::Fn
pub fn get_fn_rc(&self, index: u32) -> &Rc<T::Fn>
pub fn get_builtin(&self, index: u32) -> &str
pub fn get_namespace(&self, index: u32) -> (&str, &[(Rc<str>, NanValue)])
pub fn get_nullary_variant_ctor(&self, index: u32) -> u32
pub fn register_record_type( &mut self, name: &str, field_names: Vec<String>, ) -> u32
pub fn register_sum_type( &mut self, name: &str, variant_names: Vec<String>, ) -> u32
pub fn register_variant_name( &mut self, type_id: u32, variant_name: String, ) -> u16
pub fn get_type_name(&self, type_id: u32) -> &str
pub fn type_count(&self) -> u32
pub fn get_field_names(&self, type_id: u32) -> &[String]
pub fn get_variant_name(&self, type_id: u32, variant_id: u16) -> &str
pub fn find_type_id(&self, name: &str) -> Option<u32>
pub fn find_variant_id(&self, type_id: u32, variant_name: &str) -> Option<u16>
pub fn find_ctor_id(&self, type_id: u32, variant_id: u16) -> Option<u32>
pub fn get_ctor_parts(&self, ctor_id: u32) -> (u32, u16)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl<T: ArenaTypes> Arena<T>
impl<T: ArenaTypes> Arena<T>
pub fn push_list_prepend(&mut self, head: NanValue, tail: NanValue) -> u32
pub fn push_list_append(&mut self, list: NanValue, value: NanValue) -> u32
pub fn push_list_concat(&mut self, left: NanValue, right: NanValue) -> u32
pub fn list_len_value(&self, list: NanValue) -> usize
pub fn list_is_empty_value(&self, list: NanValue) -> bool
pub fn list_get_value( &self, list: NanValue, position: usize, ) -> Option<NanValue>
pub fn list_to_vec_value(&self, list: NanValue) -> Vec<NanValue>
pub fn list_len(&self, index: u32) -> usize
pub fn list_is_empty(&self, index: u32) -> bool
pub fn list_get(&self, index: u32, position: usize) -> Option<NanValue>
pub fn list_to_vec(&self, index: u32) -> Vec<NanValue>
pub fn list_uncons(&mut self, list: NanValue) -> Option<(NanValue, NanValue)>
Source§impl<T: ArenaTypes> Arena<T>
impl<T: ArenaTypes> Arena<T>
pub fn truncate_to(&mut self, mark: u32)
pub fn collect_young_from_roots(&mut self, mark: u32, roots: &mut [NanValue])
pub fn truncate_yard_to(&mut self, mark: u32)
pub fn truncate_handoff_to(&mut self, mark: u32)
pub fn evacuate_frame_to_yard( &mut self, young_mark: u32, yard_mark: u32, handoff_mark: u32, roots: &mut [NanValue], ) -> (bool, bool)
pub fn evacuate_frame_to_handoff( &mut self, young_mark: u32, yard_mark: u32, handoff_mark: u32, roots: &mut [NanValue], ) -> (bool, bool)
Sourcepub fn flatten_deep_list(&mut self, value: NanValue) -> NanValue
pub fn flatten_deep_list(&mut self, value: NanValue) -> NanValue
Flatten a deep list (Prepend/Concat chain) into a single Flat entry.