Skip to main content

ArenaInner

Struct ArenaInner 

Source
pub struct ArenaInner {
    pub herd: Herd,
    pub hir_node: DashMap<usize, *const ()>,
    pub hir_file: DashMap<usize, *const ()>,
    pub hir_text: DashMap<usize, *const ()>,
    pub hir_internal: DashMap<usize, *const ()>,
    pub hir_scope: DashMap<usize, *const ()>,
    pub hir_ident: DashMap<usize, *const ()>,
    pub scope: DashMap<usize, *const ()>,
    pub symbol: DashMap<usize, *const ()>,
}
Expand description

The actual data container: thread-safe, allocation-aware. Uses ’static lifetime for storage since we use raw pointers internally.

Fields§

§herd: Herd§hir_node: DashMap<usize, *const ()>§hir_file: DashMap<usize, *const ()>§hir_text: DashMap<usize, *const ()>§hir_internal: DashMap<usize, *const ()>§hir_scope: DashMap<usize, *const ()>§hir_ident: DashMap<usize, *const ()>§scope: DashMap<usize, *const ()>§symbol: DashMap<usize, *const ()>

Implementations§

Source§

impl ArenaInner

Source

pub fn new() -> Self

Create a fresh ArenaInner.

Source

pub fn new_with_capacity(cap: usize) -> Self

Create ArenaInner with pre-allocated capacity for each field.

Source

pub fn reset(&mut self)

Clear all allocations and reset memory.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn len_hir_node(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_hir_file(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_hir_text(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_hir_internal(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_hir_scope(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_hir_ident(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_scope(&self) -> usize

Get count of items.

Source

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.

Source

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.

Source

pub fn len_symbol(&self) -> usize

Get count of items.

Source

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§

Source§

impl Debug for ArenaInner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ArenaInner

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Send for ArenaInner

Source§

impl Sync for ArenaInner

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more