Trait HttpTrait

Source
pub trait HttpTrait:
    Send
    + Sync
    + Any {
    // Required method
    fn operate<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        req: &'life1 mut RecvRequest,
    ) -> Pin<Box<dyn Future<Output = ProtResult<RecvResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn middle_operate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        req: &'life1 mut RecvRequest,
        middles: &'life2 mut Vec<Box<dyn Middleware>>,
    ) -> Pin<Box<dyn Future<Output = ProtResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn is_continue_next(&self) -> bool { ... }
    fn as_any(&self) -> Option<&dyn Any> { ... }
    fn as_any_mut(&mut self) -> Option<&mut dyn Any> { ... }
}

Required Methods§

Source

fn operate<'life0, 'life1, 'async_trait>( &'life0 mut self, req: &'life1 mut RecvRequest, ) -> Pin<Box<dyn Future<Output = ProtResult<RecvResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

处理请求并返回正确的数据

Provided Methods§

Source

fn middle_operate<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, req: &'life1 mut RecvRequest, middles: &'life2 mut Vec<Box<dyn Middleware>>, ) -> Pin<Box<dyn Future<Output = ProtResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

处理中间件的请求,跟中间件相关的处理

Source

fn is_continue_next(&self) -> bool

是否主动结束服务,返回false则表示服务暂停

Source

fn as_any(&self) -> Option<&dyn Any>

Source

fn as_any_mut(&mut self) -> Option<&mut dyn Any>

Implementors§