Skip to content

Commit

Permalink
der: add SequenceRef::as_bytes and AsRef<[u8]> impl (#1454)
Browse files Browse the repository at this point in the history
Closes #1078
  • Loading branch information
tarcieri authored Jul 25, 2024
1 parent 9918fc7 commit a3c986b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions der/src/asn1/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ pub struct SequenceRef<'a> {
body: BytesRef<'a>,
}

impl<'a> SequenceRef<'a> {
/// Borrow the inner byte slice.
pub fn as_bytes(&self) -> &'a [u8] {
self.body.as_slice()
}
}

impl AsRef<[u8]> for SequenceRef<'_> {
fn as_ref(&self) -> &[u8] {
self.as_bytes()
}
}

impl<'a> DecodeValue<'a> for SequenceRef<'a> {
type Error = Error;

Expand Down

0 comments on commit a3c986b

Please sign in to comment.