1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::Patch;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Mail<'mail> {
Git(Patch<'mail>),
Mail(String),
}
pub struct PatchTree<'mail> {
pub this: Mail<'mail>,
pub children: Vec<PatchTree<'mail>>,
pub selected: bool,
}
impl<'mail> PatchTree<'mail> {
pub fn new(initial: Patch<'mail>) -> Self {
Self {
this: Mail::Git(initial),
children: Default::default(),
selected: false,
}
}
pub fn select(&mut self) {
self.selected = true;
}
pub fn deselect(&mut self) {
self.selected = false;
}
}