number_types/
macros.rs

1#[macro_export]
2macro_rules! assert_types_eq {
3    ($a:ty, $b:ty) => {{
4        let _: ::std::marker::PhantomData<$a> = ::std::marker::PhantomData::<$b>;
5    }};
6}
7
8#[macro_export]
9macro_rules! type_expr {
10    (<$a:ty> + <$b:ty>) => {
11        <Op<$a, $b> as AddOp>::Output
12    };
13    (<$a:ty> * <$b:ty>) => {
14        <Op<$a, $b> as MulOp>::Output
15    };
16    (<$a:ty> - <$b:ty>) => {
17        <Op<$a, $b> as SubOp>::Output
18    };
19    (<$a:ty> + $($b:tt)+) => {
20        <Op<$a, type_expr!($($b)+)> as AddOp>::Output
21    };
22    (<$a:ty> * $($b:tt)+) => {
23        <Op<$a, type_expr!($($b)+)> as MulOp>::Output
24    };
25    (<$a:ty> - $($b:tt)+) => {
26        <Op<$a, type_expr!($($b)+)> as SubOp>::Output
27    };
28}