Skip to main content

Displacement

Trait Displacement 

Source
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§

Source

fn displace(&self, other: &T) -> Self::Output

Displace the current value by the provided other value.

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.

$$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);
Source§

fn displace(&self, other: &i32) -> Self::Output

Displacement (difference) between two scalars:

$$d = a - b$$

Source§

type Output = i32

Implementors§

Source§

impl<T1, T2> Displacement<Point<T1, T2>> for Point<T1, T2>
where T1: Displacement<T1, Output = T1>, T2: Displacement<T2, Output = T2>,

Source§

type Output = Vector2<T1, T2>

Source§

impl<T> Displacement<Interval<T>> for Interval<T>
where T: Displacement<T, Output = T>,