Skip to main content

sqlitegraph/
api_ergonomics.rs

1use std::fmt;
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
4pub struct NodeId(pub i64);
5
6#[derive(Clone, Debug, PartialEq, Eq, Hash)]
7pub struct Label(pub String);
8
9#[derive(Clone, Debug, PartialEq, Eq, Hash)]
10pub struct PropertyKey(pub String);
11
12#[derive(Clone, Debug, PartialEq, Eq, Hash)]
13pub struct PropertyValue(pub String);
14
15impl fmt::Display for NodeId {
16    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17        write!(f, "{}", self.0)
18    }
19}
20
21impl NodeId {
22    pub fn as_i64(self) -> i64 {
23        self.0
24    }
25}
26
27impl From<i64> for NodeId {
28    fn from(value: i64) -> Self {
29        NodeId(value)
30    }
31}