Add List ID type

This commit is contained in:
D. Scott Boggs 2023-01-09 08:25:10 -05:00 committed by Scott Boggs
parent 6e044c3f35
commit 6d8a9d6194
1 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,23 @@ use serde::{Deserialize, Serialize};
/// Used for ser/de of list resources
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct List {
id: String,
id: ListId,
title: String,
}
/// Wrapper type for a list ID string
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(transparent)]
pub struct ListId(String);
impl AsRef<str> for ListId {
fn as_ref(&self) -> &str {
&self.0
}
}
impl ListId {
pub fn new(value: impl Into<String>) -> Self {
Self(value.into())
}
}