Expand description
§use-file-stem
Practical file stem utility primitives for RustUse.
§Experimental
use-file-stem is experimental while the use-fs workspace remains below 0.3.0.
§Example
use use_file_stem::{append_to_file_stem, file_stem_without_compound_extension};
assert_eq!(file_stem_without_compound_extension("archive.tar.gz").as_deref(), Some("archive"));
assert_eq!(append_to_file_stem("report.txt", "-final"), "report-final.txt");§Scope
- file-stem extraction
- compound-extension-aware stem helpers
- stem replacement and formatting
- conservative ASCII slug shaping
§Non-goals
- full slugification systems
- locale-aware casing
- filesystem I/O
§License
Licensed under either of the following, at your option:
- Apache License, Version 2.0
- MIT license
Structs§
- File
Stem - A string-backed file stem.
Functions§
- append_
to_ file_ stem - Appends a suffix to the file stem while preserving the original extension suffix.
- file_
stem - Extracts the simple file stem from a file name or path-like input.
- file_
stem_ without_ compound_ extension - Extracts the file stem while removing a supported compound extension when present.
- has_
file_ stem - Returns
truewhen the input has a recoverable file stem. - prepend_
to_ file_ stem - Prepends a prefix to the file stem while preserving the original extension suffix.
- slug_
file_ stem_ basic - Converts a file stem into a conservative ASCII slug.
- with_
file_ stem - Replaces the file stem while preserving the original extension suffix.