Skip to main content

Crate patchable

Crate patchable 

Source
Expand description

§Patchable

A crate for handling partial updates to data structures.

This crate provides the Patchable, Patch, and TryPatch traits, along with derive macros for Patchable and Patch, and an attribute macro patchable_model re-exported from patchable_macro for easy derivation.

§Motivation

Many systems receive incremental updates where only a subset of fields change or can be considered part of the state. This crate formalizes this pattern by defining a patch type for a structure and providing a consistent way to apply such patches safely.

Traits§

Patch
A type that can be updated using its companion patch.
Patchable
A type that declares a companion patch type.
TryPatch
A fallible variant of Patch.

Attribute Macros§

patchable_model
Attribute macro that augments a struct with Patchable/Patch derives.

Derive Macros§

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