diff_match_patch_rs/
patch_input.rs1use crate::{dmp::Diff, DType};
2
3pub enum PatchInput<'a, T: DType> {
4 Texts(&'a str, &'a str),
5 Diffs(&'a [Diff<T>]),
6 TextDiffs(&'a str, &'a [Diff<T>]),
7}
8
9impl<'a, T: DType> PatchInput<'a, T> {
10 pub fn new_text_text(old: &'a str, new: &'a str) -> Self {
11 Self::Texts(old, new)
12 }
13
14 pub fn new_diffs(diffs: &'a [Diff<T>]) -> Self {
15 Self::Diffs(diffs)
16 }
17
18 pub fn new_text_diffs(old: &'a str, diffs: &'a [Diff<T>]) -> Self {
19 Self::TextDiffs(old, diffs)
20 }
21}