pub struct Arena<'a> { /* private fields */ }Expand description
Shared wrapper around ArenaInner, safely cloneable across threads.
Implementations§
Methods from Deref<Target = ArenaInner>§
Sourcepub fn alloc_with_id<'a, T: ArenaInsertWithId<'a>>(
&'a self,
id: usize,
value: T,
) -> &'a T
pub fn alloc_with_id<'a, T: ArenaInsertWithId<'a>>( &'a self, id: usize, value: T, ) -> &'a T
Thread-safe allocation with ID for lookup. Allocates in bump arena and inserts into DashMap.
Sourcepub fn alloc<'a, T: ArenaInsert<'a>>(&'a self, value: T) -> &'a T
pub fn alloc<'a, T: ArenaInsert<'a>>(&'a self, value: T) -> &'a T
Thread-safe allocation without ID tracking. Just allocates in bump arena, no DashMap insert.
Sourcepub fn alloc_in_herd<T>(&self, value: T) -> &T
pub fn alloc_in_herd<T>(&self, value: T) -> &T
Allocate a value in the thread-local bump allocator. Uses thread_local to cache the Member per thread, avoiding mutex contention.
Sourcepub fn alloc_str(&self, src: &str) -> &str
pub fn alloc_str(&self, src: &str) -> &str
Allocate a string in the thread-local bump allocator. Returns a reference to the arena-allocated string, avoiding heap allocation.
Sourcepub fn get_hir_node<'a>(&'a self, id: usize) -> Option<&'a HirNode<'a>>
pub fn get_hir_node<'a>(&'a self, id: usize) -> Option<&'a HirNode<'a>>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_node(&self) -> usize
pub fn len_hir_node(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_node<'a>(&'a self) -> impl Iterator<Item = &'a HirNode<'a>> + 'a
pub fn iter_hir_node<'a>(&'a self) -> impl Iterator<Item = &'a HirNode<'a>> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_hir_file<'a>(&'a self, id: usize) -> Option<&'a HirFile>
pub fn get_hir_file<'a>(&'a self, id: usize) -> Option<&'a HirFile>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_file(&self) -> usize
pub fn len_hir_file(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_file<'a>(&'a self) -> impl Iterator<Item = &'a HirFile> + 'a
pub fn iter_hir_file<'a>(&'a self) -> impl Iterator<Item = &'a HirFile> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_hir_text<'a>(&'a self, id: usize) -> Option<&'a HirText<'a>>
pub fn get_hir_text<'a>(&'a self, id: usize) -> Option<&'a HirText<'a>>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_text(&self) -> usize
pub fn len_hir_text(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_text<'a>(&'a self) -> impl Iterator<Item = &'a HirText<'a>> + 'a
pub fn iter_hir_text<'a>(&'a self) -> impl Iterator<Item = &'a HirText<'a>> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_hir_internal<'a>(&'a self, id: usize) -> Option<&'a HirInternal>
pub fn get_hir_internal<'a>(&'a self, id: usize) -> Option<&'a HirInternal>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_internal(&self) -> usize
pub fn len_hir_internal(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_internal<'a>(
&'a self,
) -> impl Iterator<Item = &'a HirInternal> + 'a
pub fn iter_hir_internal<'a>( &'a self, ) -> impl Iterator<Item = &'a HirInternal> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_hir_scope<'a>(&'a self, id: usize) -> Option<&'a HirScope<'a>>
pub fn get_hir_scope<'a>(&'a self, id: usize) -> Option<&'a HirScope<'a>>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_scope(&self) -> usize
pub fn len_hir_scope(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_scope<'a>(
&'a self,
) -> impl Iterator<Item = &'a HirScope<'a>> + 'a
pub fn iter_hir_scope<'a>( &'a self, ) -> impl Iterator<Item = &'a HirScope<'a>> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_hir_ident<'a>(&'a self, id: usize) -> Option<&'a HirIdent<'a>>
pub fn get_hir_ident<'a>(&'a self, id: usize) -> Option<&'a HirIdent<'a>>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_hir_ident(&self) -> usize
pub fn len_hir_ident(&self) -> usize
Get count of items.
Sourcepub fn iter_hir_ident<'a>(
&'a self,
) -> impl Iterator<Item = &'a HirIdent<'a>> + 'a
pub fn iter_hir_ident<'a>( &'a self, ) -> impl Iterator<Item = &'a HirIdent<'a>> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_scope<'a>(&'a self, id: usize) -> Option<&'a Scope<'a>>
pub fn get_scope<'a>(&'a self, id: usize) -> Option<&'a Scope<'a>>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn iter_scope<'a>(&'a self) -> impl Iterator<Item = &'a Scope<'a>> + 'a
pub fn iter_scope<'a>(&'a self) -> impl Iterator<Item = &'a Scope<'a>> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Sourcepub fn get_symbol<'a>(&'a self, id: usize) -> Option<&'a Symbol>
pub fn get_symbol<'a>(&'a self, id: usize) -> Option<&'a Symbol>
Get item by ID from DashMap (O(1) concurrent lookup). SAFETY: The pointer was allocated from the bump arena and is valid for the arena’s lifetime.
Sourcepub fn len_symbol(&self) -> usize
pub fn len_symbol(&self) -> usize
Get count of items.
Sourcepub fn iter_symbol<'a>(&'a self) -> impl Iterator<Item = &'a Symbol> + 'a
pub fn iter_symbol<'a>(&'a self) -> impl Iterator<Item = &'a Symbol> + 'a
Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Arena<'a>
impl<'a> !RefUnwindSafe for Arena<'a>
impl<'a> Send for Arena<'a>
impl<'a> Sync for Arena<'a>
impl<'a> Unpin for Arena<'a>
impl<'a> !UnwindSafe for Arena<'a>
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<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 more