feat!: remove codegen dependency on compression feature (#1004)
This commit is contained in:
+2
-2
@@ -200,7 +200,7 @@ futures = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||
prost = "0.10"
|
||||
tokio = { version = "1.0", features = [ "rt-multi-thread", "time", "fs", "macros", "net",] }
|
||||
tokio-stream = { version = "0.1", features = ["net"] }
|
||||
tonic = { path = "../tonic", features = ["tls", "compression"] }
|
||||
tonic = { path = "../tonic", features = ["tls", "gzip"] }
|
||||
tower = { version = "0.4" }
|
||||
# Required for routeguide
|
||||
rand = "0.8"
|
||||
@@ -237,4 +237,4 @@ tower-http = { version = "0.3", features = ["add-extension", "util"] }
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = { path = "../tonic-build", features = ["prost", "compression"] }
|
||||
tonic-build = { path = "../tonic-build", features = ["prost"] }
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user