1use crate::{error::NumeraResult, number::traits::*};
13
14pub type NoNumber = ();
19
20#[rustfmt::skip]
23impl Number for NoNumber {
24 type InnerRepr = NoNumber;
26 type InnermostRepr = NoNumber;
28 #[inline]
30 fn from_inner_repr(value: NoNumber) -> NumeraResult<Self> { Ok(value) }
31 #[inline]
33 #[cfg(not(feature = "safe"))]
34 #[cfg_attr(feature = "nightly", doc(cfg(feature = "not(safe)")))]
35 unsafe fn from_inner_repr_unchecked(value: NoNumber) -> Self { value }
36 #[inline]
38 fn try_from_inner_repr(_value: impl Into<Self::InnerRepr>) -> NumeraResult<Self> { Ok(()) }
39 #[inline]
41 fn from_innermost_repr(value: NoNumber) -> NumeraResult<Self> { Ok(value) }
42 #[inline]
44 #[cfg(not(feature = "safe"))]
45 #[cfg_attr(feature = "nightly", doc(cfg(feature = "not(safe)")))]
46 unsafe fn from_innermost_repr_unchecked(value: NoNumber) -> Self { value }
47 #[inline]
49 fn into_inner_repr(self) -> Self::InnerRepr { self }
50 #[inline]
52 fn into_innermost_repr(self) -> Self::InnermostRepr { self }
53}
54
55#[rustfmt::skip]
58impl Bound for NoNumber {
59 #[inline]
61 fn is_lower_bounded(&self) -> bool { true }
62 #[inline]
63 fn is_upper_bounded(&self) -> bool { true }
65 #[inline]
67 fn lower_bound(&self) -> Option<Self> { Some(()) }
68 #[inline]
70 fn upper_bound(&self) -> Option<Self> { Some(()) }
71}
72impl LowerBounded for NoNumber {
74 #[inline]
76 fn new_min() -> Self {}
77}
78impl UpperBounded for NoNumber {
79 #[inline]
81 fn new_max() -> Self {}
82}
83impl ConstLowerBounded for NoNumber {
86 const MIN: NoNumber = ();
88}
89impl ConstUpperBounded for NoNumber {
91 const MAX: NoNumber = ();
93}
94impl NonLowerBounded for NoNumber {}
96impl NonUpperBounded for NoNumber {}
97
98#[rustfmt::skip]
101impl Count for NoNumber {
102 #[inline]
103 fn is_countable(&self) -> bool { false }
104}
105#[rustfmt::skip]
106impl Countable for NoNumber {
107 #[inline]
109 fn next(&self) -> NumeraResult<Self> { Ok(()) }
110 #[inline]
112 fn previous(&self) -> NumeraResult<Self> { Ok(()) }
113}
114impl Uncountable for NoNumber {}
115
116#[rustfmt::skip]
119impl Ident for NoNumber {
120 #[inline]
122 fn can_zero(&self) -> bool { false }
123 #[inline]
125 fn can_one(&self) -> bool { false }
126 #[inline]
128 fn can_neg_one(&self) -> bool { false }
129 #[inline]
131 fn is_zero(&self) -> bool { false }
132 #[inline]
134 fn is_one(&self) -> bool { false }
135 #[inline]
137 fn is_neg_one(&self) -> bool { false }
138}
139impl NonZero for NoNumber {}
140impl ConstOne for NoNumber {
142 const ONE: NoNumber = ();
144}
145impl ConstZero for NoNumber {
147 const ZERO: NoNumber = ();
149}
150impl ConstNegOne for NoNumber {
152 const NEG_ONE: NoNumber = ();
154}
155impl One for NoNumber {
156 #[inline]
158 fn new_one() -> Self {}
159
160 #[inline]
162 fn set_one(&mut self) {}
163}
164impl Zero for NoNumber {
165 #[inline]
167 fn new_zero() -> Self {}
168
169 #[inline]
171 fn set_zero(&mut self) {}
172}
173impl NegOne for NoNumber {
174 #[inline]
176 fn new_neg_one() -> Self {}
177
178 #[inline]
180 fn set_neg_one(&mut self) {}
181}
182
183#[rustfmt::skip]
186impl Sign for NoNumber {
187 #[inline]
189 fn can_positive(&self) -> bool { false }
190 #[inline]
192 fn can_negative(&self) -> bool { false }
193 #[inline]
195 fn is_positive(&self) -> bool { false }
196 #[inline]
198 fn is_negative(&self) -> bool { false }
199}
200impl Positive for NoNumber {}
202impl Negative for NoNumber {}
203impl NonNegative for NoNumber {}
205#[rustfmt::skip]
206impl NonPositive for NoNumber {
207 type InnerRepr = NoNumber;
209 #[inline]
211 fn new_neg(value: Self::InnerRepr) -> NumeraResult<Self::InnerRepr> { Ok(value) }
212}