clap/args/arg_builder/
switched.rs

1use Arg;
2
3#[derive(Debug)]
4pub 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
12impl<'e> Default for Switched<'e> {
13    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
24impl<'n, 'e, 'z> From<&'z Arg<'n, 'e>> for Switched<'e> {
25    fn from(a: &'z Arg<'n, 'e>) -> Self { a.s.clone() }
26}
27
28impl<'e> Clone for Switched<'e> {
29    fn clone(&self) -> Self {
30        Switched {
31            short: self.short,
32            long: self.long,
33            aliases: self.aliases.clone(),
34            disp_ord: self.disp_ord,
35            unified_ord: self.unified_ord,
36        }
37    }
38}