Hom

Trait Hom 

Source
pub trait Hom<M: Monoid>: HomMut<M> {
    // Required method
    fn call(&self, m: M) -> Self::Output;
}
Expand description

An Fn-like monoid homomorphism (see the module-level documentation for details).

Required Methods§

Source

fn call(&self, m: M) -> Self::Output

Trait Implementations§

Source§

impl<'a, M1: Monoid, M2: Monoid> Hom<M1> for Box<dyn Hom<M1, Output = M2> + 'a>

Source§

fn call(&self, m: M1) -> M2

Source§

impl<'a, M1: Monoid, M2: Monoid> HomMut<M1> for Box<dyn Hom<M1, Output = M2> + 'a>

Source§

fn call_mut(&mut self, m: M1) -> M2

Source§

impl<'a, M1: Monoid, M2: Monoid> HomOnce<M1> for Box<dyn Hom<M1, Output = M2> + 'a>

Source§

type Output = M2

Source§

fn call_once(self, m: M1) -> M2

Source§

impl<'a, M: 'a + Monoid> Monoid for Box<dyn Hom<M, Output = M> + 'a>

Monoid endomorphisms (homomorphisms where Output = Input) are themselves monoids under composition.

Source§

fn ident() -> Self

The identity element for combine.
Source§

fn combine(self, rhs: Self) -> Self

Combine an element with another element. This must obey Read more
Source§

fn combine_assign(&mut self, rhs: Self)

Like combine, but assigns the result to self. Read more
Source§

fn combine_assign_to(self, rhs: &mut Self)

Like combine, but assigns the result to rhs. Read more
Source§

fn combine_iter<I: Iterator<Item = Self>>(iter: I) -> Self

An overridable method to provide some optimization based on the fact that combine is associative.
Source§

fn combine_iter_assign<I: Iterator<Item = Self>>(&mut self, iter: I)

Like combine_iter, but assigns the result to self.

Implementations on Foreign Types§

Source§

impl<'a, M1: Monoid, M2: Monoid> Hom<M1> for Box<dyn Hom<M1, Output = M2> + 'a>

Source§

fn call(&self, m: M1) -> M2

Source§

impl<'a, M: Monoid, H: Hom<M>> Hom<M> for &'a H

Source§

fn call(&self, m: M) -> H::Output

Source§

impl<M1: Monoid, M2: Monoid, H1, H2> Hom<(M1, M2)> for (H1, H2)
where H1: Hom<M1>, H2: Hom<M2>,

See HomOnce for (H1, H2) for an explanation.

Source§

fn call(&self, (m1, m2): (M1, M2)) -> Self::Output

Source§

impl<M: Monoid> Hom<M> for ()

While this is a bit of an abuse of typing, the unit type here stands for the monoid homomorphism that just maps everything to the only possible output value.

Source§

fn call(&self, _m: M)

Implementors§

Source§

impl<'a, M: 'a + ?Sized + MonoidBorrowed<MonoidOwned: 'a> + ToOwned<Owned = M::MonoidOwned>> Hom<<M as PreMonoidBorrowed>::MonoidOwned> for CowFromOwned<'a, M>

Source§

impl<'a, M: 'a + ?Sized + MonoidBorrowed<MonoidOwned: 'a> + ToOwned<Owned = M::MonoidOwned>> Hom<Cow<'a, M>> for CowIntoOwned<'a, M>

Source§

impl<'a, M: ?Sized + MonoidBorrowed> Hom<<M as PreMonoidBorrowed>::MonoidOwned> for LCombineRef<'a, M>

Source§

impl<'a, M: ?Sized + MonoidBorrowed> Hom<<M as PreMonoidBorrowed>::MonoidOwned> for RCombineRef<'a, M>

Source§

impl<L: List, M: Monoid, F: Fn(L::Item) -> M> Hom<L> for ListHomFromFn<F>

Source§

impl<M1: Monoid, M2: Monoid, M3: Monoid, H1, H2> Hom<M1> for Chain<H1, H2>
where H1: Hom<M1, Output = M2>, H2: Hom<M2, Output = M3>,

Source§

impl<M, H: HomStaticBorrowed<M>> Hom<Graph<M, H>> for GraphInputClone
where M: Clone + Monoid,

Source§

impl<M: Monoid + Clone> Hom<M> for LCombine<M>

Source§

impl<M: Monoid + Clone> Hom<M> for RCombine<M>

Source§

impl<M: Monoid> Hom<()> for GetIdent<M>

Source§

impl<M: Monoid> Hom<M> for Id

Source§

impl<M: Monoid, H: HomStaticBorrowed<M>> Hom<Graph<M, H>> for GraphOutputClone
where H::Output: Clone,

Source§

impl<T, L1: List<Item = T>, L2: List<Item = T>> Hom<L1> for ListIsom<L2>