core/bitreader: add get_data() for accessing bitreader input directly
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 21 Jun 2020 15:46:15 +0000 (17:46 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 21 Jun 2020 15:46:15 +0000 (17:46 +0200)
nihav-core/src/io/bitreader.rs

index 6c786228c1ecf9465e387f27ab6516e7c406891d..569330b5be59e14ab75612c14462ba18832dec0a 100644 (file)
@@ -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)