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
fn upper(&self, _: Locale) -> Cow<Self>
Turns Self
to upper case avoiding allocations if nothing would change.
fn lower(&self, _: Locale) -> Cow<Self>
Turns Self
to lower case avoiding allocations if nothing would change.
fn capitalized(&self, _: Locale) -> Cow<Self>
Turns Self
to its capitalized version, turning the first character to
upper case and the rest to lower case.
fn camel(
&self,
separators: Separator<&[Self::Character]>,
mode: Camel,
_: Locale
) -> Cow<Self>
&self,
separators: Separator<&[Self::Character]>,
mode: Camel,
_: Locale
) -> Cow<Self>
Turns Self
to camel case using the passed Separator
to know which
symbols should mark a new word.
fn separated(
&self,
separator: Separator<Self::Character>,
_: Locale
) -> Cow<Self>
&self,
separator: Separator<Self::Character>,
_: Locale
) -> Cow<Self>
Turns Self
to a case separated by the given separator, using
Separator('_')
would turn to snake case, using Separator('-')
would
turn to dashed case.
fn header(&self, _: Locale) -> Cow<Self>
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.