musichoard/src/lib.rs

34 lines
810 B
Rust
Raw Normal View History

2023-03-29 02:44:59 +02:00
//! MusicHoard - a music collection manager.
2023-03-29 01:29:11 +02:00
use serde::{Deserialize, Serialize};
use uuid::Uuid;
pub mod database;
2023-03-29 11:00:32 +02:00
pub mod library;
2023-03-29 01:29:11 +02:00
2023-03-29 02:44:59 +02:00
/// [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier) (MBID).
pub type Mbid = Uuid;
2023-03-29 01:29:11 +02:00
2023-03-30 14:41:25 +02:00
/// A single track on an album.
2023-03-30 16:34:23 +02:00
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
2023-03-29 01:29:11 +02:00
pub struct Track {
pub number: u32,
pub title: String,
2023-03-30 14:41:25 +02:00
pub artist: Vec<String>,
2023-03-28 22:49:59 +02:00
}
2023-03-30 17:00:32 +02:00
/// The album identifier.
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Hash)]
2023-03-30 16:54:11 +02:00
pub struct AlbumId {
2023-03-30 16:34:23 +02:00
pub artist: String,
2023-03-29 01:29:11 +02:00
pub year: u32,
2023-03-30 14:41:25 +02:00
pub title: String,
2023-03-30 16:54:11 +02:00
}
/// An album is a collection of tracks that were released together.
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Album {
pub id: AlbumId,
2023-03-30 14:41:25 +02:00
pub tracks: Vec<Track>,
2023-03-28 22:49:59 +02:00
}