Skip to main content

MulSemigroup

Trait MulSemigroup 

Source
pub trait MulSemigroup:
    Mul<Output = Self>
    + Associative
    + Clone { }
Expand description

Represents a Multiplicative Semigroup.

A semigroup is an algebraic structure with a single associative binary operation. Unlike a monoid, a semigroup does NOT require an identity element.

§Mathematical Definition

A set S with a binary operation * is a multiplicative semigroup if:

  1. Closure: a * b is in S for all a, b in S. (Implicit in Rust).
  2. Associativity: (a * b) * c = a * (b * c) for all a, b, c in S.

§Hierarchy

Magma (closure only)
  ↓
Semigroup (+ associativity)
  ↓
Monoid (+ identity)

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<T> MulSemigroup for T
where T: Mul<Output = Self> + Associative + Clone,