heck

Trait TitleCase

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

This trait defines a title case conversion.

In Title Case, word boundaries are indicated by spaces, and every word is capitalized.

§Example:

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

    let sentence = "We have always lived in slums and holes in the wall.";
    assert_eq!(sentence.to_title_case(), "We Have Always Lived In Slums And Holes In The Wall");
}

Required Methods§

Source

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

Convert this type to title 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 TitleCase for str

Implementors§