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§
type IntoIterRef<'a>: Iterator<Item = &'a Self::Item> where Self: 'a
Required Methods§
Sourcefn iter<'a>(&'a self) -> Self::IntoIterRef<'a>
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.