From d45502a43eef20b1c8dc274a57537f64a82947e0 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 30 Nov 2024 03:31:52 +0100 Subject: [PATCH] commands: add derives for a few response types --- src/commands/audio_output_devices/outputs.rs | 4 +++- src/commands/client_to_client/channels.rs | 4 +++- src/commands/client_to_client/readmessages.rs | 4 +++- src/commands/playback_options/replay_gain_status.rs | 3 +++ src/commands/querying_mpd_status/currentsong.rs | 3 +++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/commands/audio_output_devices/outputs.rs b/src/commands/audio_output_devices/outputs.rs index 763bb75..986d13f 100644 --- a/src/commands/audio_output_devices/outputs.rs +++ b/src/commands/audio_output_devices/outputs.rs @@ -1,12 +1,14 @@ use std::collections::HashMap; +use serde::{Deserialize, Serialize}; + use crate::commands::{ Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError, }; pub struct Outputs; -#[derive(Debug)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Output { pub id: u64, pub name: String, diff --git a/src/commands/client_to_client/channels.rs b/src/commands/client_to_client/channels.rs index c0ebfbb..fee6cd4 100644 --- a/src/commands/client_to_client/channels.rs +++ b/src/commands/client_to_client/channels.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::commands::{ Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes, ResponseParserError, @@ -5,7 +7,7 @@ use crate::commands::{ pub struct Channels; -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ChannelsResponse { pub channels: Vec, } diff --git a/src/commands/client_to_client/readmessages.rs b/src/commands/client_to_client/readmessages.rs index 348a56c..9cd4776 100644 --- a/src/commands/client_to_client/readmessages.rs +++ b/src/commands/client_to_client/readmessages.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + use crate::commands::{ Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes, ResponseParserError, @@ -5,7 +7,7 @@ use crate::commands::{ pub struct ReadMessages; -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ReadMessagesResponse { pub messages: Vec<(String, String)>, } diff --git a/src/commands/playback_options/replay_gain_status.rs b/src/commands/playback_options/replay_gain_status.rs index 7342f25..fae06b2 100644 --- a/src/commands/playback_options/replay_gain_status.rs +++ b/src/commands/playback_options/replay_gain_status.rs @@ -1,5 +1,7 @@ use std::{collections::HashMap, str::FromStr}; +use serde::{Deserialize, Serialize}; + use crate::{ commands::{ get_property, Command, Request, RequestParserResult, ResponseAttributes, @@ -10,6 +12,7 @@ use crate::{ pub struct ReplayGainStatus; +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ReplayGainStatusResponse { pub replay_gain_mode: ReplayGainModeMode, } diff --git a/src/commands/querying_mpd_status/currentsong.rs b/src/commands/querying_mpd_status/currentsong.rs index 871ebb3..dcf4c84 100644 --- a/src/commands/querying_mpd_status/currentsong.rs +++ b/src/commands/querying_mpd_status/currentsong.rs @@ -1,9 +1,12 @@ +use serde::{Deserialize, Serialize}; + use crate::commands::{ Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError, }; pub struct CurrentSong; +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct CurrentSongResponse {} impl Command for CurrentSong {