// Helper function to call server streaming handler.
Helper function to call server streaming handler.
Helper function to call server streaming handler .
pub fn execute_server_streaming<P, Q, F>(
    ctx: RpcContext,
    ser: SerializeFn<Q>,
    de: DeserializeFn<P>,
    payload: &[u8],
    f: &mut F,
) where
    F: FnMut(RpcContext, P, ServerStreamingSink<Q>),
{
    let mut call = ctx.call();
    let close_f = accept_call!(call);
    let request = match de(payload) {
        Ok(t) => t,
        Err(e) => {
            let status = RpcStatus::new(
                RpcStatusCode::Internal,
                Some(format!("Failed to deserialize response message: {:?}", e)),
            );
            call.abort(&status);
            return;
        }
    };
    let sink = ServerStreamingSink::new(ShareCall::new(call, close_f), ser);
    f(ctx, request, sink)
}
pub fn execute_server_streaming < P , Q , F > ( ctx : RpcContext , ser : SerializeFn < Q > , de : DeserializeFn < P > , payload : & [ u8 ] , f : & mut F , ) where F : FnMut ( RpcContext , P , ServerStreamingSink < Q > ) , { let mut call = ctx . call ( ) ; let close_f = accept_call ! ( call ) ; let request = match de ( payload ) { Ok ( t ) => t , Err ( e ) => { let status = RpcStatus :: new ( RpcStatusCode :: Internal , Some ( format ! ( " " e ) ) , ) ; call . abort ( & status ) ; return ; } } ; let sink = ServerStreamingSink :: new ( ShareCall :: new ( call , close_f ) , ser ) ; f ( ctx , request , sink ) }
Helper function to call server streaming handler.
Helper function to call server streaming handler .
ctx
RpcContext
ser
SerializeFn<Q>
de
DeserializeFn<P>
payload
&[u8]
f
&mut F