From 9532b83912e4d74deee587a303359d56e7bc5602 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 8 Aug 2020 18:14:29 +0800 Subject: [PATCH] Show Path extension example change multi extension --- library/std/src/path.rs | 2 ++ 1 file changed, 2 insertions(+) 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>(&self, extension: S) -> PathBuf {