nalgebra/nalgebra-glm/src/traits.rs

40 lines
766 B
Rust
Raw Normal View History

use approx::AbsDiffEq;
2021-08-08 18:59:40 +08:00
use num::{Bounded, Signed};
2021-04-11 17:00:38 +08:00
use na::Scalar;
2021-08-08 19:05:13 +08:00
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField};
use std::cmp::PartialOrd;
/// A number that can either be an integer or a float.
2018-10-22 04:11:27 +08:00
pub trait Number:
Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded
2018-10-22 04:11:27 +08:00
{
}
2020-03-21 19:16:46 +08:00
impl<
T: Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
2020-03-21 19:16:46 +08:00
+ AbsDiffEq<Epsilon = Self>
+ Signed
2021-08-08 19:05:13 +08:00
+ Bounded,
2020-03-21 19:16:46 +08:00
> Number for T
{
}
2021-08-08 18:59:40 +08:00
/// A number that can be any float type.
pub trait RealNumber: Number + RealField {}
impl<T: Number + RealField> RealNumber for T {}