paf

Struct Reader

Source
pub struct Reader<R> { /* private fields */ }
Expand description

Struct representing a PAF parser iterator.

Implementations§

Source§

impl Reader<File>

Source

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);
    }
}
Source

pub fn from_reader<R: Read>(rdr: R) -> Reader<R>

Creates a new PAF parser from a reader.

Source§

impl<R: Read> Reader<R>

Source

pub fn new(rdr: R) -> Self

Creates a new PAF parser from a buffered reader.

Source

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);
    }
}
Source

pub fn into_records(self) -> RecordsIntoIter<R>

An owned iterator over the records of a PAF file.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.