numera/number/integer/nnz/
family.rs1use super::{super::family::define_integer_family, *};
7use crate::number::traits::{
8 ConstLowerBounded, ConstOne, ConstUpperBounded, ConstZero, LowerBounded, NonNegative, One,
9 Positive, UpperBounded, Zero,
10};
11
12define_integer_family![build_variants:
13 NonNegativeIntegers, "The family of [non-negative integers][super], also known as [`Nnz`][super::Nnz].",
15 common:
16 NonNegativeInteger+8, NonNegativeInteger+16, NonNegativeInteger+32, NonNegativeInteger+64,
17 NonNegativeInteger+128
18 ;
19
20 depending:
21 Big, NonNegativeIntegerBig, "dashu-int-TODO" ];
23
24impl Positive for NonNegativeIntegers {}
29impl NonNegative for NonNegativeIntegers {}
30
31impl Zero for NonNegativeIntegers {
34 #[inline]
36 fn new_zero() -> Self {
37 NonNegativeInteger8::new_zero().into()
38 }
39}
40impl One for NonNegativeIntegers {
41 #[inline]
43 fn new_one() -> Self {
44 NonNegativeInteger8::new_one().into()
45 }
46}
47impl ConstZero for NonNegativeIntegers {
48 const ZERO: Self = NonNegativeIntegers::_8(NonNegativeInteger8::ZERO);
50}
51impl ConstOne for NonNegativeIntegers {
52 const ONE: Self = NonNegativeIntegers::_8(NonNegativeInteger8::ONE);
54}
55
56impl LowerBounded for NonNegativeIntegers {
59 #[inline]
61 fn new_min() -> Self {
62 NonNegativeInteger8::new_min().into()
63 }
64}
65impl UpperBounded for NonNegativeIntegers {
66 #[inline]
68 fn new_max() -> Self {
69 NonNegativeInteger128::new_max().into()
70 }
71}
72impl ConstLowerBounded for NonNegativeIntegers {
73 const MIN: Self = NonNegativeIntegers::_8(NonNegativeInteger8::MIN);
75}
76impl ConstUpperBounded for NonNegativeIntegers {
77 const MAX: Self = NonNegativeIntegers::_128(NonNegativeInteger128::MAX);
79}