diff --git a/codegen/Dockerfile b/codegen/Dockerfile index 1e8dfb75..4c1dc560 100644 --- a/codegen/Dockerfile +++ b/codegen/Dockerfile @@ -26,9 +26,9 @@ ENV PATH="${PATH}:/usr/local/go/bin:/root/go/bin" RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal; \ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.81.0 --profile minimal; \ . $HOME/.cargo/env; \ - cargo install protoc-gen-prost protoc-gen-prost-crate protoc-gen-prost-serde protoc-gen-tonic + cargo install protoc-gen-prost@0.4.0 protoc-gen-prost-crate@0.4.1 protoc-gen-tonic@0.4.1 ENV PATH="${PATH}:/root/.cargo/bin" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a82b6173..a3ad5679 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -540,7 +540,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "p4runtime" -version = "1.4.0-rc.5" +version = "1.4.0" dependencies = [ "pbjson", "pbjson-types", @@ -660,9 +660,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" dependencies = [ "bytes", "prost-derive", @@ -691,9 +691,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ "anyhow", "itertools", @@ -937,9 +937,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.12.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f738b6a169a29bca4e39656db89c44a08e09c5b700b896ee9e7459f0652e81dd" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index aa44dfa8..7364d047 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "p4runtime" -version = "1.4.0-rc.5" +version = "1.4.0" edition = "2021" authors = ["P4 API Working Group "] description = "P4Runtime Specification" @@ -12,8 +12,8 @@ repository = "https://github.com/p4lang/p4runtime" [dependencies] pbjson = "0.7.0" pbjson-types = "0.7.0" -prost = "0.13.1" -tonic = "0.12.0" +prost = "0.13.2" +tonic = "0.12.2" [features] default = ["proto_full"] diff --git a/rust/src/google.rpc.rs b/rust/src/google.rpc.rs index cfb26b3f..c7ec9a85 100644 --- a/rust/src/google.rpc.rs +++ b/rust/src/google.rpc.rs @@ -7,7 +7,6 @@ /// /// You can find out more about this error model and how to work with it in the /// [API Design Guide](). -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Status { /// The status code, which should be an enum value of diff --git a/rust/src/p4.config.v1.rs b/rust/src/p4.config.v1.rs index de22ae7d..95ba2128 100644 --- a/rust/src/p4.config.v1.rs +++ b/rust/src/p4.config.v1.rs @@ -34,7 +34,6 @@ /// message and refer to the types by name in the P4DataTypeSpec message. We also /// support annotations for these type specs which can be useful, e.g. to /// identify well-known headers (such as ipv4). -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4TypeInfo { #[prost(map="string, message", tag="1")] @@ -53,7 +52,6 @@ pub struct P4TypeInfo { pub new_types: ::std::collections::HashMap<::prost::alloc::string::String, P4NewTypeSpec>, } /// Describes a P4_16 type. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4DataTypeSpec { #[prost(oneof="p4_data_type_spec::TypeSpec", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] @@ -61,8 +59,7 @@ pub struct P4DataTypeSpec { } /// Nested message and enum types in `P4DataTypeSpec`. pub mod p4_data_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum TypeSpec { #[prost(message, tag="1")] Bitstring(super::P4BitstringLikeTypeSpec), @@ -90,7 +87,6 @@ pub mod p4_data_type_spec { NewType(super::P4NamedType), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4NamedType { #[prost(string, tag="1")] @@ -98,15 +94,12 @@ pub struct P4NamedType { } /// Empty message as no type information needed, just used as a placeholder in /// the oneof to identify boolean types. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4BoolType { } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4ErrorType { } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4BitstringLikeTypeSpec { /// Useful to identify well-known types, such as IP address or Ethernet MAC @@ -124,8 +117,7 @@ pub struct P4BitstringLikeTypeSpec { } /// Nested message and enum types in `P4BitstringLikeTypeSpec`. pub mod p4_bitstring_like_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum TypeSpec { /// bit #[prost(message, tag="1")] @@ -138,33 +130,28 @@ pub mod p4_bitstring_like_type_spec { Varbit(super::P4VarbitTypeSpec), } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4BitTypeSpec { #[prost(int32, tag="1")] pub bitwidth: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4IntTypeSpec { #[prost(int32, tag="1")] pub bitwidth: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4VarbitTypeSpec { #[prost(int32, tag="1")] pub max_bitwidth: i32, } /// From the P4_16 spec: "A tuple is similar to a struct, in that it holds /// multiple values. Unlike a struct type, tuples have no named fields." -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4TupleTypeSpec { #[prost(message, repeated, tag="1")] pub members: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4StructTypeSpec { #[prost(message, repeated, tag="1")] @@ -180,8 +167,7 @@ pub struct P4StructTypeSpec { } /// Nested message and enum types in `P4StructTypeSpec`. pub mod p4_struct_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, @@ -189,7 +175,6 @@ pub mod p4_struct_type_spec { pub type_spec: ::core::option::Option, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderTypeSpec { #[prost(message, repeated, tag="1")] @@ -205,8 +190,7 @@ pub struct P4HeaderTypeSpec { } /// Nested message and enum types in `P4HeaderTypeSpec`. pub mod p4_header_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, @@ -214,7 +198,6 @@ pub mod p4_header_type_spec { pub type_spec: ::core::option::Option, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderUnionTypeSpec { #[prost(message, repeated, tag="1")] @@ -230,8 +213,7 @@ pub struct P4HeaderUnionTypeSpec { } /// Nested message and enum types in `P4HeaderUnionTypeSpec`. pub mod p4_header_union_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, @@ -239,7 +221,6 @@ pub mod p4_header_union_type_spec { pub header: ::core::option::Option, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderStackTypeSpec { #[prost(message, optional, tag="1")] @@ -247,7 +228,6 @@ pub struct P4HeaderStackTypeSpec { #[prost(int32, tag="2")] pub size: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderUnionStackTypeSpec { #[prost(message, optional, tag="1")] @@ -255,7 +235,6 @@ pub struct P4HeaderUnionStackTypeSpec { #[prost(int32, tag="2")] pub size: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyValuePair { #[prost(string, tag="1")] @@ -263,13 +242,11 @@ pub struct KeyValuePair { #[prost(message, optional, tag="2")] pub value: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyValuePairList { #[prost(message, repeated, tag="1")] pub kv_pairs: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Expression { #[prost(oneof="expression::Value", tags="1, 2, 3")] @@ -277,8 +254,7 @@ pub struct Expression { } /// Nested message and enum types in `Expression`. pub mod expression { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Value { #[prost(string, tag="1")] StringValue(::prost::alloc::string::String), @@ -288,13 +264,11 @@ pub mod expression { BoolValue(bool), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExpressionList { #[prost(message, repeated, tag="1")] pub expressions: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StructuredAnnotation { #[prost(string, tag="1")] @@ -307,8 +281,7 @@ pub struct StructuredAnnotation { } /// Nested message and enum types in `StructuredAnnotation`. pub mod structured_annotation { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Body { #[prost(message, tag="2")] ExpressionList(super::ExpressionList), @@ -317,7 +290,6 @@ pub mod structured_annotation { } } /// Location of code relative to a given source file. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SourceLocation { /// Path to the source file (absolute or relative to the working directory). @@ -331,7 +303,6 @@ pub struct SourceLocation { } /// For "safe" enums with no underlying representation and no member integer /// values. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4EnumTypeSpec { #[prost(message, repeated, tag="1")] @@ -347,8 +318,7 @@ pub struct P4EnumTypeSpec { } /// Nested message and enum types in `P4EnumTypeSpec`. pub mod p4_enum_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, @@ -365,7 +335,6 @@ pub mod p4_enum_type_spec { /// For serializable (or "unsafe") enums, which have an underlying type. Note /// that as per the P4_16 specification, the underlying representation can only /// be a bit type. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4SerializableEnumTypeSpec { #[prost(message, optional, tag="1")] @@ -383,8 +352,7 @@ pub struct P4SerializableEnumTypeSpec { } /// Nested message and enum types in `P4SerializableEnumTypeSpec`. pub mod p4_serializable_enum_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(string, tag="1")] pub name: ::prost::alloc::string::String, @@ -402,13 +370,11 @@ pub mod p4_serializable_enum_type_spec { } /// Similar to an enum, but there is always one and only one instance per P4 /// program. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4ErrorTypeSpec { #[prost(string, repeated, tag="1")] pub members: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4NewTypeTranslation { /// the URI uniquely identifies the translation in order to enable the @@ -424,14 +390,12 @@ pub struct P4NewTypeTranslation { } /// Nested message and enum types in `P4NewTypeTranslation`. pub mod p4_new_type_translation { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SdnString { } /// The object is either represented as an unsigned integer with a bitwidth of /// `sdn_bitwidth`, or as a string. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum SdnType { #[prost(int32, tag="2")] SdnBitwidth(i32), @@ -440,7 +404,6 @@ pub mod p4_new_type_translation { } } /// New types introduced with the "type" keyword -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4NewTypeSpec { /// for other annotations (not @p4runtime_translation) @@ -457,8 +420,7 @@ pub struct P4NewTypeSpec { } /// Nested message and enum types in `P4NewTypeSpec`. pub mod p4_new_type_spec { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Representation { /// if no @p4runtime_translation annotation present #[prost(message, tag="1")] @@ -468,7 +430,6 @@ pub mod p4_new_type_spec { TranslatedType(super::P4NewTypeTranslation), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4Info { #[prost(message, optional, tag="1")] @@ -500,7 +461,6 @@ pub struct P4Info { #[prost(message, optional, tag="200")] pub type_info: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Documentation { /// A brief description of something, e.g. one sentence @@ -512,8 +472,7 @@ pub struct Documentation { pub description: ::prost::alloc::string::String, } /// Used to describe the required properties of the underlying platform. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PlatformProperties { /// The minimum number of multicast entries (i.e. multicast groups) that the /// platform is required to support. If 0, there are no requirements. @@ -531,7 +490,6 @@ pub struct PlatformProperties { } /// Top-level package documentation describing the forwarding pipeline config /// Can be used to manage multiple P4 packages. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PkgInfo { /// a definitive name for this configuration, e.g. switch.p4_v1.0 @@ -574,8 +532,7 @@ pub struct PkgInfo { } /// wrapping the enum in a message to avoid name collisions in C++, where "enum /// values are siblings of their type, not children of it" -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct P4Ids { } /// Nested message and enum types in `P4Ids`. @@ -660,7 +617,6 @@ pub mod p4_ids { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Preamble { /// ids share the same number-space; e.g. table ids cannot overlap with counter @@ -699,7 +655,6 @@ pub struct Preamble { pub structured_annotations: ::prost::alloc::vec::Vec, } /// used to group all extern instances of the same type in one message -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Extern { /// the extern_type_id is unique for a given architecture and must be in the @@ -711,7 +666,6 @@ pub struct Extern { #[prost(message, repeated, tag="3")] pub instances: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExternInstance { #[prost(message, optional, tag="1")] @@ -721,7 +675,6 @@ pub struct ExternInstance { #[prost(message, optional, tag="2")] pub info: ::core::option::Option<::pbjson_types::Any>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MatchField { #[prost(uint32, tag="1")] @@ -787,8 +740,7 @@ pub mod match_field { } } } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Match { #[prost(enumeration="MatchType", tag="5")] MatchType(i32), @@ -798,7 +750,28 @@ pub mod match_field { OtherMatchType(::prost::alloc::string::String), } } -#[allow(clippy::derive_partial_eq_without_eq)] +/// A TableActionCall references a particular action id and executes the +/// action with the supplied list of arguments. +/// Arguments are matched to the id of the respective action parameter. +/// TableActionCalls may be used as the default action call of a table implementation. +/// Added in 1.4.0. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TableActionCall { + #[prost(uint32, tag="1")] + pub action_id: u32, + #[prost(message, repeated, tag="4")] + pub arguments: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `TableActionCall`. +pub mod table_action_call { + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Argument { + #[prost(uint32, tag="2")] + pub param_id: u32, + #[prost(bytes="vec", tag="3")] + pub value: ::prost::alloc::vec::Vec, + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct Table { #[prost(message, optional, tag="1")] @@ -814,6 +787,10 @@ pub struct Table { /// 0 (default value) means that the table does not have a const default action #[prost(uint32, tag="4")] pub const_default_action_id: u32, + /// The initial default action of the table. This can be overridden at runtime. + /// Added in 1.4.0. + #[prost(message, optional, tag="5")] + pub initial_default_action: ::core::option::Option, /// P4 id of the "implementation" for this table (e.g. action profile id); 0 /// (default value) means that the table is a regular (direct) match table. As /// of today, only action profiles are supported but other table @@ -882,7 +859,6 @@ pub mod table { } } /// used to list all possible actions in a Table -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionRef { #[prost(uint32, tag="1")] @@ -930,7 +906,6 @@ pub mod action_ref { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Action { #[prost(message, optional, tag="1")] @@ -940,8 +915,7 @@ pub struct Action { } /// Nested message and enum types in `Action`. pub mod action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Param { #[prost(uint32, tag="1")] pub id: u32, @@ -965,7 +939,6 @@ pub mod action { pub structured_annotations: ::prost::alloc::vec::Vec, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionProfile { #[prost(message, optional, tag="1")] @@ -994,23 +967,20 @@ pub mod action_profile { /// indicates that `size` and `max_group_size` represent the maximum sum of /// weights that can be present across all selector groups and within a /// single selector group respectively. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SumOfWeights { } /// indicates that `size` and `max_group_size` represent the maximum number /// of members that can be present across all selector groups and within a /// single selector group respectively. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SumOfMembers { /// the maximum weight of each individual member in a group. #[prost(int32, tag="1")] pub max_member_weight: i32, } /// specifies the semantics of `size` and `max_group_size` above - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum SelectorSizeSemantics { /// group size is the sum of the group's weights. #[prost(message, tag="6")] @@ -1020,8 +990,7 @@ pub mod action_profile { SumOfMembers(SumOfMembers), } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CounterSpec { #[prost(enumeration="counter_spec::Unit", tag="1")] pub unit: i32, @@ -1063,7 +1032,6 @@ pub mod counter_spec { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Counter { #[prost(message, optional, tag="1")] @@ -1077,7 +1045,6 @@ pub struct Counter { #[prost(message, optional, tag="4")] pub index_type_name: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DirectCounter { #[prost(message, optional, tag="1")] @@ -1088,8 +1055,7 @@ pub struct DirectCounter { #[prost(uint32, tag="3")] pub direct_table_id: u32, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct MeterSpec { #[prost(enumeration="meter_spec::Unit", tag="1")] pub unit: i32, @@ -1175,7 +1141,6 @@ pub mod meter_spec { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Meter { #[prost(message, optional, tag="1")] @@ -1189,7 +1154,6 @@ pub struct Meter { #[prost(message, optional, tag="4")] pub index_type_name: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DirectMeter { #[prost(message, optional, tag="1")] @@ -1206,7 +1170,6 @@ pub struct DirectMeter { /// respectively. There can be at most one header each with these annotations. /// This message captures the info contained within these special headers, /// and used in p4runtime.proto to supply the metadata. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ControllerPacketMetadata { /// preamble.name and preamble.id will specify header type ("packet_out" or @@ -1220,8 +1183,7 @@ pub struct ControllerPacketMetadata { } /// Nested message and enum types in `ControllerPacketMetadata`. pub mod controller_packet_metadata { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { #[prost(uint32, tag="1")] pub id: u32, @@ -1244,7 +1206,6 @@ pub mod controller_packet_metadata { pub structured_annotations: ::prost::alloc::vec::Vec, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValueSet { #[prost(message, optional, tag="1")] @@ -1255,7 +1216,6 @@ pub struct ValueSet { #[prost(int32, tag="3")] pub size: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Register { #[prost(message, optional, tag="1")] @@ -1268,7 +1228,6 @@ pub struct Register { #[prost(message, optional, tag="4")] pub index_type_name: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Digest { #[prost(message, optional, tag="1")] diff --git a/rust/src/p4.v1.rs b/rust/src/p4.v1.rs index 1f52e0fc..8fd1db9f 100644 --- a/rust/src/p4.v1.rs +++ b/rust/src/p4.v1.rs @@ -1,6 +1,5 @@ // @generated // This file is @generated by prost-build. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4Data { #[prost(oneof="p4_data::Data", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] @@ -8,8 +7,7 @@ pub struct P4Data { } /// Nested message and enum types in `P4Data`. pub mod p4_data { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Data { /// for bit, int #[prost(bytes, tag="1")] @@ -41,7 +39,6 @@ pub mod p4_data { EnumValue(::prost::alloc::vec::Vec), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4Varbit { #[prost(bytes="vec", tag="1")] @@ -50,13 +47,11 @@ pub struct P4Varbit { #[prost(int32, tag="2")] pub bitwidth: i32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4StructLike { #[prost(message, repeated, tag="1")] pub members: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4Header { /// If the header is invalid (is_valid is "false"), then the bitstrings @@ -66,7 +61,6 @@ pub struct P4Header { #[prost(bytes="vec", repeated, tag="2")] pub bitstrings: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderUnion { /// An empty string indicates that none of the union members are valid and @@ -76,7 +70,6 @@ pub struct P4HeaderUnion { #[prost(message, optional, tag="2")] pub valid_header: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderStack { /// The length of this repeated field must always be equal to the compile-time @@ -84,7 +77,6 @@ pub struct P4HeaderStack { #[prost(message, repeated, tag="1")] pub entries: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct P4HeaderUnionStack { /// The length of this repeated field must always be equal to the compile-time @@ -93,7 +85,6 @@ pub struct P4HeaderUnionStack { pub entries: ::prost::alloc::vec::Vec, } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WriteRequest { #[prost(uint64, tag="1")] @@ -165,11 +156,9 @@ pub mod write_request { } } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct WriteResponse { } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadRequest { #[prost(uint64, tag="1")] @@ -180,13 +169,11 @@ pub struct ReadRequest { #[prost(message, repeated, tag="2")] pub entities: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReadResponse { #[prost(message, repeated, tag="1")] pub entities: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Update { #[prost(enumeration="update::Type", tag="1")] @@ -229,7 +216,6 @@ pub mod update { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Entity { #[prost(oneof="entity::Entity", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")] @@ -237,8 +223,7 @@ pub struct Entity { } /// Nested message and enum types in `Entity`. pub mod entity { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Entity { #[prost(message, tag="1")] ExternEntry(super::ExternEntry), @@ -266,7 +251,6 @@ pub mod entity { DigestEntry(super::DigestEntry), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExternEntry { /// the extern_type_id is unique for a given architecture and must be in the @@ -279,7 +263,6 @@ pub struct ExternEntry { #[prost(message, optional, tag="3")] pub entry: ::core::option::Option<::pbjson_types::Any>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TableEntry { #[prost(uint32, tag="1")] @@ -367,8 +350,7 @@ pub struct TableEntry { } /// Nested message and enum types in `TableEntry`. pub mod table_entry { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct IdleTimeout { /// Time elapsed - in nanoseconds - since the table entry was last "hit" as /// part of a data plane table lookup. @@ -377,7 +359,6 @@ pub mod table_entry { } } /// field_match_type ::= exact | ternary | lpm | range | optional -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FieldMatch { #[prost(uint32, tag="1")] @@ -389,22 +370,19 @@ pub struct FieldMatch { pub mod field_match { /// Matches can be performed on arbitrarily-large inputs; the protobuf type /// 'bytes' is used to model arbitrarily-large values. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Exact { #[prost(bytes="vec", tag="1")] pub value: ::prost::alloc::vec::Vec, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Ternary { #[prost(bytes="vec", tag="1")] pub value: ::prost::alloc::vec::Vec, #[prost(bytes="vec", tag="2")] pub mask: ::prost::alloc::vec::Vec, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Lpm { #[prost(bytes="vec", tag="1")] pub value: ::prost::alloc::vec::Vec, @@ -414,8 +392,7 @@ pub mod field_match { } /// A Range is logically a set that contains all values numerically between /// 'low' and 'high' inclusively. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Range { #[prost(bytes="vec", tag="1")] pub low: ::prost::alloc::vec::Vec, @@ -424,14 +401,12 @@ pub mod field_match { } /// If the Optional match should be a wildcard, the FieldMatch must be omitted. /// Otherwise, this behaves like an exact match. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Optional { #[prost(bytes="vec", tag="1")] pub value: ::prost::alloc::vec::Vec, } - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum FieldMatchType { #[prost(message, tag="2")] Exact(Exact), @@ -450,7 +425,6 @@ pub mod field_match { } } /// table_actions ::= action_specification | action_profile_specification -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TableAction { #[prost(oneof="table_action::Type", tags="1, 2, 3, 4")] @@ -458,8 +432,7 @@ pub struct TableAction { } /// Nested message and enum types in `TableAction`. pub mod table_action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Type { #[prost(message, tag="1")] Action(super::Action), @@ -471,7 +444,6 @@ pub mod table_action { ActionProfileActionSet(super::ActionProfileActionSet), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Action { #[prost(uint32, tag="1")] @@ -481,8 +453,7 @@ pub struct Action { } /// Nested message and enum types in `Action`. pub mod action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Param { #[prost(uint32, tag="2")] pub param_id: u32, @@ -490,13 +461,11 @@ pub mod action { pub value: ::prost::alloc::vec::Vec, } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionProfileActionSet { #[prost(message, repeated, tag="1")] pub action_profile_actions: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionProfileAction { #[prost(message, optional, tag="1")] @@ -508,8 +477,7 @@ pub struct ActionProfileAction { } /// Nested message and enum types in `ActionProfileAction`. pub mod action_profile_action { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum WatchKind { /// Using int32 as ports is deprecated, use watch_port instead. #[prost(int32, tag="3")] @@ -519,7 +487,6 @@ pub mod action_profile_action { } } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionProfileMember { #[prost(uint32, tag="1")] @@ -530,7 +497,6 @@ pub struct ActionProfileMember { pub action: ::core::option::Option, } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ActionProfileGroup { #[prost(uint32, tag="1")] @@ -550,8 +516,7 @@ pub struct ActionProfileGroup { } /// Nested message and enum types in `ActionProfileGroup`. pub mod action_profile_group { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, PartialEq, ::prost::Message)] pub struct Member { #[prost(uint32, tag="1")] pub member_id: u32, @@ -562,8 +527,7 @@ pub mod action_profile_group { } /// Nested message and enum types in `Member`. pub mod member { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum WatchKind { /// Using int32 as ports is deprecated, use watch_port instead. #[prost(int32, tag="3")] @@ -580,8 +544,7 @@ pub mod action_profile_group { /// these but we cannot use a default zero index value to do so, as zero is a /// valid index (first entry in the array). We therefore wrap the index in a /// message. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Index { #[prost(int64, tag="1")] pub index: i64, @@ -591,8 +554,7 @@ pub struct Index { /// For ReadRequest, the scope is defined as follows: /// - All meter cells for all meters if meter_id = 0 (default). /// - All meter cells for given meter_id if index is unset (default). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct MeterEntry { #[prost(uint32, tag="1")] pub meter_id: u32, @@ -611,7 +573,6 @@ pub struct MeterEntry { /// - All meter cells for all tables if table_entry.table_id = 0. /// - All meter cells of a table if table_entry.table_id is present and /// table_entry.match is empty. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DirectMeterEntry { /// The associated table entry. This field is required. @@ -641,8 +602,7 @@ pub struct DirectMeterEntry { /// yellow or green depending on whether it exceeds or doesn't exceed the EBS. /// For this meter type, it must be the case that `cir == pir && cburst == /// pburst`. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct MeterConfig { /// Committed information rate (units per sec) #[prost(int64, tag="1")] @@ -666,8 +626,7 @@ pub struct MeterConfig { /// For ReadRequest, the scope is defined as follows: /// - All counter cells for all counters if counter_id = 0 (default). /// - All counter cells for given counter_id if index is unset (default). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CounterEntry { #[prost(uint32, tag="1")] pub counter_id: u32, @@ -684,7 +643,6 @@ pub struct CounterEntry { /// - All counter cells for all tables if table_entry.table_id = 0. /// - All counter cells of a table if table_entry.table_id is present and /// table_entry.match is empty. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DirectCounterEntry { /// The associated table entry. This field is required. @@ -694,16 +652,14 @@ pub struct DirectCounterEntry { #[prost(message, optional, tag="2")] pub data: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CounterData { #[prost(int64, tag="1")] pub byte_count: i64, #[prost(int64, tag="2")] pub packet_count: i64, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct MeterCounterData { #[prost(message, optional, tag="1")] pub green: ::core::option::Option, @@ -715,7 +671,6 @@ pub struct MeterCounterData { /// ------------------------------------------------------------------------------ /// Only one instance of a Packet Replication Engine (PRE) is expected in the /// P4 pipeline. Hence, no instance id is needed to access the PRE. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketReplicationEngineEntry { #[prost(oneof="packet_replication_engine_entry::Type", tags="1, 2")] @@ -723,8 +678,7 @@ pub struct PacketReplicationEngineEntry { } /// Nested message and enum types in `PacketReplicationEngineEntry`. pub mod packet_replication_engine_entry { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Type { #[prost(message, tag="1")] MulticastGroupEntry(super::MulticastGroupEntry), @@ -733,7 +687,6 @@ pub mod packet_replication_engine_entry { } } /// Used for replicas created for cloning and multicasting actions. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Replica { #[prost(uint32, tag="2")] @@ -743,8 +696,7 @@ pub struct Replica { } /// Nested message and enum types in `Replica`. pub mod replica { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum PortKind { /// Using uint32 as ports is deprecated, use port field instead. #[prost(uint32, tag="1")] @@ -759,7 +711,6 @@ pub mod replica { /// of a programmed multicast group entry. The port and instance fields of each /// replica's egress input metadata will be set to the respective values /// programmed in the multicast group entry. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MulticastGroupEntry { #[prost(uint32, tag="1")] @@ -784,7 +735,6 @@ pub struct MulticastGroupEntry { /// length is also common to all clones in the clone session. If the /// packet_length_bytes field is 0, no truncation on the clone(s) will be /// performed. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CloneSessionEntry { #[prost(uint32, tag="1")] @@ -798,7 +748,6 @@ pub struct CloneSessionEntry { } /// A member in a P4 value set. Each member defines a list of matches, which can /// have different match types. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValueSetMember { #[prost(message, repeated, tag="1")] @@ -819,7 +768,6 @@ pub struct ValueSetMember { /// - All matches for all value-set entries if value_set_id = 0 /// - All matches of the value-set if a valid value_set_id is specified /// - The 'match' field must never be set in the ReadRequest -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValueSetEntry { #[prost(uint32, tag="1")] @@ -828,7 +776,6 @@ pub struct ValueSetEntry { pub members: ::prost::alloc::vec::Vec, } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterEntry { #[prost(uint32, tag="1")] @@ -840,8 +787,7 @@ pub struct RegisterEntry { } /// ------------------------------------------------------------------------------ /// Used to configure the digest extern only, not to stream digests or acks -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct DigestEntry { #[prost(uint32, tag="1")] pub digest_id: u32, @@ -855,8 +801,7 @@ pub mod digest_entry { /// - the oldest digest in the list has been waiting for at least /// max_timeout_ns nanoseconds or we have gathered max_list_size digests /// already - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Config { /// max timeout for outstanding digest data #[prost(int64, tag="1")] @@ -870,7 +815,6 @@ pub mod digest_entry { } } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StreamMessageRequest { #[prost(oneof="stream_message_request::Update", tags="1, 2, 3, 4")] @@ -878,8 +822,7 @@ pub struct StreamMessageRequest { } /// Nested message and enum types in `StreamMessageRequest`. pub mod stream_message_request { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Update { #[prost(message, tag="1")] Arbitration(super::MasterArbitrationUpdate), @@ -892,7 +835,6 @@ pub mod stream_message_request { } } /// Packet sent from the controller to the switch. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketOut { #[prost(bytes="vec", tag="1")] @@ -907,15 +849,13 @@ pub struct PacketOut { /// controller, the switch must not generate digest notifications for the same /// data until a DigestListAck message with the same list_id is received or the /// ack timeout (ack_timeout_ns field in DigestEntry.Config) expires. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct DigestListAck { #[prost(uint32, tag="1")] pub digest_id: u32, #[prost(uint64, tag="2")] pub list_id: u64, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StreamMessageResponse { #[prost(oneof="stream_message_response::Update", tags="1, 2, 3, 4, 5, 6")] @@ -923,8 +863,7 @@ pub struct StreamMessageResponse { } /// Nested message and enum types in `StreamMessageResponse`. pub mod stream_message_response { - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Update { #[prost(message, tag="1")] Arbitration(super::MasterArbitrationUpdate), @@ -943,7 +882,6 @@ pub mod stream_message_response { } } /// Packet sent from the switch to the controller. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketIn { #[prost(bytes="vec", tag="1")] @@ -954,7 +892,6 @@ pub struct PacketIn { #[prost(message, repeated, tag="2")] pub metadata: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DigestList { /// identifies the digest extern instance @@ -977,7 +914,6 @@ pub struct DigestList { /// @controller_header("packet_out") and @controller_header("packet_in") /// respectively. There can be at most one header each with these annotations. /// These special headers are captured in P4Info ControllerPacketMetadata. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketMetadata { /// This refers to Metadata.id coming from P4Info ControllerPacketMetadata. @@ -986,7 +922,6 @@ pub struct PacketMetadata { #[prost(bytes="vec", tag="2")] pub value: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MasterArbitrationUpdate { #[prost(uint64, tag="1")] @@ -1008,7 +943,6 @@ pub struct MasterArbitrationUpdate { #[prost(message, optional, tag="4")] pub status: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Role { /// Uniquely identifies this role. @@ -1025,7 +959,6 @@ pub struct Role { #[prost(message, optional, tag="2")] pub config: ::core::option::Option<::pbjson_types::Any>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct IdleTimeoutNotification { /// The only fields that are required to be set in each TableEntry are the @@ -1040,7 +973,6 @@ pub struct IdleTimeoutNotification { } /// Used by the server to asynchronously report errors which occur when /// processing StreamMessageRequest messages. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StreamError { /// gRPC canonical error code (see @@ -1072,8 +1004,7 @@ pub mod stream_error { /// the fields must be set (so that the client can identify which type of /// stream message triggered the error), but that field may be set to its /// default value. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] + #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Details { #[prost(message, tag="5")] PacketOut(super::PacketOutError), @@ -1083,29 +1014,25 @@ pub mod stream_error { Other(super::StreamOtherError), } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketOutError { /// Optional. The packet out message that caused the error. #[prost(message, optional, tag="1")] pub packet_out: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct DigestListAckError { /// Optional. The digest list acknowledgement message that caused the error. #[prost(message, optional, tag="1")] pub digest_list_ack: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct StreamOtherError { /// Optional. The architecture-specific stream message that caused the error. #[prost(message, optional, tag="1")] pub other: ::core::option::Option<::pbjson_types::Any>, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Uint128 { /// Highest 64 bits of a 128 bit number. #[prost(uint64, tag="1")] @@ -1115,7 +1042,6 @@ pub struct Uint128 { pub low: u64, } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SetForwardingPipelineConfigRequest { #[prost(uint64, tag="1")] @@ -1198,11 +1124,9 @@ pub mod set_forwarding_pipeline_config_request { } } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SetForwardingPipelineConfigResponse { } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ForwardingPipelineConfig { #[prost(message, optional, tag="1")] @@ -1222,15 +1146,13 @@ pub mod forwarding_pipeline_config { /// we need to distinguish those cases where a cookie is NOT present (e.g. not /// set in the SetForwardingPipelineConfigRequest, therefore we wrap the actual /// uint64 value in a protobuf message. - #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Cookie { #[prost(uint64, tag="1")] pub cookie: u64, } } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetForwardingPipelineConfigRequest { #[prost(uint64, tag="1")] pub device_id: u64, @@ -1278,14 +1200,12 @@ pub mod get_forwarding_pipeline_config_request { } } } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetForwardingPipelineConfigResponse { #[prost(message, optional, tag="1")] pub config: ::core::option::Option, } /// Error message used to report a single P4-entity error for a Write RPC. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Error { /// gRPC canonical error code (see @@ -1309,11 +1229,9 @@ pub struct Error { pub details: ::core::option::Option<::pbjson_types::Any>, } /// ------------------------------------------------------------------------------ -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CapabilitiesRequest { } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CapabilitiesResponse { /// The full semantic version string (e.g. "1.1.0-rc.1") corresponding to the diff --git a/rust/src/p4.v1.tonic.rs b/rust/src/p4.v1.tonic.rs index 29e98fb5..58e622c4 100644 --- a/rust/src/p4.v1.tonic.rs +++ b/rust/src/p4.v1.tonic.rs @@ -23,8 +23,8 @@ pub mod p4_runtime_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); @@ -49,7 +49,7 @@ pub mod p4_runtime_client { >, , - >>::Error: Into + Send + Sync, + >>::Error: Into + std::marker::Send + std::marker::Sync, { P4RuntimeClient::new(InterceptedService::new(inner, interceptor)) } @@ -239,7 +239,7 @@ pub mod p4_runtime_server { use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with P4RuntimeServer. #[async_trait] - pub trait P4Runtime: Send + Sync + 'static { + pub trait P4Runtime: std::marker::Send + std::marker::Sync + 'static { async fn write( &self, request: tonic::Request, @@ -248,7 +248,7 @@ pub mod p4_runtime_server { type ReadStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > - + Send + + std::marker::Send + 'static; async fn read( &self, @@ -272,7 +272,7 @@ pub mod p4_runtime_server { type StreamChannelStream: tonic::codegen::tokio_stream::Stream< Item = std::result::Result, > - + Send + + std::marker::Send + 'static; async fn stream_channel( &self, @@ -290,20 +290,18 @@ pub mod p4_runtime_server { >; } #[derive(Debug)] - pub struct P4RuntimeServer { - inner: _Inner, + pub struct P4RuntimeServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl P4RuntimeServer { + impl P4RuntimeServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -353,8 +351,8 @@ pub mod p4_runtime_server { impl tonic::codegen::Service> for P4RuntimeServer where T: P4Runtime, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; @@ -366,7 +364,6 @@ pub mod p4_runtime_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/p4.v1.P4Runtime/Write" => { #[allow(non_camel_case_types)] @@ -395,7 +392,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = WriteSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -442,7 +438,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ReadSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -495,7 +490,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = SetForwardingPipelineConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -548,7 +542,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = GetForwardingPipelineConfigSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -597,7 +590,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = StreamChannelSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -643,7 +635,6 @@ pub mod p4_runtime_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = CapabilitiesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -665,8 +656,11 @@ pub mod p4_runtime_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -675,7 +669,7 @@ pub mod p4_runtime_server { } } } - impl Clone for P4RuntimeServer { + impl Clone for P4RuntimeServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -687,17 +681,9 @@ pub mod p4_runtime_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for P4RuntimeServer { - const NAME: &'static str = "p4.v1.P4Runtime"; + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "p4.v1.P4Runtime"; + impl tonic::server::NamedService for P4RuntimeServer { + const NAME: &'static str = SERVICE_NAME; } }