[−][src]Struct str_slug::StrSlug
Fields
use_hash: bool
append_hash: bool
if its set to false the hash will be prepended
hash_len: usize
use full hash if hash_len
= 0
hash_separator: char
separator to use to separate slug and hash
separator: char
remove_duplicate_separators: bool
trim_separator: bool
Trim leading and trailing separators after slugifying the given string.
trim_separator_start: bool
trim_separator_end: bool
Methods
impl StrSlug
[src]
pub fn new() -> Self
[src]
pub fn slug<T: AsRef<str>>(&self, value: T) -> String
[src]
Generate a slug for the given value by applying user options.
Examples
Normal usage
use str_slug::StrSlug; let str_slug = StrSlug::new(); let slug = str_slug::slug("Hello, World!"); assert_eq!(slug, "hello-world");
Hashed slug
use str_slug::StrSlug; let mut str_slug = StrSlug::new(); str_slug.use_hash = true; let slug = str_slug.slug("Hello, World!"); assert_eq!(slug, "hello-world_288a86");
Auto Trait Implementations
impl RefUnwindSafe for StrSlug
impl Send for StrSlug
impl Sync for StrSlug
impl Unpin for StrSlug
impl UnwindSafe for StrSlug
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,