use std::fmt::Display;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Hash, Eq, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct Certificate(pub(crate) String);
impl Certificate {
pub fn new<S: Into<String>>(id: S) -> Self {
Self(id.into())
}
pub fn inner(&self) -> &String {
&self.0
}
}
impl Display for Certificate {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl<S: Into<String>> From<S> for Certificate {
fn from(value: S) -> Self {
Certificate::new(value)
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct Identity(pub(crate) String);
impl Identity {
pub fn new<S: Into<String>>(id: S) -> Self {
Self(id.into())
}
}
impl Display for Identity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl<S: Into<String>> From<S> for Identity {
fn from(value: S) -> Self {
Identity::new(value)
}
}