title: How to read in a fasta in Rust usio the bio package
body: <p>I'm pretty new to Rust (and bio rust) and just learning so any guidance would be appreciated. I've read the small Read Example for how to read in a fasta sequence from stdin,</p>
  <pre><code>let mut records = fasta::Reader::new(io::stdin()).records();
  </code></pre>
  <p>but I can't figure out how to read in from a file. I've tried</p>
  <pre><code>let mut records = fasta::Reader::new(filename);
  </code></pre>
  <p>Where the filename is a slice and a string and I've found the from_file function trying that as well. While some of them appear to work, then when I try to parse through them with for or while loops, they always complain that they're of the wrong type. The from_file function seems to not make an iterator, but a Result reader, so I can't call the next() or collect() function on it,</p>
  <pre><code>let mut records = fasta::Reader::from_file(filename);
  let mut nb_reads = 0;
  let mut nb_bases = 0;
  
  
  
  while let Some(Ok(record)) = records.next() {
      nb_reads += 1;
      nb_bases += record.seq().len();
  
  
      let sa = suffix_array(record.seq());
  
      println!(&quot;Here's the Suffix array: {:#?}&quot;, sa);
  
      nb_reads += 1;
      nb_bases += record.seq().len();
  }
  </code></pre>
  <p>while the for loop seems to work, but the 'result' iterator doesn't have the right type so I can't pull sequences.</p>
  <pre><code>let mut reader = fasta::Reader::from_file(filename);
  let mut nb_reads = 0;
  let mut nb_bases = 0;
  
  
  
  for result in reader {
      nb_reads += 1;
      nb_bases += result.seq().len();
  
  
      let sa = suffix_array(result.seq());
  
      println!(&quot;Here's the Suffix array: {:#?}&quot;, sa);
  
      nb_reads += 1;
      nb_bases += result.seq().len();
  }
  </code></pre>
  <p>I'm stumped, but I feel like I'm close to getting it to work. Thanks!</p>