Trait SeqDiffer

Source
pub trait SeqDiffer {
    type Ok;
    type Err;

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

    // Provided method
    fn diff_elements<T, I>(&mut self, a: I, b: I)
       where T: Diff,
             I: IntoIterator<Item = T> { ... }
}
Expand description

A type that can do something with information about differences in a sequence, like a slice or Vec.

Required Associated Types§

Source

type Ok

Type returned on success.

Source

type Err

Type returned on failure.

Required Methods§

Source

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

We’ve found elements in corresponding positions in both sequences.

Source

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

We’ve found an element that only appears in the left-hand sequence.

Source

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

We’ve found an element that only appears in the right-hand sequence.

Source

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

Complete the sequence and produce the result.

Provided Methods§

Source

fn diff_elements<T, I>(&mut self, a: I, b: I)
where T: Diff, I: IntoIterator<Item = T>,

Consumes two iterators, diffing their contents. This is a convenience method implemented in terms of the others.

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 SeqDiffer for ()

Source§

type Ok = ()

Source§

type Err = Void

Source§

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

Source§

fn diff_elements<T, I>(&mut self, _: I, _: I)
where T: Diff, I: IntoIterator<Item = T>,

Source§

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

Source§

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

Source§

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

Implementors§

Source§

impl<R> SeqDiffer for Const<R>

Source§

type Ok = R

Source§

type Err = Void