pub trait Invertible<N> {
// Required method
fn uncombine(&self, a: &mut N, b: &N);
}
Expand description
A trait for invertible operations.
Required Methods§
Sourcefn uncombine(&self, a: &mut N, b: &N)
fn uncombine(&self, a: &mut N, b: &N)
A method such that the following code will leave a
in the same state as it
started.
// after running these two methods, a should be unchanged:
op.combine_mut(&mut a, &b);
op.uncombine(&mut a, &b);
assert_eq!(a, original_value_of_a);
// a should also be unchanged after running them in the reverse order
op.uncombine(&mut a, &b);
op.combine_mut(&mut a, &b);
assert_eq!(a, original_value_of_a);