ProtocolAdapter

Trait ProtocolAdapter 

Source
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§

Source

fn name(&self) -> &str

Get the name of this protocol adapter

Source

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§

Source§

impl ProtocolAdapter for GraphQLAdapter

Source§

impl ProtocolAdapter for GraphQLProductionAdapter

Available on crate feature router-graphql only.
Source§

impl ProtocolAdapter for GrpcAdapter

Source§

impl ProtocolAdapter for GrpcProductionAdapter

Available on crate feature router-grpc only.
Source§

impl ProtocolAdapter for RestAdapter