Trait Diffable

Source
pub trait Diffable<Other> {
    const KIND: DiffKind;

    // Required method
    fn diff(&self, other: Other) -> Diff;
}
Available on crate feature diff only.
Expand description

A value which can be diffed against another value.

Diffing two values produces a Diff, which consists of a list of DiffSegments.

Required Associated Constants§

Source

const KIND: DiffKind

A discriminant that represents how the diff should be formatted.

See DiffKind.

Required Methods§

Source

fn diff(&self, other: Other) -> Diff

Generate a diff of this value and other.

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 Diffable<String> for String

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: String) -> Diff

Source§

impl<'a> Diffable<&'a str> for &'a str

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: &'a str) -> Diff

Source§

impl<'a> Diffable<&'a str> for Cow<'a, str>

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: &'a str) -> Diff

Source§

impl<'a> Diffable<&'a str> for String

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: &'a str) -> Diff

Source§

impl<'a> Diffable<Cow<'a, str>> for &'a str

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: Cow<'a, str>) -> Diff

Source§

impl<'a> Diffable<Cow<'a, str>> for Cow<'a, str>

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: Cow<'a, str>) -> Diff

Source§

impl<'a> Diffable<Cow<'a, str>> for String

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: Cow<'a, str>) -> Diff

Source§

impl<'a> Diffable<String> for &'a str

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: String) -> Diff

Source§

impl<'a> Diffable<String> for Cow<'a, str>

Source§

const KIND: DiffKind = DiffKind::String

Source§

fn diff(&self, other: String) -> Diff

Source§

impl<'a, T> Diffable<&'a [T]> for &'a [T]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &'a [T]) -> Diff

Source§

impl<'a, T> Diffable<&'a [T]> for &Vec<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &'a [T]) -> Diff

Source§

impl<'a, T> Diffable<&'a [T]> for Vec<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &'a [T]) -> Diff

Source§

impl<'a, T> Diffable<&Vec<T>> for &'a [T]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &Vec<T>) -> Diff

Source§

impl<'a, T> Diffable<Vec<T>> for &'a [T]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: Vec<T>) -> Diff

Source§

impl<'a, T, const LEN: usize> Diffable<&'a [T]> for &[T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &'a [T]) -> Diff

Source§

impl<'a, T, const LEN: usize> Diffable<&'a [T]> for [T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &'a [T]) -> Diff

Source§

impl<'a, T, const OTHER_LEN: usize> Diffable<&[T; OTHER_LEN]> for &'a [T]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &[T; OTHER_LEN]) -> Diff

Source§

impl<'a, T, const OTHER_LEN: usize> Diffable<[T; OTHER_LEN]> for &'a [T]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: [T; OTHER_LEN]) -> Diff

Source§

impl<K, V> Diffable<&BTreeMap<K, V>> for &BTreeMap<K, V>
where K: Eq + Hash + Ord + Clone + Debug, V: Eq + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Map

Source§

fn diff(&self, other: &BTreeMap<K, V>) -> Diff

Source§

impl<K, V> Diffable<&HashMap<K, V>> for &HashMap<K, V>
where K: Eq + Hash + Clone + Debug, V: Eq + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Map

Source§

fn diff(&self, other: &HashMap<K, V>) -> Diff

Source§

impl<K, V> Diffable<BTreeMap<K, V>> for BTreeMap<K, V>
where K: Eq + Hash + Ord + Clone + Debug, V: Eq + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Map

Source§

fn diff(&self, other: BTreeMap<K, V>) -> Diff

Source§

impl<K, V> Diffable<HashMap<K, V>> for HashMap<K, V>
where K: Eq + Hash + Clone + Debug, V: Eq + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Map

Source§

fn diff(&self, other: HashMap<K, V>) -> Diff

Source§

impl<T> Diffable<&BTreeSet<T>> for &BTreeSet<T>
where T: Eq + Hash + Ord + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Set

Source§

fn diff(&self, other: &BTreeSet<T>) -> Diff

Source§

impl<T> Diffable<&Vec<T>> for &Vec<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &Vec<T>) -> Diff

Source§

impl<T> Diffable<&HashSet<T>> for &HashSet<T>
where T: Eq + Hash + Clone + Debug,

Source§

const KIND: DiffKind = DiffKind::Set

Source§

fn diff(&self, other: &HashSet<T>) -> Diff

Source§

impl<T> Diffable<BTreeSet<T>> for BTreeSet<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Set

Source§

fn diff(&self, other: BTreeSet<T>) -> Diff

Source§

impl<T> Diffable<Vec<T>> for Vec<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: Vec<T>) -> Diff

Source§

impl<T> Diffable<HashSet<T>> for HashSet<T>
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Set

Source§

fn diff(&self, other: HashSet<T>) -> Diff

Source§

impl<T, const LEN: usize> Diffable<&Vec<T>> for &[T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &Vec<T>) -> Diff

Source§

impl<T, const LEN: usize> Diffable<Vec<T>> for &[T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: Vec<T>) -> Diff

Source§

impl<T, const LEN: usize> Diffable<Vec<T>> for [T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: Vec<T>) -> Diff

Source§

impl<T, const LEN: usize, const OTHER_LEN: usize> Diffable<&[T; OTHER_LEN]> for &[T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: &[T; OTHER_LEN]) -> Diff

Source§

impl<T, const LEN: usize, const OTHER_LEN: usize> Diffable<[T; OTHER_LEN]> for [T; LEN]
where T: Clone + Hash + Ord + Debug,

Source§

const KIND: DiffKind = DiffKind::Slice

Source§

fn diff(&self, other: [T; OTHER_LEN]) -> Diff

Implementors§