use std::fmt::Display;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct GraphId(String);
impl GraphId {
pub fn new_from(id: String) -> Self {
Self(id)
}
}
impl Default for GraphId {
fn default() -> Self {
Self(uuid::Uuid::new_v4().to_string())
}
}
impl Display for GraphId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct NodeId(String);
impl NodeId {
pub fn new_from(id: String) -> Self {
Self(id)
}
}
impl Default for NodeId {
fn default() -> Self {
Self(uuid::Uuid::new_v4().to_string())
}
}
impl Display for NodeId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}