Struct naga::arena::handle_set::HandleSet

source ·
pub struct HandleSet<T> {
    len: usize,
    members: BitSet,
    as_keys: PhantomData<T>,
}
Expand description

A set of Handle<T> values.

Fields§

§len: usize

Bound on indexes of handles stored in this set.

§members: BitSet

members[i] is true if the handle with index i is a member.

§as_keys: PhantomData<T>

This type is indexed by values of type T.

Implementations§

source§

impl<T> HandleSet<T>

source

pub fn new() -> Self

Return a new, empty HandleSet.

source

pub fn is_empty(&self) -> bool

source

pub fn for_arena(arena: &impl ArenaType<T>) -> Self

Return a new, empty HandleSet, sized to hold handles from arena.

source

pub fn clear(&mut self)

Remove all members from self.

source

pub fn clear_for_arena(&mut self, arena: &impl ArenaType<T>)

Remove all members from self, and reserve space to hold handles from arena.

source

pub fn all_possible(&self) -> impl Iterator<Item = Handle<T>>

Return an iterator over all handles that could be made members of this set.

source

pub fn insert(&mut self, handle: Handle<T>) -> bool

Add handle to the set.

Return true if handle was not already present in the set.

source

pub fn remove(&mut self, handle: Handle<T>) -> bool

Remove handle from the set.

Returns true if handle was present in the set.

source

pub fn insert_iter(&mut self, iter: impl IntoIterator<Item = Handle<T>>)

Add handles from iter to the set.

source

pub fn contains(&self, handle: Handle<T>) -> bool

source

pub fn iter(&self) -> impl '_ + Iterator<Item = Handle<T>>

Return an iterator over all handles in self.

Trait Implementations§

source§

impl<T: Debug> Debug for HandleSet<T>

source§

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

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

impl<T> Default for HandleSet<T>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Freeze for HandleSet<T>

§

impl<T> RefUnwindSafe for HandleSet<T>
where T: RefUnwindSafe,

§

impl<T> Send for HandleSet<T>
where T: Send,

§

impl<T> Sync for HandleSet<T>
where T: Sync,

§

impl<T> Unpin for HandleSet<T>
where T: Unpin,

§

impl<T> UnwindSafe for HandleSet<T>
where T: UnwindSafe,

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, 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, 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.