#[non_exhaustive]pub enum AggBy {
Count,
Sum,
Min,
Max,
}Expand description
Ranking metric for AggSegment::top_groups.
use kevy_index::AggBy;
assert_eq!(AggBy::default(), AggBy::Count);
assert_eq!(AggBy::parse(b"MAX"), Some(AggBy::Max), "tags are case-insensitive");
assert_eq!(AggBy::parse(b"avg"), None);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Count
By row count (default).
s.apply(b"o:1", row(b"eu", 30));
s.apply(b"o:2", row(b"eu", 12));
s.apply(b"o:3", row(b"us", 99));
let top = s.top_groups(kevy_index::AggBy::Count, 1);
assert_eq!((top[0].0.as_slice(), top[0].1.count), (&b"eu"[..], 2));Sum
By sum.
s.apply(b"o:1", row(b"eu", 30));
s.apply(b"o:2", row(b"eu", 12));
s.apply(b"o:3", row(b"us", 99));
let top = s.top_groups(kevy_index::AggBy::Sum, 1);
assert_eq!((top[0].0.as_slice(), top[0].1.sum), (&b"us"[..], 99.0));Min
By minimum (ascending — smallest mins first).
s.apply(b"o:1", row(b"eu", 30));
s.apply(b"o:2", row(b"eu", 12));
s.apply(b"o:3", row(b"us", 99));
let top = s.top_groups(kevy_index::AggBy::Min, 2);
assert_eq!(top[0].0, b"eu", "12 < 99");Max
By maximum (descending — largest maxes first).
s.apply(b"o:1", row(b"eu", 30));
s.apply(b"o:2", row(b"eu", 12));
s.apply(b"o:3", row(b"us", 99));
let top = s.top_groups(kevy_index::AggBy::Max, 2);
assert_eq!(top[0].0, b"us", "99 > 30");Implementations§
Trait Implementations§
impl Copy for AggBy
impl Eq for AggBy
impl StructuralPartialEq for AggBy
Auto Trait Implementations§
impl Freeze for AggBy
impl RefUnwindSafe for AggBy
impl Send for AggBy
impl Sync for AggBy
impl Unpin for AggBy
impl UnsafeUnpin for AggBy
impl UnwindSafe for AggBy
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