@@ -308,6 +308,7 @@ impl CString {
308308 /// let _ = CString::from_raw(ptr);
309309 /// }
310310 /// ```
311+ #[ inline]
311312 #[ stable( feature = "cstr_memory" , since = "1.4.0" ) ]
312313 pub fn into_raw ( self ) -> * mut c_char {
313314 Box :: into_raw ( self . into_inner ( ) ) as * mut c_char
@@ -382,6 +383,7 @@ impl CString {
382383 /// let bytes = c_string.as_bytes();
383384 /// assert_eq!(bytes, &[b'f', b'o', b'o']);
384385 /// ```
386+ #[ inline]
385387 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
386388 pub fn as_bytes ( & self ) -> & [ u8 ] {
387389 & self . inner [ ..self . inner . len ( ) - 1 ]
@@ -401,6 +403,7 @@ impl CString {
401403 /// let bytes = c_string.as_bytes_with_nul();
402404 /// assert_eq!(bytes, &[b'f', b'o', b'o', b'\0']);
403405 /// ```
406+ #[ inline]
404407 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
405408 pub fn as_bytes_with_nul ( & self ) -> & [ u8 ] {
406409 & self . inner
@@ -409,6 +412,7 @@ impl CString {
409412 /// Extracts a [`CStr`] slice containing the entire string.
410413 ///
411414 /// [`CStr`]: struct.CStr.html
415+ #[ inline]
412416 #[ unstable( feature = "as_c_str" , issue = "40380" ) ]
413417 pub fn as_c_str ( & self ) -> & CStr {
414418 & * self
@@ -449,6 +453,7 @@ impl Drop for CString {
449453impl ops:: Deref for CString {
450454 type Target = CStr ;
451455
456+ #[ inline]
452457 fn deref ( & self ) -> & CStr {
453458 unsafe { CStr :: from_bytes_with_nul_unchecked ( self . as_bytes_with_nul ( ) ) }
454459 }
@@ -463,6 +468,7 @@ impl fmt::Debug for CString {
463468
464469#[ stable( feature = "cstring_into" , since = "1.7.0" ) ]
465470impl From < CString > for Vec < u8 > {
471+ #[ inline]
466472 fn from ( s : CString ) -> Vec < u8 > {
467473 s. into_bytes ( )
468474 }
@@ -498,6 +504,7 @@ impl Default for CString {
498504
499505#[ stable( feature = "cstr_borrow" , since = "1.3.0" ) ]
500506impl Borrow < CStr > for CString {
507+ #[ inline]
501508 fn borrow ( & self ) -> & CStr { self }
502509}
503510
@@ -511,13 +518,15 @@ impl<'a> From<&'a CStr> for Box<CStr> {
511518
512519#[ stable( feature = "c_string_from_box" , since = "1.18.0" ) ]
513520impl From < Box < CStr > > for CString {
521+ #[ inline]
514522 fn from ( s : Box < CStr > ) -> CString {
515523 s. into_c_string ( )
516524 }
517525}
518526
519527#[ stable( feature = "box_from_c_string" , since = "1.18.0" ) ]
520528impl Into < Box < CStr > > for CString {
529+ #[ inline]
521530 fn into ( self ) -> Box < CStr > {
522531 self . into_boxed_c_str ( )
523532 }
@@ -730,6 +739,7 @@ impl CStr {
730739 /// assert_eq!(cstr, &*cstring);
731740 /// }
732741 /// ```
742+ #[ inline]
733743 #[ stable( feature = "cstr_from_bytes" , since = "1.10.0" ) ]
734744 pub unsafe fn from_bytes_with_nul_unchecked ( bytes : & [ u8 ] ) -> & CStr {
735745 mem:: transmute ( bytes)
@@ -772,6 +782,7 @@ impl CStr {
772782 /// *ptr;
773783 /// }
774784 /// ```
785+ #[ inline]
775786 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
776787 pub fn as_ptr ( & self ) -> * const c_char {
777788 self . inner . as_ptr ( )
@@ -789,6 +800,7 @@ impl CStr {
789800 /// > **Note**: This method is currently implemented as a 0-cost cast, but
790801 /// > it is planned to alter its definition in the future to perform the
791802 /// > length calculation whenever this method is called.
803+ #[ inline]
792804 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
793805 pub fn to_bytes ( & self ) -> & [ u8 ] {
794806 let bytes = self . to_bytes_with_nul ( ) ;
@@ -805,6 +817,7 @@ impl CStr {
805817 /// > length calculation whenever this method is called.
806818 ///
807819 /// [`to_bytes`]: #method.to_bytes
820+ #[ inline]
808821 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
809822 pub fn to_bytes_with_nul ( & self ) -> & [ u8 ] {
810823 unsafe { mem:: transmute ( & self . inner ) }
@@ -908,13 +921,15 @@ impl ops::Index<ops::RangeFull> for CString {
908921
909922#[ stable( feature = "cstring_asref" , since = "1.7.0" ) ]
910923impl AsRef < CStr > for CStr {
924+ #[ inline]
911925 fn as_ref ( & self ) -> & CStr {
912926 self
913927 }
914928}
915929
916930#[ stable( feature = "cstring_asref" , since = "1.7.0" ) ]
917931impl AsRef < CStr > for CString {
932+ #[ inline]
918933 fn as_ref ( & self ) -> & CStr {
919934 self
920935 }
0 commit comments