ospf_rust_math/algebra/concept/signed.rs
1use std::ops::Neg;
2
3pub trait Signed {}
4
5impl<T> Signed for T where T: Neg<Output = T> {}
6
7pub trait Unsigned {}
8
9macro_rules! signed_template {
10 ($($type:ident)*) => ($(
11 impl Signed for $type { }
12 )*)
13}
14signed_template! { i8 i16 i32 i64 i128 isize f32 f64 }
15
16macro_rules! unsigned_template {
17 ($($type:ident)*) => ($(
18 impl Unsigned for $type { }
19 )*)
20}
21unsigned_template! { bool u8 u16 u32 u64 u128 usize }