pub trait ProtocolAdapter: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn handle(
&self,
request: &str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>;
}Expand description
Protocol adapter trait
Adapters implement this trait to provide protocol-specific request/response handling while using the unified handler interface.
Required Methods§
Sourcefn handle(
&self,
request: &str,
) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>
fn handle( &self, request: &str, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>
Handle a protocol-specific request
The adapter is responsible for:
- Parsing the incoming request format
- Extracting parameters for the handler
- Calling the appropriate handler
- Formatting the response in protocol-specific format
Implementors§
impl ProtocolAdapter for GraphQLAdapter
impl ProtocolAdapter for GraphQLProductionAdapter
Available on crate feature
router-graphql only.impl ProtocolAdapter for GrpcAdapter
impl ProtocolAdapter for GrpcProductionAdapter
Available on crate feature
router-grpc only.