pub struct Reader<R> { /* private fields */ }Expand description
Struct representing a PAF parser iterator.
Implementations§
Source§impl Reader<File>
impl Reader<File>
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Reader<File>>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Reader<File>>
Creates a new PAF parser from a file path.
Examples found in repository?
examples/print_paf.rs (line 8)
4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data = env::args().skip(1).next();
if let Some(filename) = data {
let mut reader = Reader::from_path(&filename).unwrap();
for record in reader.records() {
let record = record.unwrap();
println!("{:?}", record);
}
} else {
eprintln!("Usage: print_paf <filename>");
std::process::exit(1);
}
}Sourcepub fn from_reader<R: Read>(rdr: R) -> Reader<R>
pub fn from_reader<R: Read>(rdr: R) -> Reader<R>
Creates a new PAF parser from a reader.
Source§impl<R: Read> Reader<R>
impl<R: Read> Reader<R>
Sourcepub fn records(&mut self) -> RecordsIter<'_, R> ⓘ
pub fn records(&mut self) -> RecordsIter<'_, R> ⓘ
A borrowed iterator over the records of a PAF file.
Examples found in repository?
examples/print_paf.rs (line 9)
4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let data = env::args().skip(1).next();
if let Some(filename) = data {
let mut reader = Reader::from_path(&filename).unwrap();
for record in reader.records() {
let record = record.unwrap();
println!("{:?}", record);
}
} else {
eprintln!("Usage: print_paf <filename>");
std::process::exit(1);
}
}Sourcepub fn into_records(self) -> RecordsIntoIter<R> ⓘ
pub fn into_records(self) -> RecordsIntoIter<R> ⓘ
An owned iterator over the records of a PAF file.
Sourcepub fn read_record(&mut self) -> Result<Option<PafRecord>>
pub fn read_record(&mut self) -> Result<Option<PafRecord>>
Read a single record.
Auto Trait Implementations§
impl<R> Freeze for Reader<R>where
R: Freeze,
impl<R> RefUnwindSafe for Reader<R>where
R: RefUnwindSafe,
impl<R> Send for Reader<R>where
R: Send,
impl<R> Sync for Reader<R>where
R: Sync,
impl<R> Unpin for Reader<R>where
R: Unpin,
impl<R> UnwindSafe for Reader<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