1 2 3 4 5 6 7 8 9 10 11
use std::ops::Add; /// A `Monoid` consists of a semigroup (the [`Add`][Add] trait in Rust) and an /// empty value (the [`Default`][Default] trait) plus the following laws: /// /// - Associativity: `(x + y) + z == x + (y + z)` /// - Identity: `0 + a == a + 0 == a` /// /// [Add]: https://doc.rust-lang.org/std/ops/trait.Add.html /// [Default]: https://doc.rust-lang.org/std/default/trait.Default.html pub trait Monoid: Add + Default {}