[][src]Enum lcov::record::Record

pub enum Record {
    TestName {
        name: String,
    },
    SourceFile {
        path: PathBuf,
    },
    FunctionName {
        name: String,
        start_line: u32,
    },
    FunctionData {
        name: String,
        count: u64,
    },
    FunctionsFound {
        found: u32,
    },
    FunctionsHit {
        hit: u32,
    },
    BranchData {
        line: u32,
        block: u32,
        branch: u32,
        taken: Option<u64>,
    },
    BranchesFound {
        found: u32,
    },
    BranchesHit {
        hit: u32,
    },
    LineData {
        line: u32,
        count: u64,
        checksum: Option<String>,
    },
    LinesFound {
        found: u32,
    },
    LinesHit {
        hit: u32,
    },
    EndOfRecord,
}

Represents all kinds of LCOV records.

This struct can be created by parsing an LCOV record string by parse method (provided by the FromStr trait). This struct can be converted into an LCOV record string by to_string method (provided by the ToString trait).

See those documentation for more.

Variants

TestName

Represents a TN record.

Examples

use lcov::Record;
assert_eq!("TN:test_name".parse(), Ok(Record::TestName { name: "test_name".into() }));

Fields of TestName

name: String

test name

SourceFile

Represents a SF record.

Examples

use lcov::Record;
assert_eq!("SF:/usr/include/stdio.h".parse(),
           Ok(Record::SourceFile { path: "/usr/include/stdio.h".into() }));

Fields of SourceFile

path: PathBuf

Absolute path to the source file.

FunctionName

Represents a FN record.

Examples

use lcov::Record;
assert_eq!("FN:10,main".parse(),
           Ok(Record::FunctionName { name: "main".into(), start_line: 10 }));

Fields of FunctionName

name: String

Function name.

start_line: u32

Line number of function start.

FunctionData

Represents a FNDA record.

Examples

use lcov::Record;
assert_eq!("FNDA:1,main".parse(),
           Ok(Record::FunctionData { name: "main".into(), count: 1 }));

Fields of FunctionData

name: String

Function name.

count: u64

Execution count.

FunctionsFound

Represents a FNF record.

Examples

use lcov::Record;
assert_eq!("FNF:10".parse(), Ok(Record::FunctionsFound { found: 10 }));

Fields of FunctionsFound

found: u32

Number of functions found.

FunctionsHit

Represents a FNH record.

Examples

use lcov::Record;
assert_eq!("FNH:7".parse(), Ok(Record::FunctionsHit { hit: 7 }));

Fields of FunctionsHit

hit: u32

Number of functions hit.

BranchData

Represents a BRDA record.

block and branch are gcc internal IDs for the branch.

Examples

use lcov::Record;
assert_eq!("BRDA:10,30,40,-".parse(),
           Ok(Record::BranchData { line: 10, block: 30, branch: 40, taken: None }));
assert_eq!("BRDA:10,30,40,3".parse(),
           Ok(Record::BranchData { line: 10, block: 30, branch: 40, taken: Some(3) }));

Fields of BranchData

line: u32

Line number.

block: u32

Block number.

branch: u32

Branch number.

taken: Option<u64>

A number indicating how often that branch was taken.

BranchesFound

Represents a BRF record.

Examples

use lcov::Record;
assert_eq!("BRF:40".parse(), Ok(Record::BranchesFound { found: 40 }));

Fields of BranchesFound

found: u32

Number of branches found.

BranchesHit

Represents a BRH record.

Examples

use lcov::Record;
assert_eq!("BRH:20".parse(), Ok(Record::BranchesHit { hit: 20 }));

Fields of BranchesHit

hit: u32

Number of branches hit.

LineData

Represents a DA record.

Examples

use lcov::Record;
assert_eq!("DA:8,30".parse(), Ok(Record::LineData { line: 8, count: 30, checksum: None }));
assert_eq!("DA:8,30,asdfasdf".parse(),
           Ok(Record::LineData { line: 8, count: 30, checksum: Some("asdfasdf".into()) }));

Fields of LineData

line: u32

Line number.

count: u64

Execution count.

checksum: Option<String>

Checksum for each instrumented line.

LinesFound

Represents a LF record.

Examples

use lcov::Record;
assert_eq!("LF:123".parse(), Ok(Record::LinesFound { found: 123 }));

Fields of LinesFound

found: u32

Number of instrumented line.

LinesHit

Represents a LH record.

Examples

use lcov::Record;
assert_eq!("LH:45".parse(), Ok(Record::LinesHit { hit: 45 }));

Fields of LinesHit

hit: u32

Number of lines with a non-zero execution count.

EndOfRecord

Represents a end_of_record record.

Examples

use lcov::Record;
assert_eq!("end_of_record".parse(), Ok(Record::EndOfRecord));

Implementations

impl Record[src]

pub fn kind(&self) -> RecordKind[src]

Returns the corresponding RecordKind for this record.

Examples

use lcov::{Record, RecordKind};
let rec = Record::LinesHit { hit: 32 };
assert_eq!(rec.kind(), RecordKind::LinesHit);

Trait Implementations

impl Clone for Record[src]

impl Debug for Record[src]

impl Display for Record[src]

impl Eq for Record[src]

impl FromStr for Record[src]

type Err = ParseRecordError

The associated error which can be returned from parsing.

impl Ord for Record[src]

impl PartialEq<Record> for Record[src]

impl PartialOrd<Record> for Record[src]

impl StructuralEq for Record[src]

impl StructuralPartialEq for Record[src]

Auto Trait Implementations

impl RefUnwindSafe for Record

impl Send for Record

impl Sync for Record

impl Unpin for Record

impl UnwindSafe for Record

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.