Trait IterRef

Source
pub trait IterRef: IntoIterator {
    type IntoIterRef<'a>: Iterator<Item = &'a Self::Item>
       where Self: 'a;

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

Trait for iterating over references without consuming the iterator.

Required Associated Types§

Source

type IntoIterRef<'a>: Iterator<Item = &'a Self::Item> where Self: 'a

Required Methods§

Source

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

Iterates over the items as immutable references.

A ‘reference’ is a type that points to a different spot in memory where the actual data is. Being ‘immutable’ means that the reference can’t change the underlying data. If you want to change the underlying data then use iter_mut()

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: IntoIterator> IterRef for T
where for<'a> &'a T: IntoIterator<Item = &'a T::Item>,

Source§

type IntoIterRef<'a> = <&'a T as IntoIterator>::IntoIter where T: 'a