diff options
| author | Nick Hamann <nick@wabbo.org> | 2015-04-20 20:45:02 -0500 |
|---|---|---|
| committer | Nick Hamann <nick@wabbo.org> | 2015-04-20 20:45:02 -0500 |
| commit | db2f308a46fe4e66311ed7d05f2b4f7597c6a7b3 (patch) | |
| tree | be494b7e3ad03356aaf786bf4552c6934d39df74 /src/libstd | |
| parent | f46c4e158d395cf6e186bf6afdf1705c12071cbe (diff) | |
| download | rust-db2f308a46fe4e66311ed7d05f2b4f7597c6a7b3.tar.gz rust-db2f308a46fe4e66311ed7d05f2b4f7597c6a7b3.zip | |
Add two examples for Path::new
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/path.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 1ad1508ae2d..c5646e014eb 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1248,6 +1248,13 @@ impl Path { /// use std::path::Path; /// /// Path::new("foo.txt"); + /// + /// // Strings work too + /// let s = String::from("bar.txt"); + /// let p = Path::new(&s); + /// + /// // As do other Paths + /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path { |
