Skip to content

Slugify and deterministic collation

State: open/verified · Kind: module · Audience: system

  • NFKD-normalizing slugify plus a deterministic, locale-independent collation, so titles become stable filenames and cross-machine sorts never depend on ICU or the host locale.
  • Extracted from determined-vault and promoted to a tier-1 shared crate.

slugify and slugify_with turn a title into a filesystem-safe slug: NFKD-decompose, drop combining marks, fold non-alphanumerics to a separator, collapse, trim and cap length. café becomes cafe rather than colliding with an unaccented twin. compare, compare_paths and path_sort_key are a portable substitute for localeCompare: case-insensitive, accent-folded, ties broken by raw bytes, so two machines never disagree on an order. The vault crates rely on this for hashed and rendered output such as backup tree entries, the parity manifest and digest tie-breaks.

  • slugify(input) and slugify_with(input, SlugOptions), with options for max length and apostrophes.
  • compare(a, b): deterministic string ordering.
  • compare_paths(a, b): segment-wise path comparison with the same collation.
  • path_sort_key(path): a precomputed key for sort_by_cached_key giving the same order as compare_paths.
  • packages/rust/slug/src/lib.rs.
  • Consumers: solutions/determined/crates/determined-{vault,notes,authoring,index,sync,photos,backup}, packages/rust/wikilink, packages/rust/vault-transform.
  • packages/rust/slug/
  • packages/rust/slug/src/lib.rs#slugify
  • packages/rust/slug/src/lib.rs#compare
  • packages/rust/slug/src/lib.rs#compare_paths
  • packages/rust/slug/src/lib.rs#path_sort_key

← Back to Capabilities