File: parse.rs

package info (click to toggle)
rust-caps 0.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208 kB
  • sloc: makefile: 2
file content (15 lines) | stat: -rw-r--r-- 377 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use caps::Capability;
use std::str::FromStr;

fn main() {
    let input = std::env::args().nth(1).expect("missing argument");
    match Capability::from_str(&input.to_uppercase()) {
        Ok(p) => println!(
            "Parsed: {} -> index={}, bitmask={}",
            p,
            p.index(),
            p.bitmask()
        ),
        Err(e) => println!("{}", e),
    }
}