🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

deltae

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deltae - cargo Package Compare versions

Comparing version
0.3.1
to
0.3.2
+1
-1
.cargo_vcs_info.json
{
"git": {
"sha1": "5f8547d6b85d2c6f8a981fbe7b25c29c387f45df"
"sha1": "3caea55fe378157802187cf66d07169aa5f1c06e"
},
"path_in_vcs": ""
}
+249
-63

@@ -6,45 +6,99 @@ # This file is automatically @generated by Cargo.

[[package]]
name = "ansi_term"
version = "0.11.0"
name = "anstream"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f"
dependencies = [
"winapi",
"anstyle",
"anstyle-parse",
"anstyle-wincon",
"concolor-override",
"concolor-query",
"is-terminal",
"utf8parse",
]
[[package]]
name = "atty"
version = "0.2.11"
name = "anstyle"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2"
[[package]]
name = "anstyle-parse"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116"
dependencies = [
"libc",
"termion",
"winapi",
"utf8parse",
]
[[package]]
name = "anstyle-wincon"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa"
dependencies = [
"anstyle",
"windows-sys 0.45.0",
]
[[package]]
name = "bitflags"
version = "1.0.4"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "clap"
version = "2.33.0"
version = "4.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3"
dependencies = [
"ansi_term",
"atty",
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"clap_lex",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "clap_lex"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
[[package]]
name = "concolor-override"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f"
[[package]]
name = "concolor-query"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf"
dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "deltae"
version = "0.3.1"
version = "0.3.2"
dependencies = [

@@ -55,87 +109,219 @@ "clap",

[[package]]
name = "libc"
version = "0.2.51"
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "numtoa"
version = "0.1.0"
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "redox_syscall"
version = "0.1.54"
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "redox_termios"
version = "0.1.1"
name = "io-lifetimes"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [
"redox_syscall",
"hermit-abi",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "strsim"
version = "0.8.0"
name = "is-terminal"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys 0.48.0",
]
[[package]]
name = "termion"
version = "1.5.2"
name = "libc"
version = "0.2.141"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea"
checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
[[package]]
name = "linux-raw-sys"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
[[package]]
name = "rustix"
version = "0.37.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"numtoa",
"redox_syscall",
"redox_termios",
"linux-raw-sys",
"windows-sys 0.48.0",
]
[[package]]
name = "textwrap"
version = "0.11.0"
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"unicode-width",
"windows-targets 0.42.2",
]
[[package]]
name = "unicode-width"
version = "0.1.5"
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.0",
]
[[package]]
name = "vec_map"
version = "0.8.1"
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "winapi"
version = "0.3.7"
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
"windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.0",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

@@ -15,3 +15,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "deltae"
version = "0.3.1"
version = "0.3.2"
authors = ["Ryan O'Beirne <ryanobeirne@ryanobeirne.com>"]

@@ -26,2 +26,2 @@ description = "Calculate Delta E between two colors in CIE Lab space."

[dev-dependencies.clap]
version = "2.32.0"
version = "4.2.1"

@@ -1,29 +0,33 @@

