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§

Source§

impl<S, B> Decoder<PgBinary, S, B> for BoolDecoder

Source§

impl<S, B> Decoder<PgBinary, S, B> for DateDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for DecimalTextDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for IntDecoder

Source§

impl<S, B> Decoder<PgBinary, S, B> for IntervalDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for JsonVerbatimDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for NullDecoder

Source§

impl<S, B> Decoder<PgBinary, S, B> for PgByteaBinaryDecoder
where B: From<Vec<u8>>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for RealDecoder

Source§

impl<S, B> Decoder<PgBinary, S, B> for TextDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for TimeDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for TimestampDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for TimestampTzDecoder
where S: From<String>,

Source§

impl<S, B> Decoder<PgBinary, S, B> for UuidBlob16Decoder
where B: From<Vec<u8>>,