diff options
| author | bors <bors@rust-lang.org> | 2015-04-25 17:06:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-25 17:06:48 +0000 |
| commit | 0d8309ec0b13ebad02bbc76f93eff39edf4af2d0 (patch) | |
| tree | c9c57c7b7b33d9fcb150af5d4299b51b1ec4a709 /src/libstd | |
| parent | 83263b48c39ef0e21cc9872191f4ce4877f4e05f (diff) | |
| parent | 3e67b6bb6c5383674f58a637f93d6740bca6a7d7 (diff) | |
| download | rust-0d8309ec0b13ebad02bbc76f93eff39edf4af2d0.tar.gz rust-0d8309ec0b13ebad02bbc76f93eff39edf4af2d0.zip | |
Auto merge of #24813 - Manishearth:rollup, r=Manishearth
- Successful merges: #24649, #24806, #24809, #24811 - Manual merges: #24812
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index e8052041aeb..2ceb60cc3aa 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1241,6 +1241,16 @@ impl Path { /// /// Path::new("foo.txt"); /// ``` + /// + /// You can create `Path`s from `String`s, or even other `Path`s: + /// + /// ``` + /// use std::path::Path; + /// + /// let s = String::from("bar.txt"); + /// let p = Path::new(&s); + /// Path::new(&p); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path { unsafe { mem::transmute(s.as_ref()) } |
