Show Path extension example change multi extension

This commit is contained in:
Ivan Tham 2020-08-08 18:14:29 +08:00 committed by GitHub
parent d19d7e2755
commit 9532b83912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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 {