Trait linera_views::batch::BatchValueWriter

source ·
pub trait BatchValueWriter<Batch>: Send + Sync {
    // Required methods
    fn is_empty(&self) -> bool;
    fn write_next_value(
        &mut self,
        batch: &mut Batch,
        batch_size: &mut usize,
    ) -> Result<bool, Error>;
    fn next_batch_size(
        &mut self,
        batch: &Batch,
        batch_size: usize,
    ) -> Result<Option<usize>, Error>;
}
Expand description

An iterator-like object that can write values one by one to a batch while updating the total size of the batch.

Required Methods§

source

fn is_empty(&self) -> bool

Returns true if there are no more values to write.

source

fn write_next_value( &mut self, batch: &mut Batch, batch_size: &mut usize, ) -> Result<bool, Error>

Writes the next value (if any) to the batch and updates the batch size accordingly.

Returns false if there was no value to write.

source

fn next_batch_size( &mut self, batch: &Batch, batch_size: usize, ) -> Result<Option<usize>, Error>

Computes the batch size that we would obtain if we wrote the next value (if any) without consuming the value.

Implementors§