pub struct TapeDecoder {
elements: Vec<TapeElement>,
cur_row: usize,
batch_size: usize,
bytes: Vec<u8>,
offsets: Vec<usize>,
stack: Vec<DecoderState>,
}
Expand description
Implements a state machine for decoding JSON to a tape
Fields§
§elements: Vec<TapeElement>
§cur_row: usize
The number of rows decoded, including any in progress if !stack.is_empty()
batch_size: usize
Number of rows to read per batch
bytes: Vec<u8>
A buffer of parsed string data
Note: if part way through a record, i.e. stack
is not empty,
this may contain truncated UTF-8 data
offsets: Vec<usize>
Offsets into data
stack: Vec<DecoderState>
A stack of DecoderState
Implementations§
Source§impl TapeDecoder
impl TapeDecoder
Sourcepub fn new(batch_size: usize, num_fields: usize) -> Self
pub fn new(batch_size: usize, num_fields: usize) -> Self
Create a new TapeDecoder
with the provided batch size
and an estimated number of fields in each row
pub fn decode(&mut self, buf: &[u8]) -> Result<usize, ArrowError>
Sourcepub fn serialize<S: Serialize>(&mut self, rows: &[S]) -> Result<(), ArrowError>
pub fn serialize<S: Serialize>(&mut self, rows: &[S]) -> Result<(), ArrowError>
Writes any type that implements Serialize
into this TapeDecoder
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears this TapeDecoder
in preparation to read the next batch
Auto Trait Implementations§
impl Freeze for TapeDecoder
impl RefUnwindSafe for TapeDecoder
impl Send for TapeDecoder
impl Sync for TapeDecoder
impl Unpin for TapeDecoder
impl UnwindSafe for TapeDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more