Skip to main content

IterExtensions

Trait IterExtensions 

Source
pub trait IterExtensions: Iterator {
    // Provided methods
    fn reusable_format(self, sep: &str) -> ReusableIterFormat<'_, Self>
       where Self: Sized { ... }
    fn rle_cumulative(self) -> impl Iterator<Item = (usize, Self::Item)>
       where Self: Sized,
             Self::Item: PartialEq { ... }
}
Expand description

Format all iterator elements, separated by sep.

Unlike the underlying itertools::format, does not panic if fmt is called more than once. Should be used for logging purposes since itertools::format will panic when used by multiple loggers.

Provided Methods§

Source

fn reusable_format(self, sep: &str) -> ReusableIterFormat<'_, Self>
where Self: Sized,

Source

fn rle_cumulative(self) -> impl Iterator<Item = (usize, Self::Item)>
where Self: Sized, Self::Item: PartialEq,

Provides a run-length-encoding iterator that yields the cumulative count of elements seen so far, along with the value of the element. Useful for creating compressed representations of sequences with repeating elements

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> IterExtensions for T
where T: Iterator + ?Sized,