diff --git a/verifier/src/lib.rs b/verifier/src/lib.rs index c4cb474..af08115 100644 --- a/verifier/src/lib.rs +++ b/verifier/src/lib.rs @@ -457,6 +457,19 @@ impl std::iter::IntoIterator for MeasurementSet { } } +impl std::fmt::Display for MeasurementSet { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "measurement set")?; + for m in &self.0 { + writeln!(f, " {}", m)?; + } + if self.0.is_empty() { + writeln!(f, "(set is empty)")?; + } + Ok(()) + } +} + /// A collection of measurement values that is used as a source of truth when /// appraising the set of measurements derived from an attestation. pub struct ReferenceMeasurements(pub(crate) HashSet); @@ -488,6 +501,19 @@ impl TryFrom<&[Corim]> for ReferenceMeasurements { } } +impl std::fmt::Display for ReferenceMeasurements { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "Reference measurements")?; + for m in &self.0 { + writeln!(f, " {}", m)?; + } + if self.0.is_empty() { + writeln!(f, "(set is empty)")?; + } + Ok(()) + } +} + /// Errors produced by the `verify_attestation` function #[derive(Debug, Error)] pub enum VerifyAttestationError {