Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/co-rs/mco-rpc
server/client remote call crate
https://github.com/co-rs/mco-rpc
async mco rpc
Last synced: 3 months ago
JSON representation
server/client remote call crate
- Host: GitHub
- URL: https://github.com/co-rs/mco-rpc
- Owner: co-rs
- License: apache-2.0
- Created: 2021-12-26T11:26:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-08T11:37:19.000Z (about 1 year ago)
- Last Synced: 2024-08-09T21:13:46.954Z (7 months ago)
- Topics: async, mco, rpc
- Language: Rust
- Homepage:
- Size: 71.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mco-rpc
mco-rpc
* based on [mco](https://github.com/co-rs/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?
```toml
mco="0.1"
mco-rpc = "0.1"
```* client
```rust
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
```rust
use mco_rpc::server::Server;
use mco::std::errors::Result;fn handle(req: i32) -> Result {
Ok(req)
}
let mut s = Server::default ();
s.register_fn("handle", handle);
s.register_fn("handle_fn2", |arg:i32| -> Result{
Ok(1)
});
s.serve("0.0.0.0:10000");
```