Skip to content

Commit ad6b5fe

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

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/result/status.rs

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

58
/// Bit indicating that an UEFI status code is an error
@@ -194,6 +197,15 @@ impl FromResidual for Status {
194197
}
195198
}
196199

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

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

0 commit comments

Comments
 (0)