Commit Graph

240 Commits

Author SHA1 Message Date
Ian Douglas Scott ab48de8847 Use cfg! instead of #[cfg] 2017-08-22 08:17:05 -07:00
Ian Douglas Scott e0f0fd08b5 Correct has_root() on Redox 2017-08-18 16:07:29 -07:00
Ian Douglas Scott b272f6ca05 redox: Require scheme for path to be absolute
Redox paths are problematic. It would make sense to add a `Scheme`
variant to the `std::path::Component` enum; but that would presumably be
a breaking change due to exhaustive matching. Alternately it could use
the existing `Prefix` variant, like Windows, but none of the existing
types of prefix make sense, Redox only has one kind, and adding a new
variant to that enum has the same issue as `Component`.
2017-08-18 12:04:45 -07:00
Zack M. Davis 1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Kornel 4792d28ef1 Emphasise that these functions look at the disk, not just the path 2017-08-02 15:40:08 +01:00
Alex Crichton cbfce40e1c std: Stabilize CString/OsString/PathBuf extra methods
Stabilizes:

* `CString::as_c_str`
* `CString::into_boxed_c_str`
* `CStr::into_c_string`
* `OsString::into_boxed_os_str`
* `OsStr::into_os_string`
* `PathBuf::into_boxed_path`
* `PathBuf::into_path_buf`

Closes #40380
2017-07-25 07:09:31 -07:00
Bruce Mitchener 539df8121b Fix some doc/comment typos. 2017-07-23 22:48:01 +07:00
Corey Farwell 09b3ea71db Rollup merge of #43229 - kennytm:return-false-if-path-is-relative-hahaha, r=steveklabnik
Fix minor typo in std::path documentation.

Fix minor typo in `std::path` documentation.

Replace all `'C' as u8` with `b'C'`.
2017-07-14 20:57:19 -07:00
kennytm 1da51cca9e Fix minor typo in std::path documentation.
Replace all `'C' as u8` with `b'C'`.
2017-07-14 10:06:06 +08:00
Steve Klabnik 3aaa809c7b Rollup merge of #42926 - Havvy:doc-path-ext, r=steveklabnik
Document what happens on failure in path ext is_file is_dir

r? @steveklabnik

Also, what other ways could there be an error that gets discarded and returns false? Should we list them all? Should we say that any errors trying to access the metadata at that path causes it to return false, even if there might be a file or directory there?

Should I add a See also link to the original functions that do return Results?
2017-07-13 10:45:16 -04:00
Havvy a01c91c8bc Document error coercion to false in path-ext methods + see also sections 2017-07-12 12:05:40 -07:00
Mark Simulacrum 32cbbffea2 Rollup merge of #42227 - ollie27:into_to_from, r=aturon
Convert Intos to Froms.

This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
2017-07-04 07:41:33 -06:00
Aleksey Kladov 40dec0984e Document that / works as separator on Windows 2017-06-28 23:14:06 +03:00
Oliver Middleton 0d885efe16 Update version numbers for From impls 2017-06-21 01:18:19 +01:00
Clar Charr 5a97036b69 Convert Intos to Froms. 2017-06-21 01:18:18 +01:00
Stepan Koltsov ac96fd7787 Avoid allocations in Debug for os_str
Fixes #38879
2017-06-15 20:42:37 +01:00
Clar Charr 6119f9856c Remove unused lifetimes. 2017-05-20 15:32:11 -04:00
Oliver Middleton 2f703e4304 Correct some stability versions
These were found by running tidy on stable versions of rust and finding
features stabilised with the wrong version numbers.
2017-05-20 08:38:39 +01:00
steveklabnik 23382e614a Add more ways to create a PathBuf to docs
The best way to do this wasn't in the documentation, and the ways that
were there needed some extra text to elaborate.

Fixes #40159
2017-05-09 12:43:49 -04:00
Guillaume Gomez d79b511f5c Fix invalid linkage 2017-04-22 13:25:14 +02:00
Matt Brubeck 3b4d34d4fa Expanded docs and examples for PathBuf::file_name and friends 2017-04-20 11:33:05 -07:00
Corey Farwell 204243fcac Rollup merge of #41390 - scottmcm:toowned-clone-into, r=alexcrichton
Override ToOwned::clone_into for Path and OsStr

The only non-overridden one remaining is the CStr impl, which cannot
be optimized as doing so would break CString's second invariant.

