Skip to content

Commit

Permalink
some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Narfinger committed Nov 15, 2023
1 parent 1194aa4 commit ce2a454
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions viola_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -92,6 +92,7 @@ impl From<GStreamerAction> for GStreamerMessage {
}
}

/// Messages we send over the websocket
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum WsMessage {
PlayChanged(usize),
Expand All @@ -108,6 +109,7 @@ impl From<WsMessage> for String {
}
}

/// a treetype used for TreeViewQuery
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum TreeType {
Artist,
Expand Down Expand Up @@ -145,27 +147,32 @@ impl TreeViewQuery {
}
}

/// Smartplaylists (just a vector of strings)
pub type Smartplaylists = Vec<String>;

/// 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,
pub current_position: usize,
pub id: i32,
}

/// The JSON of PlaylistsTabs
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct PlaylistTabsJSON {
pub current: usize,
pub current_playing_in: Option<usize>,
pub tabs: Vec<PlaylistTabJSON>,
}

/// 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,
Expand Down

0 comments on commit ce2a454

Please sign in to comment.