pub trait DomainService: Send + Sync {
// Required method
fn service_id(&self) -> &'static str;
// Provided methods
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn service_name(&self) -> &'static str { ... }
fn module_name(&self) -> &'static str { ... }
}Expand description
Base trait for all domain services.
Domain services are stateless operations that coordinate between multiple entities or handle complex business logic.
Required Methods§
Sourcefn service_id(&self) -> &'static str
fn service_id(&self) -> &'static str
Unique identifier for this service.
Format: {module}.{service_name}
Example: "corpus.organization_service"
Provided Methods§
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check for this service.
Returns Ok(()) if the service is healthy,
or an error describing the issue.
Sourcefn service_name(&self) -> &'static str
fn service_name(&self) -> &'static str
Get the service name (derived from service_id).
Sourcefn module_name(&self) -> &'static str
fn module_name(&self) -> &'static str
Get the module name (derived from service_id).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".