Follow-up to 7ec27ae (PR #41009).

r? @alexcrichton
2017-04-20 01:39:56 -04:00
Scott McMurray 295bcdb715 Override ToOwned::clone_into for Path and OsStr
The only non-overridden one remaining is the CStr impl, which cannot
be optimized as doing so would break CString's second invariant.
2017-04-18 21:02:18 -07:00
lukaramu d6f7577279 Fix typos in std::path's docs
* Closed an unclosed paren
* seperator -> separator
* deperator -> separator
2017-04-18 15:03:41 +02:00
lukaramu 32132d9fb6 Expand std::path::Display's docs
Part of #29368.
* Added explanation for why the struct exists
* Added link to where it is created
* Added example
2017-04-17 22:51:12 +02:00
lukaramu 51ca5fe716 Restructure and redistribute std::path's module docs
Part of #29368.
* Added a new summary paragraph about std::path's parsing facilities
* Slightly exanded `Component`'s docs
* removed the now redundant section on component types from the module docs
* moved the section on path normalization during parsing to the docs on
  `Path::components`
* Clarified difference between `Prefix` and `PrefixComponent` in their
  respecive summary sentences
2017-04-17 22:37:27 +02:00
lukaramu 8c21b60136 Expand and add examples to std::path::{Prefix, PrefixComponent}'s docs
Part of #29368.
2017-04-17 00:24:46 +02:00
lukaramu 1afe77fb5f Cleaned up throughout std::path's docs
Part of #29368.
* added missing links
* updated method summaries to use 3rd person style
* added missing periods in `Component`'s variant summaries
* use standard iterator boilerplate in `Components`' and `Iter`'s docs
* added example to `Iter::as_path`, adapted from `Components::as_path`'s
  example
* consolidated examples for `Path::file_name`
* some other small fixes
2017-04-15 23:55:59 +02:00
Petr Zemek 7add53e47e Fix a typo in path.rs docs
The name of the variable used in the example is `path`, not `os_str`.
2017-03-19 07:02:20 +01:00
bors a559452b05 Auto merge of #40598 - frewsxcv:rollup, r=frewsxcv
Rollup of 23 pull requests

- Successful merges: #40387, #40433, #40452, #40456, #40457, #40458, #40463, #40466, #40467, #40495, #40496, #40497, #40499, #40500, #40503, #40505, #40512, #40514, #40517, #40520, #40536, #40545, #40586
- Failed merges:
2017-03-17 17:26:52 +00:00
Corey Farwell 69717170a4 Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, r=GuillaumeGomez
Remove function invokation parens from documentation links.

This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-17 08:48:51 -04:00
Clar Charr 0739ecec61 Removes Default for Box<Path>. 2017-03-15 11:36:13 -04:00
Corey Farwell e7b0f2badf Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13 21:43:18 -04:00
Clar Charr 560944b982 Add From<Box<..>> implementations. 2017-03-10 14:57:57 -05:00
Clar Charr 963843b1b3 Conversions between CStr/OsStr/Path and boxes. 2017-02-14 14:18:43 -05:00
Corey Farwell 4cde461bb0 Rollup merge of #38764 - Aaronepower:master, r=aturon
Added Default impl to PathBuf
2017-02-07 22:54:19 -05:00
bors b4c0207148 Auto merge of #38935 - redox-os:fix_path_redox, r=brson
Fix is_absolute on Redox

Due to not using prefixes on Redox, yet, it must be added as an exception to Path::is_absolute.
2017-01-14 11:03:25 +00:00
Jeremy Soller ca2ade1d36 Fix is_absolute on Redox 2017-01-13 14:48:01 -07:00
Guillaume Gomez 54535c59a4 Rollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcv
Add missing links and examples for path modules and structs

r? @frewsxcv
2017-01-13 10:42:28 +01:00
Guillaume Gomez 28d1ac3191 Add missing links and examples for path modules and structs 2017-01-11 23:26:27 +01:00
Corey Farwell 4794f95683 Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples. 2017-01-05 09:52:14 -05:00
Aaron Power 108293d4e9 Added Default impl to PathBuf 2017-01-01 20:15:19 +00:00
Guillaume Gomez 60d1660748 Add Component examples 2016-12-02 20:16:12 -08:00
bors c7ddb8946b Auto merge of #38019 - sourcefrog:doc-separator, r=frewsxcv
Clearer description of std::path::MAIN_SEPARATOR.
2016-11-27 20:22:44 -06:00
Martin Pool 591c134456 Clearer description of std::path::MAIN_SEPARATOR. 2016-11-26 09:24:48 -08:00
Corey Farwell af1aa1bccf Update top-level path doc examples to show results. 2016-11-14 15:54:40 -05:00
Corey Farwell f53d062d42 Minor rewriting of std::path::Path::push doc example. 2016-11-13 12:58:55 -05:00
Alex Crichton 727f1d3f16 Rollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton
Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From

Fixes #37561. First contribution, happy with any and all feedback!
2016-11-05 10:50:25 -07:00
leonardo.yvens 3e4bd88438 Change Into<Vec<u8>> for String and Into<OsString> for PathBuf to From impls 2016-11-04 15:54:08 -02:00
Guillaume Gomez 7e805eae8e Rollup merge of #37316 - ollie27:docs_links, r=GuillaumeGomez
Fix a few links in the docs

r? @steveklabnik
2016-11-01 16:15:52 +01:00