Skip to main content

Fired

Struct Fired 

Source
pub struct Fired { /* private fields */ }
Expand description

Which rules fired, over one function or over a whole compilation.

A bit per rule and nothing else. This is on the path of every instruction selected, so what it costs is paid by every compilation whether or not anybody asked for the number, and the cheapest thing that answers the question is a flag per rule set once.

The index of a rule is how this is kept and not how it is written down. An index moves the moment a rule is added above it, so Fired::listing names the rule file and the line instead: a line is a place somebody can open, and a report written by one build can still be read against a rule file that has grown since.

Implementations§

Source§

impl Fired

Source

pub const fn new() -> Fired

Nothing has fired yet.

Source

pub fn mark(&mut self, rule: usize)

Records that the rule at this index fired.

Source

pub fn has(&self, rule: usize) -> bool

Whether the rule at this index fired.

Source

pub fn count(&self) -> usize

How many rules fired.

Source

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

Takes in everything another one recorded.

One compilation is many functions and one command line is many files, and the question is about all of them together. Merging rather than writing a file per function is also what keeps the answer the same however the work was scheduled.

Source

pub fn listing(&self, table: &Table) -> String

What -Zrule-coverage=FILE writes.

One line per rule in the table, in the order the rule file writes them, each saying whether the rule fired and naming the file and line it is written at. Every rule is listed rather than only the ones that fired, so that one of these files says what the whole rule set was as well as what this compilation reached: a reader unioning them over a corpus needs both and would otherwise have to parse the rule file to get the second.

The first line is a comment holding the count, which is the number a person wants and the one thing here that is not worth making them add up.

Trait Implementations§

Source§

impl Clone for Fired

Source§

fn clone(&self) -> Fired

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Fired

Source§

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

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

impl Default for Fired

Source§

fn default() -> Fired

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

impl Eq for Fired

Source§

impl PartialEq for Fired

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Fired

Auto Trait Implementations§

§

impl Freeze for Fired

§

impl RefUnwindSafe for Fired

§

impl Send for Fired

§

impl Sync for Fired

§

impl Unpin for Fired

§

impl UnsafeUnpin for Fired

§

impl UnwindSafe for Fired

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.