From ce2a454af8f0cb507b2299154e15d3822cd7bc0e Mon Sep 17 00:00:00 2001 From: Narfinger Date: Wed, 15 Nov 2023 15:06:40 +0900 Subject: [PATCH] some documentation --- viola_common/src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/viola_common/src/lib.rs b/viola_common/src/lib.rs index d134ddcd..27453dec 100644 --- a/viola_common/src/lib.rs +++ b/viola_common/src/lib.rs @@ -6,10 +6,10 @@ extern crate diesel; pub mod schema; #[cfg(feature = "backend")] use crate::schema::tracks; - +use serde::{Deserialize, Serialize}; use std::hash::Hash; -use serde::{Deserialize, Serialize}; +/// A track with all its information #[derive(Debug, Clone, Eq, Serialize, Deserialize)] #[cfg_attr(feature = "backend", derive(AsChangeset, Identifiable, Queryable))] pub struct Track { @@ -92,6 +92,7 @@ impl From for GStreamerMessage { } } +/// Messages we send over the websocket #[derive(Debug, Copy, Clone, Serialize, Deserialize)] pub enum WsMessage { PlayChanged(usize), @@ -108,6 +109,7 @@ impl From for String { } } +/// a treetype used for TreeViewQuery #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] pub enum TreeType { Artist, @@ -145,13 +147,16 @@ impl TreeViewQuery { } } +/// Smartplaylists (just a vector of strings) pub type Smartplaylists = Vec; +/// query to load a smart playlist by given an index #[derive(Debug, Serialize, Deserialize)] pub struct LoadSmartPlaylistJson { pub index: usize, } +/// the JSON of a PlaylistTab #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct PlaylistTabJSON { pub name: String, @@ -159,6 +164,7 @@ pub struct PlaylistTabJSON { pub id: i32, } +/// The JSON of PlaylistsTabs #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct PlaylistTabsJSON { pub current: usize, @@ -166,6 +172,7 @@ pub struct PlaylistTabsJSON { pub tabs: Vec, } +/// The query of the album cover (with a nonce so we do not get cache interferrence) #[derive(Debug, Serialize, Deserialize)] pub struct ImageQuery { pub nonce: String,