diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-07-18 16:46:16 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-07-18 17:06:51 +0200 |
commit | 05f4e30e72e4aff547fd3496a48c42359e73c02f (patch) | |
tree | de6cf3e0197d6b0768c772b19c372ab029cc2faf | |
parent | 430dcbf562d97b58dfa564d7037c9218df253626 (diff) |
openpgp: Impl AsRef and AsMut for Bitfield.
-rw-r--r-- | openpgp/src/types/bitfield.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openpgp/src/types/bitfield.rs b/openpgp/src/types/bitfield.rs index 6df0791a..5fccbbaa 100644 --- a/openpgp/src/types/bitfield.rs +++ b/openpgp/src/types/bitfield.rs @@ -10,6 +10,18 @@ impl From<Vec<u8>> for Bitfield { } } +impl AsRef<[u8]> for Bitfield { + fn as_ref(&self) -> &[u8] { + self.as_bytes() + } +} + +impl AsMut<[u8]> for Bitfield { + fn as_mut(&mut self) -> &mut [u8] { + self.as_bytes_mut() + } +} + impl Bitfield { pub fn iter(&self) -> impl Iterator<Item = usize> + Send + Sync + '_ { |