pub trait Encoder {
// Required methods
fn construct(text: &[u32]) -> Self;
fn encode(&self, t: u32) -> Option<(u32, u8)>;
fn decode(&self, e: u32, s: u8) -> Option<u32>;
fn symbols(&self) -> usize;
}Expand description
Encoder captures prefix-free codes from a text document. It is necessary that codes be prefix-free starting with the least significant bit.
Required Methods§
Sourcefn construct(text: &[u32]) -> Self
fn construct(text: &[u32]) -> Self
Construct a new encoder, returning Err if the text is not amenable to encoding (usually because there are too many symbols in the text).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".