|
3 | 3 | use super::{is_highest_bit_set, uint, value_cmp}; |
4 | 4 | use crate::{ |
5 | 5 | AnyRef, BytesRef, DecodeValue, EncodeValue, Error, ErrorKind, FixedTag, Header, Length, Reader, |
6 | | - Result, Tag, ValueOrd, Writer, ord::OrdIsValueOrd, |
| 6 | + Result, Tag, ValueOrd, Writer, asn1::integer::IntLike, ord::OrdIsValueOrd, |
7 | 7 | }; |
8 | 8 | use core::cmp::Ordering; |
9 | 9 |
|
@@ -180,13 +180,19 @@ impl FixedTag for IntRef<'_> { |
180 | 180 |
|
181 | 181 | impl OrdIsValueOrd for IntRef<'_> {} |
182 | 182 |
|
| 183 | +impl IntLike for IntRef<'_> { |
| 184 | + fn as_int_bytes(&self) -> &[u8] { |
| 185 | + self.inner.as_slice() |
| 186 | + } |
| 187 | +} |
| 188 | + |
183 | 189 | #[cfg(feature = "alloc")] |
184 | 190 | mod allocating { |
185 | 191 | use super::{IntRef, strip_leading_ones, validate_canonical}; |
186 | 192 | use crate::{ |
187 | 193 | BytesOwned, DecodeValue, EncodeValue, Error, ErrorKind, FixedTag, Header, Length, Reader, |
188 | 194 | Result, Tag, Writer, |
189 | | - asn1::Uint, |
| 195 | + asn1::{Uint, integer::IntLike}, |
190 | 196 | ord::OrdIsValueOrd, |
191 | 197 | referenced::{OwnedToRef, RefToOwned}, |
192 | 198 | }; |
@@ -237,6 +243,12 @@ mod allocating { |
237 | 243 | } |
238 | 244 | } |
239 | 245 |
|
| 246 | + impl IntLike for Int { |
| 247 | + fn as_int_bytes(&self) -> &[u8] { |
| 248 | + self.inner.as_slice() |
| 249 | + } |
| 250 | + } |
| 251 | + |
240 | 252 | impl_any_conversions!(Int); |
241 | 253 |
|
242 | 254 | impl<'a> DecodeValue<'a> for Int { |
|
0 commit comments