pub trait IteratorExt: IntoIterator {
    // Provided method
    fn into_internal(self) -> Internal<Self::IntoIter>
       where Self: Sized { ... }
}
Expand description

Extension trait to add conversion to InternalIterator for regular iterators.

Provided Methods§

source

fn into_internal(self) -> Internal<Self::IntoIter>where Self: Sized,

Convert an std::iter::Iterator to an InternalIterator.

Composing internal iterators together requires all used iterators to be internal iterators. Given that regular iterators are far more prevalent, this function can be used to allow them to be used together with internal iterators.


fn flatten_ranges(
    ranges: impl InternalIterator<Item = (i32, i32)>,
) -> impl InternalIterator<Item = i32> {
    ranges.flat_map(|(from, to)| (from..to).into_internal())
}

Implementors§