diff options
| author | bors <bors@rust-lang.org> | 2014-08-21 02:36:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-08-21 02:36:00 +0000 |
| commit | 6063f7981f7d40df633a8a5e4326cbb7451a7649 (patch) | |
| tree | f2e947ffb82f2c9f4bb1b3be46f5b6e7e28589a6 /src/libstd/path | |
| parent | 4dfdc697e9ec79ed9f8b79246a4042bed58c201e (diff) | |
| parent | e918733e5fc3bdb6f5cbfb77aa9045a26028e20e (diff) | |
| download | rust-6063f7981f7d40df633a8a5e4326cbb7451a7649.tar.gz rust-6063f7981f7d40df633a8a5e4326cbb7451a7649.zip | |
auto merge of #16443 : steveklabnik/rust/fix_path_docs, r=kballard
Originally discovered here: http://www.reddit.com/r/rust/comments/2dbg3j/hm_unwrap_is_being_renamed_to_assert/cjnxiax
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/windows.rs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 8402d751bf2..dd87e214c2c 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -628,18 +628,36 @@ impl GenericPath for Path { } impl Path { - /// Returns a new Path from a byte vector or string + /// Returns a new `Path` from a `BytesContainer`. /// /// # Failure /// - /// Fails the task if the vector contains a NUL. - /// Fails if invalid UTF-8. + /// Fails if the vector contains a `NUL`, or if it contains invalid UTF-8. + /// + /// # Example + /// + /// ``` + /// println!("{}", Path::new(r"C:\some\path").display()); + /// ``` #[inline] pub fn new<T: BytesContainer>(path: T) -> Path { GenericPath::new(path) } - /// Returns a new Path from a byte vector or string, if possible + /// Returns a new `Some(Path)` from a `BytesContainer`. + /// + /// Returns `None` if the vector contains a `NUL`, or if it contains invalid UTF-8. + /// + /// # Example + /// + /// ``` + /// let path = Path::new_opt(r"C:\some\path"); + /// + /// match path { + /// Some(path) => println!("{}", path.display()), + /// None => println!("There was a problem with your path."), + /// } + /// ``` #[inline] pub fn new_opt<T: BytesContainer>(path: T) -> Option<Path> { GenericPath::new_opt(path) |
