1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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) } }