Skip to content

Commit b13958e

Browse files
committed
Add FromResidual<Result<!, Error>> impl for Status
1 parent 1561f67 commit b13958e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/result/status.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::{Completion, Error, Result};
2-
use core::ops::{ControlFlow, FromResidual, Try};
2+
use core::{convert::Infallible, ops::{ControlFlow, FromResidual, Try}};
33
use core::{fmt::Debug, num::NonZeroUsize};
44

55
/// Bit indicating that an UEFI status code is an error
@@ -194,6 +194,15 @@ impl FromResidual for Status {
194194
}
195195
}
196196

197+
impl FromResidual<core::result::Result<Infallible, Error>> for Status {
198+
fn from_residual(r: core::result::Result<Infallible, Error>) -> Self {
199+
match r {
200+
Err(err) => err.status(),
201+
Ok(infallible) => match infallible {},
202+
}
203+
}
204+
}
205+
197206
// FIXME: This conversion will go away along with usage of the ucs2 crate
198207

199208
impl From<ucs2::Error> for Status {

0 commit comments

Comments
 (0)