Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder: Send {
    // Required methods
    fn consumer(&mut self) -> &mut dyn OutputConsumer;
    fn encode(&mut self, batch: Arc<dyn SerBatchReader>) -> AnyResult<()>;
}

Required Methods§

Source

fn consumer(&mut self) -> &mut dyn OutputConsumer

Returns a reference to the consumer that the encoder is connected to.

Source

fn encode(&mut self, batch: Arc<dyn SerBatchReader>) -> AnyResult<()>

Encode a batch of updates and push the results to the consumer.

The encoder calls [OutputConsumer::batch_start] before emitting any data, then delivers encoded records via [OutputConsumer::push_buffer] or [OutputConsumer::push_key], and finally calls [OutputConsumer::batch_end].

Which of push_buffer or push_key is used depends on the kind of encoder used.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§