rmk_types/action/
encoder.rs1use postcard::experimental::max_size::MaxSize;
4use serde::{Deserialize, Serialize};
5
6use super::KeyAction;
7
8#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, MaxSize)]
12#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
14#[cfg_attr(feature = "wasm", tsify(into_wasm_abi, from_wasm_abi))]
15pub struct EncoderAction {
16 pub clockwise: KeyAction,
18 pub counter_clockwise: KeyAction,
20}
21
22impl Default for EncoderAction {
23 fn default() -> Self {
24 Self {
25 clockwise: KeyAction::No,
26 counter_clockwise: KeyAction::No,
27 }
28 }
29}
30
31impl EncoderAction {
32 pub const fn new(clockwise: KeyAction, counter_clockwise: KeyAction) -> Self {
34 Self {
35 clockwise,
36 counter_clockwise,
37 }
38 }
39}