marmalade 0.0.1

A simple UI library for video games
Documentation
#[derive(Clone, PartialEq, Eq, Hash)]
pub enum Key {
    Digit1,
    Digit2,
    Digit3,
    Digit4,
    Digit5,
    Digit6,
    Digit7,
    Digit8,
    Digit9,
    Digit0,
    A,
    B,
    C,
    D,
    E,
    F,
    G,
    H,
    I,
    J,
    K,
    L,
    M,
    N,
    O,
    P,
    Q,
    R,
    S,
    T,
    U,
    V,
    W,
    X,
    Y,
    Z,
    ShiftLeft,
    CtrlLeft,
    Space,
}

impl Key {
    #[must_use]
    pub fn from_code(code: &str) -> Option<Self> {
        Some(match code {
            "Digit1" => Self::Digit1,
            "Digit2" => Self::Digit2,
            "Digit3" => Self::Digit3,
            "Digit4" => Self::Digit4,
            "Digit5" => Self::Digit5,
            "Digit6" => Self::Digit6,
            "Digit7" => Self::Digit7,
            "Digit8" => Self::Digit8,
            "Digit9" => Self::Digit9,
            "Digit0" => Self::Digit0,
            "KeyA" => Self::A,
            "KeyB" => Self::B,
            "KeyC" => Self::C,
            "KeyD" => Self::D,
            "KeyE" => Self::E,
            "KeyF" => Self::F,
            "KeyG" => Self::G,
            "KeyH" => Self::H,
            "KeyI" => Self::I,
            "KeyJ" => Self::J,
            "KeyK" => Self::K,
            "KeyL" => Self::L,
            "KeyM" => Self::M,
            "KeyN" => Self::N,
            "KeyO" => Self::O,
            "KeyP" => Self::P,
            "KeyQ" => Self::Q,
            "KeyR" => Self::R,
            "KeyS" => Self::S,
            "KeyT" => Self::T,
            "KeyU" => Self::U,
            "KeyV" => Self::V,
            "KeyW" => Self::W,
            "KeyX" => Self::X,
            "KeyY" => Self::Y,
            "KeyZ" => Self::Z,
            "ShiftLeft" => Self::ShiftLeft,
            "ControlLeft" => Self::CtrlLeft,
            "Space" => Self::Space,
            _ => return None,
        })
    }
}