diff options
| author | Fenrir <[email protected]> | 2018-08-19 17:48:00 -0600 |
|---|---|---|
| committer | Fenrir <[email protected]> | 2018-08-19 17:56:18 -0600 |
| commit | 5d28bfcfd6086c3328837de9695099ea39048d0d (patch) | |
| tree | a514fde042ff2a504a03305bfe0894ff8cd8d47e /ctr-std/src/path.rs | |
| parent | Update for latest nightly 2018-06-09 (#70) (diff) | |
| download | ctru-rs-5d28bfcfd6086c3328837de9695099ea39048d0d.tar.xz ctru-rs-5d28bfcfd6086c3328837de9695099ea39048d0d.zip | |
Update for nightly-2018-08-18
Diffstat (limited to 'ctr-std/src/path.rs')
| -rw-r--r-- | ctr-std/src/path.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/ctr-std/src/path.rs b/ctr-std/src/path.rs index 27f57bd..ae7b632 100644 --- a/ctr-std/src/path.rs +++ b/ctr-std/src/path.rs @@ -1045,8 +1045,6 @@ impl<'a> cmp::Ord for Components<'a> { /// # Examples /// /// ``` -/// #![feature(path_ancestors)] -/// /// use std::path::Path; /// /// let path = Path::new("/foo/bar"); @@ -1059,26 +1057,23 @@ impl<'a> cmp::Ord for Components<'a> { /// [`ancestors`]: struct.Path.html#method.ancestors /// [`Path`]: struct.Path.html #[derive(Copy, Clone, Debug)] -#[unstable(feature = "path_ancestors", issue = "48581")] +#[stable(feature = "path_ancestors", since = "1.28.0")] pub struct Ancestors<'a> { next: Option<&'a Path>, } -#[unstable(feature = "path_ancestors", issue = "48581")] +#[stable(feature = "path_ancestors", since = "1.28.0")] impl<'a> Iterator for Ancestors<'a> { type Item = &'a Path; fn next(&mut self) -> Option<Self::Item> { let next = self.next; - self.next = match next { - Some(path) => path.parent(), - None => None, - }; + self.next = next.and_then(Path::parent); next } } -#[unstable(feature = "path_ancestors", issue = "48581")] +#[stable(feature = "path_ancestors", since = "1.28.0")] impl<'a> FusedIterator for Ancestors<'a> {} //////////////////////////////////////////////////////////////////////////////// @@ -1415,6 +1410,14 @@ impl From<PathBuf> for Box<Path> { } } +#[stable(feature = "more_box_slice_clone", since = "1.29.0")] +impl Clone for Box<Path> { + #[inline] + fn clone(&self) -> Self { + self.to_path_buf().into_boxed_path() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for PathBuf { fn from(s: &'a T) -> PathBuf { @@ -1737,9 +1740,11 @@ impl Path { /// Converts a `Path` to a [`Cow<str>`]. /// - /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. + /// Any non-Unicode sequences are replaced with + /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD]. /// /// [`Cow<str>`]: ../borrow/enum.Cow.html + /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html /// /// # Examples /// @@ -1833,7 +1838,7 @@ impl Path { /// * On Unix, a path has a root if it begins with `/`. /// /// * On Windows, a path has a root if it: - /// * has no prefix and begins with a separator, e.g. `\\windows` + /// * has no prefix and begins with a separator, e.g. `\windows` /// * has a prefix followed by a separator, e.g. `c:\windows` but not `c:windows` /// * has any non-disk prefix, e.g. `\\server\share` /// @@ -1893,8 +1898,6 @@ impl Path { /// # Examples /// /// ``` - /// #![feature(path_ancestors)] - /// /// use std::path::Path; /// /// let mut ancestors = Path::new("/foo/bar").ancestors(); @@ -1906,7 +1909,7 @@ impl Path { /// /// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`parent`]: struct.Path.html#method.parent - #[unstable(feature = "path_ancestors", issue = "48581")] + #[stable(feature = "path_ancestors", since = "1.28.0")] pub fn ancestors(&self) -> Ancestors { Ancestors { next: Some(&self), |