Add List ID type
This commit is contained in:
parent
6e044c3f35
commit
6d8a9d6194
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue