Trait Monoid

Source
pub trait Monoid: Add + Default { }
Expand description

A Monoid consists of a semigroup (the Add trait in Rust) and an empty value (the Default trait) plus the following laws:

  • Associativity: (x + y) + z == x + (y + z)
  • Identity: 0 + a == a + 0 == a

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§