Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion der/src/asn1/integer/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::{is_highest_bit_set, uint, value_cmp};
use crate::{
AnyRef, BytesRef, DecodeValue, EncodeValue, Error, ErrorKind, FixedTag, Header, Length, Reader,
Result, Tag, ValueOrd, Writer, ord::OrdIsValueOrd,
Result, Tag, ValueOrd, Writer, ord::OrdIsValueOrd, referenced::OwnedToRef,
};
use core::cmp::Ordering;

Expand Down Expand Up @@ -180,6 +180,16 @@ impl FixedTag for IntRef<'_> {

impl OrdIsValueOrd for IntRef<'_> {}

impl<'a> OwnedToRef for IntRef<'a> {
type Borrowed<'b>
= IntRef<'a>
where
'a: 'b;
fn owned_to_ref(&self) -> Self::Borrowed<'a> {
*self
}
}

#[cfg(feature = "alloc")]
mod allocating {
use super::{IntRef, strip_leading_ones, validate_canonical};
Expand Down
12 changes: 11 additions & 1 deletion der/src/asn1/integer/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::value_cmp;
use crate::{
AnyRef, BytesRef, DecodeValue, EncodeValue, Error, ErrorKind, FixedTag, Header, Length, Reader,
Result, Tag, ValueOrd, Writer, ord::OrdIsValueOrd,
Result, Tag, ValueOrd, Writer, ord::OrdIsValueOrd, referenced::OwnedToRef,
};
use core::cmp::Ordering;

Expand Down Expand Up @@ -169,6 +169,16 @@ impl FixedTag for UintRef<'_> {

impl OrdIsValueOrd for UintRef<'_> {}

impl<'a> OwnedToRef for UintRef<'a> {
type Borrowed<'b>
= UintRef<'a>
where
'a: 'b;
fn owned_to_ref(&self) -> Self::Borrowed<'a> {
*self
}
}

#[cfg(feature = "alloc")]
mod allocating {
use super::{UintRef, decode_to_slice, encoded_len, strip_leading_zeroes};
Expand Down