aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--dome_key_map.h5
-rw-r--r--src/config.rs15
-rw-r--r--src/lib.rs3
4 files changed, 24 insertions, 3 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 53b5729..45b5883 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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) {
diff --git a/src/lib.rs b/src/lib.rs
index ed9e9c3..300cc66 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,6 +15,9 @@ extern crate log;
#[macro_use]
extern crate objc;
+
+#[macro_use]
+extern crate serde_derive;
extern crate stderrlog;
extern crate xdg;