Module tor_persist::slug

source ·
Expand description

“Slugs” used as part of on-disk filenames and other similar purposes

Arti uses “slugs” as parts of filenames in many places. Slugs are fixed or variable strings which either designate the kind of a thing, or which of various things this is.

Slugs have a restricted character set: Lowercase ASCII alphanumerics, underscore, hyphen. We may extend this to allow additional characters in the future, but /, +, and . (the slug separators) will never be valid slug characters.

Slugs may not be empty, and they may not start with a hyphen.

Slugs can be concatenated to build file names. When concatenating slugs to make filenames, they should be separated using /, +, or . (SLUG_SEPARATOR_CHARS). Slugs should not be concatenated without separators (for security reasons).

On Windows only, the following slugs are forbidden, because of absurd Windows filename behaviours: con prn aux nul com1 com2 com3 com4 com5 com6 com7 com8 com9 com0 lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9 lpt0.

Structs§

  • An owned slug, checked for syntax
  • A borrwed slug, checked for syntax

Enums§

Constants§

Traits§

Functions§

  • Check the string s to see if it would be valid as a slug