makepad_draw/text/
num.rs

1pub trait Zero {
2    const ZERO: Self;
3}
4
5macro_rules! impl_zero {
6    ($T:ty, $ZERO:expr) => {
7        impl Zero for $T {
8            const ZERO: Self = $ZERO;
9        }
10    };
11}
12
13impl_zero!(usize, 0);
14impl_zero!(f32, 0.0);
15
16pub trait One {
17    const ONE: Self;
18}
19
20macro_rules! impl_one {
21    ($T:ty, $ONE:expr) => {
22        impl One for $T {
23            const ONE: Self = $ONE;
24        }
25    };
26}
27
28impl_one!(usize, 1);
29impl_one!(f32, 1.0);