Trait undo::Edit

source ·
pub trait Edit {
    type Target;
    type Output;

    // Required methods
    fn edit(&mut self, target: &mut Self::Target) -> Self::Output;
    fn undo(&mut self, target: &mut Self::Target) -> Self::Output;

    // Provided methods
    fn redo(&mut self, target: &mut Self::Target) -> Self::Output { ... }
    fn merge(&mut self, other: Self) -> Merged<Self>
       where Self: Sized { ... }
}
Expand description

Base functionality for all edit commands.

Required Associated Types§

source

type Target

The target type.

source

type Output

The output type.

Required Methods§

source

fn edit(&mut self, target: &mut Self::Target) -> Self::Output

Applies the edit command on the target.

source

fn undo(&mut self, target: &mut Self::Target) -> Self::Output

Restores the state of the target as it was before the edit was applied.

Provided Methods§

source

fn redo(&mut self, target: &mut Self::Target) -> Self::Output

Reapplies the edit on the target.

The default implementation uses the Edit::edit implementation.

source

fn merge(&mut self, other: Self) -> Merged<Self>where Self: Sized,

Used for manual merging of edits. See Merged for more information.

Implementors§