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

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.