pub trait Service:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn start(&self, shutdown: ShutdownToken) -> ServiceFuture<'_>;
// Provided method
fn stop(&self) -> ServiceFuture<'_> { ... }
}Expand description
Async service lifecycle managed by crate::core::ServiceGroup.
Implementors should return from Service::start when the supplied
ShutdownToken is cancelled. Service::stop is a best-effort hook used
to unblock resources that do not observe the token directly.
Required Methods§
Sourcefn start(&self, shutdown: ShutdownToken) -> ServiceFuture<'_>
fn start(&self, shutdown: ShutdownToken) -> ServiceFuture<'_>
Starts the service and runs until shutdown or failure.
Provided Methods§
Sourcefn stop(&self) -> ServiceFuture<'_>
fn stop(&self) -> ServiceFuture<'_>
Stops the service. The default implementation is a no-op.