Struct ChunkBy

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct ChunkBy<'a, T: 'a, P> { pub(in ::slice::iter) slice: &'a [T], pub(in ::slice::iter) predicate: P }

An iterator over slice in (non-overlapping) chunks separated by a predicate.

This struct is created by the chunk_by method on slices.

Fields

slice: &'a [T]
predicate: P

Implementations

impl<'a, T: 'a, P> ChunkBy<'a, T, P>

const fn new(slice: &'a [T], predicate: P) -> Self

Trait Implementations

impl<'a, T: 'a + Debug, P> Debug for ChunkBy<'a, T, P>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<'a, T: 'a, P> DoubleEndedIterator for ChunkBy<'a, T, P> where P: FnMut(&T, &T) -> bool,

fn next_back(&mut self) -> Option<Self::Item>

impl<'a, T: 'a, P> FusedIterator for ChunkBy<'a, T, P> where P: FnMut(&T, &T) -> bool,

impl<'a, T: 'a, P> Iterator for ChunkBy<'a, T, P> where P: FnMut(&T, &T) -> bool,

type Item = &'a [T];
fn next(&mut self) -> Option<Self::Item>
fn size_hint(&self) -> (usize, Option<usize>)
fn count(self) -> usize
fn last(self) -> Option<Self::Item>

impl<'a, T: 'a, P: Clone> Clone for ChunkBy<'a, T, P>

fn clone(&self) -> Self

Auto Trait Implementations

impl<'a, T, P> Freeze for ChunkBy<'a, T, P> where &'a [T]: Freeze, P: Freeze,

impl<'a, T, P> RefUnwindSafe for ChunkBy<'a, T, P> where &'a [T]: RefUnwindSafe, P: RefUnwindSafe,

impl<'a, T, P> Send for ChunkBy<'a, T, P> where &'a [T]: Send, P: Send,

impl<'a, T, P> Sync for ChunkBy<'a, T, P> where &'a [T]: Sync, P: Sync,

impl<'a, T, P> Unpin for ChunkBy<'a, T, P> where &'a [T]: Unpin, P: Unpin,

impl<'a, T, P> UnsafeUnpin for ChunkBy<'a, T, P> where &'a [T]: UnsafeUnpin, P: UnsafeUnpin,

impl<'a, T, P> UnwindSafe for ChunkBy<'a, T, P> where &'a [T]: UnwindSafe, P: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for ChunkBy<'a, T, P> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for ChunkBy<'a, T, P> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ChunkBy<'a, T, P> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ChunkBy<'a, T, P> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for ChunkBy<'a, T, P> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for ChunkBy<'a, T, P>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for ChunkBy<'a, T, P> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for ChunkBy<'a, T, P>

impl<T, U> Into<U> for ChunkBy<'a, T, P> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for ChunkBy<'a, T, P> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for ChunkBy<'a, T, P> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>