pub struct ServiceInitializerContext { /* private fields */ }
Expand description
Contains context for service initialization.
ServiceInitializerContext
also implements Future
and resolves to ServiceHandles
once
it is signaled to do so.
Implementations§
Source§impl ServiceInitializerContext
impl ServiceInitializerContext
Sourcepub fn register_handle<H>(&self, handle: H)
pub fn register_handle<H>(&self, handle: H)
Insert a service handle with the given name
Sourcepub fn lazy_service<F, S>(&self, service_fn: F) -> LazyService<F, Self, S>where
F: FnOnce(ServiceHandles) -> S,
pub fn lazy_service<F, S>(&self, service_fn: F) -> LazyService<F, Self, S>where
F: FnOnce(ServiceHandles) -> S,
Call the given function with the final handles once this future is ready (notify_ready
is called).
Sourcepub fn spawn_when_ready<F, Fut>(self, f: F) -> JoinHandle<Fut::Output>
pub fn spawn_when_ready<F, Fut>(self, f: F) -> JoinHandle<Fut::Output>
Spawn a task once handles are ready. The resolved handles are passed into this closure.
Sourcepub fn spawn_until_shutdown<F, Fut>(
self,
f: F,
) -> JoinHandle<Option<Fut::Output>>
pub fn spawn_until_shutdown<F, Fut>( self, f: F, ) -> JoinHandle<Option<Fut::Output>>
Spawn a task once handles are ready. The resolved handles are passed into this closure. The future returned from the closure is polled on a new task until the shutdown signal is triggered.
Sourcepub async fn wait_ready(self) -> ServiceHandles
pub async fn wait_ready(self) -> ServiceHandles
Wait until the service handle are ready and return them when they are.
Sourcepub fn get_shutdown_signal(&self) -> ShutdownSignal
pub fn get_shutdown_signal(&self) -> ShutdownSignal
Returns the shutdown signal for this stack
pub fn into_inner(self) -> ServiceHandles
Trait Implementations§
Source§impl Clone for ServiceInitializerContext
impl Clone for ServiceInitializerContext
Source§fn clone(&self) -> ServiceInitializerContext
fn clone(&self) -> ServiceInitializerContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ServiceInitializerContext
impl !RefUnwindSafe for ServiceInitializerContext
impl Send for ServiceInitializerContext
impl Sync for ServiceInitializerContext
impl Unpin for ServiceInitializerContext
impl !UnwindSafe for ServiceInitializerContext
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