pub trait ArrowDecoder: Send + 'static {
// Required methods
fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>;
fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>;
}
Required Methods§
sourcefn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>
fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>
Decode records from buf
returning the number of bytes read.
This method returns Ok(0)
once batch_size
objects have been parsed since the
last call to Self::flush
, or buf
is exhausted.
Any remaining bytes should be included in the next call to Self::decode
.
sourcefn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>
fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>
Flushes the currently buffered data to a [RecordBatch
].
This should only be called after Self::decode
has returned Ok(0)
,
otherwise may return an error if part way through decoding a record
Returns Ok(None)
if no buffered data.