-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlib.rs
42 lines (38 loc) · 1009 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::instrumentation_profile::types::InstrumentationProfile;
use std::path::Path;
pub mod coverage;
mod hash_table;
pub mod instrumentation_profile;
pub mod summary;
pub mod util;
pub use crate::instrumentation_profile::{parse, parse_bytes};
pub use coverage::coverage_mapping::CoverageMapping;
pub use coverage::reporting::*;
pub use coverage::*;
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum ProfileFormat {
Binary,
CompactBinary,
ExtBinary,
Text,
Gcc,
}
pub fn merge_profiles<T>(files: &[T]) -> std::io::Result<InstrumentationProfile>
where
T: AsRef<Path>,
{
if files.is_empty() {
Ok(InstrumentationProfile::default())
} else {
let mut profiles = vec![];
for input in files {
let profile = parse(input)?;
profiles.push(profile);
}
let mut base = profiles.remove(0);
for profile in &profiles {
base.merge(profile);
}
Ok(base)
}
}