Trait Monoid

Source
pub trait Monoid: Semigroup + Identity {
    // Provided methods
    fn fold_m<I>(&self, iter: I) -> Self::Element
       where I: IntoIterator<Item = Self::Element> { ... }
    fn times(&self, a: Self::Element, n: u64) -> Self::Element
       where Self::Element: Clone { ... }
}
Expand description

モノイド

Provided Methods§

Source

fn fold_m<I>(&self, iter: I) -> Self::Element
where I: IntoIterator<Item = Self::Element>,

iterが空のとき、モノイドの単位元を返す。 そうでないとき、iterの中身を二項演算で畳み込んで返す。

Source

fn times(&self, a: Self::Element, n: u64) -> Self::Element
where Self::Element: Clone,

$\underbrace{a \circ a \circ \dots \circ a \circ a}_{n}$を計算する。

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§