1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Id(pub String);
impl From<String> for Id {
#[must_use]
fn from(id: String) -> Self {
Self(id)
}
}
impl<'a> From<&'a String> for Id {
#[must_use]
fn from(id: &'a String) -> Self {
Self(id.clone())
}
}
impl<'a> From<&'a str> for Id {
#[must_use]
fn from(id: &'a str) -> Self {
Self(id.to_owned())
}
}