Function undo
pub fn undo(
doc: &mut AutoCommit,
scope: &Scope,
limit: usize,
compensate: impl FnMut(&Version) -> Result<Option<Box<dyn Action>>, String>,
) -> Result<Vec<Version>, String>Expand description
Take back scope’s last limit steps that are in effect, as one new
change in doc’s open transaction: each through the inverse compensate
gives for it, else by reverting its patches. Returns the steps, newest
first. On a refusal some of it may already be written: the caller
discards the transaction, as the action executor does for a refused
action.
§Errors
Says why nothing was undone: there is nothing of the scope’s to undo, somebody else has since changed what a step touched, or an inverse cannot be applied.