Skip to content

Conversation

@labbott
Copy link
Contributor

@labbott labbott commented Oct 22, 2025

It's useful to see what the current set of measurements is on device

@labbott
Copy link
Contributor Author

labbott commented Oct 22, 2025

This PR came up while I was doing some debugging for manufacturing programming and I figure if I wanted it once we will probably want it again

It's useful to see what the current set of measurements is on device
@labbott labbott force-pushed the print_measurement_set branch from ac70b56 to 9c4ad21 Compare October 22, 2025 14:53

impl std::iter::IntoIterator for MeasurementSet {
type Item = Measurement;
type IntoIter = <std::collections::HashSet<attest_data::Measurement> as std::iter::IntoIterator>::IntoIter;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what rust suggested, it's possible I could do this in a less obfuscated way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is to define an Iterator for MeasurementSet and then impl IntoIterator in terms of that. This seems fine though, and is less code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HashSet is already in scope here so you save some characters by dropping the std::collections

@labbott labbott requested review from andrewjstone and flihp October 22, 2025 14:54
}

fn measurement_set(attest: &dyn Attest) -> Result<MeasurementSet> {
// get log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: probably don't need this comment


impl std::iter::IntoIterator for MeasurementSet {
type Item = Measurement;
type IntoIter = <std::collections::HashSet<attest_data::Measurement> as std::iter::IntoIterator>::IntoIter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is to define an Iterator for MeasurementSet and then impl IntoIterator in terms of that. This seems fine though, and is less code.

Copy link
Collaborator

@flihp flihp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants