#actor-framework #actor #thread

tonari-actor

A minimalist actor framework aiming for high performance and simplicity

13 releases (8 breaking)

0.11.0 Jul 31, 2025
0.10.0 Aug 13, 2024
0.9.0 May 31, 2024
0.8.3 Feb 28, 2023
0.4.1 Mar 4, 2021

#167 in Concurrency

Download history 7/week @ 2025-07-05 9/week @ 2025-07-12 7/week @ 2025-07-19 120/week @ 2025-07-26 41/week @ 2025-08-02 11/week @ 2025-08-09 8/week @ 2025-08-16 5/week @ 2025-08-23 5/week @ 2025-08-30 6/week @ 2025-09-06 24/week @ 2025-09-13 38/week @ 2025-09-20 59/week @ 2025-09-27 10/week @ 2025-10-04 3/week @ 2025-10-11 7/week @ 2025-10-18

84 downloads per month
Used in downtown

MIT license

70KB
1K SLoC

tonari-actor

Crates.io Documentation

This crate aims to provide a minimalist and high-performance actor framework for Rust with significantly less complexity than other frameworks like Actix.

In this framework, each Actor is its own OS-level thread. This makes debugging noticeably simpler, and is suitably performant when the number of actors is less than or equal to the number of CPU threads.

Example

use tonari_actor::{Actor, Context, System};

struct TestActor {}

impl Actor for TestActor {
    type Error = ();
    type Message = usize;

    fn handle(&mut self, _context: &Context<Self>, message: Self::Message) -> Result<(), ()> {
        println!("message: {}", message);

        Ok(())
    }
}

fn main() {
    let mut system = System::new("default");

    // will spin up a new thread running this actor
    let addr = system.spawn(TestActor {}).unwrap();

    // send messages to actors to spin off work...
    addr.send(1usize).unwrap();

    // ask the actors to finish and join the threads.
    system.shutdown().unwrap();
}

Dependencies

  • cargo
  • rustc

Build

$ cargo build --release

Testing

$ cargo test

Code Format

The formatting options currently use nightly-only options.

$ cargo +nightly fmt

Code Linting

$ cargo clippy

Dependencies

~2MB
~32K SLoC