is_slug
Checks whether s has the shape of an ASCII URL slug: non-empty, made only of lowercase
ASCII letters, digits and hyphens, with no leading, trailing or doubled hyphen.
This is ASCII-only by design, even though slugify keeps Unicode
letters (slugify("café") is "café", which is_slug rejects): a slug meant to go
unescaped in a URL path is conventionally ASCII. For ASCII input, is_slug(&slugify(s)) is
true whenever slugify(s) is not empty.
Import
Section titled “Import”Cargo feature validate (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
s | &str | The text to check. |
Returns
Section titled “Returns”bool — true when s already has the shape of a slug.
