pub trait Monoid: Default {
type SourceValue;
// Required methods
fn new(value: Self::SourceValue) -> Self;
fn combine(&self, other: &Self) -> Self;
}
Expand description
Interface for a monoid. The default value must be the identity of the monoid.
Required Associated Types§
Sourcetype SourceValue
type SourceValue
The source value for constructing the monoid.
Required Methods§
Sourcefn new(value: Self::SourceValue) -> Self
fn new(value: Self::SourceValue) -> Self
Creates a monoid from a given value.
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.