1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use core::iter::Iterator;
use fastx::FastX::FastXRead;
use fastx::FastX::{self, FastQRead};
use std::env::args;
use std::io;
use std::path::Path;

fn main() -> io::Result<()>
{
    for filename in args().skip(1)
    {
        println!("{}", filename);
        let mut fastx_reader = FastX::reader_from_path(Path::new(&filename))?;
        let mut fastq_record = FastX::FastQRecord::default();

        while let Ok(_some @ 1..=usize::MAX) = fastq_record.read(&mut fastx_reader)
        {
            println!(
                "@{} {}\n{}\n+{}\n{}",
                fastq_record.id(),
                fastq_record.desc(),
                String::from_utf8_lossy(&fastq_record.seq()),
                fastq_record.comment(),
                String::from_utf8_lossy(&fastq_record.qual())
            );
        }
    }
    Ok(())
}