File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -207,18 +207,37 @@ impl AsRef<[u8]> for AsciiStr {
207
207
self . as_bytes ( )
208
208
}
209
209
}
210
-
211
210
impl AsRef < str > for AsciiStr {
212
211
fn as_ref ( & self ) -> & str {
213
212
self . as_str ( )
214
213
}
215
214
}
215
+ impl AsRef < [ Ascii ] > for AsciiStr {
216
+ fn as_ref ( & self ) -> & [ Ascii ] {
217
+ & self . slice
218
+ }
219
+ }
220
+ impl AsMut < [ Ascii ] > for AsciiStr {
221
+ fn as_mut ( & mut self ) -> & mut [ Ascii ] {
222
+ & mut self . slice
223
+ }
224
+ }
216
225
226
+ impl Default for & ' static AsciiStr {
227
+ fn default ( ) -> & ' static AsciiStr {
228
+ unsafe { "" . into_ascii_unchecked ( ) }
229
+ }
230
+ }
217
231
impl < ' a > From < & ' a [ Ascii ] > for & ' a AsciiStr {
218
232
fn from ( slice : & [ Ascii ] ) -> & AsciiStr {
219
233
unsafe { mem:: transmute ( slice) }
220
234
}
221
235
}
236
+ impl < ' a > From < & ' a mut [ Ascii ] > for & ' a mut AsciiStr {
237
+ fn from ( slice : & mut [ Ascii ] ) -> & mut AsciiStr {
238
+ unsafe { mem:: transmute ( slice) }
239
+ }
240
+ }
222
241
impl From < Box < [ Ascii ] > > for Box < AsciiStr > {
223
242
fn from ( owned : Box < [ Ascii ] > ) -> Box < AsciiStr > {
224
243
unsafe { mem:: transmute ( owned) }
You can’t perform that action at this time.
0 commit comments