Module opendp::traits [−][src]
Traits
Performs multiplication that returns none if overflowing.
Performs subtraction that returns none if overflowing.
A type that can be used as a stability or privacy constant to scale a distance. Encapsulates the necessary traits for the new_from_constant method on relations. Making a relation from a constant has the general form d_out >= QO::distance_cast(d_in) * c (where d_out and c have type QO: DistanceConstant) Computing this needs all of the traits DistanceConstant inherits from:
Fallible casting where the casted value is equal to the original value. Casting fails for any value not between Self::MIN_CONSECUTIVE and Self::MAX_CONSECUTIVE.
Fallible casting where the casted value rounds towards infinity. This preserves the invariant that the casted value is gte the original value. For example, casting a 128_u8 to i8 doesn’t saturate to i8::MAX (127), it errors.
A type that can be used as a measure distance.
A type that can be used as a metric distance.
Performs addition that saturates at the numeric bounds instead of overflowing.
TotalOrd is well-defined on types that are Ord on their non-null values. The framework provides a way to ensure values are non-null at runtime. This trait should only be used when the framework can rely on these assurances.