Skip to content

Commit

Permalink
der: add OctetString::into_bytes()
Browse files Browse the repository at this point in the history
This makes it possible to extract the owned data without copying.
  • Loading branch information
abonander authored Jan 12, 2023
1 parent 7f91388 commit 218923c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions der/src/asn1/octet_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ mod allocating {
pub fn as_bytes(&self) -> &[u8] {
self.inner.as_slice()
}

/// Take ownership of the octet string.
pub fn into_bytes(self) -> Vec<u8> {
self.inner
}

/// Get the length of the inner byte slice.
pub fn len(&self) -> Length {
Expand Down

0 comments on commit 218923c

Please sign in to comment.