pub struct ChildSpec {
pub id: String,
pub restart: Restart,
pub spawn_fn: SpawnFn,
pub backoff_fn: Option<ChildBackoffFn>,
pub reset_after: Option<Duration>,
}Expand description
Defines how to spawn and manage a single child actor.
Fields§
§id: StringUnique child ID string that must be provided. This will be used as:
- The actor’s global registry name
- Key for failure tracking
- Child specification identifier
§Important
This ID must be unique within the supervisor’s child list and will be
used to register the actor in the global registry via ractor::registry.
restart: RestartRestart policy for this child. Restart::Permanent, Restart::Transient, Restart::Temporary.
spawn_fn: SpawnFnThe user-defined spawn closure. If this fails, meltdown is triggered if repeated too often.
backoff_fn: Option<ChildBackoffFn>A child-level backoff function. If set, this can delay re-spawning the child after a crash.
reset_after: Option<Duration>Optional child-level meltdown “reset.” If the child hasn’t failed in the reset_after duration,
we reset this child’s failure count to 0 next time it fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChildSpec
impl !RefUnwindSafe for ChildSpec
impl Send for ChildSpec
impl Sync for ChildSpec
impl Unpin for ChildSpec
impl !UnwindSafe for ChildSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage