#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct SeriesId(String);
impl SeriesId {
pub fn new(id: impl Into<String>) -> Self {
Self(id.into())
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl std::fmt::Display for SeriesId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
impl From<&str> for SeriesId {
fn from(s: &str) -> Self {
Self(s.to_owned())
}
}
impl From<String> for SeriesId {
fn from(s: String) -> Self {
Self(s)
}
}
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
)]
#[serde(transparent)]
pub struct CategoryId(u32);
impl CategoryId {
pub const ROOT: Self = Self(0);
pub fn new(id: u32) -> Self {
Self(id)
}
pub fn get(self) -> u32 {
self.0
}
}
impl std::fmt::Display for CategoryId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl From<u32> for CategoryId {
fn from(id: u32) -> Self {
Self(id)
}
}
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
)]
#[serde(transparent)]
pub struct ReleaseId(u32);
impl ReleaseId {
pub fn new(id: u32) -> Self {
Self(id)
}
pub fn get(self) -> u32 {
self.0
}
}
impl std::fmt::Display for ReleaseId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl From<u32> for ReleaseId {
fn from(id: u32) -> Self {
Self(id)
}
}
#[derive(
Debug,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Default,
serde::Serialize,
serde::Deserialize,
)]
#[serde(transparent)]
pub struct ReleaseElementId(u32);
impl ReleaseElementId {
pub fn new(id: u32) -> Self {
Self(id)
}
pub fn get(self) -> u32 {
self.0
}
}
impl std::fmt::Display for ReleaseElementId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl From<u32> for ReleaseElementId {
fn from(id: u32) -> Self {
Self(id)
}
}
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, Default, serde::Serialize, serde::Deserialize,
)]
#[serde(transparent)]
pub struct SourceId(u32);
impl SourceId {
pub fn new(id: u32) -> Self {
Self(id)
}
pub fn get(self) -> u32 {
self.0
}
}
impl std::fmt::Display for SourceId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl From<u32> for SourceId {
fn from(id: u32) -> Self {
Self(id)
}
}