Trait differential_dataflow::difference::Semigroup[][src]

pub trait Semigroup: for<'a> AddAssign<&'a Self> + Sized + Data + Clone {
    fn is_zero(&self) -> bool;
}

A type with addition and a test for zero.

These traits are currently the minimal requirements for a type to be a “difference” in differential dataflow. Addition allows differential dataflow to compact multiple updates to the same data, and the test for zero allows differential dataflow to retire updates that have no effect. There is no requirement that the test for zero ever return true, and the zero value does not need to inhabit the type.

There is a light presumption of commutativity here, in that while we will largely perform addition in order of timestamps, for many types of timestamps there is no total order and consequently no obvious order to respect. Non-commutative semigroups should be used with care.

Required methods

fn is_zero(&self) -> bool[src]

Returns true if the element is the additive identity.

This is primarily used by differential dataflow to know when it is safe to delete an update. When a difference accumulates to zero, the difference has no effect on any accumulation and can be removed.

A semigroup is not obligated to have a zero element, and this method could always return false in such a setting.

Loading content...

Implementations on Foreign Types

impl Semigroup for isize[src]

impl Semigroup for i128[src]

impl Semigroup for i64[src]

impl Semigroup for i32[src]

impl Semigroup for i16[src]

impl Semigroup for i8[src]

Loading content...

Implementors

impl Semigroup for Present[src]

impl<R1: Semigroup, R2: Semigroup> Semigroup for DiffPair<R1, R2>[src]

impl<R: Semigroup> Semigroup for DiffVector<R>[src]

Loading content...