pub enum RenameAll {
Lowercase,
Uppercase,
PascalCase,
CamelCase,
SnakeCase,
ScreamingSnakeCase,
KebabCase,
ScreamingKebabCase,
}Expand description
Serde’s eight rename_all modes.
PR 1 declares the enum shape so EmitConfig::case_default type-checks;
PR 2 implements the actual case-transform table and property-tests it
against serde_json::to_string.
Variants§
Lowercase
"lowercase" — all-lower, no separator.
Uppercase
"UPPERCASE" — all-upper, no separator.
PascalCase
"PascalCase".
CamelCase
"camelCase".
SnakeCase
"snake_case".
ScreamingSnakeCase
"SCREAMING_SNAKE_CASE".
KebabCase
"kebab-case".
ScreamingKebabCase
"SCREAMING-KEBAB-CASE".
Implementations§
Source§impl RenameAll
impl RenameAll
Sourcepub fn apply_to_field(self, field: &str) -> String
pub fn apply_to_field(self, field: &str) -> String
Apply this rename_all mode to a field ident (assumed snake_case).
Examples (mirroring serde’s RenameRule::apply_to_field):
"parse_url_v2" → camelCase → "parseUrlV2"
"parse_url_v2" → PascalCase → "ParseUrlV2"
"parse_url_v2" → SCREAMING_SNAKE_CASE → "PARSE_URL_V2"
"parse_url_v2" → kebab-case → "parse-url-v2"Sourcepub fn apply_to_variant(self, variant: &str) -> String
pub fn apply_to_variant(self, variant: &str) -> String
Apply this rename_all mode to a variant ident (assumed PascalCase).
Examples (mirroring serde’s RenameRule::apply_to_variant):
"HTMLParser" → snake_case → "h_t_m_l_parser" (no acronym detection!)
"HTMLParser" → camelCase → "hTMLParser" (just lowercase first ch)
"ApiClient" → snake_case → "api_client"
"ApiClient" → kebab-case → "api-client"Trait Implementations§
impl Copy for RenameAll
impl Eq for RenameAll
impl StructuralPartialEq for RenameAll
Auto Trait Implementations§
impl Freeze for RenameAll
impl RefUnwindSafe for RenameAll
impl Send for RenameAll
impl Sync for RenameAll
impl Unpin for RenameAll
impl UnsafeUnpin for RenameAll
impl UnwindSafe for RenameAll
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
Mutably borrows from an owned value. Read more