Struct bookdata::io::lines::LineProcessor
source · 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 !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