FileCov

Struct FileCov 

Source
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: String

name of the tested source file as in the coverage report

§stmt_count: usize

number of statements in the file

§miss_count: usize

number of statements missed in testing

§covered_percent: u8

percentage 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 Debug for FileCov

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FileCov

Outputs data represented by FileCov record in the lcov format

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FileCov

Source§

fn eq(&self, other: &FileCov) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<&str> for FileCov

Source§

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]
});
Source§

type Error = String

The type returned in the event of a conversion error.
Source§

impl Eq for FileCov

Source§

impl StructuralPartialEq for FileCov

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.