pub struct LCOVParser<T> { /* private fields */ }
Expand description
Parse the record one line at a time
§Examples
use std::fs:: { File };
use lcov_parser:: { LCOVRecord, LCOVParser };
let s = File::open("tests/fixtures/parser/report.lcov").unwrap();
let mut parser = LCOVParser::new(s);
let mut records = vec![];
loop {
let result = parser.next().unwrap();
match result {
Some(r) => { records.push(r) },
None => { break; }
}
}
assert_eq!(records[0], LCOVRecord::TestName(Some("test".to_string())));
Implementations§
Source§impl<T: Read> LCOVParser<T>
impl<T: Read> LCOVParser<T>
pub fn new(reader: T) -> Self
pub fn parse(&mut self) -> Result<Vec<LCOVRecord>, ParseError>
pub fn next(&mut self) -> Result<Option<LCOVRecord>, ParseError>
Trait Implementations§
Source§impl FromFile<File> for LCOVParser<File>
Create a parser from file
impl FromFile<File> for LCOVParser<File>
Create a parser from file
§Examples
use lcov_parser:: { LCOVParser, LCOVRecord, FromFile };
let mut parser = LCOVParser::from_file("tests/fixtures/parser/report.lcov").unwrap();
let result = parser.next().unwrap();
assert_eq!(result, Some(LCOVRecord::TestName(Some("test".to_string()))));
Auto Trait Implementations§
impl<T> Freeze for LCOVParser<T>where
T: Freeze,
impl<T> RefUnwindSafe for LCOVParser<T>where
T: RefUnwindSafe,
impl<T> Send for LCOVParser<T>where
T: Send,
impl<T> Sync for LCOVParser<T>where
T: Sync,
impl<T> Unpin for LCOVParser<T>where
T: Unpin,
impl<T> UnwindSafe for LCOVParser<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more