diff --git a/Cargo.lock b/Cargo.lock index f6b817b..08d3641 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,3 +5,71 @@ version = 3 [[package]] name = "musichoard" version = "0.1.0" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "proc-macro2" +version = "1.0.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e3787bb71465627110e7d87ed4faaa36c1f61042ee67badb9e2ef173accc40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "uuid" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +dependencies = [ + "serde", +] diff --git a/Cargo.toml b/Cargo.toml index 4321e78..03065c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +serde = { version = "1.0", features = ["derive"] } +uuid = { version = "1.3", features = ["serde"] } diff --git a/src/lib.rs b/src/lib.rs index 7d12d9a..d7c1a7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,50 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right +use serde::{Deserialize, Serialize}; +use uuid; + +/// The [MusicBrainz Identifier](https://musicbrainz.org/doc/MusicBrainz_Identifier). +type Mbid = uuid::Uuid; + +/// An artist. May be linked to MusicBrainz. +#[derive(Deserialize, Serialize)] +pub struct Artist { + pub name: String, + pub mbid: Option, } -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } +/// A single track on a release. +#[derive(Deserialize, Serialize)] +pub struct Track { + pub number: u32, + pub title: String, + pub artist: Artist, +} + +/// MusicHoard release corresponds to MusicBrainz' concept of a release. However, it does not link +/// to MusicBrainz as the intention of MusicHoard is to manage releases locally. +#[derive(Deserialize, Serialize)] +pub struct Release { + pub title: String, + pub artist: String, + pub tracks: Vec, +} + +/// MusicHoard uses MusicBrainz [primary release group +/// type](https://musicbrainz.org/doc/Release_Group/Type) +#[derive(Deserialize, Serialize)] +pub enum ReleaseGroupType { + Album, + Ep, + Single, + Other, +} + +/// MusicHoard uses MusicBrainz' [Release Group concept](https://musicbrainz.org/doc/Release_Group). +#[derive(Deserialize, Serialize)] +pub struct ReleaseGroup { + pub r#type: ReleaseGroupType, + pub title: String, + pub artist: Artist, + pub year: u32, + pub mbid: Option, + pub releases: Vec, }