chore: Fix feature flags and build docs (#311)

Signed-off-by: Lucio Franco <[email protected]>
This commit is contained in:
Lucio Franco
2020-03-30 12:02:10 -04:00
committed by GitHub
parent 59c7788846
commit 3cba9f5f6f
14 changed files with 258 additions and 247 deletions
+13 -19
View File
@@ -1,4 +1,4 @@
use super::{client, schema, server};
use super::{client, server};
use proc_macro2::TokenStream;
use prost_build::{Config, Method, Service};
use quote::ToTokens;
@@ -7,18 +7,11 @@ use std::path::{Path, PathBuf};
const PROST_CODEC_PATH: &'static str = "tonic::codec::ProstCodec";
impl schema::Commentable for Service {
type Comment = String;
fn comment(&self) -> &[Self::Comment] {
&self.comments.leading[..]
}
}
impl schema::Service for Service {
impl crate::Service for Service {
const CODEC_PATH: &'static str = PROST_CODEC_PATH;
type Method = Method;
type Comment = String;
fn name(&self) -> &str {
&self.name
@@ -32,21 +25,18 @@ impl schema::Service for Service {
&self.proto_name
}
fn comment(&self) -> &[Self::Comment] {
&self.comments.leading[..]
}
fn methods(&self) -> &[Self::Method] {
&self.methods[..]
}
}
impl schema::Commentable for Method {
type Comment = String;
fn comment(&self) -> &[Self::Comment] {
&self.comments.leading[..]
}
}
impl schema::Method for Method {
impl crate::Method for Method {
const CODEC_PATH: &'static str = PROST_CODEC_PATH;
type Comment = String;
fn name(&self) -> &str {
&self.name
@@ -64,6 +54,10 @@ impl schema::Method for Method {
self.server_streaming
}
fn comment(&self) -> &[Self::Comment] {
&self.comments.leading[..]
}
fn request_response_name(&self, proto_path: &str) -> (TokenStream, TokenStream) {
let request = if self.input_proto_type.starts_with(".google.protobuf")
|| self.input_type.starts_with("::")