[−][src]Struct enumset::EnumSet
An efficient set type for enums.
Methods
impl<T: EnumSetType> EnumSet<T>
[src]
pub fn new() -> Self
[src]
Returns an empty set.
pub fn only(t: T) -> Self
[src]
Returns a set containing a single value.
pub fn empty() -> Self
[src]
Returns an empty set.
pub fn all() -> Self
[src]
Returns a set with all bits set.
pub fn bit_width() -> u8
[src]
Total number of bits this enumset uses. Note that the actual amount of space used is
rounded up to the next highest integer type (u8
, u16
, u32
, u64
, or u128
).
This is the same as EnumSet::variant_count
except in enums with "sparse" variants.
(e.g. enum Foo { A = 10, B = 20 }
)
pub fn variant_count() -> u8
[src]
The number of valid variants in this enumset.
This is the same as EnumSet::bit_width
except in enums with "sparse" variants.
(e.g. enum Foo { A = 10, B = 20 }
)
pub fn to_bits(&self) -> u128
[src]
Returns the raw bits of this set
pub fn from_bits(bits: u128) -> Self
[src]
pub fn len(&self) -> usize
[src]
Returns the number of values in this set.
pub fn is_empty(&self) -> bool
[src]
Checks if the set is empty.
pub fn clear(&mut self)
[src]
Removes all elements from the set.
pub fn is_disjoint(&self, other: Self) -> bool
[src]
Checks if this set shares no elements with another.
pub fn is_superset(&self, other: Self) -> bool
[src]
Checks if all elements in another set are in this set.
pub fn is_subset(&self, other: Self) -> bool
[src]
Checks if all elements of this set are in another set.
pub fn union(&self, other: Self) -> Self
[src]
Returns a set containing the union of all elements in both sets.
pub fn intersection(&self, other: Self) -> Self
[src]
Returns a set containing all elements in common with another set.
pub fn difference(&self, other: Self) -> Self
[src]
Returns a set with all elements of the other set removed.
pub fn symmetrical_difference(&self, other: Self) -> Self
[src]
Returns a set with all elements not contained in both sets.
pub fn complement(&self) -> Self
[src]
Returns a set containing all elements not in this set.
pub fn contains(&self, value: T) -> bool
[src]
Checks whether this set contains a value.
pub fn insert(&mut self, value: T) -> bool
[src]
Adds a value to this set.
pub fn remove(&mut self, value: T) -> bool
[src]
Removes a value from this set.
pub fn insert_all(&mut self, other: Self)
[src]
Adds all elements in another set to this one.
pub fn remove_all(&mut self, other: Self)
[src]
Removes all values in another set from this one.
ⓘImportant traits for EnumSetIter<T>pub fn iter(&self) -> EnumSetIter<T>
[src]
Creates an iterator over the values in this set.
Trait Implementations
impl<T: EnumSetType + Debug> Debug for EnumSet<T>
[src]
impl<T: PartialEq + EnumSetType> PartialEq<EnumSet<T>> for EnumSet<T> where
T::Repr: PartialEq,
[src]
T::Repr: PartialEq,
impl<T: EnumSetType> PartialEq<T> for EnumSet<T>
[src]
fn eq(&self, other: &T) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: Eq + EnumSetType> Eq for EnumSet<T> where
T::Repr: Eq,
[src]
T::Repr: Eq,
impl<T: Ord + EnumSetType> Ord for EnumSet<T> where
T::Repr: Ord,
[src]
T::Repr: Ord,
fn cmp(&self, other: &EnumSet<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<T: PartialOrd + EnumSetType> PartialOrd<EnumSet<T>> for EnumSet<T> where
T::Repr: PartialOrd,
[src]
T::Repr: PartialOrd,
fn partial_cmp(&self, other: &EnumSet<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &EnumSet<T>) -> bool
[src]
fn le(&self, other: &EnumSet<T>) -> bool
[src]
fn gt(&self, other: &EnumSet<T>) -> bool
[src]
fn ge(&self, other: &EnumSet<T>) -> bool
[src]
impl<T: EnumSetType> From<T> for EnumSet<T>
[src]
impl<T: Hash + EnumSetType> Hash for EnumSet<T> where
T::Repr: Hash,
[src]
T::Repr: Hash,
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Copy + EnumSetType> Copy for EnumSet<T> where
T::Repr: Copy,
[src]
T::Repr: Copy,
impl<T: EnumSetType, O: Into<EnumSet<T>>> Sub<O> for EnumSet<T>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: O) -> Self::Output
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> SubAssign<O> for EnumSet<T>
[src]
fn sub_assign(&mut self, rhs: O)
[src]
impl<T: EnumSetType> Not for EnumSet<T>
[src]
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAnd<O> for EnumSet<T>
[src]
type Output = Self
The resulting type after applying the &
operator.
fn bitand(self, other: O) -> Self::Output
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOr<O> for EnumSet<T>
[src]
type Output = Self
The resulting type after applying the |
operator.
fn bitor(self, other: O) -> Self::Output
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXor<O> for EnumSet<T>
[src]
type Output = Self
The resulting type after applying the ^
operator.
fn bitxor(self, other: O) -> Self::Output
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAndAssign<O> for EnumSet<T>
[src]
fn bitand_assign(&mut self, rhs: O)
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOrAssign<O> for EnumSet<T>
[src]
fn bitor_assign(&mut self, rhs: O)
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXorAssign<O> for EnumSet<T>
[src]
fn bitxor_assign(&mut self, rhs: O)
[src]
impl<T: EnumSetType> IntoIterator for EnumSet<T>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = EnumSetIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Clone + EnumSetType> Clone for EnumSet<T> where
T::Repr: Clone,
[src]
T::Repr: Clone,
fn clone(&self) -> EnumSet<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: EnumSetType> Default for EnumSet<T>
[src]
Auto Trait Implementations
impl<T> Send for EnumSet<T> where
<T as EnumSetType>::Repr: Send,
<T as EnumSetType>::Repr: Send,
impl<T> Sync for EnumSet<T> where
<T as EnumSetType>::Repr: Sync,
<T as EnumSetType>::Repr: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,