Add serialize derive to all structs
This commit is contained in:
parent
f3738b1af7
commit
c1499ff9b3
|
@ -1,11 +1,11 @@
|
|||
use chrono::prelude::*;
|
||||
use helpers::*;
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt, time::Duration};
|
||||
|
||||
/// All information about a track. This is returned by the `currentsong`, `queue`, or
|
||||
/// `playlistinfo` commands.
|
||||
#[derive(Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Track {
|
||||
pub file: String,
|
||||
|
@ -50,7 +50,7 @@ pub struct Track {
|
|||
|
||||
/// An empty struct that can be used as the response data for commands that only ever return `OK`
|
||||
/// or an error message, e.g. `consume` or other boolean toggles.
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||
pub struct UnitResponse {}
|
||||
|
||||
/// The position of an item in a list with an optional total length.
|
||||
|
@ -58,7 +58,7 @@ pub struct UnitResponse {}
|
|||
/// Can be used for e.g. track number,
|
||||
/// where `Position { 3, 12 }` represents track 3 of a CD with 12 tracks,
|
||||
/// or disc numbers in a multi-disc set.
|
||||
#[derive(Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
pub struct Position {
|
||||
pub item_position: u16,
|
||||
pub total_items: Option<u16>,
|
||||
|
@ -80,7 +80,7 @@ impl fmt::Display for Position {
|
|||
/// i.e. on a server with no pulse or alsa output configured.
|
||||
/// Output via httpd might be used instead
|
||||
/// but will result in empty `volume` and `audio` fields.
|
||||
#[derive(Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Status {
|
||||
pub volume: Option<u8>,
|
||||
|
@ -128,7 +128,7 @@ pub struct Status {
|
|||
/// Properly parsing `listfiles` into a Vector of some enum with variants for file and directory
|
||||
/// would make the deserialization code a lot more complicated, so I’m not interested in doing that
|
||||
/// at this point in time.
|
||||
#[derive(Deserialize, Clone, Debug, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub struct File {
|
||||
#[serde(alias = "directory", rename = "file")]
|
||||
pub name: String,
|
||||
|
@ -150,7 +150,7 @@ impl File {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub enum State {
|
||||
Stop,
|
||||
Play,
|
||||
|
@ -165,7 +165,7 @@ impl Default for State {
|
|||
}
|
||||
|
||||
/// Database statistics as returned by the `stats` command.
|
||||
#[derive(Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Stats {
|
||||
pub artists: u32,
|
||||
|
|
Loading…
Reference in New Issue
Block a user