@@ -21,7 +21,7 @@ pub struct Buf {
21
21
}
22
22
23
23
#[ repr( transparent) ]
24
- pub struct Slice {
24
+ pub struct OsSlice {
25
25
pub inner : [ u8 ] ,
26
26
}
27
27
@@ -56,13 +56,13 @@ impl fmt::Display for Buf {
56
56
}
57
57
}
58
58
59
- impl fmt:: Debug for Slice {
59
+ impl fmt:: Debug for OsSlice {
60
60
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
61
61
fmt:: Debug :: fmt ( & self . inner . utf8_chunks ( ) . debug ( ) , f)
62
62
}
63
63
}
64
64
65
- impl fmt:: Display for Slice {
65
+ impl fmt:: Display for OsSlice {
66
66
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
67
67
// If we're the empty string then our iterator won't actually yield
68
68
// anything, so perform the formatting manually
@@ -135,7 +135,7 @@ impl Buf {
135
135
}
136
136
137
137
#[ inline]
138
- pub fn push_slice ( & mut self , s : & Slice ) {
138
+ pub fn push_slice ( & mut self , s : & OsSlice ) {
139
139
self . inner . extend_from_slice ( & s. inner )
140
140
}
141
141
@@ -175,44 +175,44 @@ impl Buf {
175
175
}
176
176
177
177
#[ inline]
178
- pub fn as_slice ( & self ) -> & Slice {
179
- // SAFETY: Slice just wraps [u8],
178
+ pub fn as_slice ( & self ) -> & OsSlice {
179
+ // SAFETY: OsSlice just wraps [u8],
180
180
// and &*self.inner is &[u8], therefore
181
- // transmuting &[u8] to &Slice is safe.
181
+ // transmuting &[u8] to &OsSlice is safe.
182
182
unsafe { mem:: transmute ( self . inner . as_slice ( ) ) }
183
183
}
184
184
185
185
#[ inline]
186
- pub fn as_mut_slice ( & mut self ) -> & mut Slice {
187
- // SAFETY: Slice just wraps [u8],
186
+ pub fn as_mut_slice ( & mut self ) -> & mut OsSlice {
187
+ // SAFETY: OsSlice just wraps [u8],
188
188
// and &mut *self.inner is &mut [u8], therefore
189
- // transmuting &mut [u8] to &mut Slice is safe.
189
+ // transmuting &mut [u8] to &mut OsSlice is safe.
190
190
unsafe { mem:: transmute ( self . inner . as_mut_slice ( ) ) }
191
191
}
192
192
193
193
#[ inline]
194
- pub fn leak < ' a > ( self ) -> & ' a mut Slice {
194
+ pub fn leak < ' a > ( self ) -> & ' a mut OsSlice {
195
195
unsafe { mem:: transmute ( self . inner . leak ( ) ) }
196
196
}
197
197
198
198
#[ inline]
199
- pub fn into_box ( self ) -> Box < Slice > {
199
+ pub fn into_box ( self ) -> Box < OsSlice > {
200
200
unsafe { mem:: transmute ( self . inner . into_boxed_slice ( ) ) }
201
201
}
202
202
203
203
#[ inline]
204
- pub fn from_box ( boxed : Box < Slice > ) -> Buf {
204
+ pub fn from_box ( boxed : Box < OsSlice > ) -> Buf {
205
205
let inner: Box < [ u8 ] > = unsafe { mem:: transmute ( boxed) } ;
206
206
Buf { inner : inner. into_vec ( ) }
207
207
}
208
208
209
209
#[ inline]
210
- pub fn into_arc ( & self ) -> Arc < Slice > {
210
+ pub fn into_arc ( & self ) -> Arc < OsSlice > {
211
211
self . as_slice ( ) . into_arc ( )
212
212
}
213
213
214
214
#[ inline]
215
- pub fn into_rc ( & self ) -> Rc < Slice > {
215
+ pub fn into_rc ( & self ) -> Rc < OsSlice > {
216
216
self . as_slice ( ) . into_rc ( )
217
217
}
218
218
@@ -222,7 +222,7 @@ impl Buf {
222
222
/// # Safety
223
223
///
224
224
/// The length must be at an `OsStr` boundary, according to
225
- /// `Slice ::check_public_boundary`.
225
+ /// `OsSlice ::check_public_boundary`.
226
226
#[ inline]
227
227
pub unsafe fn truncate_unchecked ( & mut self , len : usize ) {
228
228
self . inner . truncate ( len) ;
@@ -240,14 +240,14 @@ impl Buf {
240
240
}
241
241
}
242
242
243
- impl Slice {
243
+ impl OsSlice {
244
244
#[ inline]
245
245
pub fn as_encoded_bytes ( & self ) -> & [ u8 ] {
246
246
& self . inner
247
247
}
248
248
249
249
#[ inline]
250
- pub unsafe fn from_encoded_bytes_unchecked ( s : & [ u8 ] ) -> & Slice {
250
+ pub unsafe fn from_encoded_bytes_unchecked ( s : & [ u8 ] ) -> & OsSlice {
251
251
unsafe { mem:: transmute ( s) }
252
252
}
253
253
@@ -295,8 +295,8 @@ impl Slice {
295
295
}
296
296
297
297
#[ inline]
298
- pub fn from_str ( s : & str ) -> & Slice {
299
- unsafe { Slice :: from_encoded_bytes_unchecked ( s. as_bytes ( ) ) }
298
+ pub fn from_str ( s : & str ) -> & OsSlice {
299
+ unsafe { OsSlice :: from_encoded_bytes_unchecked ( s. as_bytes ( ) ) }
300
300
}
301
301
302
302
#[ inline]
@@ -320,27 +320,27 @@ impl Slice {
320
320
}
321
321
322
322
#[ inline]
323
- pub fn into_box ( & self ) -> Box < Slice > {
323
+ pub fn into_box ( & self ) -> Box < OsSlice > {
324
324
let boxed: Box < [ u8 ] > = self . inner . into ( ) ;
325
325
unsafe { mem:: transmute ( boxed) }
326
326
}
327
327
328
328
#[ inline]
329
- pub fn empty_box ( ) -> Box < Slice > {
329
+ pub fn empty_box ( ) -> Box < OsSlice > {
330
330
let boxed: Box < [ u8 ] > = Default :: default ( ) ;
331
331
unsafe { mem:: transmute ( boxed) }
332
332
}
333
333
334
334
#[ inline]
335
- pub fn into_arc ( & self ) -> Arc < Slice > {
335
+ pub fn into_arc ( & self ) -> Arc < OsSlice > {
336
336
let arc: Arc < [ u8 ] > = Arc :: from ( & self . inner ) ;
337
- unsafe { Arc :: from_raw ( Arc :: into_raw ( arc) as * const Slice ) }
337
+ unsafe { Arc :: from_raw ( Arc :: into_raw ( arc) as * const OsSlice ) }
338
338
}
339
339
340
340
#[ inline]
341
- pub fn into_rc ( & self ) -> Rc < Slice > {
341
+ pub fn into_rc ( & self ) -> Rc < OsSlice > {
342
342
let rc: Rc < [ u8 ] > = Rc :: from ( & self . inner ) ;
343
- unsafe { Rc :: from_raw ( Rc :: into_raw ( rc) as * const Slice ) }
343
+ unsafe { Rc :: from_raw ( Rc :: into_raw ( rc) as * const OsSlice ) }
344
344
}
345
345
346
346
#[ inline]
@@ -375,7 +375,7 @@ impl Slice {
375
375
}
376
376
377
377
#[ unstable( feature = "clone_to_uninit" , issue = "126799" ) ]
378
- unsafe impl CloneToUninit for Slice {
378
+ unsafe impl CloneToUninit for OsSlice {
379
379
#[ inline]
380
380
#[ cfg_attr( debug_assertions, track_caller) ]
381
381
unsafe fn clone_to_uninit ( & self , dst : * mut u8 ) {
0 commit comments