Expand description
The trfr
crate is purely for parsing the output of
the command line tool Tandem Repeat Finder
(or trf
).
The output is generated by passing the -d
flag to create
a parseable table (rather than the standard HTML output). Please
see here for the
source code and citation for trf
.
The API follows that of most mainstream Rust API’s (in particular BurntSushi’s). It is an iterator API.
§Example
use std::{error::Error, io, process};
fn example() -> Result<(), Box<dyn Error>> {
// Build the trfr reader
// and assuming you are parsing with `-d` flag only
let mut rdr = trfr::Reader::from_reader(io::stdin(), trfr::Flag::D);
for result in rdr.records() {
let record = result?;
println!("{:?}", record);
}
Ok(())
}
fn main() {
if let Err(err) = example() {
println!("error running example: {}", err);
process::exit(1);
}
}
Structs§
- Error
- Error when parsing trfr text.
- Reader
- Record
- The record fields in a
trf
table - Records
Into Iter - An owned iterator over the records of a refer file.
- Records
Iter - A borrowed iterator over the records of a refer file.
Enums§
- Error
Kind - Specific errors that can happen.
- Flag
- If you passed
-d
, useD
, and if you passed-ngs
, then you wantNgs
. This leads to a slight modification in the parsing.
Type Aliases§
- Result
- A type alias for
Result<T, trfr::Error>
.