pub struct SpansBy<I: Iterator, K, F> { /* private fields */ }Expand description
SpansBy wraps an iterator and provides progressive access to contiguous spans of the iterator.
See Spans::spans_by_key for more information.
Implementations§
Source§impl<I, K, C, F> SpansBy<I, K, F>
impl<I, K, C, F> SpansBy<I, K, F>
Sourcepub fn next(&mut self) -> Option<Span<'_, I, K, C, F>>
pub fn next(&mut self) -> Option<Span<'_, I, K, C, F>>
Returns the next span or None if the iterator terminated.
§Example
use spans::Spans;
let vec = vec![1, 2, 5];
let mut spans = vec.iter().spans_by_key(|&&x| x, |a, b| a + 1 == b);
while let Some(span) = spans.next() {
// do something with `span`
let count = span.count();
assert!(count > 0); // true for all spans
assert!(count < 3); // true for the spans in this example
}Auto Trait Implementations§
impl<I, K, F> Freeze for SpansBy<I, K, F>
impl<I, K, F> RefUnwindSafe for SpansBy<I, K, F>
impl<I, K, F> Send for SpansBy<I, K, F>
impl<I, K, F> Sync for SpansBy<I, K, F>
impl<I, K, F> Unpin for SpansBy<I, K, F>
impl<I, K, F> UnwindSafe for SpansBy<I, K, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more