1use acktor::{Actor, ActorId, Address, Message, Recipient, SenderInfo};
2
3#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6pub enum ActorRef {
7 Index(ActorId),
8 Label(String),
9}
10
11impl<A> From<Address<A>> for ActorRef
12where
13 A: Actor,
14{
15 fn from(addr: Address<A>) -> Self {
16 Self::Index(addr.index())
17 }
18}
19
20impl<M> From<Recipient<M>> for ActorRef
21where
22 M: Message,
23{
24 fn from(recipient: Recipient<M>) -> Self {
25 Self::Index(recipient.index())
26 }
27}
28
29impl From<ActorId> for ActorRef {
30 fn from(index: ActorId) -> Self {
31 Self::Index(index)
32 }
33}
34
35impl From<u64> for ActorRef {
36 fn from(index: u64) -> Self {
37 Self::Index(ActorId::new(index))
38 }
39}
40
41impl From<String> for ActorRef {
42 fn from(label: String) -> Self {
43 Self::Label(label)
44 }
45}
46
47impl From<&str> for ActorRef {
48 fn from(label: &str) -> Self {
49 Self::Label(label.to_string())
50 }
51}