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.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Splitter<R>where
R: Freeze,
impl<R> RefUnwindSafe for Splitter<R>where
R: RefUnwindSafe,
impl<R> Send for Splitter<R>where
R: Send,
impl<R> Sync for Splitter<R>where
R: Sync,
impl<R> Unpin for Splitter<R>where
R: Unpin,
impl<R> UnsafeUnpin for Splitter<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for Splitter<R>where
R: UnwindSafe,
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