pub struct Arena<T: ?Sized, Storage = T> { /* private fields */ }Expand description
Implementations§
Source§impl<T, Storage> Arena<T, Storage>
impl<T, Storage> Arena<T, Storage>
Sourcepub fn map(&self, mapping: &ReverseMapping) -> Self
pub fn map(&self, mapping: &ReverseMapping) -> Self
Returns a re-ordered version of this arena based on the given mapping.
Source§impl<T: ?Sized, Storage> Arena<T, Storage>
impl<T: ?Sized, Storage> Arena<T, Storage>
Sourcepub fn with_capacity(len: usize) -> Self
pub fn with_capacity(len: usize) -> Self
Creates a new arena with pre-allocated space to store at least len
values of type T.
Source§impl<T: ?Sized, Storage> Arena<T, Storage>where
Storage: GetSize,
impl<T: ?Sized, Storage> Arena<T, Storage>where
Storage: GetSize,
Sourcepub fn print_summary(&self, prefix: &str, title: &str, total_bytes: usize)
Available on crate feature debug only.
pub fn print_summary(&self, prefix: &str, title: &str, total_bytes: usize)
debug only.Prints a summary of the storage used by this arena to stdout.
Source§impl<T, Storage> Arena<T, Storage>
impl<T, Storage> Arena<T, Storage>
Sourcepub fn intern(
&self,
value: impl Borrow<T> + Into<Storage>,
) -> Interned<T, Storage>
pub fn intern( &self, value: impl Borrow<T> + Into<Storage>, ) -> Interned<T, Storage>
Interns the given value in this arena.
If the value was already interned in this arena, it will simply be borrowed to retrieve its interning index. Otherwise it will then be converted to store it into the arena.
See also intern_mut(), which is more efficient if
you hold a mutable reference to this arena as it avoids acquiring locks.
Sourcepub fn intern_mut(
&mut self,
value: impl Borrow<T> + Into<Storage>,
) -> Interned<T, Storage>
pub fn intern_mut( &mut self, value: impl Borrow<T> + Into<Storage>, ) -> Interned<T, Storage>
Interns the given value in this arena.
If the value was already interned in this arena, it will simply be borrowed to retrieve its interning index. Otherwise it will then be converted to store it into the arena.
Contrary to intern(), no locks are held internally
because this function already takes an exclusive mutable reference to
this arena.
Source§impl<T: ?Sized, Storage> Arena<T, Storage>where
Storage: Clone,
impl<T: ?Sized, Storage> Arena<T, Storage>where
Storage: Clone,
Sourcepub fn lookup(&self, interned: Interned<T, Storage>) -> Storage
pub fn lookup(&self, interned: Interned<T, Storage>) -> Storage
Retrieves the given Interned value from this arena.
The caller is responsible for ensuring that the same arena was used to intern this value, otherwise an arbitrary value will be returned or a panic will happen.
See also lookup_ref() if you only need a
reference.
Trait Implementations§
Source§impl<'de, T, Storage> Deserialize<'de> for Arena<T, Storage>
Available on crate feature serde only.
impl<'de, T, Storage> Deserialize<'de> for Arena<T, Storage>
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<T: ?Sized, Storage> GetSize for Arena<T, Storage>where
Storage: GetSize,
Available on crate feature get-size2 only.
impl<T: ?Sized, Storage> GetSize for Arena<T, Storage>where
Storage: GetSize,
get-size2 only.Source§fn get_heap_size_with_tracker<Tr: GetSizeTracker>(
&self,
tracker: Tr,
) -> (usize, Tr)
fn get_heap_size_with_tracker<Tr: GetSizeTracker>( &self, tracker: Tr, ) -> (usize, Tr)
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreimpl<T, Storage> Eq for Arena<T, Storage>
Auto Trait Implementations§
impl<T, Storage = T> !Freeze for Arena<T, Storage>
impl<T, Storage = T> !RefUnwindSafe for Arena<T, Storage>
impl<T, Storage> Send for Arena<T, Storage>
impl<T, Storage> Sync for Arena<T, Storage>
impl<T, Storage> Unpin for Arena<T, Storage>where
T: ?Sized,
impl<T, Storage> UnsafeUnpin for Arena<T, Storage>where
T: ?Sized,
impl<T, Storage> UnwindSafe for Arena<T, Storage>where
Storage: RefUnwindSafe,
T: ?Sized,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.