lighthouse_protocol/utils/
unity.rs1pub trait Unity {
3 const ONE: Self;
5 const NEG_ONE: Self;
7}
8
9macro_rules! impl_int_unity {
10 ($($tys:ty),*) => {
11 $(impl Unity for $tys {
12 const ONE: Self = 1;
13 const NEG_ONE: Self = -1;
14 })*
15 };
16}
17
18macro_rules! impl_float_unity {
19 ($($tys:ty),*) => {
20 $(impl Unity for $tys {
21 const ONE: Self = 1.0;
22 const NEG_ONE: Self = -1.0;
23 })*
24 };
25}
26
27impl_int_unity!(
28 i8, i16, i32, i64, i128, isize
29);
30
31impl_float_unity!(
32 f32, f64
33);