pub struct ArraySet<K, const N: usize> { /* private fields */ }
Expand description
A set backed by an array. All possible keys must be known statically.
This set is O(1) for all operations
Implementations§
Source§impl<K: Indexable, const N: usize> ArraySet<K, N>
impl<K: Indexable, const N: usize> ArraySet<K, N>
Sourcepub fn insert(&mut self, k: K) -> bool
pub fn insert(&mut self, k: K) -> bool
Inserts a key into the set and returns whether it was already contained in the set
Sourcepub fn remove(&mut self, k: K) -> bool
pub fn remove(&mut self, k: K) -> bool
Removes a key from the set and returns whether it was already contained in the set
Sourcepub fn keys(&self) -> impl Iterator<Item = K> + '_
pub fn keys(&self) -> impl Iterator<Item = K> + '_
Returns an iterator over all values that are in the set
Sourcepub fn unset_keys(&self) -> usize
pub fn unset_keys(&self) -> usize
Returns the number of keys that aren’t in the set
Source§impl<K: ReverseIndexable, const N: usize> ArraySet<K, N>
impl<K: ReverseIndexable, const N: usize> ArraySet<K, N>
Source§impl<K: Indexable> ArraySet<K, 1>
impl<K: Indexable> ArraySet<K, 1>
Source§impl<K: Indexable> ArraySet<K, 2>
impl<K: Indexable> ArraySet<K, 2>
Source§impl<K: Indexable> ArraySet<K, 3>
impl<K: Indexable> ArraySet<K, 3>
Source§impl<K: Indexable> ArraySet<K, 4>
impl<K: Indexable> ArraySet<K, 4>
Source§impl<K: Indexable> ArraySet<K, 5>
impl<K: Indexable> ArraySet<K, 5>
Source§impl<K: Indexable> ArraySet<K, 6>
impl<K: Indexable> ArraySet<K, 6>
Source§impl<K: Indexable> ArraySet<K, 7>
impl<K: Indexable> ArraySet<K, 7>
Trait Implementations§
Source§impl<K: Indexable, const N: usize> BitAndAssign for ArraySet<K, N>
impl<K: Indexable, const N: usize> BitAndAssign for ArraySet<K, N>
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&=
operation. Read moreSource§impl<K: Indexable, const N: usize> BitOrAssign for ArraySet<K, N>
impl<K: Indexable, const N: usize> BitOrAssign for ArraySet<K, N>
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|=
operation. Read moreSource§impl<K: Indexable, const N: usize> BitXorAssign for ArraySet<K, N>
impl<K: Indexable, const N: usize> BitXorAssign for ArraySet<K, N>
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^=
operation. Read moreSource§impl<'de, K: Deserialize<'de> + Indexable, const N: usize> Deserialize<'de> for ArraySet<K, N>
impl<'de, K: Deserialize<'de> + Indexable, const N: usize> Deserialize<'de> for ArraySet<K, N>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<K: Indexable, const M: usize, const S: usize> From<&ArrayMap<K, AtomicBool, M>> for ArraySet<K, S>
impl<K: Indexable, const M: usize, const S: usize> From<&ArrayMap<K, AtomicBool, M>> for ArraySet<K, S>
Source§fn from(m: &ArrayMap<K, AtomicBool, M>) -> Self
fn from(m: &ArrayMap<K, AtomicBool, M>) -> Self
Converts to this type from the input type.
Source§impl<K: Indexable, const M: usize, const S: usize> From<ArrayMap<K, bool, M>> for ArraySet<K, S>
impl<K: Indexable, const M: usize, const S: usize> From<ArrayMap<K, bool, M>> for ArraySet<K, S>
Source§impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, AtomicBool, M>
impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, AtomicBool, M>
Source§impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, bool, M>
impl<K: Indexable, const M: usize, const S: usize> From<ArraySet<K, S>> for ArrayMap<K, bool, M>
Source§impl<K: Indexable, const N: usize> FromIterator<K> for ArraySet<K, N>
impl<K: Indexable, const N: usize> FromIterator<K> for ArraySet<K, N>
Source§fn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = K>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<K: Serialize + Indexable, const N: usize> Serialize for ArraySet<K, N>
impl<K: Serialize + Indexable, const N: usize> Serialize for ArraySet<K, N>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<K, const N: usize> Copy for ArraySet<K, N>
impl<K, const N: usize> Eq for ArraySet<K, N>
impl<K, const N: usize> Send for ArraySet<K, N>
impl<K, const N: usize> Sync for ArraySet<K, N>
impl<K, const N: usize> Unpin for ArraySet<K, N>
impl<K, const N: usize> UnwindSafe for ArraySet<K, N>
Auto Trait Implementations§
impl<K, const N: usize> Freeze for ArraySet<K, N>
impl<K, const N: usize> RefUnwindSafe for ArraySet<K, N>where
K: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more