Skip to main content

Crate use_slug

Crate use_slug 

Source
Expand description

§use-id-slug

Human-readable slug normalization and validation helpers for RustUse.

§Install

[dependencies]
use-id-slug = "0.0.1"

The published package keeps the Rust crate name use_slug, so code imports stay the same.

§Foundation

use-id-slug keeps slug behavior explicit and predictable: normalize free-form text into lowercase ASCII segments joined by hyphens, then validate the canonical form.

§Example

use use_slug::Slug;

let slug = Slug::new("RustUse Docs")?;

assert_eq!(slug.as_str(), "rustuse-docs");
assert_eq!(slug.segments().collect::<Vec<_>>(), vec!["rustuse", "docs"]);

§When to use directly

Choose use-id-slug when human-readable identifiers are the only ID surface you need.

§Scope

  • Slugs stay lowercase, ASCII, and hyphen-delimited.
  • Normalization is deterministic and documented.
  • Locale-aware transliteration and routing concerns are out of scope.

§Status

use-id-slug is a pre-1.0 crate with a deliberately narrow API. Slug normalization and validation helpers.

Modules§

prelude

Structs§

Slug

Enums§

SlugError

Functions§

is_valid_slug
normalize_slug
validate_slug
Validates that a slug is non-empty, lowercase ASCII, and hyphen-delimited.