use super::types::Type;
use crate::util::generate_uuid_v1;
use std::hash::{Hash, Hasher};
use uuid::Uuid;
#[derive(Clone, Debug)]
pub struct Vertex {
pub id: Uuid,
pub t: Type,
}
impl Vertex {
pub fn new(t: Type) -> Self {
Self::with_id(generate_uuid_v1(), t)
}
pub fn with_id(id: Uuid, t: Type) -> Self {
Vertex { id, t }
}
}
impl PartialEq for Vertex {
fn eq(&self, other: &Vertex) -> bool {
self.id == other.id
}
}
impl Hash for Vertex {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
}
}
impl Eq for Vertex {}