Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder {
    type Output;
    type Error;

    // Required method
    fn decode(&mut self, bytes: &[u8]) -> Result<Self::Output, Self::Error>;

    // Provided method
    fn decode_owned(
        &mut self,
        bytes: Vec64<u8>,
    ) -> Result<Self::Output, Self::Error> { ... }
}
Expand description

One-shot decoder: takes a self-contained byte buffer, returns the reconstructed value.

decode is the required method. decode_owned is an optional zero-copy override that takes ownership of an aligned Vec64<u8> and can feed it to the underlying parser without a memcpy; the default forwards to decode.

Required Associated Types§

Source

type Output

Value type produced by the decoder.

Source

type Error

Error surfaced by the decode methods.

Required Methods§

Source

fn decode(&mut self, bytes: &[u8]) -> Result<Self::Output, Self::Error>

Decode from a borrowed byte slice.

Provided Methods§

Source

fn decode_owned( &mut self, bytes: Vec64<u8>, ) -> Result<Self::Output, Self::Error>

Owned-bytes entry. Default forwards to decode. Override when the codec can take ownership of the buffer directly without a memcpy (Arrow IPC wraps the Vec64<u8> as a SharedBuffer and reads typed views in place).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Decoder for ArrowIpcCodec<Vec64<u8>>

Codec contract for Arrow IPC Stream: take a self-contained byte buffer, parse the schema, dictionary, and record-batch frames it holds, and return the reconstructed Table. decode_owned is the zero-copy entry: an aligned Vec64<u8> is wrapped as a SharedBuffer and the IPC parser reads typed views in place without an intermediate copy.