From 35c4946d35c99b8c9f1d16def1a261b4e7cd65f6 Mon Sep 17 00:00:00 2001 From: tottoto Date: Wed, 14 Dec 2022 03:06:20 +0900 Subject: [PATCH] chore: Use namespaced dependency feature (#1187) --- tonic/Cargo.toml | 32 +++++++++++++++----------------- tonic/src/codec/prost.rs | 4 ++-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/tonic/Cargo.toml b/tonic/Cargo.toml index a5d090f..a88ad10 100644 --- a/tonic/Cargo.toml +++ b/tonic/Cargo.toml @@ -23,27 +23,25 @@ repository = "https://github.com/hyperium/tonic" version = "0.8.3" [features] -codegen = ["async-trait"] -gzip = ["flate2"] +codegen = ["dep:async-trait"] +gzip = ["dep:flate2"] default = ["transport", "codegen", "prost"] -prost = ["prost1", "prost-derive"] -tls = ["rustls-pemfile", "transport", "tokio-rustls"] -tls-roots = ["tls-roots-common", "rustls-native-certs"] +prost = ["dep:prost", "dep:prost-derive"] +tls = ["dep:rustls-pemfile", "transport", "dep:tokio-rustls"] +tls-roots = ["tls-roots-common", "dep:rustls-native-certs"] tls-roots-common = ["tls"] -tls-webpki-roots = ["tls-roots-common", "webpki-roots"] +tls-webpki-roots = ["tls-roots-common", "dep:webpki-roots"] transport = [ - "axum", + "dep:axum", "channel" ] channel = [ - "h2", - "hyper", - "tokio", - "tower", - "tracing-futures", - "tokio/macros", - "tokio/time", - "hyper-timeout", + "dep:h2", + "dep:hyper", + "dep:tokio", + "dep:tower", + "dep:tracing-futures", + "dep:hyper-timeout", ] # [[bench]] @@ -68,7 +66,7 @@ tower-service = "0.3" # prost prost-derive = {version = "0.11", optional = true} -prost1 = {package = "prost", version = "0.11", optional = true} +prost = {version = "0.11", optional = true} # codegen 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} hyper = {version = "0.14.14", features = ["full"], 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" 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} diff --git a/tonic/src/codec/prost.rs b/tonic/src/codec/prost.rs index 2facddc..6c28997 100644 --- a/tonic/src/codec/prost.rs +++ b/tonic/src/codec/prost.rs @@ -1,7 +1,7 @@ use super::{Codec, DecodeBuf, Decoder, Encoder}; use crate::codec::EncodeBuf; use crate::{Code, Status}; -use prost1::Message; +use prost::Message; use std::marker::PhantomData; /// A [`Codec`] that implements `application/grpc+proto` via the prost library.. @@ -69,7 +69,7 @@ impl Decoder for ProstDecoder { } } -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 // https://github.com/grpc/grpc/blob/master/doc/statuscodes.md Status::new(Code::Internal, error.to_string())