Skip to main content

Sum

Struct Sum 

Source
pub struct Sum;
Expand description

Additive commutative monoid: old ⊕ op = old + op. Associative and commutative, not idempotent (re-adding double-counts). The unordered-exactly-once tier (analysis §2): a running counter / sum.

Trait Implementations§

Source§

impl<T> MergePolicy<T> for Sum
where T: Add<Output = T> + Clone,

Source§

const COMMUTATIVE: bool = true

true iff is commutative — reordering ops converges to the same state (merge(merge(a, b), c) == merge(merge(a, c), b)).
Source§

const IDEMPOTENT: bool = false

true iff is idempotent — re-applying an op is a no-op (merge(merge(a, b), b) == merge(a, b)).
Source§

fn merge(old: &T, op: T) -> T

Fold op into old. MUST be associative.
Source§

const CONFLATES: bool = true

true iff coalescing (merging accumulated ops into one) actually bounds the state — the precondition for the Conflate overflow action. All conflating policies (band / monoid / semilattice) bound; only RawFifo (concat: order + multiplicity are meaning) grows without bound, so it cannot conflate and a relay MUST reject Conflate for it (analysis §4.3).

Auto Trait Implementations§

§

impl Freeze for Sum

§

impl RefUnwindSafe for Sum

§

impl Send for Sum

§

impl Sync for Sum

§

impl Unpin for Sum

§

impl UnsafeUnpin for Sum

§

impl UnwindSafe for Sum

Blanket Implementations§

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