Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn decode_chunk(&self, chunk: &Chunk) -> Vec<Chunk>;

    // Provided methods
    fn version(&self) -> &'static str { ... }
    fn admission_sketch(&self, _chunk: &Chunk) -> DecodeAdmissionSketch { ... }
    fn admission(&self, _chunk: &Chunk) -> DecodeAdmission { ... }
}
Expand description

A trait for decoding chunks to find hidden secrets.

Required Methods§

Source

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

Source

fn decode_chunk(&self, chunk: &Chunk) -> Vec<Chunk>

Provided Methods§

Source

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

Stable implementation version used by compiled scanner and autoroute identity. Increment this value whenever the decoder can emit a different set of chunks for the same input.

Source

fn admission_sketch(&self, _chunk: &Chunk) -> DecodeAdmissionSketch

Bounded work projection for this decoder on chunk.

Custom decoders default to an unknown, conservative sketch. Built-in decoders override this beside the grammar used by decode_chunk.

Source

fn admission(&self, _chunk: &Chunk) -> DecodeAdmission

Whether this decoder can produce output for chunk.

Custom decoders default to DecodeAdmission::Unknown, which always fails open. Built-in decoders derive this from the sketch owned next to the grammar used by Self::decode_chunk. Only Impossible permits the engine to skip decode post-processing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§