Skip to main content

Crate rusm_otp

Crate rusm_otp 

Source
Expand description

rusm-otp — the Wasm-free Erlang/OTP core of RUSM.

Lightweight processes (Tokio tasks), each with a message mailbox, over a sharded process table. A process is killed by aborting its task — Tokio gives us that handle for free — so a process carries just one channel. This crate must never depend on or reference Wasmtime — the actor model stands alone; Wasm is a separate, optional backend (rusm-wasm). See docs/01-architecture.md.

Structs§

Context
What a process body receives when it starts: its own Pid and its mailbox — the receiving end of its message queue.
MonitorRef
Identifies a monitor set up with monitor; echoed back in the resulting Received::Down so a watcher can tell its monitors apart.
Pid
A process identifier, unique within a Runtime.
ProcessHandle
A handle to a spawned process: address it (kill) and await it (join).
ProcessInfo
A point-in-time snapshot of a live process for observability — the analogue of Erlang’s Process.info/1. Cheap to produce (a single table lookup). Run vs. suspended status is deliberately omitted: Tokio doesn’t expose a task’s park state, and faking it would mislead.
Runtime
Spawns and tracks lightweight processes. Cheap to clone — clones share the same process table and counters.
StreamHandle
The read end of a byte stream, delivered as Received::Stream. Single-consumer: ownership moves to the recipient, like every message.
StreamWriter
The write end of a byte stream. Bounded: write awaits when the buffer is full, so production can’t outrun a slow consumer. Dropping the writer ends the stream (the reader then sees None).
Supervisor
Builder for a supervisor process. Create with Runtime::supervisor, add children, then start.
TimerRef
A handle to a pending timer from send_after.

Enums§

ExitReason
Why a process terminated — carried to linked and monitoring processes.
LogLevel
Platform log verbosity, declared via rusm.toml [log] level. Ordered, cumulative: a configured level shows every event at or below it. Each lifecycle event maps to a distinct level — Error: a crash (a trap / OOM); Warn: + a kill (or cascade); Info: + a clean exit; Debug: + every spawn. So a restart reads as a crash exit (Error) then a fresh spawn (Debug).
Received
What a process pulls from its mailbox with recv: an ordinary message, a byte stream, or a system notification the runtime injected. Exit and down signals share the one mailbox (and FIFO order) with user messages — exactly as Erlang delivers {'EXIT', …} / {'DOWN', …}.
Strategy
How a supervisor reacts when one child dies.

Functions§

stream
A connected (writer, reader) byte-stream pair with the default buffer.
stream_with_capacity
A connected pair with an explicit buffer depth (clamped to at least 1).

Type Aliases§

Message
A user message delivered to a process mailbox.