Description
Implement Slug as a ValueObject in the identifiers module.
Spec: lowercase, alphanumeric + hyphens, no leading/trailing hyphens
Implementation checklist
Implementation detail
Input / Output
|
Type |
Alias |
| Input |
String |
SlugInput |
| Output |
String |
SlugOutput |
Normalization
Trim surrounding whitespace, convert to lowercase.
Validation
- Must not be empty after trimming.
- May only contain ASCII lowercase letters (
a–z), digits (0–9), and hyphens (-).
- Must not start or end with a hyphen.
- Must not contain consecutive hyphens (
--).
Extra methods
None beyond the trait — value() returns the normalised slug string.
References
Description
Implement
Slugas aValueObjectin theidentifiersmodule.Spec: lowercase, alphanumeric + hyphens, no leading/trailing hyphens
Implementation checklist
src/identifiers/slug.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/identifiers/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringSlugInputStringSlugOutputNormalization
Trim surrounding whitespace, convert to lowercase.
Validation
a–z), digits (0–9), and hyphens (-).--).Extra methods
None beyond the trait —
value()returns the normalised slug string.References