7 releases

Uses old Rust 2015

0.1.8 Dec 8, 2023
0.1.7 Dec 8, 2023
0.1.4 Mar 3, 2022
0.1.2 Feb 28, 2022

#1156 in Network programming

MIT license

36KB
836 lines

mco-rpc

mco-rpc

  • based on mco, this is green-thread、coroutines crates
  • based T-L-V.for example: [Tag][Length][Value]
  • support json/bincode
  • support load balance(Round/Random/Hash/MinConnect)

how to use?

mco="0.1"
mco-rpc = "0.1"
  • client
use mco_rpc::client::Client;
let c = Client::dial("127.0.0.1:10000").unwrap();
let resp:i32 = c.call("handle", 1).unwrap();
println!("resp=>>>>>>>>>>>>>> :{}", resp);
  • server
use mco_rpc::server::Server;
use mco::std::errors::Result;

fn handle(req: i32) -> Result<i32> {
    Ok(req)
}
let mut s = Server::default ();
s.register_fn("handle", handle);
s.register_fn("handle_fn2", |arg:i32| -> Result<i32>{
Ok(1)
});
s.serve("0.0.0.0:10000");

Dependencies

~5–35MB
~479K SLoC