heck

Trait KebabCase

Source
pub trait KebabCase: ToOwned {
    // Required method
    fn to_kebab_case(&self) -> Self::Owned;
}
Expand description

This trait defines a kebab case conversion.

In kebab-case, word boundaries are indicated by hyphens.

§Example:

extern crate heck;
fn main() {
     
    use heck::KebabCase;

    let sentence = "We are going to inherit the earth.";
    assert_eq!(sentence.to_kebab_case(), "we-are-going-to-inherit-the-earth");
}

Required Methods§

Source

fn to_kebab_case(&self) -> Self::Owned

Convert this type to kebab case.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl KebabCase for str

Source§

fn to_kebab_case(&self) -> Self::Owned

Implementors§