From bebc390bcfe51ffa0509a69bf1acfa7cccde5d7b Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 21 Jun 2020 17:46:15 +0200 Subject: [PATCH] core/bitreader: add get_data() for accessing bitreader input directly --- nihav-core/src/io/bitreader.rs | 3 +++ 1 file changed, 3 insertions(+) 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) -- 2.39.5