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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl PartialEq<RenameRule> for RenameRule
impl PartialEq<RenameRule> for RenameRule
impl Copy for RenameRule
impl StructuralPartialEq for RenameRule
Auto Trait Implementations
impl RefUnwindSafe for RenameRule
impl Send for RenameRule
impl Sync for RenameRule
impl Unpin for RenameRule
impl UnwindSafe for RenameRule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more