Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "dupnamegen" -version = "0.1.1" +version = "0.2.0" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "filesystem" ] keywords = [ "filename", "generator" ] Index: src/lib.rs ================================================================== --- src/lib.rs +++ src/lib.rs @@ -53,19 +53,19 @@ /// as an utf-8 string. pub fn namegen

( p: P, naming: Naming, start_idx: usize -) -> Result PathBuf>, Error> +) -> Result PathBuf + Send>, Error> where P: AsRef { fn inner( p: &Path, naming: Naming, start_idx: usize - ) -> Result PathBuf>, Error> { + ) -> Result PathBuf + Send>, Error> { let dir = p.parent().map(ToOwned::to_owned); let fname = p .file_name() .ok_or(Error::BadPath)? .to_str() @@ -85,11 +85,11 @@ fn winlike( dir: Option, fname: String, start_idx: usize -) -> Box PathBuf> { +) -> Box PathBuf + Send> { // Find last `.' that is not at the first position // If no '.' -- stick the counter at the end let insert_at = fname.rfind('.').map_or(fname.len(), |idx| { if idx == 0 { // found a dot at first the very beginning @@ -118,11 +118,11 @@ fn firefoxlike( dir: Option, fname: String, start_idx: usize -) -> Box PathBuf> { +) -> Box PathBuf + Send> { let insert_at = firefoxlike_find_index(&fname); let mut idx = start_idx; Box::new(move || { let mut nm = fname.clone(); @@ -184,11 +184,11 @@ fn dashnum( dir: Option, fname: String, start_idx: usize -) -> Box PathBuf> { +) -> Box PathBuf + Send> { let mut idx = start_idx; Box::new(move || { let nm = format!("{fname}-{idx}"); idx += 1; if let Some(ref dir) = dir { Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -2,18 +2,28 @@ ⚠️ indicates a breaking change. ## [Unreleased] -[Details](/vdiff?from=dupnamegen-0.1.1&to=trunk) +[Details](/vdiff?from=dupnamegen-0.2.0&to=trunk) ### Added ### Changed ### Removed +--- + +## [0.2.0] - 2024-10-14 + +[Details](/vdiff?from=dupnamegen-0.1.1&to=dupnamegen-0.2.0) + +### Changed + +- ⚠️ Add a `Send` bound to returned name generator closure. + --- ## [0.1.1] - 2024-10-14 [Details](/vdiff?from=dupnamegen-0.1.0&to=dupnamegen-0.1.1) Index: www/index.md ================================================================== --- www/index.md +++ www/index.md @@ -8,17 +8,17 @@ _dupnamegen_ supports three different naming conventions for generating new file names. - Windows-like - `Foo.zip` → `Foo (1).zip` - - `lua-5.4.7.tar.gz` -> `lua-5.4.7.tar (1).gz` + - `lua-5.4.7.tar.gz` → `lua-5.4.7.tar (1).gz` - Firefox-like - - `Foo.zip" → `Foo(1).zip` - - `lua-5.4.7.tar.gz` -> `lua-5.4.7(1).tar.gz` + - `Foo.zip` → `Foo(1).zip` + - `lua-5.4.7.tar.gz` → `lua-5.4.7(1).tar.gz` - Dash-num - - `Foo.zip" → `Foo.zip-1` - - `lua-5.4.7.tar.gz` -> `lua-5.4.7.tar.gz-1` + - `Foo.zip` → `Foo.zip-1` + - `lua-5.4.7.tar.gz` → `lua-5.4.7.tar.gz-1` ## Change log The details of changes can always be found in the timeline, but for a