viiper_client/devices/keyboard/
input.rs1use crate::wire::DeviceInput;
4
5#[derive(Debug, Clone, Default)]
6pub struct KeyboardInput {
7 pub modifiers: u8,
8 pub count: u8,
9 pub keys: Vec<u8>,
10}
11
12impl DeviceInput for KeyboardInput {
13 fn to_bytes(&self) -> Vec<u8> {
14 let mut buf = Vec::new();
15 buf.extend_from_slice(&self.modifiers.to_le_bytes());
16 buf.extend_from_slice(&self.count.to_le_bytes());
17
18 for item in &self.keys {
19 buf.extend_from_slice(&item.to_le_bytes());
20 }
21 buf
22 }
23}