Skip to content

Commit dd38352

Browse files
labbottflihp
authored andcommitted
Implement a few Display traits
1 parent 173a5d1 commit dd38352

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

verifier/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,19 @@ impl std::iter::IntoIterator for MeasurementSet {
457457
}
458458
}
459459

460+
impl std::fmt::Display for MeasurementSet {
461+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
462+
writeln!(f, "measurement set")?;
463+
for m in &self.0 {
464+
writeln!(f, " {}", m)?;
465+
}
466+
if self.0.is_empty() {
467+
writeln!(f, "(set is empty)")?;
468+
}
469+
Ok(())
470+
}
471+
}
472+
460473
/// A collection of measurement values that is used as a source of truth when
461474
/// appraising the set of measurements derived from an attestation.
462475
pub struct ReferenceMeasurements(pub(crate) HashSet<Measurement>);
@@ -488,6 +501,19 @@ impl TryFrom<&[Corim]> for ReferenceMeasurements {
488501
}
489502
}
490503

504+
impl std::fmt::Display for ReferenceMeasurements {
505+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
506+
writeln!(f, "Reference measurements")?;
507+
for m in &self.0 {
508+
writeln!(f, " {}", m)?;
509+
}
510+
if self.0.is_empty() {
511+
writeln!(f, "(set is empty)")?;
512+
}
513+
Ok(())
514+
}
515+
}
516+
491517
/// Errors produced by the `verify_attestation` function
492518
#[derive(Debug, Error)]
493519
pub enum VerifyAttestationError {

0 commit comments

Comments
 (0)