Expand description
Case conversion utilities. Case conversion functions and macros.
zyn ships its own case conversion — no dependency on heck.
§Functions
ⓘ
use zyn_core::case;
assert_eq!(case::to_snake("HelloWorld"), "hello_world");
assert_eq!(case::to_pascal("hello_world"), "HelloWorld");
assert_eq!(case::to_camel("hello_world"), "helloWorld");
assert_eq!(case::to_screaming("fooBar"), "FOO_BAR");
assert_eq!(case::to_kebab("FooBar"), "foo-bar");§Macros
ⓘ
// String form
let s: String = zyn_core::snake!("HelloWorld");
// → "hello_world"
// Ident form (preserves span)
let id: syn::Ident = zyn_core::pascal!(my_ident => ident);
// my_ident = `foo_bar` → `FooBar`Functions§
- to_
camel - Converts a string to camelCase.
- to_
kebab - Converts a string to kebab-case.
- to_
pascal - Converts a string to PascalCase.
- to_
screaming - Converts a string to SCREAMING_SNAKE_CASE.
- to_
snake - Converts a string to snake_case.