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
//! # toktor
//!
//! A small Actor framework for use within tokio.
//!
//! Features:
//! * both graceful and hard shutdown options for actors
//! * spawn child actors
//! * spawn associated tasks, that may be shut down with the actor
//!
//! This was created to cater for a need in a project for allowing creation of complex actor
//! structures that could be easily shutdown when required. For example in UIs, when a user
//! closes a window, or in telephony when a call is dropped.
//!
//! # Example
//!
//! ```rust
//! use toktor::{Actor, ActorContext};
//! pub struct CountingActor {
//! total: usize,
//! }
//!
//! impl Actor<usize> for CountingActor {
//! async fn on_message(&mut self, _ctx: &ActorContext, number: usize) {
//! self.total += number
//! }
//! }
//!
//! # tokio_test::block_on(async {
//! let actor = toktor::spawn(16, CountingActor { total: 0 });
//! assert!(actor.send(1).await.is_ok());
//!
//! # });
//!
//! ```
//!
pub use cratespawn;
pub use crateActor;
pub use crateActorContext;
pub use crateActorError;
pub use crateActorHandle;