From: Kostya Shishkov Date: Sun, 21 Jun 2020 15:46:15 +0000 (+0200) Subject: core/bitreader: add get_data() for accessing bitreader input directly X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=bebc390bcfe51ffa0509a69bf1acfa7cccde5d7b;p=nihav.git core/bitreader: add get_data() for accessing bitreader input directly --- diff --git a/nihav-core/src/io/bitreader.rs b/nihav-core/src/io/bitreader.rs index 6c78622..569330b 100644 --- a/nihav-core/src/io/bitreader.rs +++ b/nihav-core/src/io/bitreader.rs @@ -90,6 +90,9 @@ impl<'a> BitReader<'a> { BitReader{ cache: 0, pos: 0, bits: 0, src, mode } } + /// Returns the data bitstream reader uses. + pub fn get_data(&self) -> &'a [u8] { self.src } + /// Reports the current bit position in the bitstream (usually simply the number of bits read so far). pub fn tell(&self) -> usize { self.pos * 8 - (self.bits as usize)