diff --git a/src/result/status.rs b/src/result/status.rs index 81699c96b..fa31077bb 100644 --- a/src/result/status.rs +++ b/src/result/status.rs @@ -1,5 +1,8 @@ use super::{Completion, Error, Result}; -use core::ops::{ControlFlow, FromResidual, Try}; +use core::{ + convert::Infallible, + ops::{ControlFlow, FromResidual, Try}, +}; use core::{fmt::Debug, num::NonZeroUsize}; /// Bit indicating that an UEFI status code is an error @@ -194,6 +197,15 @@ impl FromResidual for Status { } } +impl FromResidual> for Status { + fn from_residual(r: core::result::Result) -> Self { + match r { + Err(err) => err.status(), + Ok(infallible) => match infallible {}, + } + } +} + // FIXME: This conversion will go away along with usage of the ucs2 crate impl From for Status { diff --git a/src/table/boot.rs b/src/table/boot.rs index e66d17e60..268f1bddc 100644 --- a/src/table/boot.rs +++ b/src/table/boot.rs @@ -1,8 +1,10 @@ //! UEFI services available during boot. use super::Header; -use crate::proto::{device_path::DevicePath, loaded_image::LoadedImage, Protocol}; -use crate::{data_types::Align, proto::media::fs::SimpleFileSystem}; +use crate::data_types::Align; +use crate::proto::{device_path::DevicePath, Protocol}; +#[cfg(feature = "exts")] +use crate::proto::{loaded_image::LoadedImage, media::fs::SimpleFileSystem}; use crate::{Event, Guid, Handle, Result, Status}; #[cfg(feature = "exts")] use alloc_api::vec::Vec;