Skip to content

Commit 31517d4

Browse files
authoredSep 24, 2024
Pin the dependencies of the Rust code gen tools (p4lang#502)
In the previous commit, only the version of `protoc-gen-prost/tonic` was pinned. However, Cargo would still ignore the lock file and use the latest version of dependencies for `protoc-gen-prost/tonic`. This meant that any new release of dependencies (such as `prost-build`) could result in differences in the generated code. This commit addresses the issue by adding `--locked` to the `cargo install` command, ensuring Cargo respects the lock file when installing code generation tools. The Rust code has been regenerated using this updated configuration. Signed-off-by: Campbell He <[email protected]>
1 parent f304ae3 commit 31517d4

File tree

5 files changed

+206
-56
lines changed

5 files changed

+206
-56
lines changed
 

‎codegen/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3
2828

2929
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81.0 --profile minimal; \
3030
. $HOME/.cargo/env; \
31-
cargo install protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1
31+
cargo install --locked protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1
3232

3333
ENV PATH="${PATH}:/root/.cargo/bin"
3434

‎rust/src/google.rpc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
///
88
/// You can find out more about this error model and how to work with it in the
99
/// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
10+
#[allow(clippy::derive_partial_eq_without_eq)]
1011
#[derive(Clone, PartialEq, ::prost::Message)]
1112
pub struct Status {
1213
/// The status code, which should be an enum value of

‎rust/src/p4.config.v1.rs

+88-19
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
/// message and refer to the types by name in the P4DataTypeSpec message. We also
3535
/// support annotations for these type specs which can be useful, e.g. to
3636
/// identify well-known headers (such as ipv4).
37+
#[allow(clippy::derive_partial_eq_without_eq)]
3738
#[derive(Clone, PartialEq, ::prost::Message)]
3839
pub struct P4TypeInfo {
3940
#[prost(map="string, message", tag="1")]
@@ -52,14 +53,16 @@ pub struct P4TypeInfo {
5253
pub new_types: ::std::collections::HashMap<::prost::alloc::string::String, P4NewTypeSpec>,
5354
}
5455
/// Describes a P4_16 type.
56+
#[allow(clippy::derive_partial_eq_without_eq)]
5557
#[derive(Clone, PartialEq, ::prost::Message)]
5658
pub struct P4DataTypeSpec {
5759
#[prost(oneof="p4_data_type_spec::TypeSpec", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")]
5860
pub type_spec: ::core::option::Option<p4_data_type_spec::TypeSpec>,
5961
}
6062
/// Nested message and enum types in `P4DataTypeSpec`.
6163
pub mod p4_data_type_spec {
62-
#[derive(Clone, PartialEq, ::prost::Oneof)]
64+
#[allow(clippy::derive_partial_eq_without_eq)]
65+
#[derive(Clone, PartialEq, ::prost::Oneof)]
6366
pub enum TypeSpec {
6467
#[prost(message, tag="1")]
6568
Bitstring(super::P4BitstringLikeTypeSpec),
@@ -87,19 +90,23 @@ pub mod p4_data_type_spec {
8790
NewType(super::P4NamedType),
8891
}
8992
}
93+
#[allow(clippy::derive_partial_eq_without_eq)]
9094
#[derive(Clone, PartialEq, ::prost::Message)]
9195
pub struct P4NamedType {
9296
#[prost(string, tag="1")]
9397
pub name: ::prost::alloc::string::String,
9498
}
9599
/// Empty message as no type information needed, just used as a placeholder in
96100
/// the oneof to identify boolean types.
101+
#[allow(clippy::derive_partial_eq_without_eq)]
97102
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
98103
pub struct P4BoolType {
99104
}
105+
#[allow(clippy::derive_partial_eq_without_eq)]
100106
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
101107
pub struct P4ErrorType {
102108
}
109+
#[allow(clippy::derive_partial_eq_without_eq)]
103110
#[derive(Clone, PartialEq, ::prost::Message)]
104111
pub struct P4BitstringLikeTypeSpec {
105112
/// Useful to identify well-known types, such as IP address or Ethernet MAC
@@ -117,7 +124,8 @@ pub struct P4BitstringLikeTypeSpec {
117124
}
118125
/// Nested message and enum types in `P4BitstringLikeTypeSpec`.
119126
pub mod p4_bitstring_like_type_spec {
120-
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
127+
#[allow(clippy::derive_partial_eq_without_eq)]
128+
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
121129
pub enum TypeSpec {
122130
/// bit<W>
123131
#[prost(message, tag="1")]
@@ -130,28 +138,33 @@ pub mod p4_bitstring_like_type_spec {
130138
Varbit(super::P4VarbitTypeSpec),
131139
}
132140
}
141+
#[allow(clippy::derive_partial_eq_without_eq)]
133142
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
134143
pub struct P4BitTypeSpec {
135144
#[prost(int32, tag="1")]
136145
pub bitwidth: i32,
137146
}
147+
#[allow(clippy::derive_partial_eq_without_eq)]
138148
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
139149
pub struct P4IntTypeSpec {
140150
#[prost(int32, tag="1")]
141151
pub bitwidth: i32,
142152
}
153+
#[allow(clippy::derive_partial_eq_without_eq)]
143154
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
144155
pub struct P4VarbitTypeSpec {
145156
#[prost(int32, tag="1")]
146157
pub max_bitwidth: i32,
147158
}
148159
/// From the P4_16 spec: "A tuple is similar to a struct, in that it holds
149160
/// multiple values. Unlike a struct type, tuples have no named fields."
161+
#[allow(clippy::derive_partial_eq_without_eq)]
150162
#[derive(Clone, PartialEq, ::prost::Message)]
151163
pub struct P4TupleTypeSpec {
152164
#[prost(message, repeated, tag="1")]
153165
pub members: ::prost::alloc::vec::Vec<P4DataTypeSpec>,
154166
}
167+
#[allow(clippy::derive_partial_eq_without_eq)]
155168
#[derive(Clone, PartialEq, ::prost::Message)]
156169
pub struct P4StructTypeSpec {
157170
#[prost(message, repeated, tag="1")]
@@ -167,14 +180,16 @@ pub struct P4StructTypeSpec {
167180
}
168181
/// Nested message and enum types in `P4StructTypeSpec`.
169182
pub mod p4_struct_type_spec {
170-
#[derive(Clone, PartialEq, ::prost::Message)]
183+
#[allow(clippy::derive_partial_eq_without_eq)]
184+
#[derive(Clone, PartialEq, ::prost::Message)]
171185
pub struct Member {
172186
#[prost(string, tag="1")]
173187
pub name: ::prost::alloc::string::String,
174188
#[prost(message, optional, tag="2")]
175189
pub type_spec: ::core::option::Option<super::P4DataTypeSpec>,
176190
}
177191
}
192+
#[allow(clippy::derive_partial_eq_without_eq)]
178193
#[derive(Clone, PartialEq, ::prost::Message)]
179194
pub struct P4HeaderTypeSpec {
180195
#[prost(message, repeated, tag="1")]
@@ -190,14 +205,16 @@ pub struct P4HeaderTypeSpec {
190205
}
191206
/// Nested message and enum types in `P4HeaderTypeSpec`.
192207
pub mod p4_header_type_spec {
193-
#[derive(Clone, PartialEq, ::prost::Message)]
208+
#[allow(clippy::derive_partial_eq_without_eq)]
209+
#[derive(Clone, PartialEq, ::prost::Message)]
194210
pub struct Member {
195211
#[prost(string, tag="1")]
196212
pub name: ::prost::alloc::string::String,
197213
#[prost(message, optional, tag="2")]
198214
pub type_spec: ::core::option::Option<super::P4BitstringLikeTypeSpec>,
199215
}
200216
}
217+
#[allow(clippy::derive_partial_eq_without_eq)]
201218
#[derive(Clone, PartialEq, ::prost::Message)]
202219
pub struct P4HeaderUnionTypeSpec {
203220
#[prost(message, repeated, tag="1")]
@@ -213,48 +230,55 @@ pub struct P4HeaderUnionTypeSpec {
213230
}
214231
/// Nested message and enum types in `P4HeaderUnionTypeSpec`.
215232
pub mod p4_header_union_type_spec {
216-
#[derive(Clone, PartialEq, ::prost::Message)]
233+
#[allow(clippy::derive_partial_eq_without_eq)]
234+
#[derive(Clone, PartialEq, ::prost::Message)]
217235
pub struct Member {
218236
#[prost(string, tag="1")]
219237
pub name: ::prost::alloc::string::String,
220238
#[prost(message, optional, tag="2")]
221239
pub header: ::core::option::Option<super::P4NamedType>,
222240
}
223241
}
242+
#[allow(clippy::derive_partial_eq_without_eq)]
224243
#[derive(Clone, PartialEq, ::prost::Message)]
225244
pub struct P4HeaderStackTypeSpec {
226245
#[prost(message, optional, tag="1")]
227246
pub header: ::core::option::Option<P4NamedType>,
228247
#[prost(int32, tag="2")]
229248
pub size: i32,
230249
}
250+
#[allow(clippy::derive_partial_eq_without_eq)]
231251
#[derive(Clone, PartialEq, ::prost::Message)]
232252
pub struct P4HeaderUnionStackTypeSpec {
233253
#[prost(message, optional, tag="1")]
234254
pub header_union: ::core::option::Option<P4NamedType>,
235255
#[prost(int32, tag="2")]
236256
pub size: i32,
237257
}
258+
#[allow(clippy::derive_partial_eq_without_eq)]
238259
#[derive(Clone, PartialEq, ::prost::Message)]
239260
pub struct KeyValuePair {
240261
#[prost(string, tag="1")]
241262
pub key: ::prost::alloc::string::String,
242263
#[prost(message, optional, tag="2")]
243264
pub value: ::core::option::Option<Expression>,
244265
}
266+
#[allow(clippy::derive_partial_eq_without_eq)]
245267
#[derive(Clone, PartialEq, ::prost::Message)]
246268
pub struct KeyValuePairList {
247269
#[prost(message, repeated, tag="1")]
248270
pub kv_pairs: ::prost::alloc::vec::Vec<KeyValuePair>,
249271
}
272+
#[allow(clippy::derive_partial_eq_without_eq)]
250273
#[derive(Clone, PartialEq, ::prost::Message)]
251274
pub struct Expression {
252275
#[prost(oneof="expression::Value", tags="1, 2, 3")]
253276
pub value: ::core::option::Option<expression::Value>,
254277
}
255278
/// Nested message and enum types in `Expression`.
256279
pub mod expression {
257-
#[derive(Clone, PartialEq, ::prost::Oneof)]
280+
#[allow(clippy::derive_partial_eq_without_eq)]
281+
#[derive(Clone, PartialEq, ::prost::Oneof)]
258282
pub enum Value {
259283
#[prost(string, tag="1")]
260284
StringValue(::prost::alloc::string::String),
@@ -264,11 +288,13 @@ pub mod expression {
264288
BoolValue(bool),
265289
}
266290
}
291+
#[allow(clippy::derive_partial_eq_without_eq)]
267292
#[derive(Clone, PartialEq, ::prost::Message)]
268293
pub struct ExpressionList {
269294
#[prost(message, repeated, tag="1")]
270295
pub expressions: ::prost::alloc::vec::Vec<Expression>,
271296
}
297+
#[allow(clippy::derive_partial_eq_without_eq)]
272298
#[derive(Clone, PartialEq, ::prost::Message)]
273299
pub struct StructuredAnnotation {
274300
#[prost(string, tag="1")]
@@ -281,7 +307,8 @@ pub struct StructuredAnnotation {
281307
}
282308
/// Nested message and enum types in `StructuredAnnotation`.
283309
pub mod structured_annotation {
284-
#[derive(Clone, PartialEq, ::prost::Oneof)]
310+
#[allow(clippy::derive_partial_eq_without_eq)]
311+
#[derive(Clone, PartialEq, ::prost::Oneof)]
285312
pub enum Body {
286313
#[prost(message, tag="2")]
287314
ExpressionList(super::ExpressionList),
@@ -290,6 +317,7 @@ pub mod structured_annotation {
290317
}
291318
}
292319
/// Location of code relative to a given source file.
320+
#[allow(clippy::derive_partial_eq_without_eq)]
293321
#[derive(Clone, PartialEq, ::prost::Message)]
294322
pub struct SourceLocation {
295323
/// Path to the source file (absolute or relative to the working directory).
@@ -303,6 +331,7 @@ pub struct SourceLocation {
303331
}
304332
/// For "safe" enums with no underlying representation and no member integer
305333
/// values.
334+
#[allow(clippy::derive_partial_eq_without_eq)]
306335
#[derive(Clone, PartialEq, ::prost::Message)]
307336
pub struct P4EnumTypeSpec {
308337
#[prost(message, repeated, tag="1")]
@@ -318,7 +347,8 @@ pub struct P4EnumTypeSpec {
318347
}
319348
/// Nested message and enum types in `P4EnumTypeSpec`.
320349
pub mod p4_enum_type_spec {
321-
#[derive(Clone, PartialEq, ::prost::Message)]
350+
#[allow(clippy::derive_partial_eq_without_eq)]
351+
#[derive(Clone, PartialEq, ::prost::Message)]
322352
pub struct Member {
323353
#[prost(string, tag="1")]
324354
pub name: ::prost::alloc::string::String,
@@ -335,6 +365,7 @@ pub mod p4_enum_type_spec {
335365
/// For serializable (or "unsafe") enums, which have an underlying type. Note
336366
/// that as per the P4_16 specification, the underlying representation can only
337367
/// be a bit<W> type.
368+
#[allow(clippy::derive_partial_eq_without_eq)]
338369
#[derive(Clone, PartialEq, ::prost::Message)]
339370
pub struct P4SerializableEnumTypeSpec {
340371
#[prost(message, optional, tag="1")]
@@ -352,7 +383,8 @@ pub struct P4SerializableEnumTypeSpec {
352383
}
353384
/// Nested message and enum types in `P4SerializableEnumTypeSpec`.
354385
pub mod p4_serializable_enum_type_spec {
355-
#[derive(Clone, PartialEq, ::prost::Message)]
386+
#[allow(clippy::derive_partial_eq_without_eq)]
387+
#[derive(Clone, PartialEq, ::prost::Message)]
356388
pub struct Member {
357389
#[prost(string, tag="1")]
358390
pub name: ::prost::alloc::string::String,
@@ -370,11 +402,13 @@ pub mod p4_serializable_enum_type_spec {
370402
}
371403
/// Similar to an enum, but there is always one and only one instance per P4
372404
/// program.
405+
#[allow(clippy::derive_partial_eq_without_eq)]
373406
#[derive(Clone, PartialEq, ::prost::Message)]
374407
pub struct P4ErrorTypeSpec {
375408
#[prost(string, repeated, tag="1")]
376409
pub members: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
377410
}
411+
#[allow(clippy::derive_partial_eq_without_eq)]
378412
#[derive(Clone, PartialEq, ::prost::Message)]
379413
pub struct P4NewTypeTranslation {
380414
/// the URI uniquely identifies the translation in order to enable the
@@ -390,12 +424,14 @@ pub struct P4NewTypeTranslation {
390424
}
391425
/// Nested message and enum types in `P4NewTypeTranslation`.
392426
pub mod p4_new_type_translation {
393-
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
427+
#[allow(clippy::derive_partial_eq_without_eq)]
428+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
394429
pub struct SdnString {
395430
}
396431
/// The object is either represented as an unsigned integer with a bitwidth of
397432
/// `sdn_bitwidth`, or as a string.
398-
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
433+
#[allow(clippy::derive_partial_eq_without_eq)]
434+
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
399435
pub enum SdnType {
400436
#[prost(int32, tag="2")]
401437
SdnBitwidth(i32),
@@ -404,6 +440,7 @@ pub mod p4_new_type_translation {
404440
}
405441
}
406442
/// New types introduced with the "type" keyword
443+
#[allow(clippy::derive_partial_eq_without_eq)]
407444
#[derive(Clone, PartialEq, ::prost::Message)]
408445
pub struct P4NewTypeSpec {
409446
/// for other annotations (not @p4runtime_translation)
@@ -420,7 +457,8 @@ pub struct P4NewTypeSpec {
420457
}
421458
/// Nested message and enum types in `P4NewTypeSpec`.
422459
pub mod p4_new_type_spec {
423-
#[derive(Clone, PartialEq, ::prost::Oneof)]
460+
#[allow(clippy::derive_partial_eq_without_eq)]
461+
#[derive(Clone, PartialEq, ::prost::Oneof)]
424462
pub enum Representation {
425463
/// if no @p4runtime_translation annotation present
426464
#[prost(message, tag="1")]
@@ -430,6 +468,7 @@ pub mod p4_new_type_spec {
430468
TranslatedType(super::P4NewTypeTranslation),
431469
}
432470
}
471+
#[allow(clippy::derive_partial_eq_without_eq)]
433472
#[derive(Clone, PartialEq, ::prost::Message)]
434473
pub struct P4Info {
435474
#[prost(message, optional, tag="1")]
@@ -461,6 +500,7 @@ pub struct P4Info {
461500
#[prost(message, optional, tag="200")]
462501
pub type_info: ::core::option::Option<P4TypeInfo>,
463502
}
503+
#[allow(clippy::derive_partial_eq_without_eq)]
464504
#[derive(Clone, PartialEq, ::prost::Message)]
465505
pub struct Documentation {
466506
/// A brief description of something, e.g. one sentence
@@ -473,6 +513,7 @@ pub struct Documentation {
473513
}
474514
/// Used to describe the required properties of the underlying platform.
475515
/// Added in v1.4.0
516+
#[allow(clippy::derive_partial_eq_without_eq)]
476517
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
477518
pub struct PlatformProperties {
478519
/// The minimum number of multicast entries (i.e. multicast groups) that the
@@ -491,6 +532,7 @@ pub struct PlatformProperties {
491532
}
492533
/// Top-level package documentation describing the forwarding pipeline config
493534
/// Can be used to manage multiple P4 packages.
535+
#[allow(clippy::derive_partial_eq_without_eq)]
494536
#[derive(Clone, PartialEq, ::prost::Message)]
495537
pub struct PkgInfo {
496538
/// a definitive name for this configuration, e.g. switch.p4_v1.0
@@ -534,6 +576,7 @@ pub struct PkgInfo {
534576
}
535577
/// wrapping the enum in a message to avoid name collisions in C++, where "enum
536578
/// values are siblings of their type, not children of it"
579+
#[allow(clippy::derive_partial_eq_without_eq)]
537580
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
538581
pub struct P4Ids {
539582
}
@@ -619,6 +662,7 @@ pub mod p4_ids {
619662
}
620663
}
621664
}
665+
#[allow(clippy::derive_partial_eq_without_eq)]
622666
#[derive(Clone, PartialEq, ::prost::Message)]
623667
pub struct Preamble {
624668
/// ids share the same number-space; e.g. table ids cannot overlap with counter
@@ -657,6 +701,7 @@ pub struct Preamble {
657701
pub structured_annotations: ::prost::alloc::vec::Vec<StructuredAnnotation>,
658702
}
659703
/// used to group all extern instances of the same type in one message
704+
#[allow(clippy::derive_partial_eq_without_eq)]
660705
#[derive(Clone, PartialEq, ::prost::Message)]
661706
pub struct Extern {
662707
/// the extern_type_id is unique for a given architecture and must be in the
@@ -668,6 +713,7 @@ pub struct Extern {
668713
#[prost(message, repeated, tag="3")]
669714
pub instances: ::prost::alloc::vec::Vec<ExternInstance>,
670715
}
716+
#[allow(clippy::derive_partial_eq_without_eq)]
671717
#[derive(Clone, PartialEq, ::prost::Message)]
672718
pub struct ExternInstance {
673719
#[prost(message, optional, tag="1")]
@@ -677,6 +723,7 @@ pub struct ExternInstance {
677723
#[prost(message, optional, tag="2")]
678724
pub info: ::core::option::Option<::pbjson_types::Any>,
679725
}
726+
#[allow(clippy::derive_partial_eq_without_eq)]
680727
#[derive(Clone, PartialEq, ::prost::Message)]
681728
pub struct MatchField {
682729
#[prost(uint32, tag="1")]
@@ -742,7 +789,8 @@ pub mod match_field {
742789
}
743790
}
744791
}
745-
#[derive(Clone, PartialEq, ::prost::Oneof)]
792+
#[allow(clippy::derive_partial_eq_without_eq)]
793+
#[derive(Clone, PartialEq, ::prost::Oneof)]
746794
pub enum Match {
747795
#[prost(enumeration="MatchType", tag="5")]
748796
MatchType(i32),
@@ -757,6 +805,7 @@ pub mod match_field {
757805
/// Arguments are matched to the id of the respective action parameter.
758806
/// TableActionCalls may be used as the default action call of a table implementation.
759807
/// Added in 1.4.0.
808+
#[allow(clippy::derive_partial_eq_without_eq)]
760809
#[derive(Clone, PartialEq, ::prost::Message)]
761810
pub struct TableActionCall {
762811
#[prost(uint32, tag="1")]
@@ -766,14 +815,16 @@ pub struct TableActionCall {
766815
}
767816
/// Nested message and enum types in `TableActionCall`.
768817
pub mod table_action_call {
769-
#[derive(Clone, PartialEq, ::prost::Message)]
818+
#[allow(clippy::derive_partial_eq_without_eq)]
819+
#[derive(Clone, PartialEq, ::prost::Message)]
770820
pub struct Argument {
771821
#[prost(uint32, tag="2")]
772822
pub param_id: u32,
773823
#[prost(bytes="vec", tag="3")]
774824
pub value: ::prost::alloc::vec::Vec<u8>,
775825
}
776826
}
827+
#[allow(clippy::derive_partial_eq_without_eq)]
777828
#[derive(Clone, PartialEq, ::prost::Message)]
778829
pub struct Table {
779830
#[prost(message, optional, tag="1")]
@@ -861,6 +912,7 @@ pub mod table {
861912
}
862913
}
863914
/// used to list all possible actions in a Table
915+
#[allow(clippy::derive_partial_eq_without_eq)]
864916
#[derive(Clone, PartialEq, ::prost::Message)]
865917
pub struct ActionRef {
866918
#[prost(uint32, tag="1")]
@@ -908,6 +960,7 @@ pub mod action_ref {
908960
}
909961
}
910962
}
963+
#[allow(clippy::derive_partial_eq_without_eq)]
911964
#[derive(Clone, PartialEq, ::prost::Message)]
912965
pub struct Action {
913966
#[prost(message, optional, tag="1")]
@@ -917,7 +970,8 @@ pub struct Action {
917970
}
918971
/// Nested message and enum types in `Action`.
919972
pub mod action {
920-
#[derive(Clone, PartialEq, ::prost::Message)]
973+
#[allow(clippy::derive_partial_eq_without_eq)]
974+
#[derive(Clone, PartialEq, ::prost::Message)]
921975
pub struct Param {
922976
#[prost(uint32, tag="1")]
923977
pub id: u32,
@@ -941,6 +995,7 @@ pub mod action {
941995
pub structured_annotations: ::prost::alloc::vec::Vec<super::StructuredAnnotation>,
942996
}
943997
}
998+
#[allow(clippy::derive_partial_eq_without_eq)]
944999
#[derive(Clone, PartialEq, ::prost::Message)]
9451000
pub struct ActionProfile {
9461001
#[prost(message, optional, tag="1")]
@@ -970,21 +1025,24 @@ pub mod action_profile {
9701025
/// weights that can be present across all selector groups and within a
9711026
/// single selector group respectively.
9721027
/// Added in v1.4.0
973-
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1028+
#[allow(clippy::derive_partial_eq_without_eq)]
1029+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9741030
pub struct SumOfWeights {
9751031
}
9761032
/// indicates that `size` and `max_group_size` represent the maximum number
9771033
/// of members that can be present across all selector groups and within a
9781034
/// single selector group respectively.
9791035
/// Added in v1.4.0
980-
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1036+
#[allow(clippy::derive_partial_eq_without_eq)]
1037+
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9811038
pub struct SumOfMembers {
9821039
/// the maximum weight of each individual member in a group.
9831040
#[prost(int32, tag="1")]
9841041
pub max_member_weight: i32,
9851042
}
9861043
/// specifies the semantics of `size` and `max_group_size` above
987-
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
1044+
#[allow(clippy::derive_partial_eq_without_eq)]
1045+
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
9881046
pub enum SelectorSizeSemantics {
9891047
/// group size is the sum of the group's weights.
9901048
/// Added in v1.4.0
@@ -996,6 +1054,7 @@ pub mod action_profile {
9961054
SumOfMembers(SumOfMembers),
9971055
}
9981056
}
1057+
#[allow(clippy::derive_partial_eq_without_eq)]
9991058
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
10001059
pub struct CounterSpec {
10011060
#[prost(enumeration="counter_spec::Unit", tag="1")]
@@ -1038,6 +1097,7 @@ pub mod counter_spec {
10381097
}
10391098
}
10401099
}
1100+
#[allow(clippy::derive_partial_eq_without_eq)]
10411101
#[derive(Clone, PartialEq, ::prost::Message)]
10421102
pub struct Counter {
10431103
#[prost(message, optional, tag="1")]
@@ -1051,6 +1111,7 @@ pub struct Counter {
10511111
#[prost(message, optional, tag="4")]
10521112
pub index_type_name: ::core::option::Option<P4NamedType>,
10531113
}
1114+
#[allow(clippy::derive_partial_eq_without_eq)]
10541115
#[derive(Clone, PartialEq, ::prost::Message)]
10551116
pub struct DirectCounter {
10561117
#[prost(message, optional, tag="1")]
@@ -1061,6 +1122,7 @@ pub struct DirectCounter {
10611122
#[prost(uint32, tag="3")]
10621123
pub direct_table_id: u32,
10631124
}
1125+
#[allow(clippy::derive_partial_eq_without_eq)]
10641126
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
10651127
pub struct MeterSpec {
10661128
#[prost(enumeration="meter_spec::Unit", tag="1")]
@@ -1147,6 +1209,7 @@ pub mod meter_spec {
11471209
}
11481210
}
11491211
}
1212+
#[allow(clippy::derive_partial_eq_without_eq)]
11501213
#[derive(Clone, PartialEq, ::prost::Message)]
11511214
pub struct Meter {
11521215
#[prost(message, optional, tag="1")]
@@ -1160,6 +1223,7 @@ pub struct Meter {
11601223
#[prost(message, optional, tag="4")]
11611224
pub index_type_name: ::core::option::Option<P4NamedType>,
11621225
}
1226+
#[allow(clippy::derive_partial_eq_without_eq)]
11631227
#[derive(Clone, PartialEq, ::prost::Message)]
11641228
pub struct DirectMeter {
11651229
#[prost(message, optional, tag="1")]
@@ -1176,6 +1240,7 @@ pub struct DirectMeter {
11761240
/// respectively. There can be at most one header each with these annotations.
11771241
/// This message captures the info contained within these special headers,
11781242
/// and used in p4runtime.proto to supply the metadata.
1243+
#[allow(clippy::derive_partial_eq_without_eq)]
11791244
#[derive(Clone, PartialEq, ::prost::Message)]
11801245
pub struct ControllerPacketMetadata {
11811246
/// preamble.name and preamble.id will specify header type ("packet_out" or
@@ -1189,7 +1254,8 @@ pub struct ControllerPacketMetadata {
11891254
}
11901255
/// Nested message and enum types in `ControllerPacketMetadata`.
11911256
pub mod controller_packet_metadata {
1192-
#[derive(Clone, PartialEq, ::prost::Message)]
1257+
#[allow(clippy::derive_partial_eq_without_eq)]
1258+
#[derive(Clone, PartialEq, ::prost::Message)]
11931259
pub struct Metadata {
11941260
#[prost(uint32, tag="1")]
11951261
pub id: u32,
@@ -1212,6 +1278,7 @@ pub mod controller_packet_metadata {
12121278
pub structured_annotations: ::prost::alloc::vec::Vec<super::StructuredAnnotation>,
12131279
}
12141280
}
1281+
#[allow(clippy::derive_partial_eq_without_eq)]
12151282
#[derive(Clone, PartialEq, ::prost::Message)]
12161283
pub struct ValueSet {
12171284
#[prost(message, optional, tag="1")]
@@ -1222,6 +1289,7 @@ pub struct ValueSet {
12221289
#[prost(int32, tag="3")]
12231290
pub size: i32,
12241291
}
1292+
#[allow(clippy::derive_partial_eq_without_eq)]
12251293
#[derive(Clone, PartialEq, ::prost::Message)]
12261294
pub struct Register {
12271295
#[prost(message, optional, tag="1")]
@@ -1234,6 +1302,7 @@ pub struct Register {
12341302
#[prost(message, optional, tag="4")]
12351303
pub index_type_name: ::core::option::Option<P4NamedType>,
12361304
}
1305+
#[allow(clippy::derive_partial_eq_without_eq)]
12371306
#[derive(Clone, PartialEq, ::prost::Message)]
12381307
pub struct Digest {
12391308
#[prost(message, optional, tag="1")]

‎rust/src/p4.v1.rs

+103-21
Large diffs are not rendered by default.

‎rust/src/p4.v1.tonic.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pub mod p4_runtime_client {
2323
where
2424
T: tonic::client::GrpcService<tonic::body::BoxBody>,
2525
T::Error: Into<StdError>,
26-
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
27-
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
26+
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27+
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
2828
{
2929
pub fn new(inner: T) -> Self {
3030
let inner = tonic::client::Grpc::new(inner);
@@ -49,7 +49,7 @@ pub mod p4_runtime_client {
4949
>,
5050
<T as tonic::codegen::Service<
5151
http::Request<tonic::body::BoxBody>,
52-
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
52+
>>::Error: Into<StdError> + Send + Sync,
5353
{
5454
P4RuntimeClient::new(InterceptedService::new(inner, interceptor))
5555
}
@@ -239,7 +239,7 @@ pub mod p4_runtime_server {
239239
use tonic::codegen::*;
240240
/// Generated trait containing gRPC methods that should be implemented for use with P4RuntimeServer.
241241
#[async_trait]
242-
pub trait P4Runtime: std::marker::Send + std::marker::Sync + 'static {
242+
pub trait P4Runtime: Send + Sync + 'static {
243243
async fn write(
244244
&self,
245245
request: tonic::Request<super::WriteRequest>,
@@ -248,7 +248,7 @@ pub mod p4_runtime_server {
248248
type ReadStream: tonic::codegen::tokio_stream::Stream<
249249
Item = std::result::Result<super::ReadResponse, tonic::Status>,
250250
>
251-
+ std::marker::Send
251+
+ Send
252252
+ 'static;
253253
async fn read(
254254
&self,
@@ -272,7 +272,7 @@ pub mod p4_runtime_server {
272272
type StreamChannelStream: tonic::codegen::tokio_stream::Stream<
273273
Item = std::result::Result<super::StreamMessageResponse, tonic::Status>,
274274
>
275-
+ std::marker::Send
275+
+ Send
276276
+ 'static;
277277
async fn stream_channel(
278278
&self,
@@ -290,14 +290,14 @@ pub mod p4_runtime_server {
290290
>;
291291
}
292292
#[derive(Debug)]
293-
pub struct P4RuntimeServer<T> {
293+
pub struct P4RuntimeServer<T: P4Runtime> {
294294
inner: Arc<T>,
295295
accept_compression_encodings: EnabledCompressionEncodings,
296296
send_compression_encodings: EnabledCompressionEncodings,
297297
max_decoding_message_size: Option<usize>,
298298
max_encoding_message_size: Option<usize>,
299299
}
300-
impl<T> P4RuntimeServer<T> {
300+
impl<T: P4Runtime> P4RuntimeServer<T> {
301301
pub fn new(inner: T) -> Self {
302302
Self::from_arc(Arc::new(inner))
303303
}
@@ -351,8 +351,8 @@ pub mod p4_runtime_server {
351351
impl<T, B> tonic::codegen::Service<http::Request<B>> for P4RuntimeServer<T>
352352
where
353353
T: P4Runtime,
354-
B: Body + std::marker::Send + 'static,
355-
B::Error: Into<StdError> + std::marker::Send + 'static,
354+
B: Body + Send + 'static,
355+
B::Error: Into<StdError> + Send + 'static,
356356
{
357357
type Response = http::Response<tonic::body::BoxBody>;
358358
type Error = std::convert::Infallible;
@@ -669,7 +669,7 @@ pub mod p4_runtime_server {
669669
}
670670
}
671671
}
672-
impl<T> Clone for P4RuntimeServer<T> {
672+
impl<T: P4Runtime> Clone for P4RuntimeServer<T> {
673673
fn clone(&self) -> Self {
674674
let inner = self.inner.clone();
675675
Self {
@@ -681,9 +681,7 @@ pub mod p4_runtime_server {
681681
}
682682
}
683683
}
684-
/// Generated gRPC service name
685-
pub const SERVICE_NAME: &str = "p4.v1.P4Runtime";
686-
impl<T> tonic::server::NamedService for P4RuntimeServer<T> {
687-
const NAME: &'static str = SERVICE_NAME;
684+
impl<T: P4Runtime> tonic::server::NamedService for P4RuntimeServer<T> {
685+
const NAME: &'static str = "p4.v1.P4Runtime";
688686
}
689687
}

0 commit comments

Comments
 (0)
Please sign in to comment.