File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,12 @@ impl Status {
131
131
132
132
/// Extension trait which provides some convenience methods for [`Status`].
133
133
pub trait StatusExt {
134
+ /// Converts this status code into a [`uefi::Result`].
135
+ ///
136
+ /// If the status does not indicate success, the status representing the specific error
137
+ /// code is embedded into the `Err` variant of type [`uefi::Error`].
138
+ fn to_result ( self ) -> Result ;
139
+
134
140
/// Converts this status code into a [`uefi::Result`] with a given `Ok` value.
135
141
///
136
142
/// If the status does not indicate success, the status representing the specific error
@@ -158,6 +164,15 @@ pub trait StatusExt {
158
164
}
159
165
160
166
impl StatusExt for Status {
167
+ #[ inline]
168
+ fn to_result ( self ) -> Result {
169
+ if self . is_success ( ) {
170
+ Ok ( ( ) )
171
+ } else {
172
+ Err ( self . into ( ) )
173
+ }
174
+ }
175
+
161
176
#[ inline]
162
177
fn to_result_with_val < T > ( self , val : impl FnOnce ( ) -> T ) -> Result < T , ( ) > {
163
178
if self . is_success ( ) {
You can’t perform that action at this time.
0 commit comments