pub struct Grouped<S, Out, K, Src, F, KF, C, V, R, Acc, Sc>where
Sc: Score,{ /* private fields */ }Expand description
Projected rows grouped by a key K and aggregated by a collector.
Implementations§
Source§impl<S, Out, K, Src, F, KF, C, V, R, Acc, Sc> Grouped<S, Out, K, Src, F, KF, C, V, R, Acc, Sc>where
S: Send + Sync + 'static,
Out: Send + Sync + 'static,
K: Clone + Eq + Hash + Send + Sync + 'static,
Src: Source<S, Out>,
F: UniFilter<S, Out>,
KF: Fn(&Out) -> K + Send + Sync,
C: for<'i> Collector<&'i Out, Value = V, Result = R, Accumulator = Acc> + Send + Sync + 'static,
V: Send + Sync + 'static,
R: Send + Sync + 'static,
Acc: Accumulator<V, R> + Send + Sync + 'static,
Sc: Score + 'static,
impl<S, Out, K, Src, F, KF, C, V, R, Acc, Sc> Grouped<S, Out, K, Src, F, KF, C, V, R, Acc, Sc>where
S: Send + Sync + 'static,
Out: Send + Sync + 'static,
K: Clone + Eq + Hash + Send + Sync + 'static,
Src: Source<S, Out>,
F: UniFilter<S, Out>,
KF: Fn(&Out) -> K + Send + Sync,
C: for<'i> Collector<&'i Out, Value = V, Result = R, Accumulator = Acc> + Send + Sync + 'static,
V: Send + Sync + 'static,
R: Send + Sync + 'static,
Acc: Accumulator<V, R> + Send + Sync + 'static,
Sc: Score + 'static,
Sourcepub fn penalize<W>(
self,
weight_fn: W,
) -> GroupedBuilder<S, Out, K, Src, F, KF, C, V, R, Acc, impl Fn(&K, &R) -> Sc + Send + Sync, Sc>
pub fn penalize<W>( self, weight_fn: W, ) -> GroupedBuilder<S, Out, K, Src, F, KF, C, V, R, Acc, impl Fn(&K, &R) -> Sc + Send + Sync, Sc>
Penalizes each group by weight_fn.
weight_fn is a fixed score, or a closure over the matched (&key, &result) returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.
Sourcepub fn reward<W>(
self,
weight_fn: W,
) -> GroupedBuilder<S, Out, K, Src, F, KF, C, V, R, Acc, impl Fn(&K, &R) -> Sc + Send + Sync, Sc>
pub fn reward<W>( self, weight_fn: W, ) -> GroupedBuilder<S, Out, K, Src, F, KF, C, V, R, Acc, impl Fn(&K, &R) -> Sc + Send + Sync, Sc>
Rewards each group by weight_fn.
weight_fn is a fixed score, or a closure over the matched (&key, &result) returning one.
A fixed weight with a non-zero hard level marks the constraint hard; closures
are soft unless wrapped in hard_weight.
Sourcepub fn complement<B, EB, KB, D>(
self,
extractor_b: EB,
key_b: KB,
default_fn: D,
) -> ComplementedGrouped<S, Out, B, K, Src, EB, F, impl Fn(&Out) -> Option<K> + Send + Sync, KB, C, V, R, Acc, D, Sc>
pub fn complement<B, EB, KB, D>( self, extractor_b: EB, key_b: KB, default_fn: D, ) -> ComplementedGrouped<S, Out, B, K, Src, EB, F, impl Fn(&Out) -> Option<K> + Send + Sync, KB, C, V, R, Acc, D, Sc>
Complements the groups with the entities of extractor_b: each b yields a
row keyed key_b(b) holding the real group’s result, or default_fn(b) when
that group is empty.
Sourcepub fn complement_with_key<B, EB, KA2, KB, D>(
self,
extractor_b: EB,
key_a: KA2,
key_b: KB,
default_fn: D,
) -> ComplementedGrouped<S, Out, B, K, Src, EB, F, KA2, KB, C, V, R, Acc, D, Sc>
pub fn complement_with_key<B, EB, KA2, KB, D>( self, extractor_b: EB, key_a: KA2, key_b: KB, default_fn: D, ) -> ComplementedGrouped<S, Out, B, K, Src, EB, F, KA2, KB, C, V, R, Acc, D, Sc>
Like complement, regrouping rows by key_a; rows whose
key is None join no target and contribute nothing.