Struct non_empty_collections::index_set::NonEmptyIndexSet[][src]

pub struct NonEmptyIndexSet<K, S = RandomState> { /* fields omitted */ }

A wrapper around ::indexmap::IndexSet that is guaranteed to have at least one element by the Rust's type system: it consists of a first element and an indexed set (which could be empty) rest elements.

Methods

impl<K> NonEmptyIndexSet<K, RandomState>
[src]

Creates a set with a default hasher.

Creates a set with a given capacity.

Creates a set from a given iterator with a default hasher.

impl<K, S> NonEmptyIndexSet<K, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

Creates a set with a given hasher.

Creates a set with a given capacity.

Iterates over key-value paris of the set in an immutable way.

Creates a set from a given iterator with a given hasher.

Gets a stored key from the set.

Checks whether a given key exists in the set.

Removes and returns a value from the set that is equal to a given key, if any.

An attempt to remove the last element will cause an Error to be returned.

Removes a value from the set that is equal to a given key, if any. Returns true if the value was present in the set.

An attempt to remove the last element will cause an Error to be returned.

Adds a value to the set.

If there was no such a value in the set before, true is returned.

If the value is in the set already, it remains unchaged and false is returned.

Replaces a value in the set with a given one. An old value is returned, if any.

Returns the number of elements in the set.

Gets an immutable reference to the first element.

Gets a mutable reference to the first element.

Gets an immutable reference to the rest indexed set of elements.

Gets a mutable reference to the rest indexed set of elements.

Attempts to remove the first element. Will fail if it is the only one element in the set.

Scans the collection and keeps only the items on which the provided keep function returns true. Will fail if in the end only one element will remain.

Trait Implementations

impl<'de, K, S> Deserialize<'de> for NonEmptyIndexSet<K, S> where
    K: Deserialize<'de>,
    K: Eq + Hash,
    S: BuildHasher + Default
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<K, H> Serialize for NonEmptyIndexSet<K, H> where
    K: Serialize,
    K: Eq + Hash,
    H: BuildHasher
[src]

Serialize this value into the given Serde serializer. Read more

impl<K: Clone, S: Clone> Clone for NonEmptyIndexSet<K, S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<K: Eq + Hash, S: BuildHasher> Into<IndexSet<K, S>> for NonEmptyIndexSet<K, S>
[src]

Performs the conversion.

impl<K, S> Debug for NonEmptyIndexSet<K, S> where
    K: Eq + Hash + Debug,
    S: BuildHasher
[src]

Formats the value using the given formatter. Read more

impl<K, S> Extend<K> for NonEmptyIndexSet<K, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

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

impl<K, S> IntoIterator for NonEmptyIndexSet<K, S> where
    K: Eq + Hash,
    S: BuildHasher
[src]

Which kind of iterator are we turning this into?

The type of the elements being iterated over.

Creates an iterator from a value. Read more

Auto Trait Implementations

impl<K, S> Send for NonEmptyIndexSet<K, S> where
    K: Send,
    S: Send

impl<K, S> Sync for NonEmptyIndexSet<K, S> where
    K: Sync,
    S: Sync