Struct collections::enum_set::EnumSet
[−]
[src]
pub struct EnumSet<E> { // some fields omitted }
A specialized set implementation to use enum types.
It is a logic error for an item to be modified in such a way that the
transformation of the item to or from a usize
, as determined by the
CLike
trait, changes while the item is in the set. This is normally only
possible through Cell
, RefCell
, global state, I/O, or unsafe code.
Methods
impl<E: CLike> EnumSet<E>
fn new() -> EnumSet<E>
Returns an empty EnumSet
.
fn len(&self) -> usize
Returns the number of elements in the given EnumSet
.
fn is_empty(&self) -> bool
Returns true if the EnumSet
is empty.
fn clear(&mut self)
fn is_disjoint(&self, other: &EnumSet<E>) -> bool
Returns false
if the EnumSet
contains any enum of the given EnumSet
.
fn is_superset(&self, other: &EnumSet<E>) -> bool
Returns true
if a given EnumSet
is included in this EnumSet
.
fn is_subset(&self, other: &EnumSet<E>) -> bool
Returns true
if this EnumSet
is included in the given EnumSet
.
fn union(&self, e: EnumSet<E>) -> EnumSet<E>
Returns the union of both EnumSets
.
fn intersection(&self, e: EnumSet<E>) -> EnumSet<E>
Returns the intersection of both EnumSets
.
fn insert(&mut self, e: E) -> bool
Adds an enum to the EnumSet
, and returns true
if it wasn't there before
fn remove(&mut self, e: &E) -> bool
Removes an enum from the EnumSet
fn contains(&self, e: &E) -> bool
Returns true
if an EnumSet
contains a given enum.
fn iter(&self) -> Iter<E>
Returns an iterator over an EnumSet
.