commands: add derives for a few response types

This commit is contained in:
Oystein Kristoffer Tveit 2024-11-30 03:31:52 +01:00
parent 4fada75fe9
commit d45502a43e
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
5 changed files with 15 additions and 3 deletions

View File

@ -1,12 +1,14 @@
use std::collections::HashMap; use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::commands::{ use crate::commands::{
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError, Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
}; };
pub struct Outputs; pub struct Outputs;
#[derive(Debug)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Output { pub struct Output {
pub id: u64, pub id: u64,
pub name: String, pub name: String,

View File

@ -1,3 +1,5 @@
use serde::{Deserialize, Serialize};
use crate::commands::{ use crate::commands::{
Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes, Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes,
ResponseParserError, ResponseParserError,
@ -5,7 +7,7 @@ use crate::commands::{
pub struct Channels; pub struct Channels;
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ChannelsResponse { pub struct ChannelsResponse {
pub channels: Vec<String>, pub channels: Vec<String>,
} }

View File

@ -1,3 +1,5 @@
use serde::{Deserialize, Serialize};
use crate::commands::{ use crate::commands::{
Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes, Command, GenericResponseValue, Request, RequestParserResult, ResponseAttributes,
ResponseParserError, ResponseParserError,
@ -5,7 +7,7 @@ use crate::commands::{
pub struct ReadMessages; pub struct ReadMessages;
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ReadMessagesResponse { pub struct ReadMessagesResponse {
pub messages: Vec<(String, String)>, pub messages: Vec<(String, String)>,
} }

View File

@ -1,5 +1,7 @@
use std::{collections::HashMap, str::FromStr}; use std::{collections::HashMap, str::FromStr};
use serde::{Deserialize, Serialize};
use crate::{ use crate::{
commands::{ commands::{
get_property, Command, Request, RequestParserResult, ResponseAttributes, get_property, Command, Request, RequestParserResult, ResponseAttributes,
@ -10,6 +12,7 @@ use crate::{
pub struct ReplayGainStatus; pub struct ReplayGainStatus;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ReplayGainStatusResponse { pub struct ReplayGainStatusResponse {
pub replay_gain_mode: ReplayGainModeMode, pub replay_gain_mode: ReplayGainModeMode,
} }

View File

@ -1,9 +1,12 @@
use serde::{Deserialize, Serialize};
use crate::commands::{ use crate::commands::{
Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError, Command, Request, RequestParserResult, ResponseAttributes, ResponseParserError,
}; };
pub struct CurrentSong; pub struct CurrentSong;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CurrentSongResponse {} pub struct CurrentSongResponse {}
impl Command for CurrentSong { impl Command for CurrentSong {