use std::convert:: { From };
use std::option:: { Option };
use parser:: { parse_record };
#[derive(Debug, PartialEq, Clone)]
pub enum LCOVRecord
{
TestName(Option<String>), SourceFile(String), Data(LineData), FunctionName(FunctionName), FunctionData(FunctionData), FunctionsFound(u32), FunctionsHit(u32), LinesHit(u32), LinesFound(u32), BranchData(BranchData), BranchesFound(u32), BranchesHit(u32), EndOfRecord }
#[derive(Debug, PartialEq, Clone)]
pub struct LineData {
pub line: u32,
pub count: u32,
pub checksum: Option<String> }
#[derive(Debug, PartialEq, Clone)]
pub struct FunctionName {
pub name: String,
pub line: u32
}
#[derive(Debug, PartialEq, Clone)]
pub struct FunctionData {
pub name: String,
pub count: u32
}
#[derive(Debug, PartialEq, Clone)]
pub struct BranchData {
pub line: u32,
pub block: u32,
pub branch: u32,
pub taken: u32
}
impl<'a> From<&'a str> for LCOVRecord {
fn from(input: &'a str) -> Self {
parse_record(input).unwrap()
}
}
impl From<LineData> for LCOVRecord {
fn from(input: LineData) -> Self {
LCOVRecord::Data(input)
}
}
impl From<FunctionName> for LCOVRecord {
fn from(input: FunctionName) -> Self {
LCOVRecord::FunctionName(input)
}
}
impl From<FunctionData> for LCOVRecord {
fn from(input: FunctionData) -> Self {
LCOVRecord::FunctionData(input)
}
}
impl From<BranchData> for LCOVRecord {
fn from(input: BranchData) -> Self {
LCOVRecord::BranchData(input)
}
}