Type Alias uefi::Result

source ·
pub type Result<Output = (), ErrData = ()> = Result<Output, Error<ErrData>>;
Expand description

Return type of most UEFI functions. Both success and error payloads are optional.

Almost all UEFI operations provide a status code as an output which indicates either success, a warning, or an error. This type alias maps Status::SUCCESS to the Ok variant (with optional Output data), and maps both warning and error statuses to the Err variant of type Error, which may carry optional inner ErrData.

Warnings are treated as errors by default because they generally indicate an abnormal situation.

Some convenience methods are provided by the ResultExt trait.

Aliased Type§

enum Result<Output = (), ErrData = ()> {
    Ok(Output),
    Err(Error<ErrData>),
}

Variants§

§1.0.0

Ok(Output)

Contains the success value

§1.0.0

Err(Error<ErrData>)

Contains the error value

Trait Implementations§

source§

impl<Output, ErrData: Debug> ResultExt<Output, ErrData> for Result<Output, ErrData>

source§

fn status(&self) -> Status

Extract the UEFI status from this result
source§

fn discard_errdata(self) -> Result<Output>

Transform the ErrData value to ()
source§

fn handle_warning<O>(self, op: O) -> Result<Output, ErrData>
where O: FnOnce(Error<ErrData>) -> Result<Output, ErrData>,

Calls op if the result contains a warning, otherwise returns the result unchanged. Read more