mm1
An Erlang-style actor runtime for Rust.
mm1 gives you lightweight actors that communicate by asynchronous message
passing, with Erlang/OTP-inspired building blocks: process links and monitors,
trap_exit-style supervision, supervisors, a gen_server-like server behaviour,
timers, a name service, and optional multi-node messaging.
Status: pre-1.0 (
0.7.x). The API still moves between minor versions. SeeCHANGELOG.md.
Concepts
- Actor — an
asyncfunction that receives an exclusive reference to a context and interacts with the system only through traits on that context (send/receive, spawn, link, watch, bind, …). The concrete context type stays opaque to the actor. - Message — any type marked with
#[message]. Addresses are opaque, IPv6-like values; a subnet is an address plus a net-mask. - Supervision — link/monitor signals plus uniform (many children of one kind) and mixed (a fixed set of heterogeneous children) supervisors.
Example: defining and matching messages
use Duration;
use Address;
use message;
// `#[message]` derives serde and marks the type as sendable between actors.
// The crate that uses it must depend on `serde` directly.
Inside an actor you receive an Envelope and match on it with dispatch!:
use dispatch;
loop
For complete, runnable programs — starting a node, wiring config, supervision,
and multi-node messaging — see the crates under
tests/ (for example tests/mm1-node-tests and the
tests/mm1-multinode-tests/examples directory).
Features
The umbrella mm1 crate re-exports the subsystem crates behind feature flags.
Default: ask, runtime, server, sup, timer, multinode.
| feature | what it enables | default |
|---|---|---|
runtime |
the node runtime (Rt, config) |
yes |
ask |
request/response (the "ask" pattern) | yes |
server |
the gen_server-like server behaviour |
yes |
sup |
supervisors (uniform + mixed) | yes |
timer |
timers | yes |
multinode |
multi-node messaging (implies runtime) |
yes |
name-service |
register/resolve actors by name | no |
logger |
logging setup helpers (mm1::logger) |
no |
test-util |
test runtime (mm1::test) |
no |
Minimum supported Rust version
mm1 builds on Rust 1.91 and later. Bumping the MSRV is treated as a
routine change, not a breaking one, while the crate is pre-1.0.
License
MIT. See LICENSE.