pub struct EntropyConfig { /* private fields */ }entropy only.Expand description
rANS entropy profile wrapping a Config.
Byte limits cover both frames and decoded storage; collection limits cover
symbol counts. Parser depth, token and read-work policies do not apply.
This profile adds framed, deterministic static-model coding. The frame magic is
RBAN. Verification is hash-free: the decoder re-encodes the decoded
symbols and requires the frame to be canonical (see the module docs), with
replay verification on by default.
Implementations§
Source§impl EntropyConfig
impl EntropyConfig
Sourcepub const fn base_config(self) -> Config
pub const fn base_config(self) -> Config
Returns the underlying resource profile.
Sourcepub const fn without_replay_verification(self) -> Self
pub const fn without_replay_verification(self) -> Self
Disables replay verification.
State and consumption checks remain. Neither setting authenticates the decoded data or guarantees detection of substitutions.
Sourcepub const fn replay_verification(self) -> bool
pub const fn replay_verification(self) -> bool
Whether replay verification is enabled.
Sourcepub const fn without_raw_fallback(self) -> Self
pub const fn without_raw_fallback(self) -> Self
Disables the raw (uncompressed) fallback in Self::compress.
Forces coded frames even for incompressible input. This can increase output size; it adds no authentication or quantified corruption detection.
Sourcepub const fn raw_fallback(self) -> bool
pub const fn raw_fallback(self) -> bool
Whether the raw (uncompressed) fallback is enabled.
Sourcepub fn encode_sequence(
&self,
models: &[&Model],
symbols: &[u32],
) -> Result<Vec<u8>>
pub fn encode_sequence( &self, models: &[&Model], symbols: &[u32], ) -> Result<Vec<u8>>
Encodes a sequence of symbols, each with its own model, into one frame.
models and symbols must have the same length. Every symbol is coded
with the matching model, so the decoder must replay the same model
slice in the same order.
Sourcepub fn decode_sequence(
&self,
models: &[&Model],
input: &[u8],
) -> Result<Vec<u32>>
pub fn decode_sequence( &self, models: &[&Model], input: &[u8], ) -> Result<Vec<u32>>
Decodes a sequence coded by Self::encode_sequence.
models must match the encoder’s model slice exactly. When replay
verification is enabled, the frame is accepted only if re-encoding the
decoded symbols reproduces the stored payload and final state.
Sourcepub fn compress(&self, input: &[u8], model: &Model) -> Result<Vec<u8>>
pub fn compress(&self, input: &[u8], model: &Model) -> Result<Vec<u8>>
Entropy-codes a byte buffer with one model, choosing raw storage when the coded form is not smaller.
Sourcepub fn decompress(&self, input: &[u8], model: &Model) -> Result<Vec<u8>>
pub fn decompress(&self, input: &[u8], model: &Model) -> Result<Vec<u8>>
Decompresses a frame produced by Self::compress.