-
Notifications
You must be signed in to change notification settings - Fork 567
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
Add inspection utility methods to Env and Key #880
Conversation
2fcbb6e
to
55ac520
Compare
These are intended for debugging and theme manipulation, not general use.
if let Some(value) = self.0.map.get(key.key) { | ||
value | ||
} else { | ||
panic!("key for {} not found", key.key) |
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.
Let's document panic conditions under the Panics header. Take a look at some of the other functions here like try_get
.
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.
Looks ok.
/// | ||
/// *WARNING:* This is not intended for general use, but only for inspecting an `Env` e.g. | ||
/// for debugging, theme editing, and theme loading. | ||
pub fn get_all(&self) -> impl ExactSizeIterator<Item = (&String, &Value)> { |
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.
a little late to the game but I might've just called this iter
or iter_raw
or something. 🤷
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.
Ah. Hm. That might have made some idiomatic sense. No reason not to change it. I'll try to find some time this weekend.
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.
no pressure, just an observation!
These are intended for debugging and theme manipulation, not general use.