@@ -1397,13 +1397,20 @@ impl<'a> From<&'a Path> for Box<Path> {
13971397
13981398#[ stable( feature = "path_buf_from_box" , since = "1.18.0" ) ]
13991399impl From < Box < Path > > for PathBuf {
1400+ /// Converts a `Box<Path>` into a `PathBuf`
1401+ ///
1402+ /// This conversion does not allocate or copy memory.
14001403 fn from ( boxed : Box < Path > ) -> PathBuf {
14011404 boxed. into_path_buf ( )
14021405 }
14031406}
14041407
14051408#[ stable( feature = "box_from_path_buf" , since = "1.20.0" ) ]
14061409impl From < PathBuf > for Box < Path > {
1410+ /// Converts a `PathBuf` into a `Box<Path>`
1411+ ///
1412+ /// This conversion currently should not allocate memory,
1413+ /// but this behavior is not guaranteed on all platforms or in all future versions.
14071414 fn from ( p : PathBuf ) -> Box < Path > {
14081415 p. into_boxed_path ( )
14091416 }
@@ -1426,20 +1433,29 @@ impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf {
14261433
14271434#[ stable( feature = "rust1" , since = "1.0.0" ) ]
14281435impl From < OsString > for PathBuf {
1436+ /// Converts a `OsString` into a `PathBuf`
1437+ ///
1438+ /// This conversion does not allocate or copy memory.
14291439 fn from ( s : OsString ) -> PathBuf {
14301440 PathBuf { inner : s }
14311441 }
14321442}
14331443
14341444#[ stable( feature = "from_path_buf_for_os_string" , since = "1.14.0" ) ]
14351445impl From < PathBuf > for OsString {
1446+ /// Converts a `PathBuf` into a `OsString`
1447+ ///
1448+ /// This conversion does not allocate or copy memory.
14361449 fn from ( path_buf : PathBuf ) -> OsString {
14371450 path_buf. inner
14381451 }
14391452}
14401453
14411454#[ stable( feature = "rust1" , since = "1.0.0" ) ]
14421455impl From < String > for PathBuf {
1456+ /// Converts a `String` into a `PathBuf`
1457+ ///
1458+ /// This conversion does not allocate or copy memory.
14431459 fn from ( s : String ) -> PathBuf {
14441460 PathBuf :: from ( OsString :: from ( s) )
14451461 }
@@ -1536,6 +1552,7 @@ impl<'a> From<Cow<'a, Path>> for PathBuf {
15361552
15371553#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
15381554impl From < PathBuf > for Arc < Path > {
1555+ /// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15391556 #[ inline]
15401557 fn from ( s : PathBuf ) -> Arc < Path > {
15411558 let arc: Arc < OsStr > = Arc :: from ( s. into_os_string ( ) ) ;
@@ -1545,6 +1562,7 @@ impl From<PathBuf> for Arc<Path> {
15451562
15461563#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
15471564impl < ' a > From < & ' a Path > for Arc < Path > {
1565+ /// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15481566 #[ inline]
15491567 fn from ( s : & Path ) -> Arc < Path > {
15501568 let arc: Arc < OsStr > = Arc :: from ( s. as_os_str ( ) ) ;
@@ -1554,6 +1572,7 @@ impl<'a> From<&'a Path> for Arc<Path> {
15541572
15551573#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
15561574impl From < PathBuf > for Rc < Path > {
1575+ /// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15571576 #[ inline]
15581577 fn from ( s : PathBuf ) -> Rc < Path > {
15591578 let rc: Rc < OsStr > = Rc :: from ( s. into_os_string ( ) ) ;
@@ -1563,6 +1582,7 @@ impl From<PathBuf> for Rc<Path> {
15631582
15641583#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
15651584impl < ' a > From < & ' a Path > for Rc < Path > {
1585+ /// Converts a Path into a Rc by copying the Path data into a new Rc buffer.
15661586 #[ inline]
15671587 fn from ( s : & Path ) -> Rc < Path > {
15681588 let rc: Rc < OsStr > = Rc :: from ( s. as_os_str ( ) ) ;
0 commit comments