• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use Arg;
2 
3 #[derive(Debug)]
4 pub struct Switched<'b> {
5     pub short: Option<char>,
6     pub long: Option<&'b str>,
7     pub aliases: Option<Vec<(&'b str, bool)>>, // (name, visible)
8     pub disp_ord: usize,
9     pub unified_ord: usize,
10 }
11 
12 impl<'e> Default for Switched<'e> {
default() -> Self13     fn default() -> Self {
14         Switched {
15             short: None,
16             long: None,
17             aliases: None,
18             disp_ord: 999,
19             unified_ord: 999,
20         }
21     }
22 }
23 
24 impl<'n, 'e, 'z> From<&'z Arg<'n, 'e>> for Switched<'e> {
from(a: &'z Arg<'n, 'e>) -> Self25     fn from(a: &'z Arg<'n, 'e>) -> Self {
26         a.s.clone()
27     }
28 }
29 
30 impl<'e> Clone for Switched<'e> {
clone(&self) -> Self31     fn clone(&self) -> Self {
32         Switched {
33             short: self.short,
34             long: self.long,
35             aliases: self.aliases.clone(),
36             disp_ord: self.disp_ord,
37             unified_ord: self.unified_ord,
38         }
39     }
40 }
41