@@ -12,6 +12,12 @@ newtype_enum! {
12
12
/// enum, as injecting an unknown value in a Rust enum is undefined behaviour.
13
13
///
14
14
/// For lack of a better option, we therefore model them as a newtype of usize.
15
+ ///
16
+ /// For a convenient integration into the Rust ecosystem, there are multiple
17
+ /// factory methods to convert a Status into a [`uefi::Result`]:
18
+ /// - [`Status::into_with`]
19
+ /// - [`Status::into_with_val`]
20
+ /// - [`Status::into_with_err`]
15
21
#[ must_use]
16
22
pub enum Status : usize => {
17
23
/// The operation completed successfully.
@@ -122,7 +128,10 @@ impl Status {
122
128
self . 0 & ERROR_BIT != 0
123
129
}
124
130
125
- /// Converts this status code into a result with a given value.
131
+ /// Converts this status code into a [`uefi::Result`] with a given `Ok` value.
132
+ ///
133
+ /// If the status does not indicate success, the status representing the specific error
134
+ /// code is embedded into the `Err` variant of type [`uefi::Error`].
126
135
#[ inline]
127
136
pub fn into_with_val < T > ( self , val : impl FnOnce ( ) -> T ) -> Result < T , ( ) > {
128
137
if self . is_success ( ) {
@@ -132,7 +141,10 @@ impl Status {
132
141
}
133
142
}
134
143
135
- /// Converts this status code into a result with a given error payload
144
+ /// Converts this status code into a [`uefi::Result`] with a given `Err` payload.
145
+ ///
146
+ /// If the status does not indicate success, the status representing the specific error
147
+ /// code is embedded into the `Err` variant of type [`uefi::Error`].
136
148
#[ inline]
137
149
pub fn into_with_err < ErrData : Debug > (
138
150
self ,
@@ -145,7 +157,10 @@ impl Status {
145
157
}
146
158
}
147
159
148
- /// Convert this status code into a result with a given value and error payload
160
+ /// Convert this status code into a result with a given `Ok` value and `Err` payload.
161
+ ///
162
+ /// If the status does not indicate success, the status representing the specific error
163
+ /// code is embedded into the `Err` variant of type [`uefi::Error`].
149
164
#[ inline]
150
165
pub fn into_with < T , ErrData : Debug > (
151
166
self ,
0 commit comments