Trait casing::Casing [] [src]

pub trait Casing: ToOwned {
    type Character: Copy + Eq;
    fn upper(&self, _: Locale) -> Cow<Self>;
    fn lower(&self, _: Locale) -> Cow<Self>;
    fn capitalized(&self, _: Locale) -> Cow<Self>;
    fn camel(
        &self,
        separators: Separator<&[Self::Character]>,
        mode: Camel,
        _: Locale
    ) -> Cow<Self>; fn separated(
        &self,
        separator: Separator<Self::Character>,
        _: Locale
    ) -> Cow<Self>; fn header(&self, _: Locale) -> Cow<Self>; }

Trait with casing extensions.

Associated Types

Required Methods

Turns Self to upper case avoiding allocations if nothing would change.

Turns Self to lower case avoiding allocations if nothing would change.

Turns Self to its capitalized version, turning the first character to upper case and the rest to lower case.

Turns Self to camel case using the passed Separator to know which symbols should mark a new word.

Turns Self to a case separated by the given separator, using Separator('_') would turn to snake case, using Separator('-') would turn to dashed case.

Turns Self to header case, where each word is separated by '-' and starts with an upper case character. Upper case characters after the first are not lower cased.

Implementors