Skip to content

zd: Add rename_all attribute to (De)SerializeDict macros

Turbo Cooler requested to merge turbocooler/zbus:zd_rename_all into main

Adds Serde-like rename_all attribute to the SerializeDict and DeserializeDict derive macros as desribed in #305 (closed).

The attribute supports all case variants currently supported by the serde_derive crate. The rename attribute on fields is prioritized over the rename_all structure attribute to allow cases when a specific field must be renamed.

Current questions:

1. Is the new dependency on the convert_case crate OK? 2. Should I update the docs and the book? In the same PR or separately? 3. While testing the changes I've noticed that in case the attribute is not specified first it is ignored (e.g. in #[zvariant(signature = "XXX", rename_all = "PascalCase")] the rename_all attribute was ignored, probably the same thing would happen for the signature attribute in this position). Should I fix the get_signature_attribute and get_rename_attribute functions to allow for multiple attributes to exist at once?

Fixes #305 (closed).

Edited by Turbo Cooler

Merge request reports

Loading