pub struct LineProcessor {
reader: Box<dyn BufRead>,
}
Expand description
Read lines from a file with buffering, decompression, and parsing.
Fields§
§reader: Box<dyn BufRead>
Implementations§
Source§impl LineProcessor
impl LineProcessor
Sourcepub fn open_gzip(path: &Path, pb: ProgressBar) -> Result<LineProcessor>
pub fn open_gzip(path: &Path, pb: ProgressBar) -> Result<LineProcessor>
Open a line processor from a gzipped source.
Sourcepub fn json_records<R: DeserializeOwned>(self) -> JSONRecords<R> ⓘ
pub fn json_records<R: DeserializeOwned>(self) -> JSONRecords<R> ⓘ
Get the lines as JSON records.
Sourcepub fn process_json<W, R>(self, writer: &mut W) -> Result<usize>where
R: DeserializeOwned,
W: ObjectWriter<R>,
pub fn process_json<W, R>(self, writer: &mut W) -> Result<usize>where
R: DeserializeOwned,
W: ObjectWriter<R>,
Process JSON rows into an object writer.
This parses each line of the data set, deserializes it with JSON, and passes the resulting object to the specified ObjectWriter. It produces useful error messages with line numbers when there is a failure. It does not call ObjectWriter::finish when it is done - the caller needs to do that.
Auto Trait Implementations§
impl Freeze for LineProcessor
impl !RefUnwindSafe for LineProcessor
impl !Send for LineProcessor
impl !Sync for LineProcessor
impl Unpin for LineProcessor
impl !UnwindSafe for LineProcessor
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