fn read(&mut self, record: &mut Record) -> io::Result<()> {
        record.clear();
        if self.line.is_empty() {
            self.reader.read_line(&mut self.line)?;
            if self.line.is_empty() {
                return Ok(());
            }
        }

        if !self.line.starts_with('>') {
            return Err(io::Error::new(
                io::ErrorKind::Other,
                "Expected > at record start.",
            ));
        }
        let mut header_fields = self.line[1..].trim_end().splitn(2, char::is_whitespace);
        record.id = header_fields.next().map(|s| s.to_owned()).unwrap();
        record.desc = header_fields.next().map(|s| s.to_owned());
        loop {
            self.line.clear();
            self.reader.read_line(&mut self.line)?;
            if self.line.is_empty() || self.line.starts_with('>') {
                break;
            }
            record.seq.push_str(self.line.trim_end());
        }

        Ok(())
    }
/// Read the next FASTA record into the given `Record`.
/// An empty record indicates that no more records can be read.
///
/// Use this method when you want to read records as fast as
/// possible because it allows the reuse of a `Record` allocation.
///
/// The [records](Reader::records) iterator provides a more ergonomic
/// approach to accessing FASTA records.
///
/// # Errors
///
/// This function will return an error if the record is incomplete,
/// syntax is violated or any form of I/O error is encountered.
///
/// # Example
///
/// ```rust
/// use bio::io::fasta::Record;
/// use bio::io::fasta::{FastaRead, Reader};
///
/// const fasta_file: &'static [u8] = b">id desc
/// AAAA
/// ";
/// let mut reader = Reader::new(fasta_file);
/// let mut record = Record::new();
///
/// // Check for errors parsing the record
/// reader
///     .read(&mut record)
///     .expect("fasta reader: got an io::Error or could not read_line()");
///
/// assert_eq!(record.id(), "id");
/// assert_eq!(record.desc().unwrap(), "desc");
/// assert_eq!(record.seq().to_vec(), b"AAAA");
/// ```
Read the next FASTA record into the given `Record`.
An empty record indicates that no more records can be read.

Use this method when you want to read records as fast as
possible because it allows the reuse of a `Record` allocation.

The [records](Reader::records) iterator provides a more ergonomic
approach to accessing FASTA records.
Read the next FASTA record into the given ` Record ` . An empty record indicates that no more records can be read . Use this method when you want to read records as fast as possible because it allows the reuse of a ` Record ` allocation . The [ records ] ( Reader :: records ) iterator provides a more ergonomic approach to accessing FASTA records .
fn read(&mut self, record: &mut Record) -> io::Result<()> {
        record.clear();
        if self.line.is_empty() {
            self.reader.read_line(&mut self.line)?;
            if self.line.is_empty() {
                return Ok(());
            }
        }
        if !self.line.starts_with('>') {
            return Err(io::Error::new(
                io::ErrorKind::Other,
                "Expected > at record start.",
            ));
        }
        let mut header_fields = self.line[1..].trim_end().splitn(2, char::is_whitespace);
        record.id = header_fields.next().map(|s| s.to_owned()).unwrap();
        record.desc = header_fields.next().map(|s| s.to_owned());
        loop {
            self.line.clear();
            self.reader.read_line(&mut self.line)?;
            if self.line.is_empty() || self.line.starts_with('>') {
                break;
            }
            record.seq.push_str(self.line.trim_end());
        }
        Ok(())
    }
fn read ( & mut self , record : & mut Record ) -> io :: Result < ( ) > { record . clear ( ) ; if self . line . is_empty ( ) { self . reader . read_line ( & mut self . line ) ? ; if self . line . is_empty ( ) { return Ok ( ( ) ) ; } } if ! self . line . starts_with ( '>' ) { return Err ( io :: Error :: new ( io :: ErrorKind :: Other , " " , ) ) ; } let mut header_fields = self . line [ 1 .. ] . trim_end ( ) . splitn ( 2 , char :: is_whitespace ) ; record . id = header_fields . next ( ) . map ( | s | s . to_owned ( ) ) . unwrap ( ) ; record . desc = header_fields . next ( ) . map ( | s | s . to_owned ( ) ) ; loop { self . line . clear ( ) ; self . reader . read_line ( & mut self . line ) ? ; if self . line . is_empty ( ) || self . line . starts_with ( '>' ) { break ; } record . seq . push_str ( self . line . trim_end ( ) ) ; } Ok ( ( ) ) }
Read the next FASTA record into the given `Record`.
Read the next FASTA record into the given ` Record ` .
&mut self
record
&mut Record
&mut self
record
&mut Record
errors
This function will return an error if the record is incomplete,
syntax is violated or any form of I/O error is encountered.
This function will return an error if the record is incomplete syntax is violated or any form of I / O error is encountered .
example
```rust
use bio::io::fasta::Record;
use bio::io::fasta::{FastaRead, Reader}.

const fasta_file: &'static [u8] = b">id desc
AAAA
";
let mut reader = Reader::new(fasta_file);
let mut record = Record::new().

Check for errors parsing the record
reader
.read(&mut record)
.expect("fasta reader: got an io::Error or could not read_line()").


` ` ` rust use bio :: io :: fasta :: Record ; use bio :: io :: fasta :: { FastaRead Reader } . const fasta_file : & ' static [ u8 ] = b " > id desc AAAA " ; let mut reader = Reader :: new ( fasta_file ) ; let mut record = Record :: new () . Check for errors parsing the record reader . read ( &mut record ) . expect ( " fasta reader : got an io :: Error or could not read_line () " ) .