diff --git a/Cargo.toml b/Cargo.toml index 086005a..3623086 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,28 +17,28 @@ include = ["examples/**/*", "tests/**/*", "src/**/*", "LICENSE", "README.md", "C features = ["events", "tls"] [dependencies] -async-stream = { version = "0.3.3", optional = true } +async-stream = { version = "0.3.4", optional = true } base64 = "0.21.0" -bitflags = "1.3.2" -futures-util = { version = "0.3.25", features = ["sink"] } -rgb = { version = "0.8.34", default-features = false } -semver = { version = "1.0.16", features = ["serde"] } -serde = { version = "1.0.152", features = ["derive"] } -serde_json = "1.0.91" -serde_repr = "0.1.10" -serde_with = "2.2.0" +bitflags = { version = "2.0.2", features = ["serde"] } +futures-util = { version = "0.3.28", features = ["sink"] } +rgb = { version = "0.8.36", default-features = false } +semver = { version = "1.0.17", features = ["serde"] } +serde = { version = "1.0.159", features = ["derive"] } +serde_json = "1.0.95" +serde_repr = "0.1.12" +serde_with = "2.3.1" sha2 = "0.10.6" -thiserror = "1.0.38" -time = "0.3.17" -tokio = { version = "1.24.2", features = ["net", "rt", "sync", "time"] } +thiserror = "1.0.40" +time = "0.3.20" +tokio = { version = "1.27.0", features = ["net", "rt", "sync", "time"] } tokio-tungstenite = "0.18.0" tracing = "0.1.37" [dev-dependencies] -anyhow = "1.0.68" -dotenvy = "0.15.6" -serde_test = "1.0.152" -tokio = { version = "1.24.2", features = ["fs", "macros", "rt-multi-thread", "time"] } +anyhow = "1.0.70" +dotenvy = "0.15.7" +serde_test = "1.0.159" +tokio = { version = "1.27.0", features = ["fs", "macros", "rt-multi-thread", "time"] } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } [features] diff --git a/src/common.rs b/src/common.rs index fa0658a..4a38b1a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -25,6 +25,7 @@ pub enum MonitorType { bitflags! { /// Different flags for font display that can be combined. + #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct FontFlags: u8 { /// Make the text appear thicker. const BOLD = 1; @@ -47,7 +48,7 @@ impl TryFrom for FontFlags { impl From for u8 { fn from(value: FontFlags) -> Self { - value.bits + value.bits() } } @@ -58,7 +59,9 @@ bitflags! { /// For example, only using `LEFT` would arrange the target to the left horizontally and /// centered vertically. To align to the top right, the alignments can be combined to /// `LEFT | TOP`. Combining both values for a single axis is invalid, like `LEFT | RIGHT`. - #[derive(Default, Deserialize, Serialize)] + #[derive( + Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize, + )] #[serde(transparent)] pub struct Alignment: u8 { /// Align to the center. @@ -84,7 +87,7 @@ impl TryFrom for Alignment { impl From for u8 { fn from(value: Alignment) -> Self { - value.bits + value.bits() } } diff --git a/src/requests/mod.rs b/src/requests/mod.rs index bf9650f..6c1d7c0 100644 --- a/src/requests/mod.rs +++ b/src/requests/mod.rs @@ -135,7 +135,7 @@ pub(crate) struct RequestBatch<'a> { bitflags! { /// Bit flags for possible event subscriptions, that can be enabled when connecting to the OBS /// instance. - #[derive(Serialize)] + #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] #[serde(transparent)] pub struct EventSubscription: u32 { /// Subscription value used to disable all events. @@ -166,17 +166,17 @@ bitflags! { const UI = 1 << 10; /// Helper to receive all non-high-volume events. - const ALL = Self::GENERAL.bits - | Self::CONFIG.bits - | Self::SCENES.bits - | Self::INPUTS.bits - | Self::TRANSITIONS.bits - | Self::FILTERS.bits - | Self::OUTPUTS.bits - | Self::SCENE_ITEMS.bits - | Self::MEDIA_INPUTS.bits - | Self::VENDORS.bits - | Self::UI.bits; + const ALL = Self::GENERAL.bits() + | Self::CONFIG.bits() + | Self::SCENES.bits() + | Self::INPUTS.bits() + | Self::TRANSITIONS.bits() + | Self::FILTERS.bits() + | Self::OUTPUTS.bits() + | Self::SCENE_ITEMS.bits() + | Self::MEDIA_INPUTS.bits() + | Self::VENDORS.bits() + | Self::UI.bits(); /// Subscription value to receive the [`InputVolumeMeters`] high-volume event. /// diff --git a/src/requests/ui.rs b/src/requests/ui.rs index b2a24c9..992840e 100644 --- a/src/requests/ui.rs +++ b/src/requests/ui.rs @@ -231,7 +231,7 @@ impl Default for QtGeometry { bitflags! { /// Request information for [`open_projector`](crate::client::General::open_projector) as part of /// [`Projector`]. - #[derive(Default)] + #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct QtWindowState: u32 { /// Window with maximum size, taking up as much space as possible but still showing /// the window frame. diff --git a/src/serde/bitflags_u8.rs b/src/serde/bitflags_u8.rs index 3f48516..e05883a 100644 --- a/src/serde/bitflags_u8.rs +++ b/src/serde/bitflags_u8.rs @@ -81,6 +81,7 @@ mod tests { use serde_test::{assert_tokens, Token}; bitflags! { + #[derive(Clone, Copy, Debug, PartialEq)] struct Flags: u8 { const ONE = 1; const TWO = 2; @@ -89,7 +90,7 @@ mod tests { impl From for u8 { fn from(value: Flags) -> Self { - value.bits + value.bits() } }