Trait lcov_parser::parser::LCOVParser
[−]
[src]
pub trait LCOVParser { fn complete(&mut self, rc: &LCOVRecord); fn failed(&mut self, error: &RecordError); fn error(&mut self, error: &Error); fn parse<R: Read>(&mut self, reader: R) { ... } fn parse_record(&mut self, line_number: &u32, line: &[u8]) { ... } }
Parser of LCOV report.
Examples
use lcov_parser:: { LCOVRecord, LCOVParser, RecordError }; use std::io:: { Error }; use std::fs::File; struct TestParser { records: Vec<LCOVRecord>, record_errors: Vec<RecordError> } impl TestParser { fn new() -> Self { TestParser { records: vec!(), record_errors: vec!() } } } impl LCOVParser for TestParser { fn complete(&mut self, result: &LCOVRecord) { self.records.push(result.clone()) } fn failed(&mut self, error: &RecordError) { self.record_errors.push(error.clone()) } fn error(&mut self, error: &Error) { println!("{:?}", error); } } let f = File::open("./fixture/report.lcov").unwrap(); let mut parser = TestParser::new(); parser.parse(&f); assert_eq!(parser.records.len(), 1);