Skip to main content

WireAdapter

Trait WireAdapter 

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

Decodes one per-column payload into a Value.

Object-safe: dyn WireAdapter<Src, S, B> works. The primary implementation is TypeMap<Src, S, B>, which dispatches on Src::TypeKey via a hashmap.

Required Methods§

Source

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

Decode one column payload.

§Errors

Returns DecodeError::NoDecoderForType when the underlying registry has no decoder for the payload’s type key, or the specific decoder’s own failure mode when it does.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<Src: WireSource, S, B> WireAdapter<Src, S, B> for TypeMap<Src, S, B>