Skip to content

Move Status to uefi-raw, along with related API changes #768

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

Merged
merged 7 commits into from
Apr 25, 2023

Conversation

nicholasbishop
Copy link
Member

The main purpose of this change is to move Status to uefi-raw, but doing so requires some changes to the API because only Status is moving to uefi-raw, not Error and the uefi::Result type alias. We could move those types too, but I'd rather not because there are a lot of different ways you could translate from Status to Result, so doesn't feel right to me to put those in uefi-raw.

Since Status is in a different package, the conversion methods from Status to Result have to change. The into_with* methods are moved to a new StatusExt trait in uefi. I also took this opportunity to rename them into_with* to to_result_with*; I've always found the old names a bit hard to read. The impl From<Status> for Result has been changed to StatusExt::to_result, since again we can't impl things cross-package without a separate trait.

All of which is to say, a fair amount of mechanical renaming in this PR :) I expect this won't affect end-users of uefi too much though, since most of our public APIs return Result rather than Status.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

This is in preparation for moving `Status` to uefi-raw. since the `Error` type
and `Result` type alias will not move to uefi-raw, we can't move the `into_with`
methods to uefi-raw. And since we can't impl methods on a type defined in
another crate, we have to move these methods to a new trait.
Slightly more verbose, but easier to read. Also fits better with a `to_result`
function (in the next commit).
This will take the place of into/from for converting from Status to
Result. Again, this is needed in preparation for moving `Status` to uefi-raw.
@nicholasbishop nicholasbishop force-pushed the bishop-move-status-raw branch from c13bf82 to 3cb29d6 Compare April 23, 2023 12:16
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! I like the new names :)

@phip1611 phip1611 merged commit 3ce9ed4 into rust-osdev:main Apr 25, 2023
@nicholasbishop nicholasbishop deleted the bishop-move-status-raw branch June 25, 2023 14:47
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.

2 participants