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>
impl<K, I, F> GroupInner<K, I, F>
sourcefn step(&mut self, client: usize) -> Option<I::Item>
fn step(&mut self, client: usize) -> Option<I::Item>
client
: Index of group that requests next element
fn lookup_buffer(&mut self, client: usize) -> Option<I::Item>
sourcefn next_element(&mut self) -> Option<I::Item>
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.
fn step_buffering(&mut self, client: usize) -> Option<I::Item>
fn push_next_group(&mut self, group: Vec<I::Item>)
sourcefn step_current(&mut self) -> Option<I::Item>
fn step_current(&mut self) -> Option<I::Item>
This is the immediate case, where we use no buffering
source§impl<K, I, F> GroupInner<K, I, F>where
I: Iterator,
impl<K, I, F> GroupInner<K, I, F>where
I: Iterator,
sourcefn drop_group(&mut self, client: usize)
fn drop_group(&mut self, client: usize)
Called when a group is dropped
Trait Implementations§
Auto Trait Implementations§
impl<K, I, F> Freeze for GroupInner<K, I, F>
impl<K, I, F> RefUnwindSafe for GroupInner<K, I, F>
impl<K, I, F> Send for GroupInner<K, I, F>
impl<K, I, F> Sync for GroupInner<K, I, F>
impl<K, I, F> Unpin for GroupInner<K, I, F>
impl<K, I, F> UnwindSafe for GroupInner<K, I, F>where
F: UnwindSafe,
I: UnwindSafe,
K: UnwindSafe,
<I as Iterator>::Item: UnwindSafe + RefUnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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