diff options
| -rw-r--r-- | Cargo.toml | 4 | ||||
| -rw-r--r-- | dome_key_map.h | 5 | ||||
| -rw-r--r-- | src/config.rs | 15 | ||||
| -rw-r--r-- | src/lib.rs | 3 | 
4 files changed, 24 insertions, 3 deletions
| @@ -12,11 +12,13 @@ getopts = "0.2.18"  libc = "0.2.43"  log = "0.4.5"  objc = "0.2.5" +serde = "1.0.58" +serde_derive = "1.0.58"  stderrlog = "0.4.1"  xdg = "2.1.0"  [build-dependencies] -cbindgen = "0.6.2" +cbindgen = "0.6.6"  [lib]  crate-type = ["staticlib"] diff --git a/dome_key_map.h b/dome_key_map.h index 86bd45d..2a73d8f 100644 --- a/dome_key_map.h +++ b/dome_key_map.h @@ -1,6 +1,6 @@  /* Test */ -/* Generated with cbindgen:0.6.2 */ +/* Generated with cbindgen:0.6.6 */  #include <stdint.h>  #include <stdlib.h> @@ -24,8 +24,11 @@ typedef struct {    bool daemon;  } Args; +typedef uint16_t Milliseconds; +  typedef struct {    Args args; +  Milliseconds timeout;  } Config;  typedef struct { diff --git a/src/config.rs b/src/config.rs index 6ee2d17..22f37b6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,7 @@  use getopts::Options; +type Milliseconds = u16; +  #[repr(C)]  #[derive(Default)]  struct Args { @@ -8,9 +10,20 @@ struct Args {  }  #[repr(C)] -#[derive(Default)] +#[derive(Deserialize)]  pub struct Config { +    #[serde(skip)]      args: Args, +    timeout: Milliseconds, +} + +impl Default for Config { +    fn default() -> Self { +        Config { +            args: Args::default(), +            timeout: 500, +        } +    }  }  fn print_usage(opts: Options) { @@ -15,6 +15,9 @@ extern crate log;  #[macro_use]  extern crate objc; + +#[macro_use] +extern crate serde_derive;  extern crate stderrlog;  extern crate xdg; | 
