diff-match-patch-rs 0.5.1

The fastest implementation of Myer's diff algorithm to perform the operations required for synchronizing plain text.
Documentation
use crate::{dmp::Diff, DType};

pub enum PatchInput<'a, T: DType> {
    Texts(&'a str, &'a str),
    Diffs(&'a [Diff<T>]),
    TextDiffs(&'a str, &'a [Diff<T>]),
}

impl<'a, T: DType> PatchInput<'a, T> {
    pub fn new_text_text(old: &'a str, new: &'a str) -> Self {
        Self::Texts(old, new)
    }

    pub fn new_diffs(diffs: &'a [Diff<T>]) -> Self {
        Self::Diffs(diffs)
    }

    pub fn new_text_diffs(old: &'a str, diffs: &'a [Diff<T>]) -> Self {
        Self::TextDiffs(old, diffs)
    }
}