pub struct ChildSpecification<S = WorkerSpec> { /* private fields */ }Expand description
A specification for a process to be added to a Supervisor.
A child specification describes how the supervisor should create and manage a child: the underlying future that
represents the process, along with metadata such as its name and shutdown strategy. All processes in a supervisor,
whether a worker or a (nested) supervisor, are represented by a ChildSpecification.
A specification is a description, not a control surface: it carries no public methods of its own. There are two ways to obtain one, matching the two levels of control:
- Pass a worker or supervisor directly to
add_worker,spawn, orSupervisorHandle::spawn, all of which accept aSupervisoror anySupervisableand convert it for you, applying the defaults appropriate to that kind of child – including the shutdown strategy that lets a nested supervisor drain its whole subtree. - Configure one with
ChildBuilder, which is the only way to set a restart policy, significance, placement, or a shutdown deadline. The builder exposes only the settings that make sense for the kind of child being described, andbuildhands the result toadd_worker.
Supervisors have no per-child settings of their own, so there is nothing to configure for a nested supervisor.
Trait Implementations§
Source§impl From<Supervisor> for ChildSpecification<SupervisorSpec>
impl From<Supervisor> for ChildSpecification<SupervisorSpec>
Source§fn from(supervisor: Supervisor) -> Self
fn from(supervisor: Supervisor) -> Self
Converts to this type from the input type.
Source§impl<T> From<T> for ChildSpecification<WorkerSpec>where
T: Supervisable + 'static,
impl<T> From<T> for ChildSpecification<WorkerSpec>where
T: Supervisable + 'static,
Auto Trait Implementations§
impl<S> Freeze for ChildSpecification<S>where
S: Freeze,
impl<S> RefUnwindSafe for ChildSpecification<S>where
S: RefUnwindSafe,
impl<S> Send for ChildSpecification<S>where
S: Send,
impl<S> Sync for ChildSpecification<S>where
S: Sync,
impl<S> Unpin for ChildSpecification<S>where
S: Unpin,
impl<S> UnwindSafe for ChildSpecification<S>where
S: UnwindSafe,
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Instruments this type by attaching the given resource group token, returning a
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Instruments this type by attaching the current resource group, returning a
Tracked wrapper. Read more