nalgebra/nalgebra-glm/src/traits.rs
2021-08-08 13:05:13 +02:00

40 lines
766 B
Rust

use approx::AbsDiffEq;
use num::{Bounded, Signed};
use na::Scalar;
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField};
use std::cmp::PartialOrd;
/// A number that can either be an integer or a float.
pub trait Number:
Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded
{
}
impl<
T: Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded,
> Number for T
{
}
/// A number that can be any float type.
pub trait RealNumber: Number + RealField {}
impl<T: Number + RealField> RealNumber for T {}