Skip to main content

may_undo_out_of_order

Function may_undo_out_of_order 

Source
pub fn may_undo_out_of_order<'a, T: PartialEq + 'a, S>(
    undo: &'a [S],
    step: usize,
    targets_of: impl Fn(&'a S) -> Vec<&'a T>,
) -> Result<(), (usize, &'a T)>
Expand description

Whether undoing step out of order is allowed (VS Code’s rule): no later step of undo (oldest first) changed one of the same targets. targets_of names what a step changes. Err: the later step in the way, and the target it shares.