Use fully qualified path for futures_core::Stream in codegen (#591)
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@ members = [
|
||||
"tests/extern_path/uuid",
|
||||
"tests/ambiguous_methods",
|
||||
"tests/extern_path/my_application",
|
||||
"tests/integration_tests"
|
||||
"tests/integration_tests",
|
||||
"tests/stream_conflict",
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "stream_conflict"
|
||||
version = "0.1.0"
|
||||
authors = ["Ben Sully <ben@bsull.io>"]
|
||||
publish = false
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
tonic = { path = "../../tonic" }
|
||||
prost = "0.7"
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = { path = "../../tonic-build" }
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tonic_build::compile_protos("proto/stream_conflict.proto").unwrap();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
package StreamConflict;
|
||||
|
||||
message Message {
|
||||
bool ok = 1;
|
||||
}
|
||||
|
||||
service Stream {
|
||||
rpc RunStream(Message) returns (stream Message);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
mod stream_conflict {
|
||||
tonic::include_proto!("stream_conflict");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
@@ -182,7 +182,7 @@ fn generate_trait_methods<T: Service>(
|
||||
|
||||
quote! {
|
||||
#stream_doc
|
||||
type #stream: Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
|
||||
#method_doc
|
||||
async fn #name(&self, request: tonic::Request<#req_message>)
|
||||
@@ -198,7 +198,7 @@ fn generate_trait_methods<T: Service>(
|
||||
|
||||
quote! {
|
||||
#stream_doc
|
||||
type #stream: Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
|
||||
#method_doc
|
||||
async fn #name(&self, request: tonic::Request<tonic::Streaming<#req_message>>)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Codegen exports used by `tonic-build`.
|
||||
|
||||
pub use async_trait::async_trait;
|
||||
pub use futures_core::Stream;
|
||||
pub use futures_core;
|
||||
pub use futures_util::future::{ok, poll_fn, Ready};
|
||||
|
||||
pub use http_body::Body as HttpBody;
|
||||
|
||||
Reference in New Issue
Block a user