1use super::Color;
2
3#[derive(Debug, Clone, Copy)]
7pub struct Diff<Left, Right> {
8 pub left: Left,
10 pub right: Right,
12 pub color: Color,
14 pub unified: bool,
16}
17
18impl<Left, Right> Diff<Left, Right> {
19 pub const fn new(left: Left, right: Right) -> Self {
21 Diff {
22 left,
23 right,
24 color: Color::Always,
25 unified: true,
26 }
27 }
28
29 pub fn left<NewLeft>(self, left: NewLeft) -> Diff<NewLeft, Right> {
31 let Diff {
32 left: _,
33 right,
34 color,
35 unified,
36 } = self;
37 Diff {
38 left,
39 right,
40 color,
41 unified,
42 }
43 }
44
45 pub fn right<NewRight>(self, right: NewRight) -> Diff<Left, NewRight> {
47 let Diff {
48 left,
49 right: _,
50 color,
51 unified,
52 } = self;
53 Diff {
54 left,
55 right,
56 color,
57 unified,
58 }
59 }
60
61 pub const fn color(mut self, color: Color) -> Self {
63 self.color = color;
64 self
65 }
66
67 pub const fn unified(mut self, unified: bool) -> Self {
69 self.unified = unified;
70 self
71 }
72}