Struct cranelift_entity::EntitySet

source ·
pub struct EntitySet<K>
where K: EntityRef,
{ /* private fields */ }
Expand description

A set of K for densely indexed entity references.

The EntitySet data structure uses the dense index space to implement a set with a bitvector. Like SecondaryMap, an EntitySet is used to associate secondary information with entities.

Implementations§

source§

impl<K> EntitySet<K>
where K: EntityRef,

Shared EntitySet implementation for all value types.

source

pub fn new() -> Self

Create a new empty set.

source

pub fn with_capacity(capacity: usize) -> Self

Creates a new empty set with the specified capacity.

source

pub fn contains(&self, k: K) -> bool

Get the element at k if it exists.

source

pub fn is_empty(&self) -> bool

Is this set completely empty?

source

pub fn cardinality(&self) -> usize

Returns the cardinality of the set. More precisely, it returns the number of calls to insert with different key values, that have happened since the the set was most recently cleared or created with new.

source

pub fn clear(&mut self)

Remove all entries from this set.

source

pub fn keys(&self) -> Keys<K>

Iterate over all the keys in this set.

source

pub fn resize(&mut self, n: usize)

Resize the set to have n entries by adding default entries as needed.

source

pub fn insert(&mut self, k: K) -> bool

Insert the element at k.

source

pub fn pop(&mut self) -> Option<K>

Removes and returns the entity from the set if it exists.

Trait Implementations§

source§

impl<K> Clone for EntitySet<K>
where K: EntityRef + Clone,

source§

fn clone(&self) -> EntitySet<K>

Returns a copy 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<K> Debug for EntitySet<K>
where K: EntityRef + Debug,

source§

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

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

impl<K: EntityRef> Default for EntitySet<K>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<K> Freeze for EntitySet<K>

§

impl<K> RefUnwindSafe for EntitySet<K>
where K: RefUnwindSafe,

§

impl<K> Send for EntitySet<K>
where K: Send,

§

impl<K> Sync for EntitySet<K>
where K: Sync,

§

impl<K> Unpin for EntitySet<K>
where K: Unpin,

§

impl<K> UnwindSafe for EntitySet<K>
where K: 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> ToOwned for T
where T: Clone,

§

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

§

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

§

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.