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