gitalk icon indicating copy to clipboard operation
gitalk copied to clipboard

用最简单的方式实现 Rust RPC 服务

Open smallnest opened this issue 5 years ago • 3 comments

https://colobu.com/2019/08/11/write-rust-rpc-service-in-the-easist-way/

smallnest avatar Aug 11 '19 03:08 smallnest

Nice

wujunze avatar Aug 26 '19 08:08 wujunze

客户端和服务器端公用的数据,这部分需要创建lib.rs吗?这部分代码写在哪?

AmadeusGB avatar May 19 '20 02:05 AmadeusGB

一点愚见: both side interface:

#[rpcx_interface(
  name = "Mul",
)]
pub trait RPC_MUL {
   fn invoke(par: ArithAddArgs) -> RpcResult<ArithAddReply>;
}

server side:

#![rpcx_rigister(RPC_MUL, fn_mul)]

pub fn fn_mul(par: ArithAddArgs) -> RpcResult<ArithAddReply>{
  //...
}

client side:

#![rpcx_intro(RPC_MUL, fn_cli_mul)]

fn main() {
  res = fn_cli_mul(par).unwrap()
}

danielliwd avatar Apr 05 '24 04:04 danielliwd