Show Path extension example change multi extension
This commit is contained in:
parent
d19d7e2755
commit
9532b83912
1 changed files with 2 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue