Skip to main content

ActorPhase

Enum ActorPhase 

Source
pub enum ActorPhase {
    Running,
    Restarting {
        generation: u32,
        attempt: u32,
    },
    Stopped {
        cause: StopCause,
        detail: Option<String>,
    },
}
Expand description

Actor 生命周期相位 —— 任意时刻可查的运行状态 (ActorRef::phase)。

与一次性的 ActorSignal::Terminated 通知互补:通知只描述“刚刚终止“ 这一时刻事件,相位是持续可查的状态 —— 通道保留末值,Actor 停止后 再查询/订阅照样能读到最终死因与 panic 详情(无需额外墓碑表)。

Variants§

§

Running

世代正在运行(含世代启动前的初始态)。

§

Restarting

监督重启空窗:上一世代已退出,新世代尚未启动。

由 Transient 退避等待期间发布,供上层观测/展示重启过程 (如地面站 UI 的“链路重连中“)。

Fields

§generation: u32

即将启动的世代号(与 ActorContext::generation 同源)。

§attempt: u32

本次重启计数(与 ActorContext::restarts 同源)。

§

Stopped

已停止:停止请求已落值(detail 为 None),或已最终退出 (cause 为真实死因,panic 详情随 detail)。

一旦进入不可逆 —— 运行期状态发布(Running / Restarting)不会 覆盖它;唯一例外是最终退出:finalize 以真实死因覆盖“停止请求“占位。

Fields

§cause: StopCause

停止原因。

§detail: Option<String>

panic 详情(仅 StopCause::Panicked 及其衍生情形可能非空)。

Implementations§

Source§

impl ActorPhase

Source

pub fn is_alive(&self) -> bool

是否尚未停止。注意:停止请求一落值即为 Stopped,本判定不区分 “停止中”(请求已送达、事件循环尚在收尾)与“已停止“。

Trait Implementations§

Source§

impl Clone for ActorPhase

Source§

fn clone(&self) -> Self

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 ActorPhase

Source§

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

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

impl Eq for ActorPhase

Source§

impl PartialEq for ActorPhase

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ActorPhase

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> ActorMsg for T
where T: Send + 'static,

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<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more