/// Add a unary RPC call handler.
Add a unary RPC call handler.
Add a unary RPC call handler .
pub fn add_unary_handler<Req, Resp, F>(
        mut self,
        method: &Method<Req, Resp>,
        mut handler: F,
    ) -> ServiceBuilder
    where
        Req: 'static,
        Resp: 'static,
        F: FnMut(RpcContext, Req, UnarySink<Resp>) + Send + Clone + 'static,
    {
        let (ser, de) = (method.resp_ser(), method.req_de());
        let h = move |ctx: RpcContext, payload: &[u8]| {
            execute_unary(ctx, ser, de, payload, &mut handler)
        };
        let ch = Box::new(Handler::new(MethodType::Unary, h));
        self.handlers.insert(method.name.as_bytes(), ch);
        self
    }
pub fn add_unary_handler < Req , Resp , F > ( mut self , method : & Method < Req , Resp > , mut handler : F , ) -> ServiceBuilder where Req : ' static , Resp : ' static , F : FnMut ( RpcContext , Req , UnarySink < Resp > ) + Send + Clone + ' static , { let ( ser , de ) = ( method . resp_ser ( ) , method . req_de ( ) ) ; let h = move | ctx : RpcContext , payload : & [ u8 ] | { execute_unary ( ctx , ser , de , payload , & mut handler ) } ; let ch = Box :: new ( Handler :: new ( MethodType :: Unary , h ) ) ; self . handlers . insert ( method . name . as_bytes ( ) , ch ) ; self }
Add a unary RPC call handler.
Add a unary RPC call handler .
mut self
method
&Method<Req, Resp>
handler
F