pub trait Displacement<T: ?Sized> {
type Output;
// Required method
fn displace(&self, other: &T) -> Self::Output;
}Expand description
Trait for computing the displacement between two values.
§Examples
use physdes::generic::Displacement;
let a: i32 = 10;
let b: i32 = 5;
let displacement = a.displace(&b);
assert_eq!(displacement, 5);Required Associated Types§
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 Displacement<i32> for i32
Computes the displacement (difference) between two i32 values: self - other.
impl Displacement<i32> for i32
Computes the displacement (difference) between two i32 values: self - other.
$$d = a - b$$
§Examples
use physdes::generic::Displacement;
let a: i32 = 10;
let b: i32 = 5;
let displacement = a.displace(&b);
assert_eq!(displacement, 5);