pub struct GroupSelection<'a> { /* private fields */ }Expand description
Selects groups for a non-destructive grouped aggregation read.
Unlike EmitTo, this selection does not remove groups or change their
indices. Selections created by Self::try_from_indices preserve the
requested order and support duplicate indices.
A selection is validated once when it is constructed and can then be reused for the group values and accumulators participating in the same snapshot. Construct a new selection if the number or indexing of those groups changes.
Implementations§
Source§impl<'a> GroupSelection<'a>
impl<'a> GroupSelection<'a>
Sourcepub fn all(total_num_groups: usize) -> Self
pub fn all(total_num_groups: usize) -> Self
Selects all total_num_groups groups in group-index order.
Sourcepub fn try_from_indices(
indices: &'a [usize],
total_num_groups: usize,
) -> Result<Self>
pub fn try_from_indices( indices: &'a [usize], total_num_groups: usize, ) -> Result<Self>
Selects groups in the order specified by indices.
Returns an error if an index is not less than total_num_groups. Empty
selections are valid, and duplicate indices are preserved.
Sourcepub fn total_num_groups(self) -> usize
pub fn total_num_groups(self) -> usize
Returns the group count against which this selection was constructed.
Sourcepub fn validate_num_groups(self, actual_num_groups: usize) -> Result<()>
pub fn validate_num_groups(self, actual_num_groups: usize) -> Result<()>
Ensures this selection is being applied to the same number of groups against which it was constructed.
Preserving-read implementations should call this method with their
stored group count before using Self::iter. This check is O(1);
the selected indices were already checked by Self::try_from_indices.
Trait Implementations§
Source§impl<'a> Clone for GroupSelection<'a>
impl<'a> Clone for GroupSelection<'a>
impl<'a> Copy for GroupSelection<'a>
Source§impl<'a> Debug for GroupSelection<'a>
impl<'a> Debug for GroupSelection<'a>
impl<'a> Eq for GroupSelection<'a>
Source§impl<'a> PartialEq for GroupSelection<'a>
impl<'a> PartialEq for GroupSelection<'a>
impl<'a> StructuralPartialEq for GroupSelection<'a>
Auto Trait Implementations§
impl<'a> Forget for GroupSelection<'a>
impl<'a> Freeze for GroupSelection<'a>
impl<'a> Move for GroupSelection<'a>
impl<'a> RefUnwindSafe for GroupSelection<'a>
impl<'a> Send for GroupSelection<'a>
impl<'a> Sync for GroupSelection<'a>
impl<'a> Unpin for GroupSelection<'a>
impl<'a> UnsafeUnpin for GroupSelection<'a>
impl<'a> UnwindSafe for GroupSelection<'a>
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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