xinput/structures/keystroke.rs
1use crate::*;
2use bytemuck::{Pod, Zeroable};
3
4
5
6/// \[[microsoft.com](https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_keystroke)\]
7/// XINPUT_KEYSTROKE
8///
9/// Describes a gamepad-provided keystroke.
10#[derive(Clone, Copy, Debug)]
11#[derive(Default, Pod, Zeroable)]
12#[repr(C)] pub struct Keystroke {
13 /// Virtual key code of the key/button/stick movement.
14 pub virtual_key: VK,
15
16 /// Documented as being unused?
17 pub unicode: u16,
18
19 /// [`Keystroke::KeyDown`] | [`Keystroke::KeyUp`] | [`Keystroke::Repeat`]
20 pub flags: KeystrokeFlags,
21
22 /// Index of the signed-in gamer associated with the device. Can be a value in the range 0–3.
23 pub user_index: u8,
24
25 /// HID code corresponding to the input. If there is no corresponding HID code, this value is zero.
26 pub hid_code: u8,
27}
28
29impl AsRef<Self> for Keystroke { fn as_ref(& self) -> & Self { self } }
30impl AsMut<Self> for Keystroke { fn as_mut(&mut self) -> &mut Self { self } }
31
32#[test] fn test_traits_for_coverage() {
33 let _keystroke = Keystroke::zeroed();
34 let _keystroke = _keystroke.clone();
35 dbg!(_keystroke);
36}
37
38//#cpp2rust XINPUT_KEYSTROKE = xinput::Keystroke