Trait quantette::SumPromotion
source · pub trait SumPromotion<Count>: Copy + Into<Self::Sum> + 'static{
type Sum: Zero + NumOps + NumAssignOps + AsPrimitive<Self>;
}Expand description
A numerical trait used to prevent overflow when summing any Count number of Selfs.
That is, the Sum type needs to be able to represent the value Count::MAX * Self::MAX without overflowing.
For floating point types, this constraint is relaxed,
and the Sum type simply needs to have more precision (if possible).
Required Associated Types§
sourcetype Sum: Zero + NumOps + NumAssignOps + AsPrimitive<Self>
type Sum: Zero + NumOps + NumAssignOps + AsPrimitive<Self>
The promotion type used for the sum.
For integral types, this needs to be able to represent the value
Count::MAX * Self::MAX without overflowing.
Object Safety§
This trait is not object safe.