Skip to main content

Chooser

Trait Chooser 

Source
pub trait Chooser: Debug + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn narrow_strings(
        &self,
        values: &[&[u8]],
        offered: &[Kind],
        depth: u8,
    ) -> Vec<Kind>;
    fn narrow_integers(
        &self,
        values: &[i64],
        offered: &[Kind],
        depth: u8,
    ) -> Vec<Kind>;
}
Expand description

Which of the candidates that apply are worth encoding in full.

Crossed once per chunk per level of the cascade. No method here sees a single value on its own, which is the rule that lets the decision be indirect at all.

Required Methods§

Source

fn name(&self) -> &'static str

The name that goes in a report.

Source

fn narrow_strings( &self, values: &[&[u8]], offered: &[Kind], depth: u8, ) -> Vec<Kind>

Which of offered to encode in full, for a chunk of strings at depth.

offered is what applies, in the order the exhaustive chooser would try them. The return has to be a subset of it and has to be non empty, because a chunk with no candidate is a chunk that cannot be written.

Source

fn narrow_integers( &self, values: &[i64], offered: &[Kind], depth: u8, ) -> Vec<Kind>

Which of offered to encode in full, for a chunk of integers at depth.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§