diff --git a/Cargo.toml b/Cargo.toml index 4b3d8db..d8756d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,11 @@ edition = "2018" [dependencies] serde = { version = "1.0.117", optional = true } serde_derive = { version = "1.0.117", optional = true } -serde_json = "1.0" +serde_json = { version = "1.0", optional = true } once_cell = "1.5.2" [features] -with_serde = ["serde", "serde_derive"] +with_serde = ["serde", "serde_derive", "serde_json"] [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3.9", features = ["winuser", "errhandlingapi"] } diff --git a/src/lib.rs b/src/lib.rs index 0fc176a..82a9139 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,7 @@ pub mod keyboard; pub mod mouse; #[derive(Debug, Copy, Clone, PartialEq)] -#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))] pub enum EventType { KeyPress(Key), KeyRelease(Key), @@ -21,7 +21,7 @@ pub enum EventType { } #[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))] pub struct Event { pub time: SystemTime, pub event_type: EventType,