1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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 {}