Struct Report

Source
pub struct Report {
    pub sections: Sections,
}
Expand description

An accumulated coverage information from some LCOV tracefiles.

Report is used for merging/filtering the coverage information.

§Examples

Merges LCOV tracefiles and outputs the result in LCOV tracefile format:

use lcov::Report;

let mut report = Report::new();

// Merges a first file.
report.merge(Report::from_file("report_a.info")?)?;

// Merges a second file.
report.merge(Report::from_file("report_b.info")?)?;

// Outputs the merge result in LCOV tracefile format.
for record in report.into_records() {
    println!("{}", record);
}

Fields§

§sections: Sections

Coverage information about every source files.

Implementations§

Source§

impl Report

Source

pub fn new() -> Self

Creates an empty report.

§Examples
use lcov::Report;
let report = Report::new();
Source

pub fn from_reader<I, E>(iter: I) -> Result<Self, ParseError>
where I: IntoIterator<Item = Result<Record, E>>, E: Into<ReadError>,

Creates a report from LCOV record reader.

§Examples
use lcov::{Report, Reader};

let input = "\
TN:test_name
SF:/path/to/source/file.rs
DA:1,2
DA:3,0
DA:5,6
LF:3
LH:2
end_of_record
";
let reader = Reader::new(input.as_bytes());
let report = Report::from_reader(reader)?;
Source

pub fn from_file<P>(path: P) -> Result<Self, ParseError>
where P: AsRef<Path>,

Creates a report from LCOV tracefile.

§Examples
use lcov::Report;

let report = Report::from_file("report.info")?;
Source

pub fn merge(&mut self, other: Self) -> Result<(), MergeError>

Merges a report into self.

§Examples
use lcov::Report;

let mut report = Report::from_file("report1.info")?;
report.merge(Report::from_file("report2.info")?)?;
Source

pub fn merge_lossy(&mut self, other: Self)

Merges a report into self with ignoring an Errors.

§Examples
use lcov::Report;

let mut report = Report::from_file("report1.info")?;
report.merge_lossy(Report::from_file("report2.info")?);
Source

pub fn into_records(self) -> IntoRecords

Creates an iterator which iterates over [LCOV section].

§Examples
use lcov::Report;

let mut report = Report::from_file("report.info")?;
// ... Manipulate report
for record in report.into_records() {
   println!("{}", record);
}

Trait Implementations§

Source§

impl Clone for Report

Source§

fn clone(&self) -> Report

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Report

Source§

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

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

impl Default for Report

Source§

fn default() -> Report

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Report

Source§

fn eq(&self, other: &Report) -> 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 Eq for Report

Source§

impl StructuralPartialEq for Report

Auto Trait Implementations§

§

impl Freeze for Report

§

impl RefUnwindSafe for Report

§

impl Send for Report

§

impl Sync for Report

§

impl Unpin for Report

§

impl UnwindSafe for Report

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.