pub struct Splitter<R> { /* private fields */ }Expand description
An already configured CSV record splitter.
§Configuration
To configure a Splitter, if you need a custom delimiter for instance of if
you want to tweak the size of the inner buffer. Check out the
SplitterBuilder.
Implementations§
Source§impl<R: Read> Splitter<R>
impl<R: Read> Splitter<R>
Sourcepub fn from_reader(reader: R) -> Self
pub fn from_reader(reader: R) -> Self
Create a new splitter with default configuration using the provided
reader implementing std::io::Read.
Sourcepub fn has_headers(&self) -> bool
pub fn has_headers(&self) -> bool
Returns whether this reader has been configured to interpret the first record as a header.
Sourcepub fn byte_headers(&mut self) -> Result<&[u8]>
pub fn byte_headers(&mut self) -> Result<&[u8]>
Attempt to return a reference to this splitter’s first record.
Sourcepub fn count_records(&mut self) -> Result<u64>
pub fn count_records(&mut self) -> Result<u64>
Consume the reader completely to count the number of records as fast as possible.
Sourcepub fn split_record(&mut self) -> Result<Option<&[u8]>>
pub fn split_record(&mut self) -> Result<Option<&[u8]>>
Attempt to split the next CSV record and return an optional reference to its byte slice.
Returns Ok(None) when the reader is fully consumed.
Sourcepub fn split_record_with_position(&mut self) -> Result<Option<(u64, &[u8])>>
pub fn split_record_with_position(&mut self) -> Result<Option<(u64, &[u8])>>
Attempt to split the next CSV record and return an optional byte offset as well as a reference to its byte slice.
Returns Ok(None) when the reader is fully consumed.