Skip to content

Instantly share code, notes, and snippets.

View HactarCE's full-sized avatar
🦀
Failure isn't an Option<T>. It's a Result<T, E>.

Andrew Farkas HactarCE

🦀
Failure isn't an Option<T>. It's a Result<T, E>.
View GitHub Profile
@HactarCE
HactarCE / history.rs
Created October 6, 2020 18:32
Transient undo history test
//! Undo/redo history.
//!
//! The simplest model of undo history consists of a single "undo stack." Every
//! operation pushes a history entry for the previous state onto the undo stack.
//! The "undo" action pops a history entry from the top of the undo stack and
//! restores it.
//!
//! To add "redo" functionality, we make an additional "redo stack." To undo an
//! action, we push an entry onto the redo stack and then pop an entry from the
//! undo stack to restore. To redo an action, we push an entry onto the undo