Trait SetIterator

Source
pub trait SetIterator<T>:
    IntoIterator<Item = T>
    + SetInterface<T, T>
    + Sized {
    type Iter<'a>: Iterator<Item = &'a T>
       where Self: 'a,
             T: 'a;

    // Required method
    fn iter<'a>(&'a self) -> Self::Iter<'a>;

    // Provided methods
    fn into_difference(self, other: Self) -> IntoDifference<Self, T>  { ... }
    fn difference<'a>(&'a self, other: &'a Self) -> Difference<'a, Self, T>  { ... }
    fn into_symmetric_difference(
        self,
        other: Self,
    ) -> IntoSymmetricDifference<Self, T>  { ... }
    fn symmetric_difference<'a>(
        &'a self,
        other: &'a Self,
    ) -> SymmetricDifference<'a, Self, T>  { ... }
    fn into_intersection(self, other: Self) -> IntoIntersection<Self, T>  { ... }
    fn intersection<'a>(&'a self, other: &'a Self) -> Intersection<'a, Self, T>  { ... }
    fn into_union(self, other: Self) -> IntoUnion<Self, T>  { ... }
    fn union<'a>(&'a self, other: &'a Self) -> Union<'a, Self, T>  { ... }
    fn is_subset(&self, other: &Self) -> bool { ... }
    fn is_superset(&self, other: &Self) -> bool { ... }
}

Required Associated Types§

Source

type Iter<'a>: Iterator<Item = &'a T> where Self: 'a, T: 'a

Required Methods§

Source

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

Returns an iterator over all elements in the set, as references.

Provided Methods§

Source

fn into_difference(self, other: Self) -> IntoDifference<Self, T>

Creates an owned iterator over all items that are in self but not other. (self \ other)

Source

fn difference<'a>(&'a self, other: &'a Self) -> Difference<'a, Self, T>

Creates a borrowed iterator over all items that are in self but not other. (self \ other)

Source

fn into_symmetric_difference( self, other: Self, ) -> IntoSymmetricDifference<Self, T>

Creates an owned iterator over all items that are in self or other but not both. (self △ other)

Source

fn symmetric_difference<'a>( &'a self, other: &'a Self, ) -> SymmetricDifference<'a, Self, T>

Creates a borrowed iterator over all items that are in self or other but not both. (self △ other)

Source

fn into_intersection(self, other: Self) -> IntoIntersection<Self, T>

Creates an owned iterator over all items that are in both self and other. (self ∩ other)

Source

fn intersection<'a>(&'a self, other: &'a Self) -> Intersection<'a, Self, T>

Creates a borrowed iterator over all items that are in both self and other. (self ∩ other)

Source

fn into_union(self, other: Self) -> IntoUnion<Self, T>

Creates an owned iterator over all items that are in either self or other. (self ∪ other)

Source

fn union<'a>(&'a self, other: &'a Self) -> Union<'a, Self, T>

Creates a borrowed iterator over all items that are in either self or other. (self ∪ other)

Source

fn is_subset(&self, other: &Self) -> bool

Returns true if other contains all elements of self. (self ⊆ other)

Source

fn is_superset(&self, other: &Self) -> bool

Returns true if self contains all elements of other. (self ⊇ other)

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.

Implementors§

Source§

impl<T: Hash + Eq, B: BuildHasher> SetIterator<T> for HashSet<T, B>

Source§

type Iter<'a> = Iter<'a, T> where Self: 'a