pub trait AddSemigroup:
Add<Output = Self>
+ Associative
+ Clone { }Expand description
Represents an Additive 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 an additive semigroup if:
- Closure:
a + bis inSfor alla, binS. (Implicit in Rust). - Associativity:
(a + b) + c = a + (b + c)for alla, b, cinS.
§Examples
- Positive integers under addition (no zero identity).
- Non-empty strings under concatenation.
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.