actix_broker/
msgs.rs

1use std::any::TypeId;
2
3use actix::prelude::*;
4
5pub trait BrokerMsg: Message<Result = ()> + Send + Clone + 'static {}
6
7impl<M> BrokerMsg for M where M: Message<Result = ()> + Send + Clone + 'static {}
8
9#[derive(Message)]
10#[rtype(result = "()")]
11pub struct SubscribeAsync<M: BrokerMsg>(pub Recipient<M>, pub TypeId);
12
13pub struct SubscribeSync<M: BrokerMsg>(pub Recipient<M>, pub TypeId);
14
15impl<M: BrokerMsg> Message for SubscribeSync<M> {
16    type Result = Option<M>;
17}
18
19#[derive(Message)]
20#[rtype(result = "()")]
21pub struct IssueAsync<M: BrokerMsg>(pub M, pub TypeId);
22
23#[derive(Message)]
24#[rtype(result = "()")]
25pub struct IssueSync<M: BrokerMsg>(pub M, pub TypeId);