Skip to content

Commit 9532b83

Browse files
authored
Show Path extension example change multi extension
1 parent d19d7e2 commit 9532b83

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,8 @@ impl Path {
22472247
///
22482248
/// let path = Path::new("foo.tar.gz");
22492249
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
2250+
/// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
2251+
/// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
22502252
/// ```
22512253
#[stable(feature = "rust1", since = "1.0.0")]
22522254
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {

0 commit comments

Comments
 (0)