Skip to main content

Edit

Trait Edit 

Source
pub trait Edit<S> {
    // Required methods
    fn apply(&mut self, s: &mut S);
    fn revert(&mut self, s: &mut S);
    fn label(&self) -> &str;

    // Provided methods
    fn merge(&mut self, _next: &mut dyn Edit<S>) -> bool { ... }
    fn value(&self) -> Option<&dyn Any> { ... }
}
Expand description

one undoable change of a state S

Required Methods§

Source

fn apply(&mut self, s: &mut S)

do it (again)

Source

fn revert(&mut self, s: &mut S)

take it back

Source

fn label(&self) -> &str

shown in “Rückgängig: …”

Provided Methods§

Source

fn merge(&mut self, _next: &mut dyn Edit<S>) -> bool

absorb the following edit into this one (true: it is part of this step now)

Source

fn value(&self) -> Option<&dyn Any>

(merge) the edit as Any-like data: the merge partner’s own value

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Clone + 'static> Edit<T> for Snapshot<T>