pub trait ConstAbsDiff:
Sized
+ Ord
+ Sub<Output = Self> {
// Required method
fn abs_diff(self, other: Self) -> Self;
}Expand description
Const-compatible absolute difference.
Computes the absolute difference between two values. For unsigned types,
this is max(a, b) - min(a, b).
§Unsigned types only
This trait is designed for unsigned integer types where abs_diff cannot
overflow. Implementors for signed types must ensure overflow is handled
correctly (e.g., by returning an unsigned result type or using checked
arithmetic), as the trait bounds do not enforce this.
Required Methods§
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.