feat!: remove codegen dependency on compression feature (#1004)

This commit is contained in:
Marcus Griep
2022-06-13 17:48:27 -04:00
committed by GitHub
parent d9f5c75112
commit a585a72293
21 changed files with 264 additions and 388 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use tonic::codec::CompressionEncoding;
use tonic::transport::Channel;
pub mod hello_world {
@@ -13,7 +14,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await
.unwrap();
let mut client = GreeterClient::new(channel).send_gzip().accept_gzip();
let mut client = GreeterClient::new(channel)
.send_compressed(CompressionEncoding::Gzip)
.accept_compressed(CompressionEncoding::Gzip);
let request = tonic::Request::new(HelloRequest {
name: "Tonic".into(),
+4 -1
View File
@@ -2,6 +2,7 @@ use tonic::{transport::Server, Request, Response, Status};
use hello_world::greeter_server::{Greeter, GreeterServer};
use hello_world::{HelloReply, HelloRequest};
use tonic::codec::CompressionEncoding;
pub mod hello_world {
tonic::include_proto!("helloworld");
@@ -32,7 +33,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("GreeterServer listening on {}", addr);
let service = GreeterServer::new(greeter).send_gzip().accept_gzip();
let service = GreeterServer::new(greeter)
.send_compressed(CompressionEncoding::Gzip)
.accept_compressed(CompressionEncoding::Gzip);
Server::builder().add_service(service).serve(addr).await?;