Trait IterContainer

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

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

A container that allows iteration morally equivalent to IntoIterator.

Iterating the container presents items in an implementation-specific order. The container’s contents are not changed.

Required Associated Types§

Source

type ItemRef<'a> where Self: 'a

The type of elements when reading non-destructively from the container.

Source

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

Iterator type when reading from the container.

Required Methods§

Source

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

Returns an iterator that reads the contents of this container.

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> IterContainer for Rc<T>
where T: IterContainer,

Source§

type ItemRef<'a> = <T as IterContainer>::ItemRef<'a> where Rc<T>: 'a

Source§

type Iter<'a> = <T as IterContainer>::Iter<'a> where Rc<T>: 'a

Source§

fn iter(&self) -> <Rc<T> as IterContainer>::Iter<'_>

Source§

impl<T> IterContainer for Arc<T>
where T: IterContainer,

Source§

type ItemRef<'a> = <T as IterContainer>::ItemRef<'a> where Arc<T>: 'a

Source§

type Iter<'a> = <T as IterContainer>::Iter<'a> where Arc<T>: 'a

Source§

fn iter(&self) -> <Arc<T> as IterContainer>::Iter<'_>

Source§

impl<T> IterContainer for Vec<T>

Source§

type ItemRef<'a> = &'a T where T: 'a

Source§

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

Source§

fn iter(&self) -> <Vec<T> as IterContainer>::Iter<'_>

Implementors§