arrow_csv::reader::records

Struct RecordDecoder

Source
pub struct RecordDecoder {
    delimiter: Reader,
    num_columns: usize,
    line_number: usize,
    offsets: Vec<usize>,
    offsets_len: usize,
    current_field: usize,
    num_rows: usize,
    data: Vec<u8>,
    data_len: usize,
    truncated_rows: bool,
}
Expand description

RecordDecoder provides a push-based interface to decoder StringRecords

Fields§

§delimiter: Reader§num_columns: usize

The expected number of fields per row

§line_number: usize

The current line number

§offsets: Vec<usize>

Offsets delimiting field start positions

§offsets_len: usize

The current offset into self.offsets

We track this independently of Vec to avoid re-zeroing memory

§current_field: usize

The number of fields read for the current record

§num_rows: usize

The number of rows buffered

§data: Vec<u8>

Decoded field data

§data_len: usize

Offsets into data

We track this independently of Vec to avoid re-zeroing memory

§truncated_rows: bool

Whether rows with less than expected columns are considered valid

Default value is false When enabled fills in missing columns with null

Implementations§

Source§

impl RecordDecoder

Source

pub fn new(delimiter: Reader, num_columns: usize, truncated_rows: bool) -> Self

Source

pub fn decode( &mut self, input: &[u8], to_read: usize, ) -> Result<(usize, usize), ArrowError>

Decodes records from input returning the number of records and bytes read

Note: this expects to be called with an empty input to signal EOF

Source

pub fn len(&self) -> usize

Returns the current number of buffered records

Source

pub fn is_empty(&self) -> bool

Returns true if the decoder is empty

Source

pub fn clear(&mut self)

Clears the current contents of the decoder

Source

pub fn flush(&mut self) -> Result<StringRecords<'_>, ArrowError>

Flushes the current contents of the reader

Trait Implementations§

Source§

impl Debug for RecordDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,