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