aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/path.rs
diff options
context:
space:
mode:
authorFenrir <[email protected]>2018-02-15 21:15:14 -0700
committerFenrir <[email protected]>2018-02-15 21:15:39 -0700
commit49dc1a5e06a04c4cb6bd136f7dedb85719646e10 (patch)
treefb39e58a1734b5def44803d07f3134b706a96ba0 /ctr-std/src/path.rs
parentFix TcpStream::wait_timeout (diff)
downloadctru-rs-49dc1a5e06a04c4cb6bd136f7dedb85719646e10.tar.xz
ctru-rs-49dc1a5e06a04c4cb6bd136f7dedb85719646e10.zip
Updates for Rust 1.24
Diffstat (limited to 'ctr-std/src/path.rs')
-rw-r--r--ctr-std/src/path.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/ctr-std/src/path.rs b/ctr-std/src/path.rs
index 7631a9a..e03a182 100644
--- a/ctr-std/src/path.rs
+++ b/ctr-std/src/path.rs
@@ -576,7 +576,7 @@ impl<'a> AsRef<OsStr> for Component<'a> {
}
}
-#[stable(feature = "path_component_asref", since = "1.24.0")]
+#[stable(feature = "path_component_asref", since = "1.25.0")]
impl<'a> AsRef<Path> for Component<'a> {
fn as_ref(&self) -> &Path {
self.as_os_str().as_ref()
@@ -1869,7 +1869,11 @@ impl Path {
///
/// let path = Path::new("/test/haha/foo.txt");
///
+ /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
/// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
+ /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
+ /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
+ /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
/// assert_eq!(path.strip_prefix("test").is_ok(), false);
/// assert_eq!(path.strip_prefix("/haha").is_ok(), false);
/// ```
@@ -1900,6 +1904,9 @@ impl Path {
/// let path = Path::new("/etc/passwd");
///
/// assert!(path.starts_with("/etc"));
+ /// assert!(path.starts_with("/etc/"));
+ /// assert!(path.starts_with("/etc/passwd"));
+ /// assert!(path.starts_with("/etc/passwd/"));
///
/// assert!(!path.starts_with("/e"));
/// ```