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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
use crossbeam::channel::{Receiver, Sender}; use rustc_hash::FxHashMap; use std::cell::RefCell; use std::collections::{BTreeMap, BTreeSet}; use std::path::PathBuf; use std::rc::Rc; use std::sync::Mutex; #[derive(Debug, Clone, PartialEq)] pub struct Function { pub start: u32, pub executed: bool, } #[derive(Debug, Clone, PartialEq)] pub struct CovResult { pub lines: BTreeMap<u32, u64>, pub branches: BTreeMap<u32, Vec<bool>>, pub functions: FunctionMap, } #[derive(Debug, PartialEq, Copy, Clone)] #[allow(non_camel_case_types)] pub enum ItemFormat { GCNO, INFO, JACOCO_XML, } #[derive(Debug)] pub struct GcnoBuffers { pub stem: String, pub gcno_buf: Vec<u8>, pub gcda_buf: Vec<Vec<u8>>, } #[derive(Debug)] pub enum ItemType { Path((String, PathBuf)), Content(Vec<u8>), Buffers(GcnoBuffers), } #[derive(Debug)] pub struct WorkItem { pub format: ItemFormat, pub item: ItemType, pub name: String, } pub type FunctionMap = FxHashMap<String, Function>; pub type JobReceiver = Receiver<Option<WorkItem>>; pub type JobSender = Sender<Option<WorkItem>>; pub type CovResultMap = FxHashMap<String, CovResult>; pub type SyncCovResultMap = Mutex<CovResultMap>; pub type CovResultIter = Box<Iterator<Item = (PathBuf, PathBuf, CovResult)>>; #[derive(Debug, Default)] pub struct CDStats { pub total: usize, pub covered: usize, pub missed: usize, pub percent: f64, } #[derive(Debug)] pub struct CDFileStats { pub name: String, pub stats: CDStats, pub coverage: Vec<i64>, } #[derive(Debug)] pub struct CDDirStats { pub name: String, pub files: Vec<CDFileStats>, pub dirs: Vec<Rc<RefCell<CDDirStats>>>, pub stats: CDStats, } #[derive(Debug)] pub struct HtmlItem { pub abs_path: PathBuf, pub rel_path: PathBuf, pub result: CovResult, } #[derive(Clone, Debug, Default)] pub struct HtmlStats { pub total_lines: usize, pub covered_lines: usize, pub total_funs: usize, pub covered_funs: usize, } #[derive(Clone, Debug)] pub struct HtmlFileStats { pub file_name: String, pub stats: HtmlStats, } #[derive(Clone, Debug)] pub struct HtmlDirStats { pub files: BTreeSet<HtmlFileStats>, pub stats: HtmlStats, } #[derive(Debug, Default)] pub struct HtmlGlobalStats { pub dirs: BTreeMap<String, HtmlDirStats>, pub stats: HtmlStats, } pub type HtmlJobReceiver = Receiver<Option<HtmlItem>>; pub type HtmlJobSender = Sender<Option<HtmlItem>>;