January 2019
Intermediate to advanced
520 pages
14h 32m
English
Open the lib.rs source file and add two generated modules:
mod ring;mod ring_grpc;
Import some types we need to create a wrapper for a gRPC client:
use crate::ring::Empty;use crate::ring_grpc::{Ring, RingClient};use grpc::{ClientConf, ClientStubExt, Error as GrpcError, RequestOptions};use std::net::SocketAddr;
As you can see, the generated modules contain types we declared in the ring.proto file. The ring module contains the Empty struct, and the ring_grpc module contains the Ring trait, which represents an interface of a remote service. Also, protoc_rust_grpc in the build script generated the RingClient type. This type is a client that can be used to call remote methods. We wrap it with our own struct, because RingClient generates ...
Read now
Unlock full access