#thread-local #actor

act-locally

Simple single-threaded async actors with ordinary functions as handlers and plainly typed messages

2 releases

0.1.1 Nov 26, 2024
0.1.0 Nov 26, 2024

#1451 in Asynchronous

Download history 6/week @ 2026-01-10 14/week @ 2026-01-17 2/week @ 2026-01-24 4/week @ 2026-02-07 39/week @ 2026-02-14 52/week @ 2026-02-21 94/week @ 2026-02-28 87/week @ 2026-03-07 63/week @ 2026-03-14 46/week @ 2026-03-21 34/week @ 2026-03-28 20/week @ 2026-04-04 27/week @ 2026-04-11

129 downloads per month

MIT/Apache

72KB
2K SLoC

act-locally

Simple single-threaded async actors with ordinary functions as handlers and plainly typed messages.

Why another actor framework?

Actor frameworks in Rust are an epidemic

In that spirit, act-locally was created with two primary goals:

  1. Simplicity in handler definition and message types: Use ordinary Rust functions as handlers, reducing boilerplate and making your code more intuitive. Use ordinary types as message/return types.

  2. Support for !Send/!Sync state: Leverage thread-local async executors so that shared state doesn't need to be thread-safe.

These features allow for more natural Rust code within an actor model, and enable use cases that many other actor frameworks don't support out of the box.

Features

  • Both synchronous and asynchronous message handlers
  • Supports mutating and non-mutating handlers
  • Flexible dispatcher system for message routing
  • Type-safe message passing
  • Built on smol for async runtime
  • Integrates with tracing for observability

TODO

  • Support closures as handlers
  • Documentation and examples
  • Offer more control over order-execution when combining mutating and non-mutating handlers (currently a write-preferring read/write lock is used)
  • Stream integration
  • Benchmarks and optimization

License

Licensed under MIT. See LICENSE for details.

Dependencies

~8–15MB
~214K SLoC