Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork175
Add variable key functions touefi::runtime
#1252
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This will allow it to be used in the new runtime module with freestandingfunctions.
The interface is slightly different than in `uefi/src/table/runtime.rs`,where we just have a function to get all keys at once in a `Vec<VariableKey>`.For the new implementation, two interfaces areprovided:`get_next_variable_key` is a low-level interface that does not requirethe `alloc` feature; it's a simple wrapper around `GetNextVariableName`.`variable_keys` is a high-level interface that returns aniterator. (Following the conventions of Rust's std lib, the iteratortype is named `VariableKeys`.) This requires `alloc`.
aca59e9
tobea0fd9
Compare// list as the `RuntimeServices::variable_keys` function. | ||
assert_eq!( | ||
runtime::variable_keys() | ||
.map(|k| k.unwrap()) |
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.
nit: could also befilter_map(core::ops::identity)
I think
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!
4fd9aed
Uh oh!
There was an error while loading.Please reload this page.
The interface is slightly different than in
uefi/src/table/runtime.rs
, where we just have a function to get all keys at once in aVec<VariableKey>
.For the new implementation, two interfaces are provided:
get_next_variable_key
is a low-level interface that does not require thealloc
feature; it's a simple wrapper aroundGetNextVariableName
.variable_keys
is a high-level interface that returns an iterator. (Following the conventions of Rust's std lib, the iterator type is namedVariableKeys
.) This requiresalloc
.Also:
VariableKey
(needed eq for the tests)Checklist