Skip to content

Commit

Permalink
Depend on num-traits instead of num.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 23, 2024
1 parent 9cd8e88 commit 095df09
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ultraviolet = ["dep:ultraviolet"]
approx = "^0.5.0"
decorum = "^0.4.0"
itertools = "^0.13.0"
num = "^0.4.0"
num-traits = "^0.2.19"
typenum = "^1.17.0"

# Integrations.
Expand Down
3 changes: 2 additions & 1 deletion src/adjunct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
//! `nalgebra` types when the `nalgebra` feature is enabled.
use decorum::cmp::{self, EmptyOrd};
use num::traits::{Bounded, One, Zero};
use num_traits::bounds::Bounded;
use num_traits::identities::{One, Zero};
use std::ops::{Add, Mul};

pub trait Adjunct: Sized {
Expand Down
5 changes: 3 additions & 2 deletions src/integration/cgmath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
use approx::AbsDiffEq;
use cgmath::{BaseFloat, BaseNum, Point2, Point3, Vector2, Vector3, Vector4};
use decorum::R64;
use num::traits::real::Real;
use num::traits::{Num, NumCast};
use num_traits::cast::NumCast;
use num_traits::real::Real;
use num_traits::Num;
use typenum::consts::{U2, U3, U4};

use crate::adjunct::{
Expand Down
4 changes: 3 additions & 1 deletion src/integration/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

use decorum::R64;
use mint::{Point2, Point3, Vector2, Vector3};
use num::traits::{Num, NumCast, One, Zero};
use num_traits::cast::NumCast;
use num_traits::identities::{One, Zero};
use num_traits::Num;
use std::ops::Neg;
use typenum::{U2, U3};

Expand Down
6 changes: 4 additions & 2 deletions src/integration/nalgebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ use nalgebra::base::{
Matrix2, Matrix3, OMatrix, OVector, RowVector2, RowVector3, Scalar, Vector2, Vector3, Vector4,
};
use nalgebra::geometry::{OPoint, Point2, Point3};
use num::traits::real::Real;
use num::traits::{Num, NumCast, One, Zero};
use num_traits::cast::NumCast;
use num_traits::identities::{One, Zero};
use num_traits::real::Real;
use num_traits::Num;
use std::ops::{AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use typenum::NonZero;

Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pub mod space;
mod integration;

use decorum::R64;
use num::traits::{Num, NumCast, One, Zero};
use num_traits::cast::NumCast;
use num_traits::identities::{One, Zero};
use num_traits::Num;

use crate::space::EuclideanSpace;

Expand Down Expand Up @@ -161,7 +163,7 @@ pub fn lerp<T>(a: T, b: T, f: R64) -> T
where
T: Num + NumCast,
{
let f = num::clamp(f, Zero::zero(), One::one());
let f = num_traits::clamp(f, Zero::zero(), One::one());
let af = <R64 as NumCast>::from(a).unwrap() * (R64::one() - f);
let bf = <R64 as NumCast>::from(b).unwrap() * f;
<T as NumCast>::from(af + bf).unwrap()
Expand Down
6 changes: 4 additions & 2 deletions src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
use approx::abs_diff_eq;
use decorum::cmp::EmptyOrd;
use decorum::InfinityEncoding;
use num::traits::real::Real;
use num::traits::{Bounded, Signed, Zero};
use num_traits::bounds::Bounded;
use num_traits::identities::Zero;
use num_traits::real::Real;
use num_traits::sign::Signed;
use std::fmt::{self, Debug, Formatter};
use std::ops::Neg;
use typenum::type_operators::Cmp;
Expand Down
5 changes: 3 additions & 2 deletions src/space.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! Vector and affine spaces.
use approx::AbsDiffEq;
use num::traits::real::Real;
use num::traits::{NumCast, One, Zero};
use num_traits::cast::NumCast;
use num_traits::identities::{One, Zero};
use num_traits::real::Real;
use std::ops::{Add, Mul, Neg, Sub};
use typenum::consts::{U0, U1, U2, U3};
use typenum::type_operators::Cmp;
Expand Down

0 comments on commit 095df09

Please sign in to comment.