Struct naga::Arena [−][src]
pub struct Arena<T> { /* fields omitted */ }
Expand description
An arena holding some kind of component (e.g., type, constant, instruction, etc.) that can be referenced.
Adding new items to the arena produces a strongly-typed Handle
.
The arena can be indexed using the given handle to obtain
a reference to the stored item.
Implementations
impl<T> Arena<T>
[src]
impl<T> Arena<T>
[src]pub fn into_inner(self) -> Vec<T>
[src]
pub fn into_inner(self) -> Vec<T>
[src]Extracts the inner vector.
pub fn iter(&self) -> impl DoubleEndedIterator<Item = (Handle<T>, &T)>
[src]
pub fn iter(&self) -> impl DoubleEndedIterator<Item = (Handle<T>, &T)>
[src]Returns an iterator over the items stored in this arena, returning both the item’s handle and a reference to it.
pub fn iter_mut(
&mut self
) -> impl DoubleEndedIterator<Item = (Handle<T>, &mut T)>
[src]
pub fn iter_mut(
&mut self
) -> impl DoubleEndedIterator<Item = (Handle<T>, &mut T)>
[src]Returns a iterator over the items stored in this arena, returning both the item’s handle and a mutable reference to it.
pub fn append(&mut self, value: T) -> Handle<T>
[src]
pub fn append(&mut self, value: T) -> Handle<T>
[src]Adds a new value to the arena, returning a typed handle.
pub fn fetch_if<F: Fn(&T) -> bool>(&self, fun: F) -> Option<Handle<T>>
[src]
pub fn fetch_if<F: Fn(&T) -> bool>(&self, fun: F) -> Option<Handle<T>>
[src]Fetch a handle to an existing type.
pub fn fetch_if_or_append<F: Fn(&T, &T) -> bool>(
&mut self,
value: T,
fun: F
) -> Handle<T>
[src]
pub fn fetch_if_or_append<F: Fn(&T, &T) -> bool>(
&mut self,
value: T,
fun: F
) -> Handle<T>
[src]Adds a value with a custom check for uniqueness: returns a handle pointing to an existing element if the check succeeds, or adds a new element otherwise.
pub fn fetch_or_append(&mut self, value: T) -> Handle<T> where
T: PartialEq,
[src]
pub fn fetch_or_append(&mut self, value: T) -> Handle<T> where
T: PartialEq,
[src]Adds a value with a check for uniqueness, where the check is plain comparison.
pub fn try_get(&self, handle: Handle<T>) -> Option<&T>
[src]
Trait Implementations
impl<'de, T> Deserialize<'de> for Arena<T> where
T: Deserialize<'de>,
[src]
impl<'de, T> Deserialize<'de> for Arena<T> where
T: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Arena<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Arena<T> where
T: Send,
T: Send,
impl<T> Sync for Arena<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Arena<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Arena<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,