Rust implementation of gRPC protocol, under development.
Client and server without streaming can be done with rust-grpc,
see grpc-examples/src/bin/greeter_{client,server}{,_async}.rs
. It can be tested
for example with go client:
# start greeter server implemented in rust
$ cargo run --bin greeter_server
# .. or start async server
$ cargo run --bin greeter_server_async
# ... or start greeter server implemented in go
$ go get -u google.golang.org/grpc/examples/helloworld/greeter_client
$ greeter_server
# start greeter client implemented in rust
$ cargo run --bin greeter_client rust
> message: "Hello rust"
# ... or start async client
$ cargo run --bin greeter_client_async rust
> message: "Hello rust"
# ... or start greeter client implemented in go
$ go get -u google.golang.org/grpc/examples/helloworld/greeter_client
$ greeter_client rust
> 2016/08/19 05:44:45 Greeting: Hello rust
Client and server are implemented asynchronously, and sync versions are thin wrappers around async counterparts.
cargo install protobuf
This command installs protoc-gen-rust
to ~/.cargo/bin
, which
should be added to $PATH
.
git clone https://github.com/stepancheg/grpc-rust.git
cd grpc-rust
cd grpc-compiler
cargo install
Installs protoc-gen-rust-grpc
to ~/.cargo/bin
.
cd $YOURPROJECT
mkdir -p src
protoc --rust_out=src *.proto
protoc --rust-grpc_out=src *.proto
In Cargo.toml:
[dependencies]
grpc = { git = "https://github.com/stepancheg/grpc-rust" }
protobuf = { git = "http://github.com/stepancheg/rust-protobuf" }
futures = "0.1"
futures-cpupool = "0.1"
In lib.rs
or main.rs
(or any other submodule):
extern crate protobuf;
extern crate grpc;
extern crate futures;
extern crate futures_cpupool;
pub mod myproto;
pub mod myproto_grpc;
It seems possible, but looks like it requires some more work.
See stepancheg/rust-protobuf#57 and https://github.com/dwrensha/capnpc-rust for more details.
- Tests
- Proper error handling
- Upload to crates
- Streaming
- Performance