Skip to main content

Module stem

Module stem 

Source
Expand description

Document-tree file-stem escaping and length truncation.

A Name projects onto a filename stem via Name::to_file_stem; file_stem is the free-function form of that projection. escaped_path extends the projection across a Path, joining each segment’s escaped stem with /.

A path that exceeds the filesystem’s length budget is shortened by truncate_stem: it keeps a prefix of the escaped stem, trims a trailing separator that the cut may have exposed, and appends a short content hash so two names that share a long common prefix still truncate to distinct stems. A budget too small to hold that hash and a character of the name is refused rather than overrun — see MIN_TRUNCATED_STEM_BUDGET.

Constants§

MIN_TRUNCATED_STEM_BUDGET
The smallest available budget truncate_stem can shorten a stem into.

Functions§

escaped_path
The escaped filesystem path path projects onto, joining each segment’s file_stem with /.
file_stem
The filename stem name projects onto in a document tree.
is_stem_of
Whether stem is the file stem of the name that escapes to escaped: the escaped stem itself, or a cut truncate_stem could have made of it under some budget.
truncate_stem
Shorten an escaped stem to fit within available characters, or None when available is below MIN_TRUNCATED_STEM_BUDGET.