uefi: Rewrite error handling
Enums in Rust are not extensible. EFI_STATUS
must be able to be
constructed from and represent any unsigned value. Remove enum Error
,
which only represents values defined in UEFI Appendix D, and use
Status
, which can represent any EFI_STATUS
, for errors in Result.
One trade off is it limits the use of ?
when converting Status
from
a call to a UEFI API to a Result<T>
, such as when used in a Rust
function that wraps the UEFI call. (Converting from Result<T>
to
Status
is always possible though.)
Other crates may now define Status
to use with Result<T>
, such as
any defined in UEFI PI specification (if it even does) or custom OEM
values defined in e.g. UEFI applications using the crate.
The use of nightly features try_trait_v2
and control_flow_enum
are
removed, allowing the base crate to be compiled using a stable
toolchain.
Ref: UEFI Specification, Version 2.9: Appendix D - Status Codes