Skip to content

Commit 7787af3

Browse files
blitznicholasbishop
authored andcommitted
Implement Display for uefi::Error
1 parent f0891fa commit 7787af3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

uefi/src/result/error.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::Status;
2-
use core::fmt::Debug;
2+
use core::fmt::{Debug, Display};
33

44
/// Errors emitted from UEFI entry point must propagate erronerous UEFI statuses,
55
/// and may optionally propagate additional entry point-specific data.
@@ -39,3 +39,9 @@ impl From<Status> for Error<()> {
3939
Self { status, data: () }
4040
}
4141
}
42+
43+
impl<Data: Debug + Display> Display for Error<Data> {
44+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45+
write!(f, "UEFI Error {}: {}", self.status(), self.data())
46+
}
47+
}

0 commit comments

Comments
 (0)