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. Additionally, : will never be a valid slug character, because Windows does not allow colons in filenames1,
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.
Modules§
- os 🔒
Non- target_family=windows - Forbidden slug support for non-Windows
- timestamp
- A module exporting timestamps types that can be encoded as
Slugs.
Macros§
- impl_
as_ 🔒ref - Implement
AsRef - impl_
as_ 🔒with_ inherent - Implement
fn as_...(&self) -> ...andAsRef
Structs§
Enums§
- BadSlug
- Error for an invalid slug
Constants§
- SLUG_
SEPARATOR_ CHARS - Characters which are good to use to separate slugs
Traits§
- TryInto
Slug - Types which can perhaps be used as a slug
Functions§
- check_
syntax - Check the string
sto see if it would be valid as a slug