File: flags.rs

package info (click to toggle)
rust-inventory 0.3.21-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 366 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
struct Flag {
    short: char,
    name: &'static str,
}

impl Flag {
    const fn new(short: char, name: &'static str) -> Self {
        Flag { short, name }
    }
}

inventory::submit! {
    Flag::new('v', "verbose")
}

inventory::collect!(Flag);

fn main() {
    for flag in inventory::iter::<Flag> {
        println!("-{}, --{}", flag.short, flag.name);
    }
}