1#[derive(Debug, Clone, PartialEq)]
3pub enum Filter {
4 Complete,
6
7 Nothing,
9
10 List(Vec<String>),
12}
13
14impl From<&str> for Filter {
15 fn from(s: &str) -> Self {
16 match s {
17 "nothing" | "Nothing" => Filter::Nothing,
18 _ => Filter::Complete,
19 }
20 }
21}
22
23impl From<String> for Filter {
24 fn from(s: String) -> Self {
25 Filter::from(s.as_str())
26 }
27}
28
29impl From<Vec<String>> for Filter {
30 fn from(v: Vec<String>) -> Self {
31 Filter::List(v)
32 }
33}
34
35impl From<Vec<&str>> for Filter {
36 fn from(v: Vec<&str>) -> Self {
37 let vec: Vec<String> = v.iter().map(|s| s.to_string()).collect();
38 Filter::from(vec)
39 }
40}
41
42impl Default for Filter {
43 fn default() -> Self {
44 Filter::Complete
45 }
46}