Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dependency num to num_traits to shrink dependency tree #76

Merged
merged 1 commit into from
Jan 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ named = []
strict = []

[dependencies]
num = "0.1"
num-traits = "0.1"
approx = "0.1"

[dependencies.phf]
Expand Down
2 changes: 1 addition & 1 deletion examples/readme_examples.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate image;
extern crate palette;
extern crate num;
extern crate num_traits;

use image::{RgbImage, GenericImage};

Expand Down
4 changes: 2 additions & 2 deletions src/alpha.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ops::{Deref, DerefMut, Add, Sub, Mul, Div};

use num::Float;
use num_traits::Float;

use approx::ApproxEq;

Expand Down Expand Up @@ -34,7 +34,7 @@ impl<C, T: Float> DerefMut for Alpha<C, T> {

impl<C: Mix> Mix for Alpha<C, C::Scalar> {
type Scalar = C::Scalar;

fn mix(&self, other: &Alpha<C, C::Scalar>, factor: C::Scalar) -> Alpha<C, C::Scalar> {
Alpha {
color: self.color.mix(&other.color, factor),
Expand Down
2 changes: 1 addition & 1 deletion src/blend/blend.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::{Float, One, Zero};
use num_traits::{Float, One, Zero};

use {ComponentWise, clamp, flt};
use blend::{PreAlpha, BlendFunction};
Expand Down
2 changes: 1 addition & 1 deletion src/blend/equations.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use {ComponentWise, Blend};
use blend::{PreAlpha, BlendFunction};
Expand Down
4 changes: 2 additions & 2 deletions src/blend/pre_alpha.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ops::{Add, Sub, Mul, Div, Deref, DerefMut};
use approx::ApproxEq;
use num::Float;
use num_traits::Float;

use {Alpha, ComponentWise, Mix, Blend, clamp};

Expand Down Expand Up @@ -86,7 +86,7 @@ impl<C, T> Blend for PreAlpha<C, T> where

impl<C: Mix> Mix for PreAlpha<C, C::Scalar> {
type Scalar = C::Scalar;

fn mix(&self, other: &PreAlpha<C, C::Scalar>, factor: C::Scalar) -> PreAlpha<C, C::Scalar> {
PreAlpha {
color: self.color.mix(&other.color, factor),
Expand Down
2 changes: 1 addition & 1 deletion src/chromatic_adaptation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!//Should print {x: 0.257963, y: 0.139776,z: 0.058825}
//!println!("{:?}", c)
//!```
use num::Float;
use num_traits::Float;

use {Xyz, FromColor, IntoColor, flt};
use white_point::WhitePoint;
Expand Down
2 changes: 1 addition & 1 deletion src/convert.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use {Alpha, Rgb, Luma, Xyz, Yxy, Lab, Lch, Hsv, Hwb, Hsl, Color};
use white_point::{WhitePoint, D65};
Expand Down
2 changes: 1 addition & 1 deletion src/equality.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;
use approx::ApproxEq;

use {Xyz, Yxy, Lab, Lch, Rgb, Hsl, Hsv, Hwb, Luma, LabHue, RgbHue, flt};
Expand Down
2 changes: 1 addition & 1 deletion src/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//!Types for interpolation between multiple colors.

use num::{Float, One, Zero};
use num_traits::{Float, One, Zero};
use std::cmp::max;
use approx::ApproxEq;

Expand Down
2 changes: 1 addition & 1 deletion src/hsl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/hsv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/hues.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::f64::consts::PI;
use std::cmp::PartialEq;
Expand Down
2 changes: 1 addition & 1 deletion src/hwb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/lab.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub, Mul, Div};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/lch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub};
use std::marker::PhantomData;
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
#[cfg_attr(test, macro_use)]
extern crate approx;

extern crate num;
extern crate num_traits;

#[cfg(feature = "phf")]
extern crate phf;

use num::{Float, ToPrimitive, NumCast};
use num_traits::{Float, ToPrimitive, NumCast};

use approx::ApproxEq;

Expand Down Expand Up @@ -692,6 +692,6 @@ pub trait ComponentWise {
}

///A convenience function to convert a constant number to Float Type
fn flt<T: num::Float, P: ToPrimitive>(prim: P) -> T {
fn flt<T: num_traits::Float, P: ToPrimitive>(prim: P) -> T {
NumCast::from(prim).unwrap()
}
2 changes: 1 addition & 1 deletion src/luma.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub, Mul, Div};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//!This module provides simple matrix operations on 3x3 matrix to aid in chromatic adaptation and
//!conversion calculations.

use num::Float;
use num_traits::Float;

use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion src/pixel/gamma_rgb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion src/pixel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//!Pixel encodings and pixel format conversion.

use num::Float;
use num_traits::Float;

use {clamp, flt};

Expand Down
2 changes: 1 addition & 1 deletion src/pixel/srgb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion src/rgb.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub, Mul, Div};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/rgb_primaries.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//!This module defines the red, blue and green primaries for the common Rgb color spaces
use num::Float;
use num_traits::Float;


use {Yxy, Xyz, Rgb, IntoColor};
Expand Down
4 changes: 2 additions & 2 deletions src/white_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//!unacceptable results when attempting to color-correct a photograph taken with incandescent lighting.


use num::Float;
use num_traits::Float;

use {Xyz, flt};

Expand All @@ -17,7 +17,7 @@ use {Xyz, flt};
///"white" in image capture, encoding, or reproduction.
///
///Custom white points can be easily defined on an empty struct with the tristimulus values
///and can be used in place of the ones defined in this library.
///and can be used in place of the ones defined in this library.
pub trait WhitePoint<T: Float>: Sized {
///Get the Xyz chromacity co-ordinates for the white point.
fn get_xyz() -> Xyz<Self, T>;
Expand Down
2 changes: 1 addition & 1 deletion src/xyz.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub, Mul, Div};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion src/yxy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use num::Float;
use num_traits::Float;

use std::ops::{Add, Sub, Mul, Div};
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion tests/color_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extern crate approx;
#[macro_use]
extern crate lazy_static;
extern crate num;
extern crate num_traits;
#[macro_use]
extern crate serde_derive;
extern crate serde;
Expand Down
2 changes: 1 addition & 1 deletion tests/pointer_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extern crate approx;
#[macro_use]
extern crate lazy_static;
extern crate num;
extern crate num_traits;
#[macro_use]
extern crate serde_derive;
extern crate serde;
Expand Down
2 changes: 1 addition & 1 deletion tests/pointer_dataset/pointer_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ u', v' 0.2008907213 0.4608888395
Note: The xyz and yxy conversions do not use the updated conversion formula. So they are not used.
*/

use num::{Float, ToPrimitive, NumCast};
use num_traits::{Float, ToPrimitive, NumCast};
use csv;
use palette::{Xyz, Lch, Lab, IntoColor};
use palette::white_point::WhitePoint;
Expand Down