Struct keyboard_types::webdriver::KeyInputState
source · pub struct KeyInputState { /* private fields */ }Expand description
Store pressed keys and modifiers.
Spec: https://w3c.github.io/webdriver/#dfn-key-input-state
Implementations§
source§impl KeyInputState
impl KeyInputState
sourcepub fn new() -> KeyInputState
pub fn new() -> KeyInputState
New state without any keys or modifiers pressed.
Same as the default value.
sourcepub fn dispatch_keydown(&mut self, raw_key: char) -> KeyboardEvent
pub fn dispatch_keydown(&mut self, raw_key: char) -> KeyboardEvent
Get a keyboard-keydown event from a WebDriver key value.
Stores that the key is pressed in the state object.
The input cancel list is not implemented here but can be emulated
by adding the raw_key value with a keyUp action to a list
before executing this function.
Specification: https://w3c.github.io/webdriver/#dfn-dispatch-a-keydown-action
sourcepub fn dispatch_keyup(&mut self, raw_key: char) -> Option<KeyboardEvent>
pub fn dispatch_keyup(&mut self, raw_key: char) -> Option<KeyboardEvent>
Get a keyboard-keyup event from a WebDriver key value.
Updates state. Returns None if the key is not listed as pressed.
Specification: https://w3c.github.io/webdriver/#dfn-dispatch-a-keyup-action
Trait Implementations§
source§impl Clone for KeyInputState
impl Clone for KeyInputState
source§fn clone(&self) -> KeyInputState
fn clone(&self) -> KeyInputState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for KeyInputState
impl Debug for KeyInputState
source§impl Default for KeyInputState
impl Default for KeyInputState
source§fn default() -> KeyInputState
fn default() -> KeyInputState
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for KeyInputState
impl<'de> Deserialize<'de> for KeyInputState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more