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 == none
Implementations§
source§impl<K, I, F> GroupInner<K, I, F>where
I: Iterator,
F: for<'a> KeyFunction<&'a I::Item, Key = K>,
K: PartialEq,
impl<K, I, F> GroupInner<K, I, F>where I: Iterator, F: for<'a> KeyFunction<&'a I::Item, Key = K>, K: PartialEq,
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