Skip to content

Commit

Permalink
gff/reader: Add example for read_lazy_line
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed May 15, 2024
1 parent 2a685c8 commit b8589a6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions noodles-gff/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,29 @@ where
}

/// Reads a single line without eagerly decoding it.
///
/// # Examples
///
/// ```
/// # use std::io;
/// use noodles_gff as gff;
///
/// let data = b"##gff-version 3
/// sq0\tNOODLES\tgene\t8\t13\t.\t+\t.\tgene_id=ndls0;gene_name=gene0
/// ";
/// let mut reader = gff::Reader::new(&data[..]);
///
/// let mut line = gff::lazy::Line::default();
///
/// reader.read_lazy_line(&mut line)?;
/// assert!(matches!(line, gff::lazy::Line::Directive(_)));
///
/// reader.read_lazy_line(&mut line)?;
/// assert!(matches!(line, gff::lazy::Line::Record(_)));
///
/// assert_eq!(reader.read_lazy_line(&mut line)?, 0);
/// # Ok::<_, io::Error>(())
/// ```
pub fn read_lazy_line(&mut self, line: &mut lazy::Line) -> io::Result<usize> {
read_lazy_line(&mut self.inner, line)
}
Expand Down

0 comments on commit b8589a6

Please sign in to comment.