BlockArena

Struct BlockArena 

Source
pub struct BlockArena<'a> { /* private fields */ }
Expand description

Shared wrapper around ArenaInner, safely cloneable across threads.

Implementations§

Source§

impl<'a> BlockArena<'a>

Source

pub fn new() -> Self

Create a new shared Arena.

Source

pub fn inner_arc(&self) -> &Arc<ArenaInner>

Get the internal Arc.

Methods from Deref<Target = ArenaInner>§

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_bb<'a>(&'a self, id: usize) -> Option<&'a BasicBlock<'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_bb(&self) -> usize

Get count of items.

Source

pub fn iter_bb<'a>(&'a self) -> impl Iterator<Item = &'a BasicBlock<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_root<'a>(&'a self, id: usize) -> Option<&'a BlockRoot<'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_blk_root(&self) -> usize

Get count of items.

Source

pub fn iter_blk_root<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockRoot<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_module<'a>(&'a self, id: usize) -> Option<&'a BlockModule<'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_blk_module(&self) -> usize

Get count of items.

Source

pub fn iter_blk_module<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockModule<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_func<'a>(&'a self, id: usize) -> Option<&'a BlockFunc<'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_blk_func(&self) -> usize

Get count of items.

Source

pub fn iter_blk_func<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockFunc<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_class<'a>(&'a self, id: usize) -> Option<&'a BlockClass<'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_blk_class(&self) -> usize

Get count of items.

Source

pub fn iter_blk_class<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockClass<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_trait<'a>(&'a self, id: usize) -> Option<&'a BlockTrait<'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_blk_trait(&self) -> usize

Get count of items.

Source

pub fn iter_blk_trait<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockTrait<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_interface<'a>( &'a self, id: usize, ) -> Option<&'a BlockInterface<'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_blk_interface(&self) -> usize

Get count of items.

Source

pub fn iter_blk_interface<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockInterface<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_impl<'a>(&'a self, id: usize) -> Option<&'a BlockImpl<'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_blk_impl(&self) -> usize

Get count of items.

Source

pub fn iter_blk_impl<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockImpl<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_call<'a>(&'a self, id: usize) -> Option<&'a BlockCall<'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_blk_call(&self) -> usize

Get count of items.

Source

pub fn iter_blk_call<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockCall<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_enum<'a>(&'a self, id: usize) -> Option<&'a BlockEnum<'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_blk_enum(&self) -> usize

Get count of items.

Source

pub fn iter_blk_enum<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockEnum<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_field<'a>(&'a self, id: usize) -> Option<&'a BlockField<'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_blk_field(&self) -> usize

Get count of items.

Source

pub fn iter_blk_field<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockField<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_const<'a>(&'a self, id: usize) -> Option<&'a BlockConst<'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_blk_const(&self) -> usize

Get count of items.

Source

pub fn iter_blk_const<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockConst<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_parameter<'a>( &'a self, id: usize, ) -> Option<&'a BlockParameter<'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_blk_parameter(&self) -> usize

Get count of items.

Source

pub fn iter_blk_parameter<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockParameter<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_return<'a>(&'a self, id: usize) -> Option<&'a BlockReturn<'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_blk_return(&self) -> usize

Get count of items.

Source

pub fn iter_blk_return<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockReturn<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Source

pub fn get_blk_alias<'a>(&'a self, id: usize) -> Option<&'a BlockAlias<'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_blk_alias(&self) -> usize

Get count of items.

Source

pub fn iter_blk_alias<'a>( &'a self, ) -> impl Iterator<Item = &'a BlockAlias<'a>> + 'a

Iterate over all items (for compatibility). SAFETY: All pointers are valid for the arena’s lifetime.

Trait Implementations§

Source§

impl<'a> Clone for BlockArena<'a>

Source§

fn clone(&self) -> BlockArena<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for BlockArena<'a>

Source§

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

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

impl<'a> Default for BlockArena<'a>

Source§

fn default() -> Self

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

impl<'a> Deref for BlockArena<'a>

Source§

type Target = ArenaInner

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> DerefMut for BlockArena<'a>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for BlockArena<'a>

§

impl<'a> !RefUnwindSafe for BlockArena<'a>

§

impl<'a> Send for BlockArena<'a>

§

impl<'a> Sync for BlockArena<'a>

§

impl<'a> Unpin for BlockArena<'a>

§

impl<'a> !UnwindSafe for BlockArena<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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