clap/args/arg_builder/
switched.rs

1use crate::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 {
26        a.s.clone()
27    }
28}
29
30impl<'e> Clone for Switched<'e> {
31    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}