Skip to main content

Crate use_slug

Crate use_slug 

Source
Expand description

§use-slug

Composable slug and URL-safe text primitives for RustUse.

use-slug is intentionally conservative in v0.1. It lowercases ASCII text, trims whitespace, collapses repeated separators, and avoids transliteration tables or locale-aware behavior.

§Included primitives

  • slugify
  • normalize_slug
  • is_slug
  • slug_words
  • truncate_slug

§Example

use use_slug::{is_slug, slugify, truncate_slug};

assert_eq!(slugify(" Release Candidate 1 "), "release-candidate-1");
assert!(is_slug("release-candidate-1"));
assert_eq!(truncate_slug("release-candidate-1", 10), "release");

Structs§

Slug
A validated default-separator slug.
SlugOptions
Configures conservative slug shaping.

Enums§

SlugSeparator
Supported separators for generated slugs.

Functions§

is_slug
Returns true when the input is already a normalized default slug.
normalize_slug
Normalizes a candidate slug using the default separator.
slug_words
Returns the normalized slug segments.
slugify
Converts free-form text into a default slug.
truncate_slug
Truncates a slug without leaving trailing separators when possible.