/// 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();
/// let expected = vec![
///     Key::Modifier(KeyModifier::CONTROL),
///     Key::Modifier(KeyModifier::ALT),
///     Key::Special(KeySpecial::DELETE),
/// ];
/// assert_eq!(v, expected);
/// ```
Parses a string and returns the list of recognized keys, in order.
Parses a string and returns the list of recognized keys in order .
pub fn parse_key_string(i: &str) -> Result<Vec<Key>, &str> {
    all_consuming(separated_list1(tag("+"), parse_key))(i)
        .map_err(|_| "Failed to parse keystring")
        .map(|t| {
            debug_assert!(t.0.is_empty());
            t.1
        })
}
pub fn parse_key_string ( i : & str ) -> Result < Vec < Key > , & str > { all_consuming ( separated_list1 ( tag ( " " ) , parse_key ) ) ( i ) . map_err ( | _ | " " ) . map ( | t | { debug_assert ! ( t 0 is_empty ( ) ) ; t . 1 } ) }
Parses a string and returns the list of recognized keys, in order.
Parses a string and returns the list of recognized keys in order .
i
&str
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.
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();
let expected = vec![
Key::Modifier(KeyModifier::CONTROL),
Key::Modifier(KeyModifier::ALT),
Key::Special(KeySpecial::DELETE),
];
assert_eq!(v, expected);
```
` ` ` use keyboard_shortcut_parser :: { parse_key_string Key KeyModifier KeySpecial } . let i = " ctrl + alt + delete " ; let v = parse_key_string ( &i ) . unwrap () ; let expected = vec! [ Key :: Modifier ( KeyModifier :: CONTROL ) Key :: Modifier ( KeyModifier :: ALT ) Key :: Special ( KeySpecial :: DELETE ) ] ; assert_eq! ( v expected ) ; ` ` `