#grpc #protobuf #rpc #tls #http2

grpcio

The rust language implementation of gRPC, base on the gRPC c core library

17 unstable releases (5 breaking)

✓ Uses Rust 2018 edition

0.5.0-alpha.1 Apr 10, 2019
0.4.4 Feb 20, 2019
0.4.1 Nov 22, 2018
0.3.0 Jun 1, 2018
0.1.0 Jul 27, 2017

#6 in Network programming

Download history 448/week @ 2018-12-26 677/week @ 2019-01-02 1011/week @ 2019-01-09 1106/week @ 2019-01-16 1661/week @ 2019-01-23 1436/week @ 2019-01-30 1522/week @ 2019-02-06 1386/week @ 2019-02-13 1627/week @ 2019-02-20 1565/week @ 2019-02-27 1826/week @ 2019-03-06 1622/week @ 2019-03-13 1686/week @ 2019-03-20 1626/week @ 2019-03-27 1635/week @ 2019-04-03

6,514 downloads per month
Used in 11 crates (8 directly)

Apache-2.0

25MB
535K SLoC

C++ 273K SLoC // 0.2% comments C 117K SLoC // 0.2% comments Perl 60K SLoC // 0.1% comments Go 31K SLoC // 0.1% comments Python 30K SLoC // 0.1% comments Assembly 10K SLoC // 0.1% comments Rust 5K SLoC // 0.2% comments Shell 3.5K SLoC // 0.5% comments Ada 1.5K SLoC // 0.2% comments C# 1K SLoC // 0.4% comments Objective C++ 607 SLoC // 0.1% comments Scons 576 SLoC // 0.2% comments Batch 557 SLoC // 0.0% comments Pascal 450 SLoC // 0.6% comments XSL 181 SLoC SQL 159 SLoC Ruby 38 SLoC // 0.5% comments Alex 19 SLoC PHP 9 SLoC // 0.6% comments D 5 SLoC

gRPC-rs

gRPC-rs is a Rust wrapper of gRPC Core. gRPC is a high performance, open source universal RPC framework that puts mobile and HTTP/2 first.

Crates.io docs.rs Build Status Build status

Status

This project is still under development. The following features with the check marks are supported:

  • Basic asynchronous unary/steaming call
  • SSL
  • Generic call
  • Connection level compression
  • Interoperability test
  • QPS benchmark
  • Custom metadata
  • Health check
  • Reflection
  • Authentication
  • Load balance

Prerequisites

  • CMake >= 3.8.0
  • Rust >= 1.19.0
  • binutils >= 2.22
  • By default, the secure feature is enabled, therefore Go (>=1.7) is required.

For Linux and MacOS, you also need to install gcc (or clang) too.

For Windows, you also need to install following software:

  • Active State Perl
  • yasm
  • Visual Studio 2015+

Build

$ git submodule update --init --recursive # if you just cloned the repository
$ cargo build

Usage

To generate the sources from proto files:

Option 1 - Manual Generation

  1. Install the protobuf compiler:
$ cargo install protobuf-codegen
  1. Install the gRPC compiler:
$ cargo install grpcio-compiler
  1. Generate the sources:
$ protoc --rust_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_rust_plugin` example.proto

Option 2 - Programmatic Generation

Programmatic generation can be used to generate Rust modules from proto files via your build.rs by using protoc-grpcio.

For more information and examples see README.

To include this project as a dependency:

[dependencies]
grpcio = "0.4"

Feature secure

secure feature enables support for TLS encryption and some authentication mechanism. When you do not need it, for example when working in intranet, you can disable it by using the following configuration:

[dependencies]
grpcio = { version = "0.4", default-features = false, features = ["protobuf-codec"] }

Performance

See benchmark to find out how to run a benchmark by yourself.

Cross Compile

See cross_compile

Dependencies