mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-23 08:54:16 +01:00
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.
This commit is contained in:
1 parent
6ae2db8389
commit
9483f849f8
1 file changed
+18
@@ -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<dyn std::error::Error>>(())
|
||||
/// ```
|
||||
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
pub struct SubscribeOptions {
|
||||
|
||||
Reference in new issue
Block a user