diff options
| author | Ivan Tham <pickfire@riseup.net> | 2020-08-08 18:14:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-08 18:14:29 +0800 |
| commit | 9532b83912e4d74deee587a303359d56e7bc5602 (patch) | |
| tree | 727fb572782c424cafbd0de351d35d10c4235e39 | |
| parent | d19d7e27552b8da17932384b8db53927a1f4e00e (diff) | |
| download | rust-9532b83912e4d74deee587a303359d56e7bc5602.tar.gz rust-9532b83912e4d74deee587a303359d56e7bc5602.zip | |
Show Path extension example change multi extension
| -rw-r--r-- | library/std/src/path.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 392c815ef28..0815dfd4714 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2247,6 +2247,8 @@ impl Path { /// /// let path = Path::new("foo.tar.gz"); /// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar")); + /// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz")); + /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt")); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf { |
