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.
- Process
Registry - A thread-safe registry of all running processes.
- Ref
- A unique reference.
- Runtime
- The Starlang runtime.
- Runtime
Handle - A cloneable handle to the runtime.
Enums§
- Exit
Reason - The reason a process exited.
- Send
Error - Errors that can occur when sending messages.
- System
Message - 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§
- Process
Fn - Type alias for process functions.