Struct keyboard_types::webdriver::KeyInputState
source · [−]Expand description
Store pressed keys and modifiers.
Spec: https://w3c.github.io/webdriver/#dfn-key-input-state
Fields
pressed: HashSet<Key>
modifiers: Modifiers
Implementations
sourceimpl 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
sourceimpl Clone for KeyInputState
impl Clone for KeyInputState
sourcefn clone(&self) -> KeyInputState
fn clone(&self) -> KeyInputState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for KeyInputState
impl Debug for KeyInputState
sourceimpl Default for KeyInputState
impl Default for KeyInputState
sourcefn default() -> KeyInputState
fn default() -> KeyInputState
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for KeyInputState
impl<'de> Deserialize<'de> for KeyInputState
sourcefn 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
sourceimpl Serialize for KeyInputState
impl Serialize for KeyInputState
Auto Trait Implementations
impl RefUnwindSafe for KeyInputState
impl Send for KeyInputState
impl Sync for KeyInputState
impl Unpin for KeyInputState
impl UnwindSafe for KeyInputState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more