pub struct RefRecord<'a> { /* private fields */ }
Expand description
A FASTA record that borrows data from a buffer.
Implementations§
source§impl<'a> RefRecord<'a>
impl<'a> RefRecord<'a>
sourcepub fn seq_lines(&self) -> SeqLines<'_> ⓘ
pub fn seq_lines(&self) -> SeqLines<'_> ⓘ
Return an iterator over all sequence lines in the data
sourcepub fn num_seq_lines(&self) -> usize
pub fn num_seq_lines(&self) -> usize
Returns the number of sequence lines.
Equivalent to self.seq_lines().len()
sourcepub fn full_seq(&self) -> Cow<'_, [u8]>
pub fn full_seq(&self) -> Cow<'_, [u8]>
Returns the full sequence. If the sequence consists of a single line,
then the sequence will be borrowed from the underlying buffer
(equivalent to calling RefRecord::seq()
). If there are multiple
lines, an owned copy will be created (equivalent to RefRecord::owned_seq()
).
sourcepub fn owned_seq(&self) -> Vec<u8>
pub fn owned_seq(&self) -> Vec<u8>
Returns the sequence as owned Vec
. Note: This function
must be called in order to obtain a sequence that does not contain
line endings (as returned by seq()
)
sourcepub fn to_owned_record(&self) -> OwnedRecord
pub fn to_owned_record(&self) -> OwnedRecord
Creates an owned copy of the record.
sourcepub fn write_unchanged<W: Write>(&self, writer: W) -> Result<()>
pub fn write_unchanged<W: Write>(&self, writer: W) -> Result<()>
Writes a record to the given io::Write
instance
by just writing the unmodified input, which is faster than RefRecord::write
Trait Implementations§
source§impl<'a> Record for RefRecord<'a>
impl<'a> Record for RefRecord<'a>
source§fn seq(&self) -> &[u8] ⓘ
fn seq(&self) -> &[u8] ⓘ
Return the FASTA sequence as byte slice.
Note that this method of RefRecord
returns
the raw sequence, which may contain line breaks.
Use seq_lines()
to iterate over all lines without
breaks, or use full_seq()
to access the whole sequence at once.
source§fn write<W: Write>(&self, writer: W) -> Result<()>
fn write<W: Write>(&self, writer: W) -> Result<()>
io::Write
instance. The sequence will occupy one line only.source§fn write_wrap<W: Write>(&self, writer: W, wrap: usize) -> Result<()>
fn write_wrap<W: Write>(&self, writer: W, wrap: usize) -> Result<()>
io::Write
instance. The sequence is wrapped to produce
multi-line FASTA with a maximum width specified by wrap
.fn id_bytes(&self) -> &[u8] ⓘ
source§fn id(&self) -> Result<&str, Utf8Error>
fn id(&self) -> Result<&str, Utf8Error>
fn desc_bytes(&self) -> Option<&[u8]>
source§fn desc(&self) -> Option<Result<&str, Utf8Error>>
fn desc(&self) -> Option<Result<&str, Utf8Error>>
None
is returned.