dactor_ractor/lib.rs
1//! # dactor-ractor
2//!
3//! Ractor adapter for the [`dactor`] distributed actor framework (v0.2 API).
4//!
5//! This crate provides [`RactorRuntime`], which spawns dactor actors as real
6//! ractor actors via [`ractor::Actor::spawn`]. Messages are delivered through
7//! ractor's mailbox as type-erased dispatch envelopes, supporting multiple
8//! `Handler<M>` impls per actor.
9//!
10//! # Quick start
11//!
12//! ```rust,no_run
13//! use dactor::prelude::*;
14//! use dactor::message::Message;
15//! use dactor_ractor::RactorRuntime;
16//! use async_trait::async_trait;
17//!
18//! struct MyActor;
19//!
20//! impl Actor for MyActor {
21//! type Args = ();
22//! type Deps = ();
23//! fn create(_: (), _: ()) -> Self { MyActor }
24//! }
25//!
26//! struct Greet(String);
27//! impl Message for Greet { type Reply = (); }
28//!
29//! #[async_trait]
30//! impl Handler<Greet> for MyActor {
31//! async fn handle(&mut self, msg: Greet, _ctx: &mut ActorContext) {
32//! println!("Got: {}", msg.0);
33//! }
34//! }
35//!
36//! #[tokio::main]
37//! async fn main() {
38//! let runtime = RactorRuntime::new();
39//! let actor = runtime.spawn::<MyActor>("greeter", ()).await.unwrap();
40//! actor.tell(Greet("hello".into())).unwrap();
41//! }
42//! ```
43
44pub mod cluster;
45pub mod runtime;
46pub mod system_actors;
47
48pub use cluster::RactorClusterEvents;
49pub use runtime::{RactorActorRef, RactorRuntime, RactorSystemActorRefs, SpawnOptions};
50pub use system_actors::{
51 CancelManagerActor, NodeDirectoryActor, SpawnManagerActor, WatchManagerActor,
52};
53
54// Re-export the core dactor crate for convenience
55pub use dactor;