1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Tokio Actors is a light-weight, Tokio-native actor framework for building
//! hierarchical systems with strongly-typed mailboxes, timers, and supervision.
//!
//! # Overview
//! - Thread-safe actors that run as exclusive tasks on Tokio's multi-threaded runtime.
//! - Typed request/response semantics through [`ActorHandle::send`](crate::actor::handle::ActorHandle::send).
//! - Recurring timers, supervision hooks, and bounded mailboxes out of the box.
//!
//! ```rust,no_run
//! use tokio_actors::{actor::{Actor, ActorExt, context::ActorContext}, ActorResult, StopReason};
//!
//! #[derive(Default)]
//! struct Counter(i64);
//!
//! impl Actor for Counter {
//! type Message = i64;
//! type Response = i64;
//!
//! async fn handle(&mut self, msg: i64, _ctx: &mut ActorContext<Self>) -> ActorResult<i64> {
//! self.0 += msg;
//! Ok(self.0)
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let counter = Counter::default().spawn().named("counter").await?;
//! counter.notify(5).await?; // fire-and-forget
//! let total = counter.send(3).await?; // request-response -> 8
//! counter.stop(StopReason::Graceful).await?;
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;