Skip to content

Commit

Permalink
chore: [rust] refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
shuai132 committed Jan 4, 2024
1 parent 60322f1 commit 67276ba
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- 'include/**'
- 'test/**'

env:
RUST_BACKTRACE: 1

jobs:
Linux:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "rpc-core"
version = "0.3.0"
version = "0.3.1"
description = "a tiny rpc library for rust"
categories = ["rpc", "rpc-core", "rpc-core-net"]
homepage = "https://github.com/shuai132/rpc_core/rust"
categories = ["rpc", "rpc-core"]
homepage = "https://github.com/shuai132/rpc_core/tree/master/rust"
repository = "https://github.com/shuai132/rpc_core"
authors = ["liushuai <770722922@qq.com>"]
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Or add the following line to your Cargo.toml:

```toml
[dependencies]
rpc-core = { version = "0.3.0", features = ["net"] }
rpc-core = { version = "0.3.1", features = ["net"] }
```

# Example
Expand Down Expand Up @@ -77,13 +77,13 @@ See `examples` for details: [src/examples](src/examples)

* client
```rust
fn client() {
async fn client() {
let rpc = Rpc::new(None);
let client = rpc_client::RpcClient::new(RpcConfigBuilder::new().rpc(Some(rpc.clone())).build());
client.set_reconnect(1000);
client.open("localhost", 6666);

let result = rpc_c.cmd("cmd").msg("hello").future::<String>().await;
let result = rpc.cmd("cmd").msg("hello").future::<String>().await;
assert_eq!(result.result.unwrap(), "world");
}
```
Expand Down
20 changes: 0 additions & 20 deletions rust/src/net/lib.rs

This file was deleted.

2 changes: 1 addition & 1 deletion rust/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl RpcProto for Rpc {
payload = coder::serialize(&msg);
connection = inner.connection.clone();
}
debug!("=> seq:{} type:{} {}", msg.seq, if msg.type_.contains( MsgType::Ping) { "ping" } else {"cmd"}, msg.cmd);
debug!("=> seq:{} type:{} {}", msg.seq, if msg.type_.contains(MsgType::Ping) { "ping" } else {"cmd"}, msg.cmd);
connection.borrow().send_package(payload);
}

Expand Down

0 comments on commit 67276ba

Please sign in to comment.