Trait cont_arith_code::Model
source · pub trait Model<T> {
// Required methods
fn push(&mut self, s: Index) -> Option<T>;
fn next_distr(&mut self) -> Box<dyn UnivariateDistribution>;
}
Expand description
Models produce distributions and consume their resolutions (as
i64
s) until a value T
pops out. Used by both Encoder and Decoder
symmetrically.
Required Methods§
sourcefn push(&mut self, s: Index) -> Option<T>
fn push(&mut self, s: Index) -> Option<T>
Push a value into the model and updates its state. Returns a values once it’s been fully described by a series of indexes.
sourcefn next_distr(&mut self) -> Box<dyn UnivariateDistribution>
fn next_distr(&mut self) -> Box<dyn UnivariateDistribution>
Get the distribution for the next symbol from the model.
Implementations on Foreign Types§
source§impl<A: Model<T>, T, B: Model<U>, U> Model<(T, U)> for (Option<T>, (A, B))
impl<A: Model<T>, T, B: Model<U>, U> Model<(T, U)> for (Option<T>, (A, B))
A pair of models can model a pair of values.