[][src]Function keyboard_shortcut_parser::parse_key_string

pub fn parse_key_string(i: &str) -> IResult<&str, Vec<Key>>

Parses a string and returns the list of recognized keys, in order.

Panics

Panics if the keystring can't be parsed correctly. This happens if the segments are not valid modifiers, special keys or are alphanumeric and longer than one char.

Examples

use keyboard_shortcut_parser::{parse_key_string, Key, KeyModifier, KeySpecial};

let i = "ctrl+alt+delete";
let v = parse_key_string(&i).unwrap().1;
assert_eq!(v, vec![Key::Modifier(KeyModifier::CONTROL), Key::Modifier(KeyModifier::ALT), Key::Special(KeySpecial::DELETE)])