use clap::{App, Arg, crate_version, crate_description, crate_authors};
use clap::{Command, Arg, ArgAction};
use deltae::DEMethod;
use std::str::FromStr;
pub fn app() -> App<'static, 'static> {
App::new("deltae")
.version(crate_version!())
.about(crate_description!())
.author(crate_authors!())
.arg(Arg::with_name("METHOD")
pub fn command() -> Command {
Command::new("deltae")
.version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.author(env!("CARGO_PKG_AUTHORS"))
.arg(Arg::new("METHOD")
.help("Set DeltaE method")
.long("method")
.short("m")
.possible_values(&["2000", "1994", "1994T", "CMC1", "CMC2", "1976"])
.case_insensitive(true)
.short('m')
.value_parser(DEMethod::from_str)
.ignore_case(true)
.default_value("2000")
.takes_value(true))
.arg(Arg::with_name("COLOR0")
.action(ArgAction::Set))
.arg(Arg::new("REFERENCE")
.help("Reference color values")
.required(true))
.arg(Arg::with_name("COLOR1")
.arg(Arg::new("SAMPLE")
.help("Sample color values")
.required(true))
.arg(Arg::with_name("COLORTYPE")
.arg(Arg::new("COLORTYPE")
.help("Set color type")
.short("c")
.short('c')
.long("color-type")
.aliases(&["color", "type"])
.aliases(["color", "type"])
.default_value("lab")
.possible_values(&["lab", "lch", "xyz"]))
.value_names(["lab", "lch", "xyz"])
.ignore_case(true)
.action(ArgAction::Set))
}
use deltae::*;
use std::error::Error;
use std::str::FromStr;

@@ -9,13 +8,13 @@ mod cli;

//Parse command line arguments with clap
let matches = cli::app().get_matches();
let matches = cli::command().get_matches();
let method = DEMethod::from_str(matches.value_of("METHOD").unwrap())?;
let color_type = matches.value_of("COLORTYPE").unwrap();
let color0 = matches.value_of("COLOR0").unwrap();
let color1 = matches.value_of("COLOR1").unwrap();
let method = matches.get_one::<DEMethod>("METHOD").unwrap().to_owned();
let color_type = matches.get_one::<String>("COLORTYPE").unwrap();
let color0 = matches.get_one::<String>("REFERENCE").unwrap();
let color1 = matches.get_one::<String>("SAMPLE").unwrap();
let delta = match color_type {
"lab" => LabValue::from_str(color0)?.delta(LabValue::from_str(color1)?, method),
"lch" => LchValue::from_str(color0)?.delta(LchValue::from_str(color1)?, method),
"xyz" => XyzValue::from_str(color0)?.delta(XyzValue::from_str(color1)?, method),
let delta = match color_type.as_str() {
"lab" => color0.parse::<LabValue>()?.delta(color1.parse::<LabValue>()?, method),
"lch" => color0.parse::<LchValue>()?.delta(color1.parse::<LchValue>()?, method),
"xyz" => color0.parse::<XyzValue>()?.delta(color1.parse::<XyzValue>()?, method),
_ => unreachable!("COLORTYPE"),

@@ -22,0 +21,0 @@ };

@@ -33,3 +33,3 @@ use std::error::Error;

// Calculate DeltaE between two lab values
let de0 = DeltaE::new(&lab0, &lab1, DE2000);
let de0 = DeltaE::new(lab0, lab1, DE2000);
// Use the Delta trait

@@ -43,4 +43,4 @@ let de1 = lab0.delta(lab1, DE2000);

// If DE2000 is less than 1.0, the colors are considered equivalent
assert!(lch0.delta_eq(&lab0, DE2000, 1.0));
assert!(xyz0.delta_eq(&lab1, DE2000, 1.0));
assert!(lch0.delta_eq(lab0, DE2000, 1.0));
assert!(xyz0.delta_eq(lab1, DE2000, 1.0));

@@ -47,0 +47,0 @@ // Calculate DeltaE between different color types

@@ -58,3 +58,3 @@ # deltae

// Calculate DeltaE between two lab values
let de0 = DeltaE::new(&lab0, &lab1, DE2000);
let de0 = DeltaE::new(lab0, lab1, DE2000);
// Use the Delta trait

@@ -68,4 +68,4 @@ let de1 = lab0.delta(lab1, DE2000);

// If DE2000 is less than 1.0, the colors are considered equivalent
assert!(lch0.delta_eq(&lab0, DE2000, 1.0));
assert!(xyz0.delta_eq(&lab1, DE2000, 1.0));
assert!(lch0.delta_eq(lab0, DE2000, 1.0));
assert!(xyz0.delta_eq(lab1, DE2000, 1.0));

@@ -72,0 +72,0 @@ // Calculate DeltaE between different color types

use super::*;
use std::convert::TryFrom;
use std::error::Error;
use std::num::ParseFloatError;
use std::str::FromStr;

@@ -226,13 +228,65 @@

impl FromStr for DEMethod {
type Err = std::io::Error;
type Err = ParseDEMethodError;
fn from_str(s: &str) -> Result<DEMethod, Self::Err> {
match s.to_lowercase().trim() {
"de2000" | "de00" | "2000" | "00" => Ok(DEMethod::DE2000),
"de1976" | "de76" | "1976" | "76" => Ok(DEMethod::DE1976),
Ok(match s.to_lowercase().trim() {
"de2000" | "de00" | "2000" | "00" => DEMethod::DE2000,
"de1976" | "de76" | "1976" | "76" => DEMethod::DE1976,
"de1994" | "de94" | "1994" | "94" |
"de1994g" | "de94g" | "1994g" | "94g" => Ok(DEMethod::DE1994G),
"de1994t" | "de94t" | "1994t" | "94t" => Ok(DEMethod::DE1994T),
"decmc" | "decmc1"| "cmc1" | "cmc" => Ok(DEMethod::DECMC(1.0, 1.0)),
"decmc2" | "cmc2" => Ok(DEMethod::DECMC(2.0, 1.0)),
_ => Err(io::Error::from(io::ErrorKind::InvalidInput)),
"de1994g" | "de94g" | "1994g" | "94g" => DEMethod::DE1994G,
"de1994t" | "de94t" | "1994t" | "94t" => DEMethod::DE1994T,
"decmc" | "decmc1"| "cmc1" | "cmc" => DEMethod::DECMC(1.0, 1.0),
"decmc2" | "cmc2" => DEMethod::DECMC(2.0, 1.0),
method => if method.contains("cmc") {
let mut split = method
.split('c')
.nth(2)
.ok_or(Self::Err::Other)?
.split(':')
.map(|word| word.replace(['(', ')'], ""));
let tl = split.next()
.ok_or(Self::Err::MissingTlValue)?
.parse()
.map_err(Self::Err::InvalidValue)?;
let tc = split.next()
.ok_or(Self::Err::MissingTcValue)?
.parse()
.map_err(Self::Err::InvalidValue)?;
DECMC(tl, tc)
} else {
return Err(Self::Err::Other);
}
})
}
}
#[test]
fn parse_cmc_method() {
let cmc_methods = [
"decmc", "decmc1", "decmc2", "cmc1", "cmc2", "cmc", "cmc1:1", "cmc2:1",
"cmc(2.0:2.0)", "cmc(1:2)", "cmc(1.5:2.5)",
];
for i in cmc_methods {
let method = i.parse().unwrap();
matches!(method, DEMethod::DECMC(_,_));
}
}
#[derive(Debug)]
pub enum ParseDEMethodError {
MissingTlValue,
MissingTcValue,
InvalidValue(ParseFloatError),
Other,
}
impl Error for ParseDEMethodError {}
impl fmt::Display for ParseDEMethodError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MissingTlValue => write!(f, "CMC missing lightness tolerance"),
Self::MissingTcValue => write!(f, "CMC missing chroma tolerance"),
Self::InvalidValue(e) => write!(f, "invalid value: {e}"),
Self::Other => write!(f, "unable to parse DEMethod"),
}

@@ -239,0 +293,0 @@ }

@@ -99,3 +99,3 @@ //! ## `Tolerance` and `DeltaEq` traits

/// Convenience macro for asserting two values are equivalent within a tolerance
/// Convenience macro for asserting two values are not equivalent within a tolerance
/// ```

@@ -102,0 +102,0 @@ /// use deltae::*;

@@ -40,3 +40,3 @@ #![warn(missing_docs)]

//! // Calculate DeltaE between two lab values
//! let de0 = DeltaE::new(&lab0, &lab1, DE2000);
//! let de0 = DeltaE::new(lab0, lab1, DE2000);
//! // Use the Delta trait

@@ -50,4 +50,4 @@ //! let de1 = lab0.delta(lab1, DE2000);

//! // If DE2000 is less than 1.0, the colors are considered equivalent
//! assert!(lch0.delta_eq(&lab0, DE2000, 1.0));
//! assert!(xyz0.delta_eq(&lab1, DE2000, 1.0));
//! assert!(lch0.delta_eq(lab0, DE2000, 1.0));
//! assert!(xyz0.delta_eq(lab1, DE2000, 1.0));
//!

@@ -96,3 +96,2 @@ //! // Calculate DeltaE between different color types

use std::fmt;
use std::io;

@@ -201,5 +200,6 @@ pub(crate) type ValueResult<T> = Result<T, color::ValueError>;

/// The most common DeltaE methods
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Clone, Copy, Default)]
pub enum DEMethod{
/// The default DeltaE method
/// The defacto standard DeltaE method, weighted to account for human color vision tolerances
#[default]
DE2000,

@@ -228,8 +228,2 @@ /// An implementation of DeltaE with separate tolerances for Lightness and Chroma

impl Default for DEMethod {
fn default() -> DEMethod {
DEMethod::DE2000
}
}
impl fmt::Display for DEMethod {

@@ -236,0 +230,0 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

@@ -56,3 +56,3 @@ use super::*;

fn round() {
let val = 1.234567890;
let val = 1.2345679;
let rnd = round::round_to(val, 4);

@@ -59,0 +59,0 @@ assert_eq!(rnd, 1.2346);

use super::*;
use color::{LabValue, LchValue, XyzValue};
use std::convert::TryFrom;
use std::str::FromStr;

@@ -58,3 +57,3 @@ #[test]

for i in good {
assert!(LabValue::from_str(i).is_ok());
assert!(i.parse::<LabValue>().is_ok());
}

@@ -76,3 +75,3 @@

for i in bad {
assert!(LabValue::from_str(i).is_err());
assert!(i.parse::<LabValue>().is_err());
}

@@ -92,3 +91,3 @@ }

for i in good {
assert!(LchValue::from_str(i).is_ok());
assert!(i.parse::<LchValue>().is_ok());
}

@@ -111,3 +110,3 @@

for i in bad {
assert!(LchValue::from_str(i).is_err());
assert!(i.parse::<LchValue>().is_err());
}

@@ -125,3 +124,3 @@ }

for i in good {
assert!(XyzValue::from_str(i).is_ok());
assert!(i.parse::<XyzValue>().is_ok());
}

@@ -139,3 +138,3 @@

for i in bad {
assert!(XyzValue::from_str(i).is_err());
assert!(i.parse::<XyzValue>().is_err());
}

@@ -142,0 +141,0 @@ }

name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

Sorry, the diff of this file is not supported yet