pub enum SystemMessage {
Exit {
from: Pid,
reason: ExitReason,
},
Down {
monitor_ref: Ref,
pid: Pid,
reason: ExitReason,
},
Timeout,
}Expand description
System-level messages delivered to processes.
These messages are generated by the runtime in response to process lifecycle events. They are distinct from user-defined messages and are handled specially by abstractions like GenServer.
§Examples
use starlang_core::{SystemMessage, ExitReason, Pid, Ref};
// Exit signal from a linked process
let exit = SystemMessage::Exit {
from: Pid::new(),
reason: ExitReason::Normal,
};
// DOWN notification from a monitored process
let down = SystemMessage::Down {
monitor_ref: Ref::from_raw(42),
pid: Pid::new(),
reason: ExitReason::Error("crashed".to_string()),
};
// Timeout notification
let timeout = SystemMessage::Timeout;Variants§
Exit
Exit signal from a linked process.
When a linked process terminates, an Exit message is sent to all
processes linked to it (if they have trap_exit enabled).
If trap_exit is disabled, the receiving process will also terminate
with the same reason (unless the reason is Normal).
Down
Monitor notification that a monitored process terminated.
Unlike exit signals, DOWN messages are always delivered as messages and never cause the receiving process to terminate.
Fields
reason: ExitReasonThe reason for termination.
Timeout
Timeout notification.
Delivered when a receive timeout expires or when a GenServer’s timeout period elapses without receiving any messages.
Implementations§
Source§impl SystemMessage
impl SystemMessage
Sourcepub fn exit(from: Pid, reason: ExitReason) -> SystemMessage
pub fn exit(from: Pid, reason: ExitReason) -> SystemMessage
Creates a new Exit message.
Sourcepub fn down(monitor_ref: Ref, pid: Pid, reason: ExitReason) -> SystemMessage
pub fn down(monitor_ref: Ref, pid: Pid, reason: ExitReason) -> SystemMessage
Creates a new Down message.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if this is a Timeout message.
Trait Implementations§
Source§impl Clone for SystemMessage
impl Clone for SystemMessage
Source§fn clone(&self) -> SystemMessage
fn clone(&self) -> SystemMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SystemMessage
impl Debug for SystemMessage
Source§impl<'de> Deserialize<'de> for SystemMessage
impl<'de> Deserialize<'de> for SystemMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SystemMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SystemMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for SystemMessage
Source§impl PartialEq for SystemMessage
impl PartialEq for SystemMessage
Source§fn eq(&self, other: &SystemMessage) -> bool
fn eq(&self, other: &SystemMessage) -> bool
self and other values to be equal, and is used by ==.