NestedSupervisorBuilder

Struct NestedSupervisorBuilder 

Source
pub struct NestedSupervisorBuilder<'a, S = Restartable> { /* private fields */ }
Expand description

Builder for a yet-to-be-started nested supervisor.

The counterpart to ChildBuilder for a child that is itself a Supervisor, and deliberately a much smaller surface. A nested supervisor has no placement of its own (it runs wherever its parent does, and its children carry their own placement) and no shutdown deadline of its own (it bounds its own drain through its children), so what is left to configure is the restart policy and significance.

Uses the same typestate as ChildBuilder: significance is offered only once the restart policy has been narrowed to one that lets the child terminate for good, since a permanent child is always brought back and so never has a termination for the parent to act on.

Implementations§

Source§

impl<'a, S: BuilderState> NestedSupervisorBuilder<'a, S>

Source

pub fn build(self) -> ChildSpecification<SupervisorSpec>

Finishes describing the child without starting it, for Supervisor::add_worker.

Use this to register a configured subtree on a supervisor that hasn’t started yet; spawn is the counterpart for a supervisor that is already running.

Whichever supervisor this builder was created against is irrelevant here – the child belongs to whichever one it is handed to.

Source

pub fn spawn(self) -> ChildId

Spawns the nested supervisor.

Returns the child’s ChildId. As with ChildBuilder::spawn, the child is queued rather than started synchronously.

§Panics

If this builder targets the ambient supervisor and there isn’t one, this panics. See spawn.

Source§

impl<'a> NestedSupervisorBuilder<'a, Restartable>

Source

pub fn transient(self) -> NestedSupervisorBuilder<'a, Terminable>

Restarts this subtree only when it terminates abnormally.

Narrows the restart policy to RestartType::Transient, which makes with_significant available.

Source

pub fn temporary(self) -> NestedSupervisorBuilder<'a, Terminable>

Never restarts this subtree.

Narrows the restart policy to RestartType::Temporary, which makes with_significant available.

Source§

impl<S: CanTerminate> NestedSupervisorBuilder<'_, S>

Source

pub fn with_significant(self, significant: bool) -> Self

Sets whether this subtree’s termination should stop the parent supervisor.

See ChildBuilder::with_significant, which this mirrors.

Auto Trait Implementations§

§

impl<'a, S> Freeze for NestedSupervisorBuilder<'a, S>

§

impl<'a, S = Restartable> !RefUnwindSafe for NestedSupervisorBuilder<'a, S>

§

impl<'a, S> Send for NestedSupervisorBuilder<'a, S>
where S: Send,

§

impl<'a, S> Sync for NestedSupervisorBuilder<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for NestedSupervisorBuilder<'a, S>
where S: Unpin,

§

impl<'a, S = Restartable> !UnwindSafe for NestedSupervisorBuilder<'a, S>

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

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Track for T

§

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>

Instruments this type by attaching the current resource group, returning a Tracked wrapper. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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