collections::enum_set::EnumSet - Rust
Description: API documentation for the Rust `EnumSet` struct in crate `collections`.
Keywords: rust, rustlang, rust-lang, EnumSet

# Struct collections::enum_set::EnumSet [−] [src]

    pub struct EnumSet<E> { /* fields omitted */ }

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

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>`
[src]

#### `fn new() -> EnumSet<E>`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns an empty `EnumSet`.

#### `fn len(&self) -> usize`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns the number of elements in the given `EnumSet`.

#### `fn is_empty(&self) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns true if the `EnumSet` is empty.

#### `fn clear(&mut self)`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

#### `fn is_disjoint(&self, other: &EnumSet<E>) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns `false` if the `EnumSet` contains any enum of the given `EnumSet`.

#### `fn is_superset(&self, other: &EnumSet<E>) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns `true` if a given `EnumSet` is included in this `EnumSet`.

#### `fn is_subset(&self, other: &EnumSet<E>) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns `true` if this `EnumSet` is included in the given `EnumSet`.

#### `fn union(&self, e: EnumSet<E>) -> EnumSet<E>`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns the union of both `EnumSets`.

#### `fn intersection(&self, e: EnumSet<E>) -> EnumSet<E>`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns the intersection of both `EnumSets`.

#### `fn insert(&mut self, e: E) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Adds an enum to the `EnumSet`, and returns `true` if it wasn't there before

#### `fn remove(&mut self, e: &E) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Removes an enum from the EnumSet

#### `fn contains(&self, e: &E) -> bool`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns `true` if an `EnumSet` contains a given enum.

#### `fn iter(&self) -> Iter<E>`

Unstable (`enumset`)

: matches collection reform specification, waiting for dust to settle

Returns an iterator over an `EnumSet`.

## Trait Implementations

### `impl<E: PartialEq> PartialEq for EnumSet<E>`
[src]

#### `fn eq(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests for `!=`.

### `impl<E: Eq> Eq for EnumSet<E>`
[src]

### `impl<E: PartialOrd> PartialOrd for EnumSet<E>`
[src]

#### `fn partial_cmp(&self, __arg_0: &EnumSet<E>) -> Option<Ordering>`

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `fn lt(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `fn le(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `fn gt(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `fn ge(&self, __arg_0: &EnumSet<E>) -> bool`

This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. Read more

### `impl<E: Ord> Ord for EnumSet<E>`
[src]

#### `fn cmp(&self, __arg_0: &EnumSet<E>) -> Ordering`

This method returns an `Ordering` between `self` and `other`. Read more

### `impl<E: Hash> Hash for EnumSet<E>`
[src]

#### `fn hash<__HE: Hasher>(&self, __arg_0: &mut __HE)`

Feeds this value into the state given, updating the hasher as necessary.

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher`
1.3.0

Feeds a slice of this type into the state provided.

### `impl<E> Copy for EnumSet<E>`
[src]

### `impl<E> Clone for EnumSet<E>`
[src]

#### `fn clone(&self) -> EnumSet<E>`

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`
1.0.0

Performs copy-assignment from `source`. Read more

### `impl<E: CLike + Debug> Debug for EnumSet<E>`
[src]

#### `fn fmt(&self, fmt: &mut Formatter) -> Result`

Formats the value using the given formatter.

### `impl<E: CLike> Sub for EnumSet<E>`
[src]

#### `type Output = EnumSet<E>`

The resulting type after applying the `-` operator

#### `fn sub(self, e: EnumSet<E>) -> EnumSet<E>`

The method for the `-` operator

### `impl<E: CLike> BitOr for EnumSet<E>`
[src]

#### `type Output = EnumSet<E>`

The resulting type after applying the `|` operator

#### `fn bitor(self, e: EnumSet<E>) -> EnumSet<E>`

The method for the `|` operator

### `impl<E: CLike> BitAnd for EnumSet<E>`
[src]

#### `type Output = EnumSet<E>`

The resulting type after applying the `&` operator

#### `fn bitand(self, e: EnumSet<E>) -> EnumSet<E>`

The method for the `&` operator

### `impl<E: CLike> BitXor for EnumSet<E>`
[src]

#### `type Output = EnumSet<E>`

The resulting type after applying the `^` operator

#### `fn bitxor(self, e: EnumSet<E>) -> EnumSet<E>`

The method for the `^` operator

### `impl<E: CLike> FromIterator<E> for EnumSet<E>`
[src]

#### `fn from_iter<I: IntoIterator<Item=E>>(iter: I) -> EnumSet<E>`

Creates a value from an iterator. Read more

### `impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike`
[src]

#### `type Item = E`

The type of the elements being iterated over.

#### `type IntoIter = Iter<E>`

Which kind of iterator are we turning this into?

#### `fn into_iter(self) -> Iter<E>`

Creates an iterator from a value. Read more

### `impl<E: CLike> Extend<E> for EnumSet<E>`
[src]

#### `fn extend<I: IntoIterator<Item=E>>(&mut self, iter: I)`

Extends a collection with the contents of an iterator. Read more

### `impl<'a, E: 'a + CLike + Copy> Extend<&'a E> for EnumSet<E>`
[src]

#### `fn extend<I: IntoIterator<Item=&'a E>>(&mut self, iter: I)`

Extends a collection with the contents of an iterator. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)