Skip to main content

AggregationFn

Type Alias AggregationFn 

Source
pub type AggregationFn = Arc<dyn Fn(Exchange, Exchange) -> Exchange + Send + Sync>;
Expand description

Aggregation function โ€” left-fold binary: (accumulated, next) -> merged.

โ“˜
use std::sync::Arc;
use camel_api::aggregator::AggregationFn;
use camel_api::{Exchange, CamelError};
// A strategy that attempts to signal failure via Result does NOT type-check
// as AggregationFn (whose Fn returns Exchange, not Result<Exchange, CamelError>).
let _: AggregationFn = Arc::new(
    |_old: Exchange, _new: Exchange| -> Result<Exchange, CamelError> { unreachable!() }
);

Aliased Typeยง

pub struct AggregationFn { /* private fields */ }