Struct itertools::groupbylazy::GroupInner

source ·
struct GroupInner<K, I, F>
where I: Iterator,
{ key: F, iter: I, current_key: Option<K>, current_elt: Option<I::Item>, done: bool, top_group: usize, oldest_buffered_group: usize, bottom_group: usize, buffer: Vec<IntoIter<I::Item>>, dropped_group: usize, }

Fields§

§key: F§iter: I§current_key: Option<K>§current_elt: Option<I::Item>§done: bool

flag set if iterator is exhausted

§top_group: usize

Index of group we are currently buffering or visiting

§oldest_buffered_group: usize

Least index for which we still have elements buffered

§bottom_group: usize

Group index for buffer[0] – the slots bottom_group..oldest_buffered_group are unused and will be erased when that range is large enough.

§buffer: Vec<IntoIter<I::Item>>

Buffered groups, from bottom_group (index 0) to top_group.

§dropped_group: usize

index of last group iter that was dropped, usize::MAX initially when no group was dropped

Implementations§

source§

impl<K, I, F> GroupInner<K, I, F>
where I: Iterator, F: for<'a> KeyFunction<&'a I::Item, Key = K>, K: PartialEq,

source

fn step(&mut self, client: usize) -> Option<I::Item>

client: Index of group that requests next element

source

fn lookup_buffer(&mut self, client: usize) -> Option<I::Item>

source

fn next_element(&mut self) -> Option<I::Item>

Take the next element from the iterator, and set the done flag if exhausted. Must not be called after done.

source

fn step_buffering(&mut self, client: usize) -> Option<I::Item>

source

fn push_next_group(&mut self, group: Vec<I::Item>)

source

fn step_current(&mut self) -> Option<I::Item>

This is the immediate case, where we use no buffering

source

fn group_key(&mut self, client: usize) -> K

Request the just started groups’ key.

client: Index of group

Panics if no group key is available.

source§

impl<K, I, F> GroupInner<K, I, F>
where I: Iterator,

source

fn drop_group(&mut self, client: usize)

Called when a group is dropped

Trait Implementations§

source§

impl<K: Clone, I, F: Clone> Clone for GroupInner<K, I, F>
where I: Iterator + Clone, I::Item: Clone,

source§

fn clone(&self) -> GroupInner<K, I, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<K, I, F> Freeze for GroupInner<K, I, F>
where F: Freeze, I: Freeze, K: Freeze, <I as Iterator>::Item: Freeze,

§

impl<K, I, F> RefUnwindSafe for GroupInner<K, I, F>

§

impl<K, I, F> Send for GroupInner<K, I, F>
where F: Send, I: Send, K: Send, <I as Iterator>::Item: Send,

§

impl<K, I, F> Sync for GroupInner<K, I, F>
where F: Sync, I: Sync, K: Sync, <I as Iterator>::Item: Sync,

§

impl<K, I, F> Unpin for GroupInner<K, I, F>
where F: Unpin, I: Unpin, K: Unpin, <I as Iterator>::Item: Unpin,

§

impl<K, I, F> UnwindSafe for GroupInner<K, I, F>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.