Skip to content

Conversation

nicholasbishop
Copy link
Member

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 are provided:

get_next_variable_key is a low-level interface that does not require the alloc feature; it's a simple wrapper around GetNextVariableName.

variable_keys is a high-level interface that returns an iterator. (Following the conventions of Rust's std lib, the iterator type is named VariableKeys.) This requires alloc.

Also:

  • Add standard derives for VariableKey (needed eq for the tests)

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)
This will allow it to be used in the new runtime module with freestanding functions.
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 are provided: `get_next_variable_key` is a low-level interface that does not require the `alloc` feature; it's a simple wrapper around `GetNextVariableName`. `variable_keys` is a high-level interface that returns an iterator. (Following the conventions of Rust's std lib, the iterator type is named `VariableKeys`.) This requires `alloc`.
@nicholasbishop nicholasbishop force-pushed the bishop-runtime-mod-varkeys-2 branch from aca59e9 to bea0fd9 Compare July 21, 2024 13:08
// list as the `RuntimeServices::variable_keys` function.
assert_eq!(
runtime::variable_keys()
.map(|k| k.unwrap())
Copy link
Member

Choose a reason for hiding this comment

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

nit: could also be filter_map(core::ops::identity) I think

Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

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

LGTM!

@phip1611 phip1611 added this pull request to the merge queue Jul 21, 2024
Merged via the queue into main with commit 4fd9aed Jul 21, 2024
@phip1611 phip1611 deleted the bishop-runtime-mod-varkeys-2 branch July 21, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants