Add summary
This commit is contained in:
21
src/report.rs
Normal file
21
src/report.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::process::ExitStatus;
|
||||
|
||||
pub type Report = HashMap<String, bool>;
|
||||
|
||||
pub trait Reporter {
|
||||
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report);
|
||||
}
|
||||
|
||||
impl Reporter for ExitStatus {
|
||||
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) {
|
||||
report.insert(key.into().into_owned(), self.success());
|
||||
}
|
||||
}
|
||||
|
||||
impl Reporter for bool {
|
||||
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) {
|
||||
report.insert(key.into().into_owned(), *self);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user