Skip to main content

acktor_ipc/
actor_handle.rs

1use acktor::ActorId;
2
3/// An actor handle which can be used to identify an actor in a node by either its index
4/// or label.
5#[derive(Debug, Clone)]
6pub enum ActorHandle {
7    Index(ActorId),
8    Label(String),
9}
10
11impl From<ActorId> for ActorHandle {
12    fn from(index: ActorId) -> Self {
13        Self::Index(index)
14    }
15}
16
17impl From<String> for ActorHandle {
18    fn from(label: String) -> Self {
19        Self::Label(label)
20    }
21}
22
23impl From<&str> for ActorHandle {
24    fn from(label: &str) -> Self {
25        Self::Label(label.to_string())
26    }
27}