[−][src]Struct pui_arena::base::sparse::Arena
A sparse arena
Implementations
impl<T> Arena<T>
[src]
impl<T, V: Version> Arena<T, (), V>
[src]
pub const INIT: Self
[src]
An empty arena
pub fn clear(&mut self)
[src]
Clear the arena without reducing it's capacity
impl<T, I, V: Version> Arena<T, I, V>
[src]
pub fn with_ident(ident: I) -> Self
[src]
Create a new arena with the given identifier
pub fn ident(&self) -> &I
[src]
Get the associated identifier for this arena
pub fn is_empty(&self) -> bool
[src]
Returns true if the arena is empty
pub fn len(&self) -> usize
[src]
Returns the number of elements in this arena
pub fn capacity(&self) -> usize
[src]
Returns the capacity of this arena
pub fn reserve(&mut self, additional: usize)
[src]
Reserves capacity for at least additional more elements to be inserted
in the given collection. The collection may reserve more space to avoid
frequent reallocations. After calling reserve, capacity will be greater
than or equal to self.len() + additional
. Does nothing if capacity is
already sufficient.
pub fn reserve_exact(&mut self, additional: usize)
[src]
Reserves the minimum capacity for exactly additional more elements
to be inserted in the given collection. After calling reserve_exact,
capacity will be greater than or equal to self.len() + additional
.
Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it requests. Therefore, capacity can not be relied upon to be precisely minimal. Prefer reserve if future insertions are expected.
pub fn parse_key<K: BuildArenaKey<I, V>>(&self, index: usize) -> Option<K>
[src]
Check if an index is in bounds, and if it is return a Key<_, _>
to it
pub fn vacant_entry(&mut self) -> VacantEntry<'_, T, I, V>
[src]
Return a handle to a vacant entry allowing for further manipulation.
This function is useful when creating values that must contain their key. The returned VacantEntry reserves a slot in the arena and is able to query the associated key.
pub fn insert<K: BuildArenaKey<I, V>>(&mut self, value: T) -> K
[src]
Insert a value in the arena, returning key assigned to the value.
The returned key can later be used to retrieve or remove the value using indexed lookup and remove. Additional capacity is allocated if needed.
pub fn contains<K: ArenaKey<I, V>>(&self, key: K) -> bool
[src]
Return true if a value is associated with the given key.
pub fn remove<K: ArenaKey<I, V>>(&mut self, key: K) -> T
[src]
Remove and return the value associated with the given key.
The key is then released and may be associated with future stored values, if the versioning strategy allows it.
Panics if key is not associated with a value.
pub fn try_remove<K: ArenaKey<I, V>>(&mut self, key: K) -> Option<T>
[src]
Remove and return the value associated with the given key.
The key is then released and may be associated with future stored values, if the versioning strategy allows it.
Returns None
if key is not associated with a value.
pub fn delete<K: ArenaKey<I, V>>(&mut self, key: K) -> bool
[src]
Removes the value associated with the given key.
The key is then released and may be associated with future stored values, if the versioning strategy allows it.
Returns true if the value was removed, an false otherwise
pub fn get<K: ArenaKey<I, V>>(&self, key: K) -> Option<&T>
[src]
Return a shared reference to the value associated with the given key.
If the given key is not associated with a value, then None is returned.
pub fn get_mut<K: ArenaKey<I, V>>(&mut self, key: K) -> Option<&mut T>
[src]
Return a unique reference to the value associated with the given key.
If the given key is not associated with a value, then None is returned.
pub unsafe fn get_unchecked(&self, index: usize) -> &T
[src]
Return a shared reference to the value associated with the given key without performing bounds checking, or checks if there is a value associated to the key
Safety
contains
should return true with the given index.
pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T
[src]
Return a unique reference to the value associated with the given key without performing bounds checking, or checks if there is a value associated to the key
Safety
contains
should return true with the given index.
pub fn delete_all(&mut self)
[src]
Deletes all elements from the arena
pub fn retain<F: FnMut(&mut T) -> bool>(&mut self, mut f: F)
[src]
Retain only the elements specified by the predicate.
If the predicate returns for a given element true, then the element is kept in the arena.
pub fn keys<K: BuildArenaKey<I, V>>(&self) -> Keys<'_, T, I, V, K>ⓘ
[src]
An iterator over the keys of the arena, in no particular order
pub fn iter(&self) -> Iter<'_, T, V>ⓘ
[src]
An iterator of shared references to values of the arena, in no particular order
pub fn iter_mut(&mut self) -> IterMut<'_, T, V>ⓘ
[src]
An iterator of unique references to values of the arena, in no particular order
pub fn drain(&mut self) -> Drain<'_, T, V>ⓘ
[src]
Return a draining iterator that removes all elements from the arena and yields the removed items.
Note: Elements are removed even if the iterator is only partially consumed or not consumed at all.
pub fn drain_filter<F: FnMut(&mut T) -> bool>(
&mut self,
filter: F
) -> DrainFilter<'_, T, V, F>ⓘNotable traits for DrainFilter<'a, T, V, F>
impl<'a, T, V: Version, F: FnMut(&mut T) -> bool> Iterator for DrainFilter<'a, T, V, F> type Item = T;
[src]
&mut self,
filter: F
) -> DrainFilter<'_, T, V, F>ⓘ
Notable traits for DrainFilter<'a, T, V, F>
impl<'a, T, V: Version, F: FnMut(&mut T) -> bool> Iterator for DrainFilter<'a, T, V, F> type Item = T;
Return a draining iterator that removes all elements specified by the predicate from the arena and yields the removed items.
If the predicate returns true for a given element, then it is removed from the arena, and yielded from the iterator.
Note: Elements are removed even if the iterator is only partially consumed or not consumed at all.
pub fn entries<K: BuildArenaKey<I, V>>(&self) -> Entries<'_, T, I, V, K>ⓘ
[src]
An iterator of keys and shared references to values of the arena, in no particular order, with each key being associated to the corrosponding value
pub fn entries_mut<K: BuildArenaKey<I, V>>(
&mut self
) -> EntriesMut<'_, T, I, V, K>ⓘNotable traits for EntriesMut<'a, T, I, V, K>
impl<'a, T, I, V: Version, K: BuildArenaKey<I, V>> Iterator for EntriesMut<'a, T, I, V, K> type Item = (K, &'a mut T);
[src]
&mut self
) -> EntriesMut<'_, T, I, V, K>ⓘ
Notable traits for EntriesMut<'a, T, I, V, K>
impl<'a, T, I, V: Version, K: BuildArenaKey<I, V>> Iterator for EntriesMut<'a, T, I, V, K> type Item = (K, &'a mut T);
An iterator of keys and unique references to values of the arena, in no particular order, with each key being associated to the corrosponding value
pub fn into_entries<K: BuildArenaKey<I, V>>(self) -> IntoEntries<T, I, V, K>ⓘNotable traits for IntoEntries<T, I, V, K>
impl<'a, T, I, V: Version, K: BuildArenaKey<I, V>> Iterator for IntoEntries<T, I, V, K> type Item = (K, T);
[src]
Notable traits for IntoEntries<T, I, V, K>
impl<'a, T, I, V: Version, K: BuildArenaKey<I, V>> Iterator for IntoEntries<T, I, V, K> type Item = (K, T);
An iterator of keys and values of the arena, in no particular order, with each key being associated to the corrosponding value
Trait Implementations
impl<T: Clone, I: Clone, V: Clone + Version> Clone for Arena<T, I, V>
[src]
pub fn clone(&self) -> Arena<T, I, V>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug, I: Debug, V: Debug + Version> Debug for Arena<T, I, V>
[src]
impl<T> Default for Arena<T>
[src]
impl<T, I, V: Version> Extend<T> for Arena<T, I, V>
[src]
pub fn extend<Iter: IntoIterator<Item = T>>(&mut self, iter: Iter)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T, I, V: Version, K: ArenaKey<I, V>> Index<K> for Arena<T, I, V>
[src]
impl<T, I, V: Version, K: ArenaKey<I, V>> IndexMut<K> for Arena<T, I, V>
[src]
impl<T, I, V: Version> IntoIterator for Arena<T, I, V>
[src]
Auto Trait Implementations
impl<T, I, V> Send for Arena<T, I, V> where
I: Send,
T: Send,
V: Send,
[src]
I: Send,
T: Send,
V: Send,
impl<T, I, V> Sync for Arena<T, I, V> where
I: Sync,
T: Sync,
V: Sync,
[src]
I: Sync,
T: Sync,
V: Sync,
impl<T, I, V> Unpin for Arena<T, I, V> where
I: Unpin,
T: Unpin,
V: Unpin,
[src]
I: Unpin,
T: Unpin,
V: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,