mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 19:04:21 +00:00
Rollup merge of #74548 - tshepang:one-more-example, r=dtolnay
one more Path::with_extension example, to demonstrate behavior
This commit is contained in:
commit
5629223782
@ -2244,6 +2244,9 @@ impl Path {
|
||||
///
|
||||
/// let path = Path::new("foo.rs");
|
||||
/// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
|
||||
///
|
||||
/// let path = Path::new("foo.tar.gz");
|
||||
/// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
|
||||
|
Loading…
Reference in New Issue
Block a user