#actor-framework #actor-model #thread-local #actor #send-sync #async

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

#844 in Asynchronous

Download history 179/week @ 2024-11-27 10/week @ 2024-12-04 27/week @ 2024-12-11 39/week @ 2024-12-18 9/week @ 2024-12-25 52/week @ 2025-01-08 30/week @ 2025-01-15 14/week @ 2025-01-29 8/week @ 2025-02-12 14/week @ 2025-02-19 29/week @ 2025-02-26 24/week @ 2025-03-12

68 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

~5–14MB
~177K SLoC