Trait iter_trait::base::Iter
[−]
[src]
pub trait Iter<'a>: 'a + HasData { type ItemRef: Ref<'a, Self::Item>; type IterRef: Iterator<Item = Self::ItemRef>; fn iter(&'a self) -> Self::IterRef; }
A trait for collections which can be iterated by reference.
In most cases, you shouldn't implement this trait directly; instead, you should implement
IntoIterator
for a reference of this type, which will in turn implement this trait.
Associated Types
type ItemRef: Ref<'a, Self::Item>
Type of the references to the data in the collection.
Although this might just be &'a Item
, it can also be more complicated. For example, an
iterator with Item = (usize, T)
might use (usize, &'a T)
for this instead.
For more information, see the Ref
trait.
type IterRef: Iterator<Item = Self::ItemRef>
Type of the iterator over references.
Required Methods
fn iter(&'a self) -> Self::IterRef
Constructs an iterator over references to the data in this collection.
Implementors
impl<'a, T: 'a + HasData> Iter<'a> for T where
&'a T: IntoIterator,
<&'a T as IntoIterator>::Item: Ref<'a, T::Item>,