pub trait ManagedService: Send + Sync {
// Required methods
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn serve<'life0, 'async_trait>(
&'life0 self,
context: ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn status(&self) -> ServiceStatus;
fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<ServiceSnapshot>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn register_devices(&self, _registry: &DeviceRegistry) -> RuntimeResult<()> { ... }
}Expand description
Shared lifecycle contract for protocol services.
Required Methods§
Sourcefn start<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Performs any non-blocking startup work.
Sourcefn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Requests a graceful stop.
Sourcefn serve<'life0, 'async_trait>(
&'life0 self,
context: ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn serve<'life0, 'async_trait>(
&'life0 self,
context: ServiceContext,
) -> Pin<Box<dyn Future<Output = RuntimeResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs the service until completion or cancellation.
Sourcefn status(&self) -> ServiceStatus
fn status(&self) -> ServiceStatus
Returns the current status.
Sourcefn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<ServiceSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RuntimeResult<ServiceSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a structured snapshot.
Provided Methods§
Sourcefn register_devices(&self, _registry: &DeviceRegistry) -> RuntimeResult<()>
fn register_devices(&self, _registry: &DeviceRegistry) -> RuntimeResult<()>
Publishes any controller-visible device ports exposed by this service.