Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder<Src: WireSource, S, B> {
    // Required method
    fn decode(
        &self,
        payload: Src::Payload<'_>,
    ) -> Result<Value<S, B>, DecodeError>;
}
Expand description

Converts a per-column payload into a Value.

Zero-sized unit-struct implementations (the crate’s built-ins) cover the common cases. User-defined stateful decoders carry their own fields (lookup tables, compiled regexes, per-adapter configuration) and implement the same trait shape.

Required Methods§

Source

fn decode(&self, payload: Src::Payload<'_>) -> Result<Value<S, B>, DecodeError>

Decode one payload.

§Errors

Returns a DecodeError variant describing the failure. Every variant carries the offending column name so the outer WireAdapter impl does not have to wrap.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§