xinput/structures/
vibration.rs1use bytemuck::{Pod, Zeroable};
2
3
4
5#[derive(Clone, Copy, Debug)]
10#[derive(Default, Pod, Zeroable)]
11#[repr(C)] pub struct Vibration {
12 pub left_motor_speed: u16,
19
20 pub right_motor_speed: u16,
27}
28
29impl From<() > for Vibration { fn from(_: () ) -> Self { Self { left_motor_speed: 0, right_motor_speed: 0 } } }
30impl From<(u16, u16)> for Vibration { fn from((l, r): (u16, u16)) -> Self { Self { left_motor_speed: l, right_motor_speed: r } } }
31impl From<[u16; 2] > for Vibration { fn from([l, r]: [u16; 2] ) -> Self { Self { left_motor_speed: l, right_motor_speed: r } } }
32
33impl AsRef<Self> for Vibration { fn as_ref(& self) -> & Self { self } }
34impl AsMut<Self> for Vibration { fn as_mut(&mut self) -> &mut Self { self } }
35
36#[test] fn test_traits_for_coverage() {
37 let _vibration = Vibration::default();
38 let _vibration = Vibration::zeroed();
39 let _vibration = _vibration.clone();
40 dbg!(_vibration);
41}
42
43