pub struct UnadoptedScope { /* private fields */ }Expand description
A scope that no process owns yet.
The scope holds the children that are spawned into it until a worker adopts it. Then the children start as
children of that worker. If the UnadoptedScope is dropped before a worker adopts it, the scope closes, and it
drops the children that wait and each child that is spawned into it later.
Most code does not use this type. Every supervised worker already has a scope, which is available through
current or spawn.
Implementations§
Source§impl UnadoptedScope
impl UnadoptedScope
Sourcepub fn scope(&self) -> &Scope
pub fn scope(&self) -> &Scope
Returns a handle to the scope, through which children can be spawned into it before a worker adopts it.
Sourcepub fn into_host(self) -> ChildSpecification<WorkerSpec>
pub fn into_host(self) -> ChildSpecification<WorkerSpec>
Describes a worker that owns this scope, for a supervisor to add as a child.
The worker only holds the children of the scope. It runs until it is told to stop, and then the scope closes. Use this for work that is spawned outside supervised processes, such as work at startup before the supervision tree runs. The worker makes that work part of the tree when the tree runs. The worker fails if one of the children of the scope fails its owner. The worker passes that failure to the supervisor or scope that it is added to.
If the supervisor starts the worker again, for example because the supervisor restarts, the new worker holds nothing. The scope closed when the first worker stopped, and the scope drops each child that is spawned into it after that.
Trait Implementations§
Source§impl Debug for UnadoptedScope
impl Debug for UnadoptedScope
Auto Trait Implementations§
impl Freeze for UnadoptedScope
impl RefUnwindSafe for UnadoptedScope
impl Send for UnadoptedScope
impl Sync for UnadoptedScope
impl Unpin for UnadoptedScope
impl UnsafeUnpin for UnadoptedScope
impl UnwindSafe for UnadoptedScope
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
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>
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>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more