Skip to main content

Patchable

Derive Macro Patchable 

Source
#[derive(Patchable)]
{
    // Attributes available to this derive:
    #[patchable]
}
Expand description

Derive macro that generates the companion Patch type and Patchable impl.

The generated patch type:

  • mirrors the original struct shape (named/tuple/unit),
  • includes fields unless marked with #[patchable(skip)],
  • implements Clone and PartialEq,
  • also derives serde::Deserialize when the serde feature is enabled for the macro crate.

The Patchable impl sets type Patch = <StructName>Patch<...> and adds any required generic bounds.

When the impl_from feature is enabled for the macro crate, a From<Struct> implementation is also generated for the patch type.