pub struct Fold<V, A, S, SF, OF> { /* private fields */ }Expand description
An aggregator that can be expressed as a fold of the input Z-set.
The Fold aggregator iterates over (key, weight) pairs with
non-zero weights updating the value of an accumulator with a
user-provided step function. The final aggregate is produced by
applying a user-provided output function to the final value of
the accumulator.
§Type arguments
A- accumulatorS- semigroup structure used to compute aggregates piecewiseSF- step functionOF- output function
Implementations§
Source§impl<V, A, S, SF> Fold<V, A, S, SF, fn(A) -> A>
impl<V, A, S, SF> Fold<V, A, S, SF, fn(A) -> A>
Sourcepub fn new(init: A, step: SF) -> Self
pub fn new(init: A, step: SF) -> Self
Create a Fold aggregator with initial accumulator value init,
step function step, and identity output function.
This constructor caters for the common case when the final value of the accumulator is the desired aggregate, i.e., no output processing is required.
Source§impl<V, A, S, SF, OF> Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> Fold<V, A, S, SF, OF>
Sourcepub fn with_output(init: A, step: SF, output: OF) -> Self
pub fn with_output(init: A, step: SF, output: OF) -> Self
Create a Fold aggregator with initial accumulator value init,
step function step, and output function output.
Trait Implementations§
Source§impl<V, T, R, A, S, O, SF, OF> Aggregator<V, T, R> for Fold<V, A, S, SF, OF>
impl<V, T, R, A, S, O, SF, OF> Aggregator<V, T, R> for Fold<V, A, S, SF, OF>
Source§type Accumulator = A
type Accumulator = A
Accumulator type returned by
Self::finalize.Source§fn aggregate<VTrait, RTrait>(
&self,
cursor: &mut dyn Cursor<VTrait, DynUnit, T, RTrait>,
) -> Option<Self::Accumulator>
fn aggregate<VTrait, RTrait>( &self, cursor: &mut dyn Cursor<VTrait, DynUnit, T, RTrait>, ) -> Option<Self::Accumulator>
Takes a cursor pointing to the first key of a Z-set and outputs
an aggregate of the Z-set. Read more
Source§fn finalize(&self, acc: Self::Accumulator) -> Self::Output
fn finalize(&self, acc: Self::Accumulator) -> Self::Output
Compute the final value of the aggregate.
Auto Trait Implementations§
impl<V, A, S, SF, OF> Freeze for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> RefUnwindSafe for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> Send for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> Sync for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> Unpin for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> UnsafeUnpin for Fold<V, A, S, SF, OF>
impl<V, A, S, SF, OF> UnwindSafe for Fold<V, A, S, SF, OF>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.