Add Display impl for events
This commit is contained in:
parent
608aa516b1
commit
5cbbb7b67f
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
|
fmt,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::ExitStatus,
|
process::ExitStatus,
|
||||||
};
|
};
|
||||||
|
@ -61,3 +62,25 @@ impl Event {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Event {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "Event")?;
|
||||||
|
for p in &self.particulars {
|
||||||
|
match p {
|
||||||
|
Particle::Path(p) => write!(f, " path={}", p.display())?,
|
||||||
|
Particle::Source(s) => write!(f, " source={:?}", s)?,
|
||||||
|
Particle::Process(p) => write!(f, " process={}", p)?,
|
||||||
|
Particle::Signal(s) => write!(f, " signal={:?}", s)?,
|
||||||
|
Particle::ProcessCompletion(None) => write!(f, " command-completed")?,
|
||||||
|
Particle::ProcessCompletion(Some(c)) => write!(f, " command-completed({})", c)?,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.metadata.is_empty() {
|
||||||
|
write!(f, " meta: {:?}", self.metadata)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue