Clean up tonic-build

This commit is contained in:
Lucio Franco
2019-09-06 18:16:11 -04:00
parent 8b548f2ea4
commit cd44bf8e9f
7 changed files with 101 additions and 94 deletions
+17
View File
@@ -1,3 +1,18 @@
//! `tonic-build` compiles `proto` files via `prost` and generates service stubs
//! and proto definitiones for use with `tonic`.
//!
//! # Examples
//!
//! ```rust,no_run
//! fn main() {
//! tonic_build::compile_protos(
//! &["proto/helloworld/helloworld.proto"],
//! &["proto/helloworld"],
//! "helloworld",
//! )
//! .unwrap();
//! }
use proc_macro2::TokenStream;
use prost_build::Config;
use std::{io, path, path::Path, process::Command};
@@ -72,12 +87,14 @@ impl prost_build::ServiceGenerator for ServiceGenerator {
let service = quote::quote! {
pub mod client {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#clients
}
pub mod server {
#![allow(unused_variables, dead_code, missing_docs)]
use tonic::codegen::*;
#servers
}