[][src]Trait binjs::meta::util::ToCases

pub trait ToCases: ToStr {
    fn to_class_cases(&self) -> String { ... }
fn to_cpp_enum_case(&self) -> String { ... }
fn to_cpp_field_case(&self) -> String { ... }
fn to_rust_identifier_case(&self) -> String { ... } }

A string or string-like construction that can be converted to upper case, lower case, class case, etc

Provided methods

fn to_class_cases(&self) -> String

Return the value in class case, e.g.

use binjs_meta::util::ToCases;

assert_eq!(&"foo_bar".to_class_cases(), "FooBar");
assert_eq!(&"fooBars".to_class_cases(), "FooBars");

fn to_cpp_enum_case(&self) -> String

Return the value in a format suitable for use as a cpp enum variants.

use binjs_meta::util::ToCases;

assert_eq!(&"foo_bar".to_cpp_enum_case(), "FooBar");
assert_eq!(&"fooBars".to_cpp_enum_case(), "FooBars");
assert_eq!(&"+=".to_cpp_enum_case(), "PlusAssign");

fn to_cpp_field_case(&self) -> String

Return the value in a format suitable for use as a C++ field name or identifier.

use binjs_meta::util::ToCases;

assert_eq!(&"foo_bar".to_cpp_field_case(), "fooBar");
assert_eq!(&"fooBars".to_cpp_field_case(), "fooBars");
assert_eq!(&"class".to_cpp_field_case(), "class_");

fn to_rust_identifier_case(&self) -> String

Return the value in a format suitable for use as a Rust field name or identifier.

use binjs_meta::util::ToCases;

assert_eq!(&"foo_bar".to_rust_identifier_case(), "foo_bar");
assert_eq!(&"fooBars".to_rust_identifier_case(), "foo_bars");
assert_eq!(&"self".to_rust_identifier_case(), "self_");
Loading content...

Implementors

impl<T> ToCases for T where
    T: ToStr
[src]

Loading content...