Skip to content
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

Merged
merged 3 commits into from
May 5, 2020

Conversation

Zarenor
Copy link
Collaborator

@Zarenor Zarenor commented Apr 28, 2020

These are intended for debugging and theme manipulation, not general use.

druid/src/env.rs Outdated Show resolved Hide resolved
druid/src/env.rs Show resolved Hide resolved
@xStrom xStrom added the S-needs-review waits for review label Apr 29, 2020
@Zarenor Zarenor force-pushed the master branch 2 times, most recently from 2fcbb6e to 55ac520 Compare May 2, 2020 00:42
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)
Copy link
Member

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.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Looks ok.

@Zarenor Zarenor merged commit 02c4ee0 into linebender:master May 5, 2020
///
/// *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)> {
Copy link
Member

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. 🤷

Copy link
Collaborator Author

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.

Copy link
Member

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!

@xStrom xStrom removed the S-needs-review waits for review label May 15, 2020
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.

None yet

3 participants