pub fn on_key_pressed<Body>(&self, key: KeyCode, mut action: Body)
    where
        Body: FnMut(), {
        if self
            .keyboard_events
            .iter()
            .filter(|e| e.keycode == key && e.state == InputState::Pressed)
            .count()
            > 0
        {
            action()
        }
    }
/// convenient function to run `action` if `key` is pressed during the current frame
convenient function to run `action` if `key` is pressed during the current frame
convenient function to run ` action ` if ` key ` is pressed during the current frame
pub fn on_key_pressed<Body>(&self, key: KeyCode, mut action: Body)
    where
        Body: FnMut(), {
        if self
            .keyboard_events
            .iter()
            .filter(|e| e.keycode == key && e.state == InputState::Pressed)
            .count()
            > 0
        {
            action()
        }
    }
pub fn on_key_pressed < Body > ( & self , key : KeyCode , mut action : Body ) where Body : FnMut ( ) , { if self . keyboard_events . iter ( ) . filter ( | e | e . keycode == key && e . state == InputState :: Pressed ) . count ( ) > 0 { action ( ) } }
convenient function to run `action` if `key` is pressed during the current frame
convenient function to run ` action ` if ` key ` is pressed during the current frame
&self
key
KeyCode
action
Body
&self
key
KeyCode
action
Body