cset 0.1.1

Fine-grained and reversible struct transactions
Documentation
  • Coverage
  • 5%
    1 out of 20 items documented1 out of 12 items with examples
  • Size
  • Source code size: 6.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.14 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • nickdbush/cset
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nickdbush

drates.io docs.rs

cset

Fine-grained and reversible struct transactions.

This crate offers a Track macro that structs can derive to generate the plumbing needed to precisely track changes to fields. Calling Trackable::edit() returns a Draft that stores edits separately from the underyling struct, such that no values are written.

When .commit() is called on the draft, edits are applied to the base struct. Each replaced value is returned to the caller as a Change in a ChangeSet. This changeset can then be re-applied to a struct of the same type, which replaces fields with values from the ChangeSet. This operation produces a new ChangeSet, allowing for the implementation of an undo-redo paradigm.

Project status

This project is early in development and API changes should be expected.