Trait seq_io::fasta::Record

source ·
pub trait Record {
    // Required methods
    fn head(&self) -> &[u8] ;
    fn seq(&self) -> &[u8] ;
    fn write<W: Write>(&self, writer: W) -> Result<()>;
    fn write_wrap<W: Write>(&self, writer: W, wrap: usize) -> Result<()>;

    // Provided methods
    fn id_bytes(&self) -> &[u8]  { ... }
    fn id(&self) -> Result<&str, Utf8Error> { ... }
    fn desc_bytes(&self) -> Option<&[u8]> { ... }
    fn desc(&self) -> Option<Result<&str, Utf8Error>> { ... }
    fn id_desc_bytes(&self) -> (&[u8], Option<&[u8]>) { ... }
    fn id_desc(&self) -> Result<(&str, Option<&str>), Utf8Error> { ... }
}
Expand description

FASTA record trait implemented by both RefRecord and OwnedRecord

Required Methods§

source

fn head(&self) -> &[u8]

Return the header line of the record as byte slice

source

fn seq(&self) -> &[u8]

Return the FASTA sequence as byte slice

source

fn write<W: Write>(&self, writer: W) -> Result<()>

Write the record to the given io::Write instance. The sequence will occupy one line only.

source

fn write_wrap<W: Write>(&self, writer: W, wrap: usize) -> Result<()>

Write the record to the given io::Write instance. The sequence is wrapped to produce multi-line FASTA with a maximum width specified by wrap.

Provided Methods§

source

fn id_bytes(&self) -> &[u8]

source

fn id(&self) -> Result<&str, Utf8Error>

Return the ID of the record (everything before an optional space) as string slice

source

fn desc_bytes(&self) -> Option<&[u8]>

source

fn desc(&self) -> Option<Result<&str, Utf8Error>>

Return the description of the record as string slice, if present. Otherwise, None is returned.

source

fn id_desc_bytes(&self) -> (&[u8], Option<&[u8]>)

Return both the ID and the description of the record (if present) This should be faster than calling id() and desc() separately.

source

fn id_desc(&self) -> Result<(&str, Option<&str>), Utf8Error>

Return both the ID and the description of the record (if present) This should be faster than calling id() and desc() separately.

Implementors§