sbom_walker/report/
mod.rs1pub mod check;
2
3use parking_lot::Mutex;
4use std::{collections::BTreeMap, sync::Arc};
5
6#[derive(Clone, Debug)]
7pub struct ReportResult<'d> {
8 pub errors: &'d BTreeMap<String, Vec<String>>,
9 pub total: usize,
10}
11
12pub trait ReportSink {
13 fn error(&self, msg: String);
14}
15
16impl ReportSink for () {
18 fn error(&self, _msg: String) {}
19}
20
21impl ReportSink for (String, Arc<Mutex<BTreeMap<String, Vec<String>>>>) {
22 fn error(&self, msg: String) {
23 self.1.lock().entry(self.0.clone()).or_default().push(msg);
24 }
25}
26
27impl ReportSink for (&'_ str, Arc<Mutex<BTreeMap<String, Vec<String>>>>) {
28 fn error(&self, msg: String) {
29 self.1
30 .lock()
31 .entry(self.0.to_string())
32 .or_default()
33 .push(msg);
34 }
35}