pub trait MinDist<T> {
// Required method
fn min_dist_with(&self, other: &T) -> u32;
}Expand description
Trait for calculating the minimum distance between two values.
§Examples
use physdes::generic::MinDist;
let a: i32 = 10;
let b: i32 = 5;
let distance = a.min_dist_with(&b);
assert_eq!(distance, 5);Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl MinDist<i32> for i32
Computes the absolute difference between two i32 values.
impl MinDist<i32> for i32
Computes the absolute difference between two i32 values.
$$d = |a - b|$$
§Examples
use physdes::generic::MinDist;
let a: i32 = 10;
let b: i32 = 5;
let distance = a.min_dist_with(&b);
assert_eq!(distance, 5);Source§fn min_dist_with(&self, other: &i32) -> u32
fn min_dist_with(&self, other: &i32) -> u32
Minimum distance between two scalars is the absolute difference:
$$d = |a - b|$$