[−][src]Struct spans::SpansBy
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]
I: Iterator,
K: Fn(&I::Item) -> C,
C: Copy,
F: Fn(C, C) -> bool,
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]
F: RefUnwindSafe,
I: RefUnwindSafe,
K: RefUnwindSafe,
<I as Iterator>::Item: RefUnwindSafe,
impl<I, K, F> Send for SpansBy<I, K, F> where
F: Send,
I: Send,
K: Send,
<I as Iterator>::Item: Send,
[src]
F: Send,
I: Send,
K: Send,
<I as Iterator>::Item: Send,
impl<I, K, F> Sync for SpansBy<I, K, F> where
F: Sync,
I: Sync,
K: Sync,
<I as Iterator>::Item: Sync,
[src]
F: Sync,
I: Sync,
K: Sync,
<I as Iterator>::Item: Sync,
impl<I, K, F> Unpin for SpansBy<I, K, F> where
F: Unpin,
I: Unpin,
K: Unpin,
<I as Iterator>::Item: Unpin,
[src]
F: Unpin,
I: Unpin,
K: Unpin,
<I as Iterator>::Item: Unpin,
impl<I, K, F> UnwindSafe for SpansBy<I, K, F> where
F: UnwindSafe,
I: UnwindSafe,
K: UnwindSafe,
<I as Iterator>::Item: UnwindSafe,
[src]
F: UnwindSafe,
I: UnwindSafe,
K: UnwindSafe,
<I as Iterator>::Item: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,