Trait Set

Source
pub trait Set {
    type Item: Clone + Ord;
    type Map<V>: Map<Self::Item, V>;
    type Iter<'a>: 'a + Iterator<Item = Self::Item>
       where Self: 'a;

    // Required methods
    fn len(&self) -> usize;
    fn iter(&self) -> Self::Iter<'_>;
    fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
       where F: Fn(&Self::Item) -> V;
}
Expand description

Ordered set.

Required Associated Types§

Source

type Item: Clone + Ord

Type of the items of the set.

Source

type Map<V>: Map<Self::Item, V>

Map type, binding each item of the graph to a value V.

§Example

Vec<V>.

Source

type Iter<'a>: 'a + Iterator<Item = Self::Item> where Self: 'a

Items iterator.

Required Methods§

Source

fn len(&self) -> usize

The number of elements in the set.

Source

fn iter(&self) -> Self::Iter<'_>

Returns an iterator over the items of the set.

Source

fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
where F: Fn(&Self::Item) -> V,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Set for u32

Source§

type Map<V> = Vec<V>

Map type, binding each item of the graph to a value V.

§Example

Vec<V>.

Source§

type Iter<'a> = Range<u32>

Items iterator.

Source§

fn len(&self) -> usize

The number of elements in the set.

Source§

fn iter(&self) -> Self::Iter<'_>

Returns an iterator over the items of the set.

Source§

type Item = u32

Source§

fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
where F: Fn(&Self::Item) -> V,

Source§

impl Set for u64

Source§

type Map<V> = Vec<V>

Map type, binding each item of the graph to a value V.

§Example

Vec<V>.

Source§

type Iter<'a> = Range<u64>

Items iterator.

Source§

fn len(&self) -> usize

The number of elements in the set.

Source§

fn iter(&self) -> Self::Iter<'_>

Returns an iterator over the items of the set.

Source§

type Item = u64

Source§

fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
where F: Fn(&Self::Item) -> V,

Source§

impl Set for usize

Source§

type Map<V> = Vec<V>

Map type, binding each item of the graph to a value V.

§Example

Vec<V>.

Source§

type Iter<'a> = Range<usize>

Items iterator.

Source§

fn len(&self) -> usize

The number of elements in the set.

Source§

fn iter(&self) -> Self::Iter<'_>

Returns an iterator over the items of the set.

Source§

type Item = usize

Source§

fn map<V: Clone, F>(&self, f: F) -> Self::Map<V>
where F: Fn(&Self::Item) -> V,

Implementors§