Struct keyboard_types::webdriver::KeyInputState
source · pub struct KeyInputState {
pressed: HashSet<Key>,
modifiers: Modifiers,
}
Expand description
Store pressed keys and modifiers.
Fields§
§pressed: HashSet<Key>
§modifiers: Modifiers
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
fn clear(&mut self, undo_actions: &mut HashSet<char>, result: &mut Vec<Event>)
fn dispatch_typeable(&mut self, text: &mut String, result: &mut Vec<Event>)
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
Auto Trait Implementations§
impl Freeze for KeyInputState
impl RefUnwindSafe for KeyInputState
impl Send for KeyInputState
impl Sync for KeyInputState
impl Unpin for KeyInputState
impl UnwindSafe for KeyInputState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more