artifact_app/ui/
types.rs

1use dev_prefix::*;
2use types::*;
3
4/// settings for what to format
5#[derive(Debug, Default, Clone, PartialEq, Eq)]
6pub struct FmtSettings {
7    pub long: bool,
8    pub recurse: u8,
9    pub def: bool,
10    pub parts: bool,
11    pub partof: bool,
12    pub loc_path: bool,
13    pub text: bool,
14    pub color: bool,
15}
16
17impl FmtSettings {
18    pub fn is_empty(&self) -> bool {
19        !self.long && !self.def && !self.parts && !self.partof && !self.loc_path && !self.text
20    }
21}
22
23/// structure which contains all the information necessary to
24/// format an artifact for cmdline, html, or anything else
25/// purposely doesn't contain items that are *always* displayed
26/// such as completed or tested
27#[derive(Debug, Default)]
28pub struct FmtArtifact {
29    pub long: bool,
30    pub def: Option<PathBuf>,
31    pub parts: Option<Vec<FmtArtifact>>,
32    pub partof: Option<Vec<FmtArtifact>>,
33    pub done: Option<String>,
34    // pub loc_path: Option<PathBuf>,
35    // pub loc_line_col: (usize, usize),
36    // pub loc_valid: Option<bool>,
37    pub text: Option<String>,
38    pub name: NameRc,
39}
40
41
42#[derive(Debug, PartialEq, Eq)]
43pub struct PercentSearch {
44    pub lt: bool,
45    pub perc: i8,
46}
47
48impl Default for PercentSearch {
49    fn default() -> PercentSearch {
50        PercentSearch {
51            lt: false,
52            perc: -127,
53        }
54    }
55}
56
57
58#[derive(Debug, Default, PartialEq, Eq)]
59pub struct SearchSettings {
60    pub use_regex: bool,
61    pub name: bool,
62    pub def: bool,
63    pub parts: bool,
64    pub partof: bool,
65    pub loc: bool,
66    pub text: bool,
67    pub completed: PercentSearch,
68    pub tested: PercentSearch,
69}