Crate starlang_process

Crate starlang_process 

Source
Expand description

§starlang-process

Process primitives for Starlang (Distributed Rust Erlang Abstract Machine).

This crate provides the Process module API, mirroring Elixir’s Process:

  • Spawning: spawn, spawn_link, spawn_monitor
  • Links: [link], [unlink]
  • Monitors: [monitor], [demonitor]
  • Messaging: [send], [send_after]
  • Exit signals: [exit]
  • Process info: [alive], [self_pid]
  • Registration: [register], [whereis], [unregister]

§Example

use starlang_process::{spawn, send, self_pid};

// Spawn a new process
let pid = spawn(|ctx| async move {
    loop {
        if let Some(msg) = ctx.recv().await {
            println!("Received: {:?}", msg);
        }
    }
}).await?;

// Send a message
send(pid, &"hello")?;

Modules§

global
Global runtime for Starlang.

Structs§

Context
The execution context for a process.
Pid
A process identifier.
ProcessRegistry
A thread-safe registry of all running processes.
Ref
A unique reference.
Runtime
The Starlang runtime.
RuntimeHandle
A cloneable handle to the runtime.

Enums§

ExitReason
The reason a process exited.
SendError
Errors that can occur when sending messages.
SystemMessage
System-level messages delivered to processes.

Traits§

Term
A trait for Erlang-like terms that can be serialized and sent between processes.

Functions§

spawn
Spawns a new process using the provided runtime handle.
spawn_link
Spawns a new process linked to the parent.
spawn_monitor
Spawns a new process and monitors it.

Type Aliases§

ProcessFn
Type alias for process functions.