numera/number/integer/n0z/
family.rs1use super::{
7 super::family::define_integer_family, NonZeroInteger128, NonZeroInteger16, NonZeroInteger32,
8 NonZeroInteger64, NonZeroInteger8,
9};
10use crate::number::traits::{
11 ConstLowerBounded, ConstNegOne, ConstOne, ConstUpperBounded, LowerBounded, NegOne, Negative,
12 NonZero, One, Positive, UpperBounded,
13};
14
15define_integer_family![build_variants:
16 NonZeroIntegers, "The family of [non-zero integers][super], also known as [`N0z`][super::N0z].",
18 common:
19 NonZeroInteger+8, NonZeroInteger+16, NonZeroInteger+32, NonZeroInteger+64,
20 NonZeroInteger+128
21 ;
22
23 depending:
24 Big, NonZeroIntegerBig, "dashu-int-TODO" ];
26
27impl Positive for NonZeroIntegers {}
32impl Negative for NonZeroIntegers {}
33
34impl NonZero for NonZeroIntegers {}
37impl NegOne for NonZeroIntegers {
38 #[inline]
40 fn new_neg_one() -> Self {
41 NonZeroInteger8::new_neg_one().into()
42 }
43}
44impl One for NonZeroIntegers {
45 #[inline]
47 fn new_one() -> Self {
48 NonZeroInteger8::new_one().into()
49 }
50}
51impl ConstNegOne for NonZeroIntegers {
52 const NEG_ONE: Self = NonZeroIntegers::_8(NonZeroInteger8::NEG_ONE);
54}
55impl ConstOne for NonZeroIntegers {
56 const ONE: Self = NonZeroIntegers::_8(NonZeroInteger8::ONE);
58}
59
60impl LowerBounded for NonZeroIntegers {
63 #[inline]
65 fn new_min() -> Self {
66 NonZeroInteger8::new_min().into()
67 }
68}
69impl UpperBounded for NonZeroIntegers {
70 #[inline]
72 fn new_max() -> Self {
73 NonZeroInteger128::new_max().into()
74 }
75}
76impl ConstLowerBounded for NonZeroIntegers {
77 const MIN: Self = NonZeroIntegers::_128(NonZeroInteger128::MIN);
79}
80impl ConstUpperBounded for NonZeroIntegers {
81 const MAX: Self = NonZeroIntegers::_128(NonZeroInteger128::MAX);
83}