atomr_core/lib.rs
1//! # atomr-core
2//!
3//! Idiomatic Rust port of `akka.net/src/core/Akka`.
4//!
5//! Public modules mirror the upstream folder layout 1:1 to make tracking
6//! upstream changes tractable. See `PORTING.md` at the workspace root.
7//!
8//! ## Quick start
9//!
10//! ```no_run
11//! use atomr_core::prelude::*;
12//!
13//! #[derive(Default)]
14//! struct Echo;
15//!
16//! #[async_trait::async_trait]
17//! impl Actor for Echo {
18//! type Msg = String;
19//! async fn handle(&mut self, _ctx: &mut Context<Self>, msg: String) {
20//! println!("echo: {msg}");
21//! }
22//! }
23//!
24//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
25//! let sys = ActorSystem::create("S", atomr_config::Config::reference()).await?;
26//! let echo = sys.actor_of(Props::create(Echo::default), "echo")?;
27//! echo.tell("hi".to_string());
28//! sys.terminate().await;
29//! # Ok(()) }
30//! ```
31
32#![forbid(unsafe_code)]
33#![deny(rust_2018_idioms)]
34
35pub mod actor;
36pub mod dispatch;
37#[macro_use]
38mod fsm_macro;
39pub mod event;
40pub mod io;
41pub mod pattern;
42pub mod routing;
43pub mod serialization;
44pub mod supervision;
45pub mod util;
46
47pub mod prelude {
48 pub use crate::actor::{
49 Actor, ActorPath, ActorRef, ActorSystem, Address, Context, Props, UntypedActorRef,
50 };
51 pub use crate::pattern::{ask, pipe_to};
52 pub use crate::supervision::{
53 Directive, OneForOneStrategy, SupervisionError, SupervisorOf, SupervisorStrategy,
54 };
55 pub use async_trait::async_trait;
56 pub use atomr_config::Config;
57}