Add a new option

This commit is contained in:
2025-09-03 22:59:22 +08:00
parent 4d5ad39e24
commit cc72c89f0c
4 changed files with 58 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ pub mod atomic;
#[cfg(feature = "fancy-regex")]
pub mod fancy_regex;
pub mod io;
pub mod path;
#[cfg(feature = "emote-psb")]
pub mod psb;
#[cfg(feature = "markup5ever_rcdom")]

14
src/ext/path.rs Normal file
View File

@@ -0,0 +1,14 @@
//! Extensions for std::path
pub trait PathBufExt {
/// Remove all extensions from the path.
fn remove_all_extensions(&mut self);
}
impl PathBufExt for std::path::PathBuf {
fn remove_all_extensions(&mut self) {
while self.extension().is_some() {
self.set_extension("");
}
}
}