Diff

Trait Diff 

Source
pub trait Diff {
    type Output: Ord;

    // Required method
    fn diff(&self, other: &Self) -> Self::Output;
}

Required Associated Types§

Source

type Output: Ord

The output of a diff calculation.

Required Methods§

Source

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

Return the difference between self and other, as a type that implements Ord for sorting.

use near_enough::Diff;
 
let a: u32 = 29;
let b: u32 = 12;
 
assert_eq!(a.diff(&b), 17);
assert_eq!(b.diff(&a), 17);

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.

Implementations on Foreign Types§

Source§

impl Diff for i8

Source§

type Output = u8

Source§

fn diff(&self, other: &Self) -> u8

Source§

impl Diff for i16

Source§

type Output = u16

Source§

fn diff(&self, other: &Self) -> u16

Source§

impl Diff for i32

Source§

type Output = u32

Source§

fn diff(&self, other: &Self) -> u32

Source§

impl Diff for i64

Source§

type Output = u64

Source§

fn diff(&self, other: &Self) -> u64

Source§

impl Diff for i128

Source§

type Output = u128

Source§

fn diff(&self, other: &Self) -> u128

Source§

impl Diff for isize

Source§

type Output = usize

Source§

fn diff(&self, other: &Self) -> usize

Source§

impl Diff for u8

Source§

type Output = u8

Source§

fn diff(&self, other: &Self) -> u8

Source§

impl Diff for u16

Source§

type Output = u16

Source§

fn diff(&self, other: &Self) -> u16

Source§

impl Diff for u32

Source§

type Output = u32

Source§

fn diff(&self, other: &Self) -> u32

Source§

impl Diff for u64

Source§

type Output = u64

Source§

fn diff(&self, other: &Self) -> u64

Source§

impl Diff for u128

Source§

type Output = u128

Source§

fn diff(&self, other: &Self) -> u128

Source§

impl Diff for usize

Source§

type Output = usize

Source§

fn diff(&self, other: &Self) -> usize

Implementors§