Crates.io | mco-rpc |
lib.rs | mco-rpc |
version | 0.1.8 |
source | src |
created_at | 2022-02-27 18:56:20.039372 |
updated_at | 2023-12-08 11:37:01.833218 |
description | RPC framework for Rust based on mco. |
homepage | https://github.com/co-rs/mco |
repository | https://github.com/co-rs/mco-rpc |
max_upload_size | |
id | 540472 |
size | 50,229 |
mco-rpc
[Tag][Length][Value]
mco="0.1"
mco-rpc = "0.1"
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);
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");