aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2019-01-23 17:56:52 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2019-01-23 17:56:52 +0100
commitdb63f876c1a23ab4b52629a485aab520101a6345 (patch)
tree89ef0dc2abd10eee84de943ee47fad6ed2faaf75
parent128253cc176c24aa8934a1a2b1c644da56df2764 (diff)
downloadnihav-db63f876c1a23ab4b52629a485aab520101a6345.tar.gz
codebook: make TableDescReader accept non-static tables
-rw-r--r--nihav-core/src/io/codebook.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/nihav-core/src/io/codebook.rs b/nihav-core/src/io/codebook.rs
index 78ef5ae..285bedd 100644
--- a/nihav-core/src/io/codebook.rs
+++ b/nihav-core/src/io/codebook.rs
@@ -314,18 +314,18 @@ impl CodebookDescReader<u32> for ShortCodebookDescReader {
fn len(&mut self) -> usize { self.data.len() }
}
-pub struct TableCodebookDescReader<CodeType:'static, IndexType:'static> {
- bits: &'static [u8],
- codes: &'static [CodeType],
+pub struct TableCodebookDescReader<'a, CodeType:'static, IndexType:'static> {
+ bits: &'a [u8],
+ codes: &'a [CodeType],
idx_map: fn(usize) -> IndexType,
}
-impl<'a, CodeType, IndexType> TableCodebookDescReader<CodeType, IndexType> {
- pub fn new(codes: &'static [CodeType], bits: &'static [u8], idx_map: fn(usize) -> IndexType) -> Self {
+impl<'a, CodeType, IndexType> TableCodebookDescReader<'a, CodeType, IndexType> {
+ pub fn new(codes: &'a [CodeType], bits: &'a [u8], idx_map: fn(usize) -> IndexType) -> Self {
Self { bits, codes, idx_map }
}
}
-impl<CodeType: Copy+Into<u32>, IndexType> CodebookDescReader<IndexType> for TableCodebookDescReader<CodeType, IndexType>
+impl<'a, CodeType: Copy+Into<u32>, IndexType> CodebookDescReader<IndexType> for TableCodebookDescReader<'a, CodeType, IndexType>
{
fn bits(&mut self, idx: usize) -> u8 { self.bits[idx] }
fn code(&mut self, idx: usize) -> u32 { self.codes[idx].into() }