pub trait RequestHandler:
Send
+ Sync
+ 'static {
// Required method
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
conn_id: u64,
request: &'life1 IncomingRequest,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
业务处理器 trait
Required Methods§
Sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
conn_id: u64,
request: &'life1 IncomingRequest,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
conn_id: u64,
request: &'life1 IncomingRequest,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
处理请求,返回响应 body(protobuf 编码后的字节) 返回 None 表示不产生响应(例如异步响应场景)