Skip to main content

MemoryMappedCsvReader

Struct MemoryMappedCsvReader 

Source
pub struct MemoryMappedCsvReader { /* private fields */ }
Expand description

Memory-mapped CSV reader for efficient processing of large files.

Implementations§

Source§

impl MemoryMappedCsvReader

Source

pub fn new(path: &Path) -> Result<Self>

Source

pub fn file_size(&self) -> u64

Get file size in bytes.

Source

pub fn read_csv_chunk( &self, offset: u64, chunk_size: usize, has_headers: bool, csv_config: Option<&CsvParserConfig>, ) -> Result<(Option<StringRecord>, Vec<StringRecord>, usize)>

Parse CSV records from memory-mapped data in chunks.

Returns (headers, records, actual_bytes_consumed).

Source

pub fn ends_inside_quotes( &self, offset: u64, csv_config: Option<&CsvParserConfig>, ) -> bool

Whether the file ends inside a quoted field, scanning from offset on.

offset must be a record boundary, such as the offset of a chunk Self::read_csv_chunk returned. Passing the last chunk’s offset keeps the scan to that chunk. The CSV parser accepts a quote that is never closed as a field running to the end of the file, so this is the only sign of it.

Source

pub fn estimate_csv_record_count( &self, csv_config: Option<&CsvParserConfig>, ) -> Result<usize>

Count logical CSV records, including the header, with a full scan. This shares the record parser with partial counting and avoids prefix bias.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V