pub fn stream_from_file(
path: PathBuf,
filter: &Filter,
) -> Result<RowIterator, StreamError>Expand description
Decompress, stream, and parse lines from a local pageviews file
The function will return a StreamError if it fails to read the file.
Otherwise, it returns a Pageviews iterator, yielding a ParseError
for each line it fails to parse, either due to IO issues or a parsing
error.
ยงExample
use pvstream::{stream_from_file, filter::FilterBuilder};
use std::path::PathBuf;
let filter = FilterBuilder::new().domain_codes(["en"]).build();
let rows = stream_from_file(PathBuf::from("pageviews-20240818-080000.gz"), &filter)?;
for result in rows {
println!("{:?}", result?);
}