Struct cargo_tarpaulin::traces::TraceMap

source ·
pub struct TraceMap { /* private fields */ }
Expand description

Stores all the program traces mapped to files and provides an interface to add, query and change traces.

Implementations§

source§

impl TraceMap

source

pub fn new() -> TraceMap

Create a new TraceMap

source

pub fn is_empty(&self) -> bool

Returns true if there are no traces

source

pub fn iter(&self) -> Iter<'_, PathBuf, Vec<Trace>>

Provides an iterator to the underlying map of PathBufs to Vec

source

pub fn merge(&mut self, other: &TraceMap)

Merges the results of one tracemap into the current one. This adds records which are missing and adds the statistics gathered to existing records

source

pub fn dedup(&mut self)

This will collapse duplicate Traces into a single trace. Warning this will lose the addresses of the duplicate traces but increment the results should be called only if you don’t need those addresses from then on TODO possibly not the cleanest solution

source

pub fn add_trace(&mut self, file: &Path, trace: Trace)

Add a trace to the tracemap for the given file

source

pub fn add_file(&mut self, file: &Path)

source

pub fn get_trace(&self, address: u64) -> Option<&Trace>

Gets an immutable reference to a trace from an address. Returns None if there is no trace at that address

source

pub fn increment_hit(&mut self, address: u64)

source

pub fn get_trace_mut(&mut self, address: u64) -> Option<&mut Trace>

Gets a mutable reference to a trace at a given address Returns None if there is no trace at that address

source

pub fn get_location(&self, address: u64) -> Option<Location>

source

pub fn contains_location(&self, file: &Path, line: u64) -> bool

Returns true if the location described by file and line number is present in the tracemap

source

pub fn contains_file(&self, file: &Path) -> bool

Returns true if the file is among the traces

source

pub fn get_child_traces<'a>( &'a self, root: &'a Path ) -> impl Iterator<Item = &'a Trace> + 'a

Gets all traces below a certain path

source

pub fn get_traces<'a>( &'a self, root: &'a Path ) -> impl Iterator<Item = &'a Trace> + 'a

Gets all traces in folder, doesn’t go into other folders for that you want get_child_traces

source

pub fn file_traces_mut(&mut self, file: &Path) -> Option<&mut Vec<Trace>>

source

pub fn all_traces(&self) -> impl Iterator<Item = &Trace>

Gets all traces

source

pub fn files(&self) -> Vec<&PathBuf>

source

pub fn coverable_in_path(&self, path: &Path) -> usize

source

pub fn covered_in_path(&self, path: &Path) -> usize

source

pub fn total_coverable(&self) -> usize

Give the total amount of coverable points in the code. This will vary based on the statistics available for line coverage it will be total lines whereas for condition or decision it will count the number of conditions available

source

pub fn total_covered(&self) -> usize

From all the coverable data return the amount covered

source

pub fn coverage_percentage(&self) -> f64

Returns coverage percentage ranging from 0.0-1.0

Trait Implementations§

source§

impl Debug for TraceMap

source§

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

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

impl Default for TraceMap

source§

fn default() -> TraceMap

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

impl<'de> Deserialize<'de> for TraceMap

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&TraceMap> for CoverageReport

source§

fn from(coverage_data: &TraceMap) -> Self

Converts to this type from the input type.
source§

impl From<&TraceMap> for Result<String, Error>

source§

fn from(val: &TraceMap) -> Self

Converts to this type from the input type.
source§

impl From<&TraceMap> for Vec<SourceFile>

source§

fn from(coverage_data: &TraceMap) -> Self

Converts to this type from the input type.
source§

impl Serialize for TraceMap

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,