Crate undo[][src]

An undo-redo library with dynamic dispatch and automatic command merging.

It uses the command pattern where the user modifies the receiver by applying commands on it. Since each command knows how to undo and redo the changes it applies to the receiver, the state of the receiver can be rolled forwards or backwards by calling undo or redo in the correct order.

The Record and History provides functionality to store and keep track of the applied commands, and makes it easy to undo and redo changes. The Record provides a stack based undo-redo functionality, while the History provides a tree based undo-redo functionality where you can jump between different branches.

Commands can be merged using the merge! macro or the id method. When two commands are merged, undoing and redoing them are done in a single step.

Macros

merge

Macro for merging commands.

Structs

Error

An error which holds the command that caused it.

History

A history of commands.

HistoryBuilder

Builder for a history.

Merged

The result of merging two commands.

Merger

A command wrapper which always merges with itself.

Record

A record of commands.

RecordBuilder

Builder for a record.

Enums

Signal

The signal sent when the record, the history, or the receiver changes.

Traits

Command

Base functionality for all commands.