lighthouse_protocol/input/
key_event.rs

1use serde::{Deserialize, Serialize};
2
3use super::{EventSource, KeyModifiers};
4
5/// A keyboard event.
6#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
7#[serde(rename_all = "camelCase")]
8pub struct KeyEvent {
9    /// The client identifier.
10    pub source: EventSource,
11    /// Whether the key was pressed.
12    pub down: bool,
13    /// Whether the event is a repeat event.
14    pub repeat: bool,
15    /// The key pressed, see the docs on JS's `KeyboardEvent.code` for details.
16    pub code: String, // TODO: Extract stronger `Key` type
17    /// The held key modifiers.
18    pub modifiers: KeyModifiers,
19}