Skip to content

Commit

Permalink
reenable forcing a different dict
Browse files Browse the repository at this point in the history
  • Loading branch information
KillingSpark committed Mar 31, 2023
1 parent 2be7fbb commit 3b6403b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/frame_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,22 @@ impl FrameDecoder {
Ok(())
}

pub fn force_dict(&mut self, dict_id: u32) -> Result<(), FrameDecoderError> {
use FrameDecoderError as err;
let Some(state) = self.state.as_mut() else {
return Err(err::NotYetInitialized);
};

let dict = self
.dicts
.get(&dict_id)
.ok_or(err::DictNotProvided { dict_id })?;
state.decoder_scratch.init_from_dict(dict);
state.using_dict = Some(dict_id);

Ok(())
}

/// Returns how many bytes the frame contains after decompression
pub fn content_size(&self) -> u64 {
match &self.state {
Expand Down

0 comments on commit 3b6403b

Please sign in to comment.