Trait ConsumeIterator
Source pub trait ConsumeIterator: Iterator {
// Provided method
fn consume(self)
where Self: Sized { ... }
}
Expand description
Convenience trait to allow using consume as a method.
This trait is implemented for every Iterator.
Consume an iterator.
§Example
The iterator is always fully consumed.
let mut range = 0..=10;
range.by_ref().consume();
assert!(range.is_empty());