1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use num_traits::{FromPrimitive, Num, NumAssign};

/// Required traits a number type must implement to be used with [simplify](crate::simplify).
pub trait ExtendedNumOps: Num + Clone + Copy + NumAssign + PartialOrd + FromPrimitive {}

macro_rules! impl_extended_num_ops {
    ($T:ty) => {
        impl ExtendedNumOps for $T {}
    };
}

impl_extended_num_ops!(isize);
impl_extended_num_ops!(i8);
impl_extended_num_ops!(i16);
impl_extended_num_ops!(i32);
impl_extended_num_ops!(i64);
impl_extended_num_ops!(usize);
impl_extended_num_ops!(u8);
impl_extended_num_ops!(u16);
impl_extended_num_ops!(u32);
impl_extended_num_ops!(u64);
impl_extended_num_ops!(f32);
impl_extended_num_ops!(f64);