dbus2 / zbus-old

Rust D-Bus crate.
https://gitlab.freedesktop.org/dbus/zbus
Other
49 stars 13 forks source link

Add Serde-like rename_all attribute to SerializeDict and DeserializeDict derive macros. #315

Closed zeenix closed 1 year ago

zeenix commented 1 year ago

In GitLab by @turbocooler on Jan 17, 2023, 16:39

Serde currently has a useful rename_all attribute for renaming all structure fields automatically when a non-snake case naming convention is used for serialization/deserialization.

This could be useful for cases like the ConnectionCredentials structure (not the best example because of all the ID parts) or various property dicts from the BlueZ API (see here).

Not renaming the fields automatically is obviously a good idea since e.g. PolicyKit APIs use the snake-case naming convention for properties.

I'll be happy to provide a PR if this is acceptable.

zeenix commented 1 year ago

I'll be happy to provide a PR if this is acceptable.

Thanks, sounds like a good enhancement to me. :)

zeenix commented 1 year ago

mentioned in commit d0aa1d6dd1c4bf3504f26b4cfe5c07cb2b235d93