https://github.com/nikvolf/zrpc
Minimal RPC for Rust
https://github.com/nikvolf/zrpc
Last synced: 11 months ago
JSON representation
Minimal RPC for Rust
- Host: GitHub
- URL: https://github.com/nikvolf/zrpc
- Owner: NikVolf
- Created: 2019-01-25T11:38:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-27T11:14:19.000Z (over 6 years ago)
- Last Synced: 2025-02-24T13:22:25.827Z (over 1 year ago)
- Language: Rust
- Size: 33.2 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zrpc
Minimal RPC for Rust
- Only what is shown in examples works, nothing more.
## Design goals
- Non-forcing. You just write your api, put `#[rpc]` and it just works!
- Very minimal, cnvention over configuration.
- Multi-transport
- Async/await
- Server references! Zero-copy! and much more!
## Easy to use
See `examples/minimal`
## Server references
Imagine there are two entities `A` and `B`. We invoke rpc `get_item(a_id) -> A`. We also have a method `generate_b(&A)`.
We can avoid all the data from A having to go from server to client if we invoke something like `generate_b(get_item(1))` by first returning lazy server reference from `get_item` and dereferencing by passing actual data of `A` only when required.
## Zero-copy
When you have something like this signature in your rpc:
```rust
fn apply(&mut self, raw: &[u8]);
```
you'll work directly with the buffer from network!