-
Notifications
You must be signed in to change notification settings - Fork 156
register iterator #512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
register iterator #512
Conversation
r? @therealprof (rust-highfive has picked a reviewer for you, use r? to override) |
src/generate/register.rs
Outdated
@@ -1101,10 +1101,10 @@ fn lookup_in_peripheral<'p>( | |||
base_register: &'p str, | |||
base_field: &str, | |||
base_evs: &str, | |||
all_registers: &[&'p Register], | |||
mut all_registers: impl Iterator<Item = &'p Register>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, why is this mut
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because iteration is mutable one-off operation.
If it is hard to read, I can bring vector and slice back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, don't we have a concrete borrowable type for all Registers to pass in? I would expect that can build something like a RegisterMap
and pass a reference to it around allowing called functions to obtain their own iter
to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've restored previous behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bors r+
No description provided.