Skip to main content

Crate use_file_stem

Crate use_file_stem 

Source
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§

FileStem
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 true when 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.