Trait TupleDiffer

Source
pub trait TupleDiffer {
    type Ok;
    type Err;

    // Required methods
    fn diff_field<T>(&mut self, a: &T, b: &T)
       where T: Diff + ?Sized;
    fn end(self) -> Result<Self::Ok, Self::Err>;

    // Provided method
    fn skip_field<T: ?Sized>(&mut self) { ... }
}
Expand description

A type that can do something with information about differences in a tuple or tuple-like struct.

For two tuples to be of the same type (and thus be able to be diffed), they must be the same length. For types that vary in length, you want a SeqDiffer instead.

Required Associated Types§

Source

type Ok

Type returned on success.

Source

type Err

Type returned on failure.

Required Methods§

Source

fn diff_field<T>(&mut self, a: &T, b: &T)
where T: Diff + ?Sized,

Visits the next field in each tuple. The field number is implicit.

Source

fn end(self) -> Result<Self::Ok, Self::Err>

Finish diffing the tuples and return a result.

Provided Methods§

Source

fn skip_field<T: ?Sized>(&mut self)

Signals that a field is being skipped. Some differs may do something with this information.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TupleDiffer for ()

Source§

type Ok = ()

Source§

type Err = Void

Source§

fn diff_field<T>(&mut self, _: &T, _: &T)
where T: Diff + ?Sized,

Source§

fn end(self) -> Result<Self::Ok, Self::Err>

Implementors§

Source§

impl<R> TupleDiffer for Const<R>

Source§

type Ok = R

Source§

type Err = Void