use std::fmt;
#[derive(
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Deserialize, serde::Serialize,
)]
#[serde(transparent)]
pub struct SyncNodeId(String);
impl SyncNodeId {
pub fn new(id: impl Into<String>) -> Self {
Self(id.into())
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl From<&str> for SyncNodeId {
fn from(value: &str) -> Self {
Self::new(value)
}
}
impl From<String> for SyncNodeId {
fn from(value: String) -> Self {
Self::new(value)
}
}
impl From<usize> for SyncNodeId {
fn from(value: usize) -> Self {
Self::new(value.to_string())
}
}
impl fmt::Display for SyncNodeId {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str(self.as_str())
}
}