pub trait ServiceRouter: Send + Sync {
type Error: Error + Send + Sync + 'static;
type ServiceId: Debug + Send + Sync;
type Service: Service;
// Required methods
fn parse_service_id<'life0, 'async_trait>(
&'life0 self,
service_id: u8,
) -> Pin<Box<dyn Future<Output = Result<Self::ServiceId, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_service<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
service_id: &'life1 Self::ServiceId,
connection_info: &'life2 ConnectionInfo,
streams: StreamPair,
) -> Pin<Box<dyn Future<Output = Result<Self::Service, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Routes incoming connections to appropriate services
The router is responsible for parsing service identifiers and creating service instances to handle connections.