pub trait Iterable: FromIterator<Self::OwnedItem>{
type OwnedItem;
type Item<'collection>
where Self: 'collection;
type Iterator<'collection>: ExactSizeIterator<Item = Self::Item<'collection>> + DoubleEndedIterator<Item = Self::Item<'collection>>
where Self: 'collection;
// Required method
fn iter<'c>(&'c self) -> Self::Iterator<'c>;
// Provided method
fn len(&self) -> usize { ... }
}
Expand description
Iterable trait to encapsulate collection types which have a length, are reversible, and are iterable
Required Associated Types§
Sourcetype Item<'collection>
where
Self: 'collection
type Item<'collection> where Self: 'collection
The item produced by the collection’s iterator. For example &f64
for
Vec<f64
Sourcetype Iterator<'collection>: ExactSizeIterator<Item = Self::Item<'collection>> + DoubleEndedIterator<Item = Self::Item<'collection>>
where
Self: 'collection
type Iterator<'collection>: ExactSizeIterator<Item = Self::Item<'collection>> + DoubleEndedIterator<Item = Self::Item<'collection>> where Self: 'collection
The iterator produced by the collection
Required Methods§
Provided Methods§
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.