[][src]Struct spans::SpansBy

pub struct SpansBy<I: Iterator, K, F> { /* fields omitted */ }

SpansBy wraps an iterator and provides progressive access to contiguous spans of the iterator.

See Spans::spans_by_key for more information.

Implementations

impl<I, K, C, F> SpansBy<I, K, F> where
    I: Iterator,
    K: Fn(&I::Item) -> C,
    C: Copy,
    F: Fn(C, C) -> bool
[src]

pub fn next(&mut self) -> Option<Span<'_, I, K, C, F>>[src]

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> RefUnwindSafe for SpansBy<I, K, F> where
    F: RefUnwindSafe,
    I: RefUnwindSafe,
    K: RefUnwindSafe,
    <I as Iterator>::Item: RefUnwindSafe
[src]

impl<I, K, F> Send for SpansBy<I, K, F> where
    F: Send,
    I: Send,
    K: Send,
    <I as Iterator>::Item: Send
[src]

impl<I, K, F> Sync for SpansBy<I, K, F> where
    F: Sync,
    I: Sync,
    K: Sync,
    <I as Iterator>::Item: Sync
[src]

impl<I, K, F> Unpin for SpansBy<I, K, F> where
    F: Unpin,
    I: Unpin,
    K: Unpin,
    <I as Iterator>::Item: Unpin
[src]

impl<I, K, F> UnwindSafe for SpansBy<I, K, F> where
    F: UnwindSafe,
    I: UnwindSafe,
    K: UnwindSafe,
    <I as Iterator>::Item: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.