pub trait StatusExt {
// Required methods
fn to_result(self) -> Result;
fn to_result_with_val<T>(self, val: impl FnOnce() -> T) -> Result<T, ()>;
fn to_result_with_err<ErrData: Debug>(
self,
err: impl FnOnce(Status) -> ErrData
) -> Result<(), ErrData>;
fn to_result_with<T, ErrData: Debug>(
self,
val: impl FnOnce() -> T,
err: impl FnOnce(Status) -> ErrData
) -> Result<T, ErrData>;
}
Expand description
Extension trait which provides some convenience methods for Status
.
Required Methods§
sourcefn to_result(self) -> Result
fn to_result(self) -> Result
Converts this status code into a uefi::Result
.
If the status does not indicate success, the status representing the specific error
code is embedded into the Err
variant of type uefi::Error
.
sourcefn to_result_with_val<T>(self, val: impl FnOnce() -> T) -> Result<T, ()>
fn to_result_with_val<T>(self, val: impl FnOnce() -> T) -> Result<T, ()>
Converts this status code into a uefi::Result
with a given Ok
value.
If the status does not indicate success, the status representing the specific error
code is embedded into the Err
variant of type uefi::Error
.
sourcefn to_result_with_err<ErrData: Debug>(
self,
err: impl FnOnce(Status) -> ErrData
) -> Result<(), ErrData>
fn to_result_with_err<ErrData: Debug>( self, err: impl FnOnce(Status) -> ErrData ) -> Result<(), ErrData>
Converts this status code into a uefi::Result
with a given Err
payload.
If the status does not indicate success, the status representing the specific error
code is embedded into the Err
variant of type uefi::Error
.
sourcefn to_result_with<T, ErrData: Debug>(
self,
val: impl FnOnce() -> T,
err: impl FnOnce(Status) -> ErrData
) -> Result<T, ErrData>
fn to_result_with<T, ErrData: Debug>( self, val: impl FnOnce() -> T, err: impl FnOnce(Status) -> ErrData ) -> Result<T, ErrData>
Convert this status code into a result with a given Ok
value and Err
payload.
If the status does not indicate success, the status representing the specific error
code is embedded into the Err
variant of type uefi::Error
.