Add method to bitfield to read specific byte

This commit is contained in:
Paul Hauner 2018-09-24 18:06:47 +10:00
parent 27743f3466
commit 029a69a4a5
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -117,6 +117,11 @@ impl BooleanBitfield {
0
}
/// Get the byte at a position, assuming big-endian encoding.
pub fn get_byte(&self, n: usize) -> Option<&u8> {
self.vec.get(n)
}
/// Clone and return the underlying byte array (`Vec<u8>`).
pub fn to_be_vec(&self) -> Vec<u8> {
let mut o = self.vec.clone();