From 9483f849f811c4eab8c547148b07ab0f9fdd6c50 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 21:19:50 -0700 Subject: [PATCH] test(protocol): restore the SubscribeOptions doctest in the protocol crate KDE's SubscribeOptions carried a doctest that used SocketMessage; it was dropped from the shared text so the three trees could converge before the move. The crate now has a doctest that checks the wire form of the options ({"filter_state_changes":true}) and the default. The SocketMessage example returns when SocketMessage moves (2e). Verified: native cargo test -p komorebi-protocol: 4 + 3 passed, doctest 1 passed, 0 failed. --- crates/komorebi-protocol/src/types.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/komorebi-protocol/src/types.rs b/crates/komorebi-protocol/src/types.rs index 5565774e..e86ff713 100644 --- a/crates/komorebi-protocol/src/types.rs +++ b/crates/komorebi-protocol/src/types.rs @@ -14,6 +14,24 @@ use strum::EnumString; /// state, and always when a window is shown, when a subscriber is added (so a new subscriber /// receives the state as soon as it subscribes), when a theme is set (the colors of the borders /// are not part of the state) and when the configuration is reloaded. +/// +/// # Example +/// +/// ```rust +/// use komorebi_protocol::types::SubscribeOptions; +/// +/// let options = SubscribeOptions { +/// filter_state_changes: true, +/// }; +/// assert_eq!( +/// serde_json::to_string(&options)?, +/// r#"{"filter_state_changes":true}"#, +/// ); +/// +/// assert!(!SubscribeOptions::default().filter_state_changes); +/// +/// # Ok::<(), Box>(()) +/// ``` #[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub struct SubscribeOptions {