chore: Use namespaced dependency feature (#1187)

This commit is contained in:
tottoto
2022-12-13 13:06:20 -05:00
committed by GitHub
parent 363c04a2e8
commit 35c4946d35
2 changed files with 17 additions and 19 deletions
+15 -17
View File
@@ -23,27 +23,25 @@ repository = "https://github.com/hyperium/tonic"
version = "0.8.3" version = "0.8.3"
[features] [features]
codegen = ["async-trait"] codegen = ["dep:async-trait"]
gzip = ["flate2"] gzip = ["dep:flate2"]
default = ["transport", "codegen", "prost"] default = ["transport", "codegen", "prost"]
prost = ["prost1", "prost-derive"] prost = ["dep:prost", "dep:prost-derive"]
tls = ["rustls-pemfile", "transport", "tokio-rustls"] tls = ["dep:rustls-pemfile", "transport", "dep:tokio-rustls"]
tls-roots = ["tls-roots-common", "rustls-native-certs"] tls-roots = ["tls-roots-common", "dep:rustls-native-certs"]
tls-roots-common = ["tls"] tls-roots-common = ["tls"]
tls-webpki-roots = ["tls-roots-common", "webpki-roots"] tls-webpki-roots = ["tls-roots-common", "dep:webpki-roots"]
transport = [ transport = [
"axum", "dep:axum",
"channel" "channel"
] ]
channel = [ channel = [
"h2", "dep:h2",
"hyper", "dep:hyper",
"tokio", "dep:tokio",
"tower", "dep:tower",
"tracing-futures", "dep:tracing-futures",
"tokio/macros", "dep:hyper-timeout",
"tokio/time",
"hyper-timeout",
] ]
# [[bench]] # [[bench]]
@@ -68,7 +66,7 @@ tower-service = "0.3"
# prost # prost
prost-derive = {version = "0.11", optional = true} prost-derive = {version = "0.11", optional = true}
prost1 = {package = "prost", version = "0.11", optional = true} prost = {version = "0.11", optional = true}
# codegen # codegen
async-trait = {version = "0.1.13", optional = true} async-trait = {version = "0.1.13", optional = true}
@@ -77,7 +75,7 @@ async-trait = {version = "0.1.13", optional = true}
h2 = {version = "0.3", optional = true} h2 = {version = "0.3", optional = true}
hyper = {version = "0.14.14", features = ["full"], optional = true} hyper = {version = "0.14.14", features = ["full"], optional = true}
hyper-timeout = {version = "0.4", optional = true} hyper-timeout = {version = "0.4", optional = true}
tokio = {version = "1.0.1", features = ["net"], optional = true} tokio = {version = "1.0.1", features = ["net", "time", "macros"], optional = true}
tokio-stream = "0.1" tokio-stream = "0.1"
tower = {version = "0.4.7", default-features = false, features = ["balance", "buffer", "discover", "limit", "load", "make", "timeout", "util"], optional = true} tower = {version = "0.4.7", default-features = false, features = ["balance", "buffer", "discover", "limit", "load", "make", "timeout", "util"], optional = true}
tracing-futures = {version = "0.2", optional = true} tracing-futures = {version = "0.2", optional = true}
+2 -2
View File
@@ -1,7 +1,7 @@
use super::{Codec, DecodeBuf, Decoder, Encoder}; use super::{Codec, DecodeBuf, Decoder, Encoder};
use crate::codec::EncodeBuf; use crate::codec::EncodeBuf;
use crate::{Code, Status}; use crate::{Code, Status};
use prost1::Message; use prost::Message;
use std::marker::PhantomData; use std::marker::PhantomData;
/// A [`Codec`] that implements `application/grpc+proto` via the prost library.. /// A [`Codec`] that implements `application/grpc+proto` via the prost library..
@@ -69,7 +69,7 @@ impl<U: Message + Default> Decoder for ProstDecoder<U> {
} }
} }
fn from_decode_error(error: prost1::DecodeError) -> crate::Status { fn from_decode_error(error: prost::DecodeError) -> crate::Status {
// Map Protobuf parse errors to an INTERNAL status code, as per // Map Protobuf parse errors to an INTERNAL status code, as per
// https://github.com/grpc/grpc/blob/master/doc/statuscodes.md // https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
Status::new(Code::Internal, error.to_string()) Status::new(Code::Internal, error.to_string())