File tree 1 file changed +16
-7
lines changed
1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use alloc::vec::Vec;
3
3
use core:: borrow:: Borrow ;
4
4
use core:: fmt:: { Formatter , Write } ;
5
5
use core:: mem:: transmute;
6
+ use core:: ops:: Deref ;
6
7
use core:: slice:: { from_raw_parts, IterMut } ;
7
8
use core:: str:: FromStr ;
8
9
@@ -163,9 +164,23 @@ impl FromStr for EfiString {
163
164
}
164
165
}
165
166
167
+ impl Deref for EfiString {
168
+ type Target = EfiStr ;
169
+
170
+ fn deref ( & self ) -> & Self :: Target {
171
+ unsafe { EfiStr :: new_unchecked ( & self . 0 ) }
172
+ }
173
+ }
174
+
166
175
impl AsRef < EfiStr > for EfiString {
167
176
fn as_ref ( & self ) -> & EfiStr {
168
- self . borrow ( )
177
+ self . deref ( )
178
+ }
179
+ }
180
+
181
+ impl Borrow < EfiStr > for EfiString {
182
+ fn borrow ( & self ) -> & EfiStr {
183
+ self . deref ( )
169
184
}
170
185
}
171
186
@@ -181,12 +196,6 @@ impl<'a> IntoIterator for &'a mut EfiString {
181
196
}
182
197
}
183
198
184
- impl Borrow < EfiStr > for EfiString {
185
- fn borrow ( & self ) -> & EfiStr {
186
- unsafe { EfiStr :: new_unchecked ( & self . 0 ) }
187
- }
188
- }
189
-
190
199
/// A non-NUL character in the EFI string.
191
200
#[ repr( transparent) ]
192
201
pub struct EfiChar ( u16 ) ;
You can’t perform that action at this time.
0 commit comments