GithubHelp home page GithubHelp logo

isabella232 / grpc-rust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pingcap/grpc-rust

0.0 0.0 0.0 658 KB

Rust implementation of gRPC (not ready yet)

License: MIT License

Shell 0.45% Go 0.62% Rust 96.33% Protocol Buffer 2.60%

grpc-rust's Introduction

grpc-rust

Build Status License

Rust implementation of gRPC protocol, under development.

Some development questions in FAQ.

Current status

It basially works. 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.

How to use gRPC compiler

Build & install Rust protobuf and gRPC compiler:

cargo install protobuf
cargo install grpc-compiler

These commands install protoc-gen-rust and protoc-gen-rust-grpc to ~/.cargo/bin, which should be added to $PATH.

Compile your proto & gRPC to Rust:

cd $YOURPROJECT
mkdir -p src
protoc --rust_out=src *.proto
protoc --rust-grpc_out=src *.proto

Use compiled protos in your project:

In Cargo.toml:

[dependencies]
grpc            = "0.*"
protobuf        = "1.*"
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;

Compiling protos manually is silly. Can Cargo do all of above for me?

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.

TODO

  • Implement flow control. See issue #35
  • Fix performance
  • More tests
  • In particular, add more compatibility tests, they live in long-tests directory
  • Fix all TODO in sources

grpc-rust's People

Contributors

aptakhin avatar coocoocacha avatar disksing avatar erickt avatar kkimdev avatar overvenus avatar siddontang avatar stepancheg avatar vrusinov avatar weiznich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.