Simple undo
An easy to use undo-redo library:
use Undo;
let mut message = new;
message.update;
message.update;
assert_eq!;
message.undo; // "Simple "
message.undo; // ""
message.redo; // "Simple "
message.update;
assert_eq!;
let result: String = message.unwrap;
assert_eq!;
How it works
Undo wraps the given state and keeps one copy of it.
When [Undo::undo] is called, the previous state is re-created by re-applying the n-1 updates to the initial state.
If you need better performance, please consider alternatives such as undo or rundo crates, which allow you to define or generate the actual undo operation.