Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tonic-build/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn generate_unary(method: &Method, proto: &str, path: String) -> TokenStream {
pub async fn #ident(&mut self, request: tonic::Request<#request>)
-> Result<tonic::Response<#response>, tonic::Status> {
self.ready().await?;
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(#path);
self.inner.unary(request, path, codec).await
}
Expand All @@ -118,7 +118,7 @@ fn generate_server_streaming(method: &Method, proto: &str, path: String) -> Toke
pub async fn #ident(&mut self, request: tonic::Request<#request>)
-> Result<tonic::Response<tonic::codec::Streaming<#response>>, tonic::Status> {
self.ready().await?;
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(#path);
self.inner.server_streaming(request, path, codec).await
}
Expand All @@ -136,7 +136,7 @@ fn generate_client_streaming(method: &Method, proto: &str, path: String) -> Toke
where S: Stream<Item = #request> + Send + 'static,
{
self.ready().await?;
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(#path);
self.inner.client_streaming(request, path, codec).await
}
Expand All @@ -154,7 +154,7 @@ fn generate_streaming(method: &Method, proto: &str, path: String) -> TokenStream
where S: Stream<Item = #request> + Send + 'static,
{
self.ready().await?;
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(#path);
self.inner.streaming(request, path, codec).await
}
Expand Down
8 changes: 4 additions & 4 deletions tonic-build/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn generate_unary(
let inner = self.inner.clone();
let fut = async move {
let method = #service_ident(inner);
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec);
let res = grpc.unary(method, req).await;
Ok(res)
Expand Down Expand Up @@ -289,7 +289,7 @@ fn generate_server_streaming(
let inner = self.inner.clone();
let fut = async move {
let method = #service_ident(inner);
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec);
let res = grpc.server_streaming(method, req).await;
Ok(res)
Expand Down Expand Up @@ -330,7 +330,7 @@ fn generate_client_streaming(
let inner = self.inner.clone();
let fut = async move {
let method = #service_ident(inner);
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec);
let res = grpc.client_streaming(method, req).await;
Ok(res)
Expand Down Expand Up @@ -373,7 +373,7 @@ fn generate_streaming(
let inner = self.inner.clone();
let fut = async move {
let method = #service_ident(inner);
let codec = tonic::codec::ProstCodec::new();
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec);
let res = grpc.streaming(method, req).await;
Ok(res)
Expand Down
7 changes: 7 additions & 0 deletions tonic-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ path = "src/tls_client_auth/server.rs"
name = "tls-client-auth-client"
path = "src/tls_client_auth/client.rs"

[[bin]]
name = "gcp-client"
path = "src/gcp/client.rs"

[dependencies]
tonic = { path = "../tonic", features = ["rustls"] }
bytes = "0.4"
Expand All @@ -68,5 +72,8 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
rand = "0.7.2"

# Required for wellknown types
prost-types = "0.5"

[build-dependencies]
tonic-build = { path = "../tonic-build" }
1 change: 1 addition & 0 deletions tonic-examples/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ fn main() {
tonic_build::compile_protos("proto/helloworld/helloworld.proto").unwrap();
tonic_build::compile_protos("proto/routeguide/route_guide.proto").unwrap();
tonic_build::compile_protos("proto/echo/echo.proto").unwrap();
tonic_build::compile_protos("proto/google/pubsub/pubsub.proto").unwrap();
}
Loading