pub struct ReCase<'a> { /* private fields */ }Expand description
An instance that holds the text to be re-cased.
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.snake_case(), "example_string");
assert_eq!(recase.upper_snake_case(), "EXAMPLE_STRING");Implementations§
Source§impl<'a> ReCase<'a>
impl<'a> ReCase<'a>
Sourcepub fn normal_case(&self) -> String
pub fn normal_case(&self) -> String
Returns a normal case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.normal_case(), "example string");Sourcepub fn camel_case(&self) -> String
pub fn camel_case(&self) -> String
Returns a camelCase version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.camel_case(), "exampleString");Sourcepub fn pascal_case(&self) -> String
pub fn pascal_case(&self) -> String
Returns a PascalCase version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.pascal_case(), "ExampleString");Sourcepub fn snake_case(&self) -> String
pub fn snake_case(&self) -> String
Returns a snake_case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.snake_case(), "example_string");Sourcepub fn kebab_case(&self) -> String
pub fn kebab_case(&self) -> String
Returns a kebab-case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.kebab_case(), "example-string");Sourcepub fn dot_case(&self) -> String
pub fn dot_case(&self) -> String
Returns a dot.case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.dot_case(), "example.string");Sourcepub fn path_case(&self) -> String
pub fn path_case(&self) -> String
Returns a path/case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.path_case(), "example/string");Sourcepub fn windows_path_case(&self) -> String
pub fn windows_path_case(&self) -> String
Returns a windows\path\case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.windows_path_case(), "example\\string");Sourcepub fn sentence_case(&self) -> String
pub fn sentence_case(&self) -> String
Returns a Sentence case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.sentence_case(), "Example string");Sourcepub fn title_case(&self) -> String
pub fn title_case(&self) -> String
Returns a Title Case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.title_case(), "Example String");Sourcepub fn header_case(&self) -> String
pub fn header_case(&self) -> String
Returns a Header-Case version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.header_case(), "Example-String");Sourcepub fn upper_snake_case(&self) -> String
pub fn upper_snake_case(&self) -> String
Returns a UPPER_SNAKE_CASE version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.upper_snake_case(), "EXAMPLE_STRING");Sourcepub fn alternating_case(&self) -> String
pub fn alternating_case(&self) -> String
Returns a AlTeRnAtInG cAsE version of the input text as a new String
§Example
let recase = recase::ReCase::new("Example String");
assert_eq!(recase.alternating_case(), "eXaMpLe StRiNg");Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ReCase<'a>
impl<'a> RefUnwindSafe for ReCase<'a>
impl<'a> Send for ReCase<'a>
impl<'a> Sync for ReCase<'a>
impl<'a> Unpin for ReCase<'a>
impl<'a> UnwindSafe for ReCase<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more