Trait differential_dataflow::difference::Semigroup

source ·
pub trait Semigroup: Sized + Data + Clone {
    // Required methods
    fn plus_equals(&mut self, rhs: &Self);
    fn is_zero(&self) -> bool;
}
Expand description

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§

source

fn plus_equals(&mut self, rhs: &Self)

The method of std::ops::AddAssign, for types that do not implement AddAssign.

source

fn is_zero(&self) -> bool

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Semigroup for i8

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for i16

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for i32

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for i64

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for i128

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for isize

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for u8

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for u16

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for u32

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for u64

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for u128

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for ()

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for usize

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<i8>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<i16>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<i32>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<i64>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<i128>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl Semigroup for Wrapping<isize>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl<A1: Semigroup> Semigroup for (A1,)

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl<A1: Semigroup, B1: Semigroup> Semigroup for (A1, B1)

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl<A1: Semigroup, B1: Semigroup, C1: Semigroup> Semigroup for (A1, B1, C1)

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl<A1: Semigroup, B1: Semigroup, C1: Semigroup, D1: Semigroup> Semigroup for (A1, B1, C1, D1)

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

source§

impl<R: Semigroup> Semigroup for Vec<R>

source§

fn plus_equals(&mut self, rhs: &Self)

source§

fn is_zero(&self) -> bool

Implementors§