pub enum EmptyOutputPolicy {
KeepEmptySlug,
UseFallbackSlug(String),
UseVerbatimFallbackSlug(String),
}Expand description
Behavior when the generated slug is empty.
Variants§
KeepEmptySlug
Return the empty slug.
UseFallbackSlug(String)
Replace the empty slug with a fallback held to the same rules.
The fallback is checked against the configuration that produced the
slug it stands in for — character set, delimiter, dot policy, case and
max_slug_chars — not only against the target surface. Without that,
an ASCII-only, 80-character configuration could still return an
arbitrary-length mixed-case Unicode string and call it validated, and a
caller reading “validated” as “matches my SlugConfig” would be wrong
in exactly the case they reached for a fallback to avoid.
UseVerbatimFallbackSlug(String)
Replace the empty slug with a fallback inserted exactly as written.
Only the target surface is checked. This exists for a value that must match something already stored — a legacy identifier a caller cannot regenerate — and it means the result may not satisfy the configuration that produced it.
Trait Implementations§
Source§impl Clone for EmptyOutputPolicy
impl Clone for EmptyOutputPolicy
Source§fn clone(&self) -> EmptyOutputPolicy
fn clone(&self) -> EmptyOutputPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more