@@ -348,6 +348,11 @@ impl OsString {
348
348
349
349
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
350
350
impl From < String > for OsString {
351
+ /// Converts a [`String`] into a [`OsString`].
352
+ /// The conversion copies the data, and includes an allocation on the heap.
353
+ ///
354
+ /// [`String`]: ../string/struct.String.html
355
+ /// [`OsString`]: struct.OsString.html
351
356
fn from ( s : String ) -> OsString {
352
357
OsString { inner : Buf :: from_string ( s) }
353
358
}
@@ -630,13 +635,21 @@ impl<'a> From<&'a OsStr> for Box<OsStr> {
630
635
631
636
#[ stable( feature = "os_string_from_box" , since = "1.18.0" ) ]
632
637
impl From < Box < OsStr > > for OsString {
638
+ /// Converts a `Box<OsStr>` into a `OsString` without copying or allocating.
639
+ ///
640
+ /// [`Box`]: ../boxed/struct.Box.html
641
+ /// [`OsString`]: ../ffi/struct.OsString.html
633
642
fn from ( boxed : Box < OsStr > ) -> OsString {
634
643
boxed. into_os_string ( )
635
644
}
636
645
}
637
646
638
647
#[ stable( feature = "box_from_os_string" , since = "1.20.0" ) ]
639
648
impl From < OsString > for Box < OsStr > {
649
+ /// Converts a [`OsString`] into a [`Box`]`<OsStr>` without copying or allocating.
650
+ ///
651
+ /// [`Box`]: ../boxed/struct.Box.html
652
+ /// [`OsString`]: ../ffi/struct.OsString.html
640
653
fn from ( s : OsString ) -> Box < OsStr > {
641
654
s. into_boxed_os_str ( )
642
655
}
@@ -652,6 +665,10 @@ impl Clone for Box<OsStr> {
652
665
653
666
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
654
667
impl From < OsString > for Arc < OsStr > {
668
+ /// Converts a [`OsString`] into a [`Arc`]`<OsStr>` without copying or allocating.
669
+ ///
670
+ /// [`Arc`]: ../sync/struct.Arc.html
671
+ /// [`OsString`]: ../ffi/struct.OsString.html
655
672
#[ inline]
656
673
fn from ( s : OsString ) -> Arc < OsStr > {
657
674
let arc = s. inner . into_arc ( ) ;
@@ -670,6 +687,10 @@ impl<'a> From<&'a OsStr> for Arc<OsStr> {
670
687
671
688
#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
672
689
impl From < OsString > for Rc < OsStr > {
690
+ /// Converts a [`OsString`] into a [`Rc`]`<OsStr>` without copying or allocating.
691
+ ///
692
+ /// [`Rc`]: ../rc/struct.Rc.html
693
+ /// [`OsString`]: ../ffi/struct.OsString.html
673
694
#[ inline]
674
695
fn from ( s : OsString ) -> Rc < OsStr > {
675
696
let rc = s. inner . into_rc ( ) ;
0 commit comments