Add #[serde(rename_all_fields = "foo")] attribute

This commit is contained in:
Jonas Platte
2019-12-15 19:08:27 +01:00
parent 03da66c805
commit 2f9bf4d3eb
5 changed files with 132 additions and 3 deletions
+8
View File
@@ -112,6 +112,14 @@ impl RenameRule {
ScreamingKebabCase => ScreamingSnakeCase.apply_to_field(field).replace('_', "-"),
}
}
/// Returns the `RenameRule` if it is not `None`, `rule_b` otherwise.
pub fn or(&self, rule_b: &Self) -> Self {
match self {
None => *rule_b,
_ => *self,
}
}
}
pub struct ParseError<'a> {