Struct enumset::EnumSet [−][src]
pub struct EnumSet<T: EnumSetType> { /* fields omitted */ }
An efficient set type for enums created with the enum_set_type!
macro.
Methods
impl<T: EnumSetType> EnumSet<T>
[src]
impl<T: EnumSetType> EnumSet<T>
pub fn new() -> Self
[src]
pub fn new() -> Self
Returns an empty set.
pub fn only(t: T) -> Self
[src]
pub fn only(t: T) -> Self
Returns a set containing a single value.
pub fn empty() -> Self
[src]
pub fn empty() -> Self
Returns an empty set.
pub fn all() -> Self
[src]
pub fn all() -> Self
Returns a set with all bits set.
pub fn bit_width() -> u8
[src]
pub fn bit_width() -> u8
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
).
pub fn to_bits(&self) -> u128
[src]
pub fn to_bits(&self) -> u128
Returns the raw bits of this set
pub fn from_bits(bits: u128) -> Self
[src]
pub fn from_bits(bits: u128) -> Self
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of values in this set.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Checks if the set is empty.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Removes all elements from the set.
pub fn is_disjoint(&self, other: Self) -> bool
[src]
pub fn is_disjoint(&self, other: Self) -> bool
Checks if this set shares no elements with another.
pub fn is_superset(&self, other: Self) -> bool
[src]
pub fn is_superset(&self, other: Self) -> bool
Checks if all elements in another set are in this set.
pub fn is_subset(&self, other: Self) -> bool
[src]
pub fn is_subset(&self, other: Self) -> bool
Checks if all elements of this set are in another set.
pub fn union(&self, other: Self) -> Self
[src]
pub fn union(&self, other: Self) -> Self
Returns a set containing the union of all elements in both sets.
pub fn intersection(&self, other: Self) -> Self
[src]
pub fn intersection(&self, other: Self) -> Self
Returns a set containing all elements in common with another set.
pub fn difference(&self, other: Self) -> Self
[src]
pub fn difference(&self, other: Self) -> Self
Returns a set with all elements of the other set removed.
pub fn symmetrical_difference(&self, other: Self) -> Self
[src]
pub fn symmetrical_difference(&self, other: Self) -> Self
Returns a set with all elements not contained in both sets.
pub fn complement(&self) -> Self
[src]
pub fn complement(&self) -> Self
Returns a set containing all elements not in this set.
pub fn contains(&self, value: T) -> bool
[src]
pub fn contains(&self, value: T) -> bool
Checks whether this set contains a value.
pub fn insert(&mut self, value: T) -> bool
[src]
pub fn insert(&mut self, value: T) -> bool
Adds a value to this set.
pub fn remove(&mut self, value: T) -> bool
[src]
pub fn remove(&mut self, value: T) -> bool
Removes a value from this set.
pub fn insert_all(&mut self, other: Self)
[src]
pub fn insert_all(&mut self, other: Self)
Adds all elements in another set to this one.
pub fn remove_all(&mut self, other: Self)
[src]
pub fn remove_all(&mut self, other: Self)
Removes all values in another set from this one.
ⓘImportant traits for EnumSetIter<T>pub fn iter(&self) -> EnumSetIter<T>
[src]
pub fn iter(&self) -> EnumSetIter<T>
Creates an iterator over the values in this set.
Trait Implementations
impl<T: Copy + EnumSetType> Copy for EnumSet<T> where
T::Repr: Copy,
[src]
impl<T: Copy + EnumSetType> Copy for EnumSet<T> where
T::Repr: Copy,
impl<T: Clone + EnumSetType> Clone for EnumSet<T> where
T::Repr: Clone,
[src]
impl<T: Clone + EnumSetType> Clone for EnumSet<T> where
T::Repr: Clone,
fn clone(&self) -> EnumSet<T>
[src]
fn clone(&self) -> EnumSet<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: PartialOrd + EnumSetType> PartialOrd for EnumSet<T> where
T::Repr: PartialOrd,
[src]
impl<T: PartialOrd + EnumSetType> PartialOrd for EnumSet<T> where
T::Repr: PartialOrd,
fn partial_cmp(&self, other: &EnumSet<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &EnumSet<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &EnumSet<T>) -> bool
[src]
fn lt(&self, other: &EnumSet<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &EnumSet<T>) -> bool
[src]
fn le(&self, other: &EnumSet<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &EnumSet<T>) -> bool
[src]
fn gt(&self, other: &EnumSet<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &EnumSet<T>) -> bool
[src]
fn ge(&self, other: &EnumSet<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord + EnumSetType> Ord for EnumSet<T> where
T::Repr: Ord,
[src]
impl<T: Ord + EnumSetType> Ord for EnumSet<T> where
T::Repr: Ord,
fn cmp(&self, other: &EnumSet<T>) -> Ordering
[src]
fn cmp(&self, other: &EnumSet<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: PartialEq + EnumSetType> PartialEq for EnumSet<T> where
T::Repr: PartialEq,
[src]
impl<T: PartialEq + EnumSetType> PartialEq for EnumSet<T> where
T::Repr: PartialEq,
fn eq(&self, other: &EnumSet<T>) -> bool
[src]
fn eq(&self, other: &EnumSet<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &EnumSet<T>) -> bool
[src]
fn ne(&self, other: &EnumSet<T>) -> bool
This method tests for !=
.
impl<T: Eq + EnumSetType> Eq for EnumSet<T> where
T::Repr: Eq,
[src]
impl<T: Eq + EnumSetType> Eq for EnumSet<T> where
T::Repr: Eq,
impl<T: Hash + EnumSetType> Hash for EnumSet<T> where
T::Repr: Hash,
[src]
impl<T: Hash + EnumSetType> Hash for EnumSet<T> where
T::Repr: Hash,
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: EnumSetType> IntoIterator for EnumSet<T>
[src]
impl<T: EnumSetType> IntoIterator for EnumSet<T>
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]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<T: EnumSetType, O: Into<EnumSet<T>>> Sub<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> Sub<O> for EnumSet<T>
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: O) -> Self::Output
[src]
fn sub(self, other: O) -> Self::Output
Performs the -
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAnd<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAnd<O> for EnumSet<T>
type Output = Self
The resulting type after applying the &
operator.
fn bitand(self, other: O) -> Self::Output
[src]
fn bitand(self, other: O) -> Self::Output
Performs the &
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOr<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOr<O> for EnumSet<T>
type Output = Self
The resulting type after applying the |
operator.
fn bitor(self, other: O) -> Self::Output
[src]
fn bitor(self, other: O) -> Self::Output
Performs the |
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXor<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXor<O> for EnumSet<T>
type Output = Self
The resulting type after applying the ^
operator.
fn bitxor(self, other: O) -> Self::Output
[src]
fn bitxor(self, other: O) -> Self::Output
Performs the ^
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> SubAssign<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> SubAssign<O> for EnumSet<T>
fn sub_assign(&mut self, rhs: O)
[src]
fn sub_assign(&mut self, rhs: O)
Performs the -=
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAndAssign<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitAndAssign<O> for EnumSet<T>
fn bitand_assign(&mut self, rhs: O)
[src]
fn bitand_assign(&mut self, rhs: O)
Performs the &=
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOrAssign<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitOrAssign<O> for EnumSet<T>
fn bitor_assign(&mut self, rhs: O)
[src]
fn bitor_assign(&mut self, rhs: O)
Performs the |=
operation.
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXorAssign<O> for EnumSet<T>
[src]
impl<T: EnumSetType, O: Into<EnumSet<T>>> BitXorAssign<O> for EnumSet<T>
fn bitxor_assign(&mut self, rhs: O)
[src]
fn bitxor_assign(&mut self, rhs: O)
Performs the ^=
operation.
impl<T: EnumSetType> Not for EnumSet<T>
[src]
impl<T: EnumSetType> Not for EnumSet<T>
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
fn not(self) -> Self::Output
Performs the unary !
operation.
impl<T: EnumSetType> From<T> for EnumSet<T>
[src]
impl<T: EnumSetType> From<T> for EnumSet<T>
impl<T: EnumSetType> PartialEq<T> for EnumSet<T>
[src]
impl<T: EnumSetType> PartialEq<T> for EnumSet<T>
fn eq(&self, other: &T) -> bool
[src]
fn eq(&self, other: &T) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: EnumSetType + Debug> Debug for EnumSet<T>
[src]
impl<T: EnumSetType + Debug> Debug for EnumSet<T>