From 239fbad6a087ba48913a2d58fa7e935cdfb2416e Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Wed, 25 Oct 2023 11:22:56 +0800 Subject: [PATCH 1/4] chore(deps): bump prost to 0.12 Signed-off-by: Ruihang Xia --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2334a424..307267ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ futures-executor = "0.3" futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] } protobuf = { version = "2.0", optional = true } protobufv3 = { package = "protobuf", version = "3.2", optional = true } -prost = { version = "0.11", optional = true } +prost = { version = "0.12", optional = true } bytes = { version = "1.0", optional = true } log = "0.4" parking_lot = "0.12" From 0d1039091323e97826a2a18f365f4bc3ef67903d Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 7 Nov 2023 16:13:56 +0800 Subject: [PATCH 2/4] run cargo xtask codegen Signed-off-by: Ruihang Xia --- health/src/proto/protobuf_v3/health.rs | 18 +++-- .../proto/protobuf_v3/example/helloworld.rs | 8 +-- .../proto/protobuf_v3/example/route_guide.rs | 14 ++-- .../proto/protobuf_v3/google/rpc/status.rs | 6 +- .../src/proto/protobuf_v3/testing/control.rs | 72 +++++++++++++------ proto/src/proto/protobuf_v3/testing/empty.rs | 6 +- .../src/proto/protobuf_v3/testing/messages.rs | 35 +++++---- .../src/proto/protobuf_v3/testing/payloads.rs | 12 ++-- .../src/proto/protobuf_v3/testing/services.rs | 4 +- proto/src/proto/protobuf_v3/testing/stats.rs | 14 ++-- proto/src/proto/protobuf_v3/testing/test.rs | 4 +- 11 files changed, 120 insertions(+), 73 deletions(-) diff --git a/health/src/proto/protobuf_v3/health.rs b/health/src/proto/protobuf_v3/health.rs index 73036bf1..1c5dc190 100644 --- a/health/src/proto/protobuf_v3/health.rs +++ b/health/src/proto/protobuf_v3/health.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.health.v1.HealthCheckRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HealthCheckRequest { // message fields // @@protoc_insertion_point(field:grpc.health.v1.HealthCheckRequest.service) @@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for HealthCheckRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.health.v1.HealthCheckResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HealthCheckResponse { // message fields // @@protoc_insertion_point(field:grpc.health.v1.HealthCheckResponse.status) @@ -300,6 +300,16 @@ pub mod health_check_response { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "Unknown" => ::std::option::Option::Some(ServingStatus::Unknown), + "Serving" => ::std::option::Option::Some(ServingStatus::Serving), + "NotServing" => ::std::option::Option::Some(ServingStatus::NotServing), + "ServiceUnknown" => ::std::option::Option::Some(ServingStatus::ServiceUnknown), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ServingStatus] = &[ ServingStatus::Unknown, ServingStatus::Serving, diff --git a/proto/src/proto/protobuf_v3/example/helloworld.rs b/proto/src/proto/protobuf_v3/example/helloworld.rs index f5fd1867..d0e732ba 100644 --- a/proto/src/proto/protobuf_v3/example/helloworld.rs +++ b/proto/src/proto/protobuf_v3/example/helloworld.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:helloworld.HelloRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HelloRequest { // message fields // @@protoc_insertion_point(field:helloworld.HelloRequest.name) @@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for HelloRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:helloworld.HelloReply) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HelloReply { // message fields // @@protoc_insertion_point(field:helloworld.HelloReply.message) diff --git a/proto/src/proto/protobuf_v3/example/route_guide.rs b/proto/src/proto/protobuf_v3/example/route_guide.rs index 1c9bea18..e5c905b7 100644 --- a/proto/src/proto/protobuf_v3/example/route_guide.rs +++ b/proto/src/proto/protobuf_v3/example/route_guide.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:routeguide.Point) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Point { // message fields // @@protoc_insertion_point(field:routeguide.Point.latitude) @@ -164,8 +164,8 @@ impl ::protobufv3::reflect::ProtobufValue for Point { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:routeguide.Rectangle) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Rectangle { // message fields // @@protoc_insertion_point(field:routeguide.Rectangle.lo) @@ -306,8 +306,8 @@ impl ::protobufv3::reflect::ProtobufValue for Rectangle { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:routeguide.Feature) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Feature { // message fields // @@protoc_insertion_point(field:routeguide.Feature.name) @@ -447,8 +447,8 @@ impl ::protobufv3::reflect::ProtobufValue for Feature { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:routeguide.RouteNote) +#[derive(PartialEq,Clone,Default,Debug)] pub struct RouteNote { // message fields // @@protoc_insertion_point(field:routeguide.RouteNote.location) @@ -588,8 +588,8 @@ impl ::protobufv3::reflect::ProtobufValue for RouteNote { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:routeguide.RouteSummary) +#[derive(PartialEq,Clone,Default,Debug)] pub struct RouteSummary { // message fields // @@protoc_insertion_point(field:routeguide.RouteSummary.point_count) diff --git a/proto/src/proto/protobuf_v3/google/rpc/status.rs b/proto/src/proto/protobuf_v3/google/rpc/status.rs index e452321f..36c4f54a 100644 --- a/proto/src/proto/protobuf_v3/google/rpc/status.rs +++ b/proto/src/proto/protobuf_v3/google/rpc/status.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:google.rpc.Status) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Status { // message fields // @@protoc_insertion_point(field:google.rpc.Status.code) diff --git a/proto/src/proto/protobuf_v3/testing/control.rs b/proto/src/proto/protobuf_v3/testing/control.rs index 27225d4c..fdcb4505 100644 --- a/proto/src/proto/protobuf_v3/testing/control.rs +++ b/proto/src/proto/protobuf_v3/testing/control.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.PoissonParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct PoissonParams { // message fields // @@protoc_insertion_point(field:grpc.testing.PoissonParams.offered_load) @@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for PoissonParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ClosedLoopParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ClosedLoopParams { // special fields // @@protoc_insertion_point(special_field:grpc.testing.ClosedLoopParams.special_fields) @@ -249,8 +249,8 @@ impl ::protobufv3::reflect::ProtobufValue for ClosedLoopParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.LoadParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct LoadParams { // message oneof groups pub load: ::std::option::Option, @@ -528,8 +528,8 @@ pub mod load_params { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.SecurityParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SecurityParams { // message fields // @@protoc_insertion_point(field:grpc.testing.SecurityParams.use_test_ca) @@ -686,8 +686,8 @@ impl ::protobufv3::reflect::ProtobufValue for SecurityParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ChannelArg) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ChannelArg { // message fields // @@protoc_insertion_point(field:grpc.testing.ChannelArg.name) @@ -956,8 +956,8 @@ pub mod channel_arg { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ClientConfig) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ClientConfig { // message fields // @@protoc_insertion_point(field:grpc.testing.ClientConfig.server_targets) @@ -1356,8 +1356,8 @@ impl ::protobufv3::reflect::ProtobufValue for ClientConfig { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ClientStatus) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ClientStatus { // message fields // @@protoc_insertion_point(field:grpc.testing.ClientStatus.stats) @@ -1479,8 +1479,8 @@ impl ::protobufv3::reflect::ProtobufValue for ClientStatus { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Mark) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Mark { // message fields // @@protoc_insertion_point(field:grpc.testing.Mark.reset) @@ -1601,8 +1601,8 @@ impl ::protobufv3::reflect::ProtobufValue for Mark { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ClientArgs) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ClientArgs { // message oneof groups pub argtype: ::std::option::Option, @@ -1880,8 +1880,8 @@ pub mod client_args { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ServerConfig) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ServerConfig { // message fields // @@protoc_insertion_point(field:grpc.testing.ServerConfig.server_type) @@ -2188,8 +2188,8 @@ impl ::protobufv3::reflect::ProtobufValue for ServerConfig { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ServerArgs) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ServerArgs { // message oneof groups pub argtype: ::std::option::Option, @@ -2467,8 +2467,8 @@ pub mod server_args { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ServerStatus) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ServerStatus { // message fields // @@protoc_insertion_point(field:grpc.testing.ServerStatus.stats) @@ -2626,8 +2626,8 @@ impl ::protobufv3::reflect::ProtobufValue for ServerStatus { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.CoreRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CoreRequest { // special fields // @@protoc_insertion_point(special_field:grpc.testing.CoreRequest.special_fields) @@ -2729,8 +2729,8 @@ impl ::protobufv3::reflect::ProtobufValue for CoreRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.CoreResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct CoreResponse { // message fields // @@protoc_insertion_point(field:grpc.testing.CoreResponse.cores) @@ -2851,8 +2851,8 @@ impl ::protobufv3::reflect::ProtobufValue for CoreResponse { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Void) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Void { // special fields // @@protoc_insertion_point(special_field:grpc.testing.Void.special_fields) @@ -2954,8 +2954,8 @@ impl ::protobufv3::reflect::ProtobufValue for Void { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Scenario) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Scenario { // message fields // @@protoc_insertion_point(field:grpc.testing.Scenario.name) @@ -3204,8 +3204,8 @@ impl ::protobufv3::reflect::ProtobufValue for Scenario { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Scenarios) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Scenarios { // message fields // @@protoc_insertion_point(field:grpc.testing.Scenarios.scenarios) @@ -3327,8 +3327,8 @@ impl ::protobufv3::reflect::ProtobufValue for Scenarios { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ScenarioResultSummary) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ScenarioResultSummary { // message fields // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.qps) @@ -3755,8 +3755,8 @@ impl ::protobufv3::reflect::ProtobufValue for ScenarioResultSummary { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ScenarioResult) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ScenarioResult { // message fields // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.scenario) @@ -4059,6 +4059,15 @@ impl ::protobufv3::Enum for ClientType { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SYNC_CLIENT" => ::std::option::Option::Some(ClientType::SYNC_CLIENT), + "ASYNC_CLIENT" => ::std::option::Option::Some(ClientType::ASYNC_CLIENT), + "OTHER_CLIENT" => ::std::option::Option::Some(ClientType::OTHER_CLIENT), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ClientType] = &[ ClientType::SYNC_CLIENT, ClientType::ASYNC_CLIENT, @@ -4120,6 +4129,16 @@ impl ::protobufv3::Enum for ServerType { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SYNC_SERVER" => ::std::option::Option::Some(ServerType::SYNC_SERVER), + "ASYNC_SERVER" => ::std::option::Option::Some(ServerType::ASYNC_SERVER), + "ASYNC_GENERIC_SERVER" => ::std::option::Option::Some(ServerType::ASYNC_GENERIC_SERVER), + "OTHER_SERVER" => ::std::option::Option::Some(ServerType::OTHER_SERVER), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ServerType] = &[ ServerType::SYNC_SERVER, ServerType::ASYNC_SERVER, @@ -4185,6 +4204,17 @@ impl ::protobufv3::Enum for RpcType { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "UNARY" => ::std::option::Option::Some(RpcType::UNARY), + "STREAMING" => ::std::option::Option::Some(RpcType::STREAMING), + "STREAMING_FROM_CLIENT" => ::std::option::Option::Some(RpcType::STREAMING_FROM_CLIENT), + "STREAMING_FROM_SERVER" => ::std::option::Option::Some(RpcType::STREAMING_FROM_SERVER), + "STREAMING_BOTH_WAYS" => ::std::option::Option::Some(RpcType::STREAMING_BOTH_WAYS), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [RpcType] = &[ RpcType::UNARY, RpcType::STREAMING, diff --git a/proto/src/proto/protobuf_v3/testing/empty.rs b/proto/src/proto/protobuf_v3/testing/empty.rs index c3c7dac9..d5259de3 100644 --- a/proto/src/proto/protobuf_v3/testing/empty.rs +++ b/proto/src/proto/protobuf_v3/testing/empty.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Empty) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Empty { // special fields // @@protoc_insertion_point(special_field:grpc.testing.Empty.special_fields) diff --git a/proto/src/proto/protobuf_v3/testing/messages.rs b/proto/src/proto/protobuf_v3/testing/messages.rs index b08e89a4..96ca2844 100644 --- a/proto/src/proto/protobuf_v3/testing/messages.rs +++ b/proto/src/proto/protobuf_v3/testing/messages.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.BoolValue) +#[derive(PartialEq,Clone,Default,Debug)] pub struct BoolValue { // message fields // @@protoc_insertion_point(field:grpc.testing.BoolValue.value) @@ -146,8 +146,8 @@ impl ::protobufv3::reflect::ProtobufValue for BoolValue { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.Payload) +#[derive(PartialEq,Clone,Default,Debug)] pub struct Payload { // message fields // @@protoc_insertion_point(field:grpc.testing.Payload.type) @@ -286,8 +286,8 @@ impl ::protobufv3::reflect::ProtobufValue for Payload { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.EchoStatus) +#[derive(PartialEq,Clone,Default,Debug)] pub struct EchoStatus { // message fields // @@protoc_insertion_point(field:grpc.testing.EchoStatus.code) @@ -426,8 +426,8 @@ impl ::protobufv3::reflect::ProtobufValue for EchoStatus { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.SimpleRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SimpleRequest { // message fields // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.response_type) @@ -678,8 +678,8 @@ impl ::protobufv3::reflect::ProtobufValue for SimpleRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.SimpleResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SimpleResponse { // message fields // @@protoc_insertion_point(field:grpc.testing.SimpleResponse.payload) @@ -837,8 +837,8 @@ impl ::protobufv3::reflect::ProtobufValue for SimpleResponse { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.StreamingInputCallRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct StreamingInputCallRequest { // message fields // @@protoc_insertion_point(field:grpc.testing.StreamingInputCallRequest.payload) @@ -979,8 +979,8 @@ impl ::protobufv3::reflect::ProtobufValue for StreamingInputCallRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.StreamingInputCallResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct StreamingInputCallResponse { // message fields // @@protoc_insertion_point(field:grpc.testing.StreamingInputCallResponse.aggregated_payload_size) @@ -1101,8 +1101,8 @@ impl ::protobufv3::reflect::ProtobufValue for StreamingInputCallResponse { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ResponseParameters) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ResponseParameters { // message fields // @@protoc_insertion_point(field:grpc.testing.ResponseParameters.size) @@ -1260,8 +1260,8 @@ impl ::protobufv3::reflect::ProtobufValue for ResponseParameters { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.StreamingOutputCallRequest) +#[derive(PartialEq,Clone,Default,Debug)] pub struct StreamingOutputCallRequest { // message fields // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallRequest.response_type) @@ -1439,8 +1439,8 @@ impl ::protobufv3::reflect::ProtobufValue for StreamingOutputCallRequest { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.StreamingOutputCallResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct StreamingOutputCallResponse { // message fields // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallResponse.payload) @@ -1562,8 +1562,8 @@ impl ::protobufv3::reflect::ProtobufValue for StreamingOutputCallResponse { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ReconnectParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ReconnectParams { // message fields // @@protoc_insertion_point(field:grpc.testing.ReconnectParams.max_reconnect_backoff_ms) @@ -1684,8 +1684,8 @@ impl ::protobufv3::reflect::ProtobufValue for ReconnectParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ReconnectInfo) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ReconnectInfo { // message fields // @@protoc_insertion_point(field:grpc.testing.ReconnectInfo.passed) @@ -1848,6 +1848,13 @@ impl ::protobufv3::Enum for PayloadType { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "COMPRESSABLE" => ::std::option::Option::Some(PayloadType::COMPRESSABLE), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [PayloadType] = &[ PayloadType::COMPRESSABLE, ]; diff --git a/proto/src/proto/protobuf_v3/testing/payloads.rs b/proto/src/proto/protobuf_v3/testing/payloads.rs index cefff4fe..c2758466 100644 --- a/proto/src/proto/protobuf_v3/testing/payloads.rs +++ b/proto/src/proto/protobuf_v3/testing/payloads.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ByteBufferParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ByteBufferParams { // message fields // @@protoc_insertion_point(field:grpc.testing.ByteBufferParams.req_size) @@ -164,8 +164,8 @@ impl ::protobufv3::reflect::ProtobufValue for ByteBufferParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.SimpleProtoParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct SimpleProtoParams { // message fields // @@protoc_insertion_point(field:grpc.testing.SimpleProtoParams.req_size) @@ -304,8 +304,8 @@ impl ::protobufv3::reflect::ProtobufValue for SimpleProtoParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ComplexProtoParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ComplexProtoParams { // special fields // @@protoc_insertion_point(special_field:grpc.testing.ComplexProtoParams.special_fields) @@ -407,8 +407,8 @@ impl ::protobufv3::reflect::ProtobufValue for ComplexProtoParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.PayloadConfig) +#[derive(PartialEq,Clone,Default,Debug)] pub struct PayloadConfig { // message oneof groups pub payload: ::std::option::Option, diff --git a/proto/src/proto/protobuf_v3/testing/services.rs b/proto/src/proto/protobuf_v3/testing/services.rs index 538c3c65..0a03648a 100644 --- a/proto/src/proto/protobuf_v3/testing/services.rs +++ b/proto/src/proto/protobuf_v3/testing/services.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; static file_descriptor_proto_data: &'static [u8] = b"\ \n\x1bgrpc/testing/services.proto\x12\x0cgrpc.testing\x1a\x1bgrpc/testin\ diff --git a/proto/src/proto/protobuf_v3/testing/stats.rs b/proto/src/proto/protobuf_v3/testing/stats.rs index b85df900..91dda9d5 100644 --- a/proto/src/proto/protobuf_v3/testing/stats.rs +++ b/proto/src/proto/protobuf_v3/testing/stats.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,10 +22,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ServerStats) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ServerStats { // message fields // @@protoc_insertion_point(field:grpc.testing.ServerStats.time_elapsed) @@ -236,8 +236,8 @@ impl ::protobufv3::reflect::ProtobufValue for ServerStats { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.HistogramParams) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HistogramParams { // message fields // @@protoc_insertion_point(field:grpc.testing.HistogramParams.resolution) @@ -376,8 +376,8 @@ impl ::protobufv3::reflect::ProtobufValue for HistogramParams { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.HistogramData) +#[derive(PartialEq,Clone,Default,Debug)] pub struct HistogramData { // message fields // @@protoc_insertion_point(field:grpc.testing.HistogramData.bucket) @@ -591,8 +591,8 @@ impl ::protobufv3::reflect::ProtobufValue for HistogramData { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.RequestResultCount) +#[derive(PartialEq,Clone,Default,Debug)] pub struct RequestResultCount { // message fields // @@protoc_insertion_point(field:grpc.testing.RequestResultCount.status_code) @@ -731,8 +731,8 @@ impl ::protobufv3::reflect::ProtobufValue for RequestResultCount { type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:grpc.testing.ClientStats) +#[derive(PartialEq,Clone,Default,Debug)] pub struct ClientStats { // message fields // @@protoc_insertion_point(field:grpc.testing.ClientStats.latencies) diff --git a/proto/src/proto/protobuf_v3/testing/test.rs b/proto/src/proto/protobuf_v3/testing/test.rs index 18c7d39a..b4a9dbbd 100644 --- a/proto/src/proto/protobuf_v3/testing/test.rs +++ b/proto/src/proto/protobuf_v3/testing/test.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit +// This file is generated by rust-protobuf 3.3.0. Do not edit // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -22,7 +22,7 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_3_0; static file_descriptor_proto_data: &'static [u8] = b"\ \n\x17grpc/testing/test.proto\x12\x0cgrpc.testing\x1a\x18grpc/testing/em\ From e900158c4df5c028e2a1a9c50bc8bb2194ee06f8 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 7 Nov 2023 23:12:16 +0800 Subject: [PATCH 3/4] fix clippy lints Signed-off-by: Ruihang Xia --- interop/src/client.rs | 2 +- src/buf.rs | 2 +- src/channel.rs | 1 + src/server.rs | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/interop/src/client.rs b/interop/src/client.rs index 68ae4abd..d462c807 100644 --- a/interop/src/client.rs +++ b/interop/src/client.rs @@ -80,7 +80,7 @@ impl Client { pub async fn server_streaming(&self) -> grpcio::Result<()> { print!("testing server streaming ... "); - let sizes = vec![31415, 9, 2653, 58979]; + let sizes = [31415, 9, 2653, 58979]; let req = StreamingOutputCallRequest { response_parameters: sizes .iter() diff --git a/src/buf.rs b/src/buf.rs index 7b5f4d31..9f247b3f 100644 --- a/src/buf.rs +++ b/src/buf.rs @@ -262,7 +262,7 @@ impl<'a> From<&'a GrpcSlice> for GrpcByteBuffer { /// Create a buffer from the given single slice. /// /// A buffer, which length is 1, is allocated for the slice. - #[allow(clippy::cast_ref_to_mut)] + #[allow(invalid_reference_casting)] fn from(s: &'a GrpcSlice) -> GrpcByteBuffer { unsafe { // hack: buffer_create accepts an mutable pointer to indicate it mutate diff --git a/src/channel.rs b/src/channel.rs index 057b614f..298334ee 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -635,6 +635,7 @@ impl Channel { /// The given grpc_channel must correspond to an instantiated grpc core /// channel. Takes exclusive ownership of the channel and will close it after /// use. + #[allow(clippy::arc_with_non_send_sync)] pub unsafe fn new( cq: CompletionQueue, env: Arc, diff --git a/src/server.rs b/src/server.rs index 042217e5..6915ed1a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -407,6 +407,7 @@ impl Server { } /// Start the server. + #[allow(clippy::arc_with_non_send_sync)] pub fn start(&mut self) { unsafe { grpc_sys::grpc_server_start(self.core.server); From be642b83d04b46738c0453ef7b6d8eba35809e18 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 7 Nov 2023 23:19:45 +0800 Subject: [PATCH 4/4] fix compile errors Signed-off-by: Ruihang Xia --- grpc-sys/src/lib.rs | 1 + proto/Cargo.toml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/grpc-sys/src/lib.rs b/grpc-sys/src/lib.rs index dc0699c0..c39fcbf7 100644 --- a/grpc-sys/src/lib.rs +++ b/grpc-sys/src/lib.rs @@ -10,4 +10,5 @@ mod bindings { mod grpc_wrap; pub use bindings::*; +#[allow(unused_imports)] pub use grpc_wrap::*; diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 8cd72d38..57655323 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -20,13 +20,13 @@ prost-codec = ["prost-build", "prost-derive", "prost-types", "bytes", "lazy_stat [dependencies] grpcio = { path = "..", features = ["boringssl"], version = "0.13.0", default-features = false } bytes = { version = "1.0", optional = true } -prost = { version = "0.11", optional = true } -prost-derive = { version = "0.11", optional = true } -prost-types = { version = "0.11", optional = true } +prost = { version = "0.12", optional = true } +prost-derive = { version = "0.12", optional = true } +prost-types = { version = "0.12", optional = true } protobuf = { version = "2", optional = true } protobufv3 = { package = "protobuf", version = "3.2", optional = true } lazy_static = { version = "1.3", optional = true } [build-dependencies] -prost-build = { version = "0.11", optional = true } +prost-build = { version = "0.12", optional = true } walkdir = "2.2"