Skip to main content

SystemMessage

Enum SystemMessage 

Source
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).

Fields

§from: Pid

The process that exited.

§reason: ExitReason

The reason for termination.

§

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

§monitor_ref: Ref

The reference returned when the monitor was created.

§pid: Pid

The process that was being monitored.

§reason: ExitReason

The 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

Source

pub fn exit(from: Pid, reason: ExitReason) -> SystemMessage

Creates a new Exit message.

Source

pub fn down(monitor_ref: Ref, pid: Pid, reason: ExitReason) -> SystemMessage

Creates a new Down message.

Source

pub fn is_exit(&self) -> bool

Returns true if this is an Exit message.

Source

pub fn is_down(&self) -> bool

Returns true if this is a Down message.

Source

pub fn is_timeout(&self) -> bool

Returns true if this is a Timeout message.

Trait Implementations§

Source§

impl Clone for SystemMessage

Source§

fn clone(&self) -> SystemMessage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SystemMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SystemMessage

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<SystemMessage, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for SystemMessage

Source§

impl PartialEq for SystemMessage

Source§

fn eq(&self, other: &SystemMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SystemMessage

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SystemMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Message for T
where T: Term,

Source§

impl<T> Term for T
where T: Serialize + DeserializeOwned + Send + 'static,

Source§

fn encode(&self) -> Vec<u8>

Encodes this term into bytes. Read more
Source§

fn decode(bytes: &[u8]) -> Result<T, DecodeError>

Decodes a term from bytes. Read more
Source§

fn try_encode(&self) -> Option<Vec<u8>>

Encodes this term, returning None on failure instead of panicking.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.