Skip to main content

guinea_core/actor/
traits.rs

1use crate::actor::Cx;
2use crate::actor::event_bus::builder::EventSubscription;
3
4pub trait Handler<M: 'static>: 'static {
5    /// Where the handler was written; `#[handler]` fills it in.
6    const DECLARED: Option<crate::actor::shape::Declared> = None;
7
8    fn handle(&mut self, msg: M, cx: Cx<Self, M>)
9    where
10        Self: Sized;
11}
12
13pub trait ManagedActor: Sized + 'static {
14    type Bus: EventSubscription<Self>;
15    type Signals;
16    /// Declared outgoing messages per handler, or `Open` when undeclared.
17    type Flow;
18    /// What `actor!` declared, for devtools.
19    const SHAPE: crate::actor::shape::Shape = crate::actor::shape::Shape::UNKNOWN;
20}
21
22pub trait AllowedSignal<M: 'static> {}
23impl<M: 'static> AllowedSignal<M> for M {}