Enum serde_derive_internals::attr::RenameRule
source · [−]pub enum RenameRule {
None,
LowerCase,
UpperCase,
PascalCase,
CamelCase,
SnakeCase,
ScreamingSnakeCase,
KebabCase,
ScreamingKebabCase,
}
Expand description
The different possible ways to change case of fields in a struct, or variants in an enum.
Variants
None
Don’t apply a default rename rule.
LowerCase
Rename direct children to “lowercase” style.
UpperCase
Rename direct children to “UPPERCASE” style.
PascalCase
Rename direct children to “PascalCase” style, as typically used for enum variants.
CamelCase
Rename direct children to “camelCase” style.
SnakeCase
Rename direct children to “snake_case” style, as commonly used for fields.
ScreamingSnakeCase
Rename direct children to “SCREAMING_SNAKE_CASE” style, as commonly used for constants.
KebabCase
Rename direct children to “kebab-case” style.
ScreamingKebabCase
Rename direct children to “SCREAMING-KEBAB-CASE” style.
Implementations
sourceimpl RenameRule
impl RenameRule
pub fn from_str(rename_all_str: &str) -> Result<Self, ParseError<'_>>
sourcepub fn apply_to_variant(&self, variant: &str) -> String
pub fn apply_to_variant(&self, variant: &str) -> String
Apply a renaming rule to an enum variant, returning the version expected in the source.
sourcepub fn apply_to_field(&self, field: &str) -> String
pub fn apply_to_field(&self, field: &str) -> String
Apply a renaming rule to a struct field, returning the version expected in the source.
Trait Implementations
sourceimpl Clone for RenameRule
impl Clone for RenameRule
sourcefn clone(&self) -> RenameRule
fn clone(&self) -> RenameRule
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more