Skip to main content

Reversible

Trait Reversible 

Source
pub trait Reversible<S>: Debug {
    // Required methods
    fn forward(&self, state: &mut S);
    fn backward(&self, state: &mut S);

    // Provided method
    fn description(&self) -> &str { ... }
}
Expand description

A reversible operation on state S.

§Laws

  1. Round-trip: forward(s); backward(s) restores s to its original value.
  2. Round-trip (reverse): backward(s); forward(s) also restores s.

Required Methods§

Source

fn forward(&self, state: &mut S)

Apply the operation.

Source

fn backward(&self, state: &mut S)

Undo the operation (apply the inverse).

Provided Methods§

Source

fn description(&self) -> &str

Human-readable description of this operation.

Implementors§