pub struct FileCov {
pub file: String,
pub stmt_count: usize,
pub miss_count: usize,
pub covered_percent: u8,
pub missed_sections: Vec<RangeInclusive<usize>>,
}Expand description
FileCov represents one line of a file coverage data in coverage report
An example line in coverage.py output:
"src/lib/config.rs 45 11 76% 37-45, 60, 73"
is represented as:
let fc = coverage2lcov::FileCov {
file: String::from("src/lib/config.rs"),
stmt_count: 45,
miss_count: 11,
covered_percent: 76,
missed_sections: vec![37..=45, 60..=60, 73..=73]
};Fields§
§file: Stringname of the tested source file as in the coverage report
stmt_count: usizenumber of statements in the file
miss_count: usizenumber of statements missed in testing
covered_percent: u8percentage of statements covered by tests
missed_sections: Vec<RangeInclusive<usize>>a vector of sections of lines missed (not covered). each section is an inclusive range of usize representing the start and end line numbers
Trait Implementations§
Source§impl TryFrom<&str> for FileCov
impl TryFrom<&str> for FileCov
Source§fn try_from(line: &str) -> Result<Self, Self::Error>
fn try_from(line: &str) -> Result<Self, Self::Error>
Convert a line from coverage data into an option of FileCov struct
§Example
use coverage2lcov::FileCov;
let s = "src/lib/config.rs 35 23 34% 6, 12, 21-23, 30-54";
let fc = FileCov::try_from(s).unwrap();
assert_eq!(fc, FileCov{
file: String::from("src/lib/config.rs"),
stmt_count: 35,
miss_count: 23,
covered_percent: 34,
missed_sections: vec![6..=6, 12..=12, 21..=23, 30..=54]
});impl Eq for FileCov
impl StructuralPartialEq for FileCov
Auto Trait Implementations§
impl Freeze for FileCov
impl RefUnwindSafe for FileCov
impl Send for FileCov
impl Sync for FileCov
impl Unpin for FileCov
impl UnwindSafe for FileCov
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