stagecraft 0.1.0

An actor framework for tokio
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Base trait for all actors.
///
/// Defines the actor's message type and inbox channel capacity. All actor traits
/// ([`Actor`], [`LocalActor`], [`StreamActor`], [`LocalStreamActor`]) require `HasMailbox`.
///
/// [`Actor`]: crate::Actor
/// [`LocalActor`]: crate::LocalActor
/// [`StreamActor`]: crate::StreamActor
/// [`LocalStreamActor`]: crate::LocalStreamActor
pub trait HasMailbox: Sized + 'static {
    /// The type of messages this actor accepts.
    type Message: Send + 'static;

    /// Inbox channel capacity. Defaults to `128`.
    fn channel_size() -> usize {
        128
    }
}