haar_lib/macros/
impl_one_zero.rs1#[macro_export]
5macro_rules! impl_one_zero {
6 ([$($bound:tt)*]; $t:ty; zero: $e:expr; $($rest:tt)*) => {
7 impl <$($bound)*> Zero for $t { fn zero() -> Self { $e } }
8 impl_one_zero!([$($bound)*]; $t; $($rest)*);
9 };
10 ([$($bound:tt)*]; $t:ty; one: $e:expr; $($rest:tt)*) => {
11 impl <$($bound)*> One for $t { fn one() -> Self { $e } }
12 impl_one_zero!([$($bound)*]; $t; $($rest)*);
13 };
14 ([$($bound:tt)*]; $t:ty;) => {};
15 ($t:ty; $($rest:tt)*) => {impl_one_zero!([]; $t; $($rest)*);};
16}