diff options
| author | FenrirWolf <[email protected]> | 2018-02-17 13:04:42 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-02-17 13:04:42 -0700 |
| commit | 81c3c0b63dc5fd9d7504e6add8f3a3f7b7beb0d1 (patch) | |
| tree | ff21a014ed0623381f5c58aab3eab914d4f50c01 /ctr-std/src/path.rs | |
| parent | Fix TcpStream::wait_timeout (diff) | |
| parent | Update pinned nightly (diff) | |
| download | ctru-rs-81c3c0b63dc5fd9d7504e6add8f3a3f7b7beb0d1.tar.xz ctru-rs-81c3c0b63dc5fd9d7504e6add8f3a3f7b7beb0d1.zip | |
Merge pull request #62 from FenrirWolf/update-1.24
Pull in upstream changes for rust 1.24.0
Diffstat (limited to 'ctr-std/src/path.rs')
| -rw-r--r-- | ctr-std/src/path.rs | 9 |
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")); /// ``` |