chiark / gitweb /
config derive: Switch to derive-deftly
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 20 Mar 2025 00:20:43 +0000 (00:20 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 20 Mar 2025 00:23:05 +0000 (00:23 +0000)
commitd59c5bbf36e7e4d515f6f120a832f4399d9da107
tree0def66c9cea765a2ca057c3171c2445d726913fb
parent7bb59417240f3c6388a4007ff9a78f8f94f31097
config derive: Switch to derive-deftly

Replace our bespoke proc_macro with a derive-deftly macro.

The macro is based on one written for derive-adhoc 0.0.1, so could do
with a bit of updating.

I've inspeccted the changes to the generated output with a semi-manual
diff.  The only significant changes were changes to
`impl InspectableConfigAuto for InstanceConfig`, as follows:

>    +                    "link" => &self.link,

This is case is handled by the manually-written
`impl InspectableConfig for InstanceConfig` so never reaches
the derived impl.  But it is identical.

>    +                    "max_batch_up" => &self.max_batch_up,

This seems to have been an omission in the previous code.
So the addition seems good.

>                         "max_clock_skew" => &self.max_clock_skew,
>    -                    "max_clock_skew" => &self.max_clock_skew,
>    -                    "ifname_server" => &self.ifname_server,
>                         "ifname_server" => &self.ifname_server,

This is the removal of two duplicates, which arose from the odd code
structure in the previous code, which does code gen for inspect_key
once per attribute, rather than once per field.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock
Cargo.lock.minimal
Cargo.toml
debian/control
macros/macros.rs
src/config.rs
src/config_derive.rs [new file with mode: 0644]
src/lib.rs
src/prelude.rs