Expand description

The lunatic vm is a system for creating actors from WebAssembly modules. This lunatic-runtime library allows you to embed the lunatic vm inside your Rust code.

The actor model in computer science is a mathematical model of concurrent computation that treats actor as the universal primitive of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more actors, send more messages, and determine how to respond to the next message received. Actors may modify their own private state, but can only affect each other indirectly through messaging (removing the need for lock-based synchronization).

Source: https://en.wikipedia.org/wiki/Actor_model

Note: If you are looking to build actors in Rust and compile them to lunatic compatible Wasm modules, checkout out the lunatic crate.

Core Concepts

  • [Environment] - defines the characteristics of Processes that are spawned into it. An [Environment] is created with an [EnvConfig] to tweak various settings, like maximum memory and compute usage.

  • WasmProcess - a handle to send signals and messages to spawned Wasm processes. It implements the Process trait.

WebAssembly module requirements



A WasmProcess represents an instance of a Wasm module that is being executed.


The reason of a process finishing

Signals can be sent to processes to interact with them.


The Process is the main abstraction in lunatic.


Spawns a process from a closure.

Spawns a new wasm process from a compiled module.