Skip to content

Add Slug (identifiers) #12

@vhrcgcom

Description

@vhrcgcom

Description

Implement Slug as a ValueObject in the identifiers module.

Spec: lowercase, alphanumeric + hyphens, no leading/trailing hyphens

Implementation checklist

  • Create src/identifiers/slug.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/identifiers/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions