Skip to main content

fret_runtime/keymap/
wire.rs

1use serde::Deserialize;
2
3#[derive(Debug, Deserialize)]
4pub struct KeymapFileV1 {
5    pub keymap_version: u32,
6    pub bindings: Vec<BindingV1>,
7}
8
9#[derive(Debug, Deserialize)]
10pub struct BindingV1 {
11    pub command: Option<String>,
12    pub platform: Option<String>,
13    pub when: Option<String>,
14    pub keys: KeySpecV1,
15}
16
17#[derive(Debug, Deserialize)]
18pub struct KeySpecV1 {
19    pub mods: Vec<String>,
20    pub key: String,
21}
22
23#[derive(Debug, Deserialize)]
24pub(super) struct KeymapFileAny {
25    pub keymap_version: u32,
26    pub bindings: Vec<BindingAny>,
27}
28
29#[derive(Debug, Deserialize)]
30pub(super) struct BindingAny {
31    pub command: Option<String>,
32    pub platform: Option<String>,
33    pub when: Option<String>,
34    pub keys: KeysAny,
35}
36
37#[derive(Debug, Deserialize)]
38#[serde(untagged)]
39pub(super) enum KeysAny {
40    Single(KeySpecV1),
41    Sequence(Vec<KeySpecV1>),
42}