@@ -111,6 +111,7 @@ impl OsString {
111
111
/// let os_string = OsString::new();
112
112
/// ```
113
113
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
114
+ #[ inline]
114
115
pub fn new ( ) -> OsString {
115
116
OsString { inner : Buf :: from_string ( String :: new ( ) ) }
116
117
}
@@ -127,6 +128,7 @@ impl OsString {
127
128
/// assert_eq!(os_string.as_os_str(), os_str);
128
129
/// ```
129
130
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
131
+ #[ inline]
130
132
pub fn as_os_str ( & self ) -> & OsStr {
131
133
self
132
134
}
@@ -145,6 +147,7 @@ impl OsString {
145
147
/// assert_eq!(string, Ok(String::from("foo")));
146
148
/// ```
147
149
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
150
+ #[ inline]
148
151
pub fn into_string ( self ) -> Result < String , OsString > {
149
152
self . inner . into_string ( ) . map_err ( |buf| OsString { inner : buf } )
150
153
}
@@ -163,6 +166,7 @@ impl OsString {
163
166
/// assert_eq!(&os_string, "foobar");
164
167
/// ```
165
168
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
169
+ #[ inline]
166
170
pub fn push < T : AsRef < OsStr > > ( & mut self , s : T ) {
167
171
self . inner . push_slice ( & s. as_ref ( ) . inner )
168
172
}
@@ -189,6 +193,7 @@ impl OsString {
189
193
/// assert_eq!(capacity, os_string.capacity());
190
194
/// ```
191
195
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
196
+ #[ inline]
192
197
pub fn with_capacity ( capacity : usize ) -> OsString {
193
198
OsString { inner : Buf :: with_capacity ( capacity) }
194
199
}
@@ -207,6 +212,7 @@ impl OsString {
207
212
/// assert_eq!(&os_string, "");
208
213
/// ```
209
214
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
215
+ #[ inline]
210
216
pub fn clear ( & mut self ) {
211
217
self . inner . clear ( )
212
218
}
@@ -224,6 +230,7 @@ impl OsString {
224
230
/// assert!(os_string.capacity() >= 10);
225
231
/// ```
226
232
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
233
+ #[ inline]
227
234
pub fn capacity ( & self ) -> usize {
228
235
self . inner . capacity ( )
229
236
}
@@ -243,6 +250,7 @@ impl OsString {
243
250
/// assert!(s.capacity() >= 10);
244
251
/// ```
245
252
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
253
+ #[ inline]
246
254
pub fn reserve ( & mut self , additional : usize ) {
247
255
self . inner . reserve ( additional)
248
256
}
@@ -265,6 +273,7 @@ impl OsString {
265
273
/// assert!(s.capacity() >= 10);
266
274
/// ```
267
275
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
276
+ #[ inline]
268
277
pub fn reserve_exact ( & mut self , additional : usize ) {
269
278
self . inner . reserve_exact ( additional)
270
279
}
@@ -285,6 +294,7 @@ impl OsString {
285
294
/// assert_eq!(3, s.capacity());
286
295
/// ```
287
296
#[ stable( feature = "osstring_shrink_to_fit" , since = "1.19.0" ) ]
297
+ #[ inline]
288
298
pub fn shrink_to_fit ( & mut self ) {
289
299
self . inner . shrink_to_fit ( )
290
300
}
@@ -342,6 +352,7 @@ impl From<String> for OsString {
342
352
/// Converts a [`String`] into a [`OsString`].
343
353
///
344
354
/// The conversion copies the data, and includes an allocation on the heap.
355
+ #[ inline]
345
356
fn from ( s : String ) -> OsString {
346
357
OsString { inner : Buf :: from_string ( s) }
347
358
}
@@ -408,34 +419,39 @@ impl fmt::Debug for OsString {
408
419
409
420
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
410
421
impl PartialEq for OsString {
422
+ #[ inline]
411
423
fn eq ( & self , other : & OsString ) -> bool {
412
424
& * * self == & * * other
413
425
}
414
426
}
415
427
416
428
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
417
429
impl PartialEq < str > for OsString {
430
+ #[ inline]
418
431
fn eq ( & self , other : & str ) -> bool {
419
432
& * * self == other
420
433
}
421
434
}
422
435
423
436
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
424
437
impl PartialEq < OsString > for str {
438
+ #[ inline]
425
439
fn eq ( & self , other : & OsString ) -> bool {
426
440
& * * other == self
427
441
}
428
442
}
429
443
430
444
#[ stable( feature = "os_str_str_ref_eq" , since = "1.29.0" ) ]
431
445
impl PartialEq < & str > for OsString {
446
+ #[ inline]
432
447
fn eq ( & self , other : & & str ) -> bool {
433
448
* * self == * * other
434
449
}
435
450
}
436
451
437
452
#[ stable( feature = "os_str_str_ref_eq" , since = "1.29.0" ) ]
438
453
impl < ' a > PartialEq < OsString > for & ' a str {
454
+ #[ inline]
439
455
fn eq ( & self , other : & OsString ) -> bool {
440
456
* * other == * * self
441
457
}
@@ -539,6 +555,7 @@ impl OsStr {
539
555
/// assert_eq!(os_str.to_str(), Some("foo"));
540
556
/// ```
541
557
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
558
+ #[ inline]
542
559
pub fn to_str ( & self ) -> Option < & str > {
543
560
self . inner . to_str ( )
544
561
}
@@ -589,6 +606,7 @@ impl OsStr {
589
606
/// }
590
607
/// ```
591
608
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
609
+ #[ inline]
592
610
pub fn to_string_lossy ( & self ) -> Cow < ' _ , str > {
593
611
self . inner . to_string_lossy ( )
594
612
}
@@ -605,6 +623,7 @@ impl OsStr {
605
623
/// assert_eq!(os_string, OsString::from("foo"));
606
624
/// ```
607
625
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
626
+ #[ inline]
608
627
pub fn to_os_string ( & self ) -> OsString {
609
628
OsString { inner : self . inner . to_owned ( ) }
610
629
}
@@ -655,6 +674,7 @@ impl OsStr {
655
674
/// ```
656
675
#[ doc( alias = "length" ) ]
657
676
#[ stable( feature = "osstring_simple_functions" , since = "1.9.0" ) ]
677
+ #[ inline]
658
678
pub fn len ( & self ) -> usize {
659
679
self . inner . inner . len ( )
660
680
}
@@ -696,6 +716,7 @@ impl OsStr {
696
716
/// assert_eq!("grÜße, jÜrgen ❤", s);
697
717
/// ```
698
718
#[ unstable( feature = "osstring_ascii" , issue = "70516" ) ]
719
+ #[ inline]
699
720
pub fn make_ascii_lowercase ( & mut self ) {
700
721
self . inner . make_ascii_lowercase ( )
701
722
}
@@ -721,6 +742,7 @@ impl OsStr {
721
742
/// assert_eq!("GRüßE, JüRGEN ❤", s);
722
743
/// ```
723
744
#[ unstable( feature = "osstring_ascii" , issue = "70516" ) ]
745
+ #[ inline]
724
746
pub fn make_ascii_uppercase ( & mut self ) {
725
747
self . inner . make_ascii_uppercase ( )
726
748
}
@@ -784,6 +806,7 @@ impl OsStr {
784
806
/// assert!(!non_ascii.is_ascii());
785
807
/// ```
786
808
#[ unstable( feature = "osstring_ascii" , issue = "70516" ) ]
809
+ #[ inline]
787
810
pub fn is_ascii ( & self ) -> bool {
788
811
self . inner . is_ascii ( )
789
812
}
@@ -811,6 +834,7 @@ impl OsStr {
811
834
812
835
#[ stable( feature = "box_from_os_str" , since = "1.17.0" ) ]
813
836
impl From < & OsStr > for Box < OsStr > {
837
+ #[ inline]
814
838
fn from ( s : & OsStr ) -> Box < OsStr > {
815
839
let rw = Box :: into_raw ( s. inner . into_box ( ) ) as * mut OsStr ;
816
840
unsafe { Box :: from_raw ( rw) }
@@ -832,6 +856,7 @@ impl From<Cow<'_, OsStr>> for Box<OsStr> {
832
856
impl From < Box < OsStr > > for OsString {
833
857
/// Converts a [`Box`]`<`[`OsStr`]`>` into a `OsString` without copying or
834
858
/// allocating.
859
+ #[ inline]
835
860
fn from ( boxed : Box < OsStr > ) -> OsString {
836
861
boxed. into_os_string ( )
837
862
}
@@ -840,6 +865,7 @@ impl From<Box<OsStr>> for OsString {
840
865
#[ stable( feature = "box_from_os_string" , since = "1.20.0" ) ]
841
866
impl From < OsString > for Box < OsStr > {
842
867
/// Converts a [`OsString`] into a [`Box`]`<OsStr>` without copying or allocating.
868
+ #[ inline]
843
869
fn from ( s : OsString ) -> Box < OsStr > {
844
870
s. into_boxed_os_str ( )
845
871
}
@@ -925,6 +951,7 @@ impl<'a> From<Cow<'a, OsStr>> for OsString {
925
951
926
952
#[ stable( feature = "box_default_extra" , since = "1.17.0" ) ]
927
953
impl Default for Box < OsStr > {
954
+ #[ inline]
928
955
fn default ( ) -> Box < OsStr > {
929
956
let rw = Box :: into_raw ( Slice :: empty_box ( ) ) as * mut OsStr ;
930
957
unsafe { Box :: from_raw ( rw) }
@@ -1075,6 +1102,7 @@ impl OsStr {
1075
1102
1076
1103
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1077
1104
impl Borrow < OsStr > for OsString {
1105
+ #[ inline]
1078
1106
fn borrow ( & self ) -> & OsStr {
1079
1107
& self [ ..]
1080
1108
}
@@ -1083,16 +1111,19 @@ impl Borrow<OsStr> for OsString {
1083
1111
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1084
1112
impl ToOwned for OsStr {
1085
1113
type Owned = OsString ;
1114
+ #[ inline]
1086
1115
fn to_owned ( & self ) -> OsString {
1087
1116
self . to_os_string ( )
1088
1117
}
1118
+ #[ inline]
1089
1119
fn clone_into ( & self , target : & mut OsString ) {
1090
1120
self . inner . clone_into ( & mut target. inner )
1091
1121
}
1092
1122
}
1093
1123
1094
1124
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1095
1125
impl AsRef < OsStr > for OsStr {
1126
+ #[ inline]
1096
1127
fn as_ref ( & self ) -> & OsStr {
1097
1128
self
1098
1129
}
@@ -1123,12 +1154,14 @@ impl AsRef<OsStr> for String {
1123
1154
}
1124
1155
1125
1156
impl FromInner < Buf > for OsString {
1157
+ #[ inline]
1126
1158
fn from_inner ( buf : Buf ) -> OsString {
1127
1159
OsString { inner : buf }
1128
1160
}
1129
1161
}
1130
1162
1131
1163
impl IntoInner < Buf > for OsString {
1164
+ #[ inline]
1132
1165
fn into_inner ( self ) -> Buf {
1133
1166
self . inner
1134
1167
}
@@ -1145,6 +1178,7 @@ impl AsInner<Slice> for OsStr {
1145
1178
impl FromStr for OsString {
1146
1179
type Err = core:: convert:: Infallible ;
1147
1180
1181
+ #[ inline]
1148
1182
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
1149
1183
Ok ( OsString :: from ( s) )
1150
1184
}
0 commit comments