Monoid

Trait Monoid 

Source
pub trait Monoid {
    type S: Clone;

    // Required methods
    fn identity() -> Self::S;
    fn binary_operation(a: &Self::S, b: &Self::S) -> Self::S;
}

Required Associated Types§

Required Methods§

Source

fn identity() -> Self::S

Source

fn binary_operation(a: &Self::S, b: &Self::S) -> Self::S

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§

Source§

impl<S> Monoid for Additive<S>
where S: Copy + Add<Output = S> + Zero,

Source§

type S = S

Source§

impl<S> Monoid for BitwiseAnd<S>
where S: Copy + BitAnd<Output = S> + Not<Output = S> + Zero,

Source§

type S = S

Source§

impl<S> Monoid for BitwiseOr<S>
where S: Copy + BitOr<Output = S> + Zero,

Source§

type S = S

Source§

impl<S> Monoid for BitwiseXor<S>
where S: Copy + BitXor<Output = S> + Zero,

Source§

type S = S

Source§

impl<S> Monoid for Max<S>
where S: Copy + Ord + BoundedBelow,

Source§

type S = S

Source§

impl<S> Monoid for Min<S>
where S: Copy + Ord + BoundedAbove,

Source§

type S = S

Source§

impl<S> Monoid for Multiplicative<S>
where S: Copy + Mul<Output = S> + One,

Source§

type S = S