1use std::fmt::Display;
2
3#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[derive(Debug, Clone, Hash, Eq, PartialEq, PartialOrd)]
9#[cfg_attr(feature = "serde", serde(transparent))]
10pub struct Certificate(pub(crate) String);
11
12impl Certificate {
13 pub fn new<S: Into<String>>(id: S) -> Self {
14 Self(id.into())
15 }
16
17 pub fn inner(&self) -> &String {
18 &self.0
19 }
20}
21
22impl Display for Certificate {
23 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24 write!(f, "{}", self.0)
25 }
26}
27
28impl<S: Into<String>> From<S> for Certificate {
31 fn from(value: S) -> Self {
32 Certificate::new(value)
33 }
34}
35
36#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
38#[derive(Debug, Clone, Eq, PartialEq, Hash)]
39#[cfg_attr(feature = "serde", serde(transparent))]
40pub struct Identity(pub(crate) String);
41
42impl Identity {
43 pub fn new<S: Into<String>>(id: S) -> Self {
44 Self(id.into())
45 }
46}
47
48impl Display for Identity {
49 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
50 write!(f, "{}", self.0)
51 }
52}
53
54impl<S: Into<String>> From<S> for Identity {
57 fn from(value: S) -> Self {
58 Identity::new(value)
59 }
60}