Trait IterableByValue

Source
pub trait IterableByValue {
    type Item;
    type Iter<'a>: Iterator<Item = Self::Item>
       where Self: 'a;

    // Required method
    fn iter_value(&self) -> Self::Iter<'_>;
}
Expand description

A trait for obtaining a value-based iterator.

This trait necessary as all standard Rust containers already have IntoIterator-based methods for obtaining reference-based iterators.

Note that iter_value returns a standard iterator. However, the intended semantics is that the iterator will return values.

If you need to iterate from a given position, and you can implement such an iterator more efficiently, please consider IterableByValueFrom.

Required Associated Types§

Source

type Item

Source

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

Required Methods§

Source

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

Returns an iterator on values.

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<T: Clone> IterableByValue for [T]

Source§

type Item = T

Source§

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

Source§

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

Source§

impl<T: Clone> IterableByValue for Box<[T]>

Source§

type Item = T

Source§

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

Source§

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

Source§

impl<T: Clone> IterableByValue for Vec<T>

Source§

type Item = T

Source§

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

Source§

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

Source§

impl<T: Clone, const N: usize> IterableByValue for [T; N]

Source§

type Item = T

Source§

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

Source§

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

Implementors§