pub trait AddMon:
MathType
+ Zero
+ AddMonOps
+ AddAssign
+ for<'a> AddAssign<&'a Self>where
for<'a> &'a Self: AddMonOps<Self>,{
// Provided method
fn sum<A, I>(itr: I) -> Self
where Self: AddAssign<A>,
I: IntoIterator<Item = A> { ... }
}Expand description
An additive monoid: a set with associative, commutative addition + and identity Zero.
See: https://en.wikipedia.org/wiki/Monoid, https://en.wikipedia.org/wiki/Commutative_monoid
Provided Methods§
Sourcefn sum<A, I>(itr: I) -> Selfwhere
Self: AddAssign<A>,
I: IntoIterator<Item = A>,
fn sum<A, I>(itr: I) -> Selfwhere
Self: AddAssign<A>,
I: IntoIterator<Item = A>,
Sum an iterator into Self, folding with +=.
A is any type for which Self: AddAssign<A> — typically Self or &Self.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".