diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 15:34:32 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 15:34:48 -0800 |
| commit | 2cdbd288ac0606902885434e1ccd8d8bde68913d (patch) | |
| tree | 9a7d37f7dd44424182797c76d49ba0ece99f9513 /src/libstd/path.rs | |
| parent | 365bd9a9e3b9dafa98e26982353fd28a6ca1efef (diff) | |
| parent | a99e698628cbd396c8100ef776d10ac61d911847 (diff) | |
| download | rust-2cdbd288ac0606902885434e1ccd8d8bde68913d.tar.gz rust-2cdbd288ac0606902885434e1ccd8d8bde68913d.zip | |
rollup merge of #22210: aturon/stab-final-borrow
Conflicts: src/libcollections/btree/map.rs src/libcollections/str.rs src/libcollections/vec.rs src/libcore/borrow.rs src/libcore/hash/mod.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs
Diffstat (limited to 'src/libstd/path.rs')
| -rwxr-xr-x | src/libstd/path.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 2ad07462f20..3d95d0f19d1 100755 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -108,12 +108,11 @@ use core::prelude::*; use ascii::*; -use borrow::BorrowFrom; +use borrow::{Borrow, ToOwned, Cow}; use cmp; use iter::{self, IntoIterator}; use mem; use ops::{self, Deref}; -use string::CowString; use vec::Vec; use fmt; @@ -982,12 +981,17 @@ impl ops::Deref for PathBuf { } } -impl BorrowFrom<PathBuf> for Path { - fn borrow_from(owned: &PathBuf) -> &Path { - owned.deref() +impl Borrow<Path> for PathBuf { + fn borrow(&self) -> &Path { + self.deref() } } +impl ToOwned for Path { + type Owned = PathBuf; + fn to_owned(&self) -> PathBuf { self.to_path_buf() } +} + impl cmp::PartialEq for PathBuf { fn eq(&self, other: &PathBuf) -> bool { self.components() == other.components() @@ -1066,10 +1070,10 @@ impl Path { self.inner.to_str() } - /// Convert a `Path` to a `CowString`. + /// Convert a `Path` to a `Cow<str>`. /// /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { self.inner.to_string_lossy() } |
