Function psup_json_rpc::serve [−][src]
pub async fn serve<S, R, W, I, O, A>(
server: Server<'_, S>,
state: &S,
reader: ReadHalf<R>,
writer: WriteHalf<W>,
request: I,
response: O,
answer: A
) -> Result<(), Box<dyn Error + Send + Sync>> where
R: AsyncRead,
W: AsyncWrite,
S: Send + Sync,
I: Fn(&Request),
O: Fn(&Response),
A: Fn(Response) -> Result<Option<Message>, Box<dyn Error + Send + Sync>>,
Read and write line-delimited JSON from a stream executing via a JSON RPC server.
Request and response functions are useful for logging service calls; the answer function can be used to handle replies from a remote method call.