Type Definition 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.

Trait Implementations§

source§

impl From<Status> for Result<(), ()>

source§

fn from(status: Status) -> Result<(), ()>

Converts to this type from the input type.
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