Trait vector::sinks::util::batch::Batch

source ·
pub trait Batch: Sized {
    type Input;
    type Output;

    // Required methods
    fn push(&mut self, item: Self::Input) -> PushResult<Self::Input>;
    fn is_empty(&self) -> bool;
    fn fresh(&self) -> Self;
    fn finish(self) -> Self::Output;
    fn num_items(&self) -> usize;

    // Provided method
    fn get_settings_defaults<D: SinkBatchSettings + Clone>(
        config: BatchConfig<D, Merged>,
    ) -> Result<BatchConfig<D, Merged>, BatchError> { ... }
}

Required Associated Types§

Required Methods§

source

fn push(&mut self, item: Self::Input) -> PushResult<Self::Input>

source

fn is_empty(&self) -> bool

source

fn fresh(&self) -> Self

source

fn finish(self) -> Self::Output

source

fn num_items(&self) -> usize

Provided Methods§

source

fn get_settings_defaults<D: SinkBatchSettings + Clone>( config: BatchConfig<D, Merged>, ) -> Result<BatchConfig<D, Merged>, BatchError>

Turn the batch configuration into an actualized set of settings, and deal with the proper behavior of max_size and if max_bytes may be set. This is in the trait to ensure all batch buffers implement it.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Batch for JsonArrayBuffer

source§

impl Batch for MetricsBuffer

source§

impl Batch for Buffer

§

type Input = BytesMut

§

type Output = BytesMut

source§

impl<B: Batch> Batch for FinalizersBatch<B>

source§

impl<B: Batch> Batch for StatefulBatch<B>

§

type Input = <B as Batch>::Input

§

type Output = <B as Batch>::Output

source§

impl<T, K> Batch for PartitionBuffer<T, K>
where T: Batch, K: Clone,

source§

impl<T: EncodedLength> Batch for VecBuffer<T>

§

type Input = T

§

type Output = Vec<T>