ColorDistance

Trait ColorDistance 

Source
pub trait ColorDistance {
    // Required method
    fn dist(&self, other: &Self) -> isize;
}
Expand description

A trait for calculating distance between colors

Required Methods§

Source

fn dist(&self, other: &Self) -> isize

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 ColorDistance for [u8]

Source§

fn dist(&self, other: &Self) -> isize

Calculates the distance between two colors

§Arguments
  • self - The first color
  • other - The second color
§Examples
use jmfm::ColorDistance;
let color1: [u8; 3] = [255, 0, 0];
let color2: [u8; 3] = [0, 255, 0];
assert_eq!(color1.dist(&color2), 195075);

Implementors§