1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct NodeId(pub String);
7
8impl fmt::Display for NodeId {
9 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10 write!(f, "Node({})", self.0)
11 }
12}
13
14impl From<&str> for NodeId {
15 fn from(s: &str) -> Self {
16 NodeId(s.to_string())
17 }
18}
19
20impl From<String> for NodeId {
21 fn from(s: String) -> Self {
22 NodeId(s)
23 }
24}
25
26#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
28#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
29pub struct ActorId {
30 pub node: NodeId,
32 pub local: u64,
34}
35
36impl fmt::Display for ActorId {
37 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38 write!(f, "Actor({}/{})", self.node.0, self.local)
39 }
40}