Skip to main content

GroupSelection

Struct GroupSelection 

Source
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>

Source

pub fn all(total_num_groups: usize) -> Self

Selects all total_num_groups groups in group-index order.

Source

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.

Source

pub fn total_num_groups(self) -> usize

Returns the group count against which this selection was constructed.

Source

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.

Source

pub fn len(self) -> usize

Returns the number of selected groups.

Source

pub fn is_empty(self) -> bool

Returns true if no groups are selected.

Source

pub fn iter(self) -> impl Iterator<Item = usize> + 'a

Returns the selected group indices in output order.

Trait Implementations§

Source§

impl<'a> Clone for GroupSelection<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for GroupSelection<'a>

Source§

impl<'a> Debug for GroupSelection<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for GroupSelection<'a>

Source§

impl<'a> PartialEq for GroupSelection<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynEq for T
where T: Eq + Any,

Source§

fn dyn_eq(&self, other: &(dyn Any + 'static)) -> bool

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

Source§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.