Expand description
An undo-redo library.
An implementation of the command pattern, where all edits are done by creating objects that applies the modifications. All objects knows how to undo the changes it applies, and by using the provided data structures it is easy to undo and redo edits made to a target.
See the examples for more information.
§Features
Edit
provides the base functionality for all edit commands. Multiple edit commands can be merged into a single edit by implementing themerge
method on the edit. This allows smaller edits to be used to build more complex operations, or smaller incremental changes to be merged into larger changes that can be undone and redone in a single step.Record
provides basic stack based undo-redo functionality.History
provides full tree based undo-redo functionality.- Queue and checkpoint functionality is supported for both
Record
andHistory
. - The target can be marked as saved to disk and the user will be notified when it changes.
- The amount of changes being tracked can be configured by the user so only the
N
most recent changes are stored. - Configurable display formatting using the display structures.
§Examples
All examples in the documentation uses the Add
command found here.
§Cargo Feature Flags
Name | Default | Enables | Description |
---|---|---|---|
std | ✓ | alloc | Enables the standard library. |
alloc | Enables the alloc crate. | ||
colored | Enables colored output when visualizing the display structures. | ||
serde | Enables serialization and deserialization. |
Re-exports§
Modules§
Structs§
- At
- A position in a history tree.
- Entry
- Wrapper around an
Edit
command that contains additional metadata.
Enums§
- Event
- Describes an event on the structures.
- Merged
- Says if the
Edit
command have been merged with another command.