From 57d7398a0fad2ded9820df7c350f7227fdc29453 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 4 Sep 2024 16:38:00 +0200 Subject: [PATCH] Use well-known types from `tendermint-proto` instead of defining and bundling our own (#226) Use the `google.protobuf.{Duration, Timestamp}` Protobuf messages exposed by `tendermint-proto` instead of defining and bundling our own. * Use well-known types from `tendermint-proto` * Add changelog entry --- .../226-tendermint-proto-wkt.md | 5 + Cargo.toml | 12 +- src/google.rs | 322 - src/lib.rs | 2 - src/prost/cosmos.auth.v1beta1.rs | 12 +- src/prost/cosmos.base.abci.v1beta1.rs | 6 +- src/prost/cosmos.base.tendermint.v1beta1.rs | 8 +- src/prost/cosmos.crypto.keyring.v1.rs | 8 +- src/prost/cosmos.crypto.multisig.rs | 4 +- src/prost/cosmos.gov.v1.rs | 22 +- src/prost/cosmos.gov.v1beta1.rs | 16 +- src/prost/cosmos.staking.v1beta1.rs | 18 +- src/prost/cosmos.tx.signing.v1beta1.rs | 4 +- src/prost/cosmos.tx.v1beta1.rs | 10 +- src/prost/cosmos.upgrade.v1beta1.rs | 4 +- src/prost/google.api.rs | 402 - src/prost/google.api.serde.rs | 443 - src/prost/google.protobuf.rs | 2551 ------ src/prost/google.protobuf.serde.rs | 7200 ----------------- ...ibc.applications.interchain_accounts.v1.rs | 4 +- src/prost/ibc.core.channel.v1.rs | 2 +- src/prost/ibc.core.client.v1.rs | 38 +- src/prost/ibc.core.connection.v1.rs | 10 +- src/prost/ibc.lightclients.solomachine.v2.rs | 16 +- src/prost/ibc.lightclients.solomachine.v3.rs | 10 +- src/prost/ibc.lightclients.tendermint.v1.rs | 8 +- .../interchain_security.ccv.consumer.v1.rs | 6 +- .../interchain_security.ccv.provider.v1.rs | 24 +- src/prost/interchain_security.ccv.v1.rs | 8 +- src/prost/proto_descriptor.bin | Bin 765010 -> 764958 bytes tools/proto-compiler/src/cmd/compile.rs | 6 +- 31 files changed, 108 insertions(+), 11073 deletions(-) create mode 100644 .changelog/unreleased/breaking-changes/226-tendermint-proto-wkt.md delete mode 100644 src/google.rs delete mode 100644 src/prost/google.api.rs delete mode 100644 src/prost/google.api.serde.rs delete mode 100644 src/prost/google.protobuf.rs delete mode 100644 src/prost/google.protobuf.serde.rs diff --git a/.changelog/unreleased/breaking-changes/226-tendermint-proto-wkt.md b/.changelog/unreleased/breaking-changes/226-tendermint-proto-wkt.md new file mode 100644 index 00000000..16f3f02e --- /dev/null +++ b/.changelog/unreleased/breaking-changes/226-tendermint-proto-wkt.md @@ -0,0 +1,5 @@ +- Use well-know types from `tendermint-proto` instead of bundling them + + Use the `google.protobuf.{Duration, Timestamp}` Protobuf messages + exposed by `tendermint-proto` instead of defining and bundling our own. + ([\#226](https://github.com/cosmos/ibc-proto-rs/pull/226)) \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index dcf01e09..ccfe7410 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,14 +39,6 @@ flex-error = { version = "0.4", default-features = false } ics23 = { version = "0.12.0", default-features = false } informalsystems-pbjson = { version = "0.7.0", optional = true, default-features = false } -## Optional: enabled by the `parity-scale-codec` feature -parity-scale-codec = { version = "3.0.0", default-features = false, features = ["full"], optional = true } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"], optional = true } - -## Optional: enabled by the `borsh` feature -## For borsh encode or decode, needs to track `anchor-lang` and `near-sdk-rs` borsh version -borsh = { version = "1", default-features = false, features = ["derive"], optional = true } - [dependencies.tendermint-proto] version = "0.39" default-features = false @@ -61,6 +53,6 @@ serde = ["dep:serde", "ics23/serde", "informalsystems-pbjson"] client = ["std", "dep:tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] json-schema = ["std", "serde", "dep:schemars"] server = ["std", "dep:tonic", "tonic/codegen", "tonic/transport", "tonic/prost"] -parity-scale-codec = ["dep:parity-scale-codec", "dep:scale-info"] -borsh = ["dep:borsh"] +parity-scale-codec = ["tendermint-proto/parity-scale-codec"] +borsh = ["tendermint-proto/borsh"] proto-descriptor = [] diff --git a/src/google.rs b/src/google.rs deleted file mode 100644 index 58a5106f..00000000 --- a/src/google.rs +++ /dev/null @@ -1,322 +0,0 @@ -pub mod protobuf { - use crate::include_proto; - - include_proto!("google.protobuf.rs"); - - #[cfg(feature = "serde")] - include_proto!("google.protobuf.serde.rs"); - - // source: https://github.com/tokio-rs/prost/blob/master/prost-types/src/lib.rs - use core::convert::TryFrom; - use core::time; - - // The Protobuf `Duration` and `Timestamp` types can't delegate to the standard library equivalents - // because the Protobuf versions are signed. To make them easier to work with, `From` conversions - // are defined in both directions. - - const NANOS_PER_SECOND: i32 = 1_000_000_000; - const NANOS_MAX: i32 = NANOS_PER_SECOND - 1; - - impl Duration { - /// Normalizes the duration to a canonical format. - pub fn normalize(&mut self) { - // Make sure nanos is in the range. - if self.nanos <= -NANOS_PER_SECOND || self.nanos >= NANOS_PER_SECOND { - if let Some(seconds) = self - .seconds - .checked_add((self.nanos / NANOS_PER_SECOND) as i64) - { - self.seconds = seconds; - self.nanos %= NANOS_PER_SECOND; - } else if self.nanos < 0 { - // Negative overflow! Set to the least normal value. - self.seconds = i64::MIN; - self.nanos = -NANOS_MAX; - } else { - // Positive overflow! Set to the greatest normal value. - self.seconds = i64::MAX; - self.nanos = NANOS_MAX; - } - } - - // nanos should have the same sign as seconds. - if self.seconds < 0 && self.nanos > 0 { - if let Some(seconds) = self.seconds.checked_add(1) { - self.seconds = seconds; - self.nanos -= NANOS_PER_SECOND; - } else { - // Positive overflow! Set to the greatest normal value. - debug_assert_eq!(self.seconds, i64::MAX); - self.nanos = NANOS_MAX; - } - } else if self.seconds > 0 && self.nanos < 0 { - if let Some(seconds) = self.seconds.checked_sub(1) { - self.seconds = seconds; - self.nanos += NANOS_PER_SECOND; - } else { - // Negative overflow! Set to the least normal value. - debug_assert_eq!(self.seconds, i64::MIN); - self.nanos = -NANOS_MAX; - } - } - } - } - - /// Converts a `std::time::Duration` to a `Duration`. - impl From for Duration { - fn from(duration: time::Duration) -> Duration { - let seconds = duration.as_secs(); - let seconds = if seconds > i64::MAX as u64 { - i64::MAX - } else { - seconds as i64 - }; - let nanos = duration.subsec_nanos(); - let nanos = if nanos > i32::MAX as u32 { - i32::MAX - } else { - nanos as i32 - }; - let mut duration = Duration { seconds, nanos }; - duration.normalize(); - duration - } - } - - impl TryFrom for time::Duration { - type Error = time::Duration; - - /// Converts a `Duration` to a result containing a positive (`Ok`) or negative (`Err`) - /// `std::time::Duration`. - fn try_from(mut duration: Duration) -> Result { - duration.normalize(); - if duration.seconds >= 0 { - Ok(time::Duration::new( - duration.seconds as u64, - duration.nanos as u32, - )) - } else { - Err(time::Duration::new( - (-duration.seconds) as u64, - (-duration.nanos) as u32, - )) - } - } - } - - impl Timestamp { - /// Normalizes the timestamp to a canonical format. - #[cfg(feature = "std")] - pub fn normalize(&mut self) { - // Make sure nanos is in the range. - if self.nanos <= -NANOS_PER_SECOND || self.nanos >= NANOS_PER_SECOND { - if let Some(seconds) = self - .seconds - .checked_add((self.nanos / NANOS_PER_SECOND) as i64) - { - self.seconds = seconds; - self.nanos %= NANOS_PER_SECOND; - } else if self.nanos < 0 { - // Negative overflow! Set to the earliest normal value. - self.seconds = i64::MIN; - self.nanos = 0; - } else { - // Positive overflow! Set to the latest normal value. - self.seconds = i64::MAX; - self.nanos = 999_999_999; - } - } - - // For Timestamp nanos should be in the range [0, 999999999]. - if self.nanos < 0 { - if let Some(seconds) = self.seconds.checked_sub(1) { - self.seconds = seconds; - self.nanos += NANOS_PER_SECOND; - } else { - // Negative overflow! Set to the earliest normal value. - debug_assert_eq!(self.seconds, i64::MIN); - self.nanos = 0; - } - } - } - } - - /// Implements the unstable/naive version of `Eq`: a basic equality check on the internal fields of the `Timestamp`. - /// This implies that `normalized_ts != non_normalized_ts` even if `normalized_ts == non_normalized_ts.normalized()`. - #[cfg(feature = "std")] - impl Eq for Timestamp {} - - #[cfg(feature = "std")] - #[allow(clippy::derived_hash_with_manual_eq)] // Derived logic is correct: comparing the 2 fields for equality - impl std::hash::Hash for Timestamp { - fn hash(&self, state: &mut H) { - self.seconds.hash(state); - self.nanos.hash(state); - } - } - - #[cfg(feature = "std")] - impl From for Timestamp { - fn from(system_time: std::time::SystemTime) -> Timestamp { - let (seconds, nanos) = match system_time.duration_since(std::time::UNIX_EPOCH) { - Ok(duration) => { - let seconds = i64::try_from(duration.as_secs()).unwrap(); - (seconds, duration.subsec_nanos() as i32) - } - Err(error) => { - let duration = error.duration(); - let seconds = i64::try_from(duration.as_secs()).unwrap(); - let nanos = duration.subsec_nanos() as i32; - if nanos == 0 { - (-seconds, 0) - } else { - (-seconds - 1, 1_000_000_000 - nanos) - } - } - }; - Timestamp { seconds, nanos } - } - } - - /// Indicates that a [`Timestamp`] could not be converted to - /// [`SystemTime`][std::time::SystemTime] because it is out of range. - /// - /// The range of times that can be represented by `SystemTime` depends on the platform. - /// All `Timestamp`s are likely representable on 64-bit Unix-like platforms, but - /// other platforms, such as Windows and 32-bit Linux, may not be able to represent - /// the full range of `Timestamp`s. - #[cfg(feature = "std")] - #[derive(Debug)] - #[non_exhaustive] - pub struct TimestampOutOfSystemRangeError { - pub timestamp: Timestamp, - } - - #[cfg(feature = "std")] - impl core::fmt::Display for TimestampOutOfSystemRangeError { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!( - f, - "{self:?} is not representable as a `SystemTime` because it is out of range" - ) - } - } - - #[cfg(feature = "std")] - impl std::error::Error for TimestampOutOfSystemRangeError {} - - #[cfg(feature = "std")] - impl TryFrom for std::time::SystemTime { - type Error = TimestampOutOfSystemRangeError; - - fn try_from(mut timestamp: Timestamp) -> Result { - let orig_timestamp = timestamp; - - timestamp.normalize(); - - let system_time = if timestamp.seconds >= 0 { - std::time::UNIX_EPOCH - .checked_add(time::Duration::from_secs(timestamp.seconds as u64)) - } else { - std::time::UNIX_EPOCH - .checked_sub(time::Duration::from_secs((-timestamp.seconds) as u64)) - }; - - let system_time = system_time.and_then(|system_time| { - system_time.checked_add(time::Duration::from_nanos(timestamp.nanos as u64)) - }); - - system_time.ok_or(TimestampOutOfSystemRangeError { - timestamp: orig_timestamp, - }) - } - } - - #[cfg(any(feature = "borsh", feature = "parity-scale-codec"))] - mod sealed { - use super::Any; - - use alloc::string::String; - use alloc::vec::Vec; - - #[cfg_attr( - feature = "parity-scale-codec", - derive( - parity_scale_codec::Encode, - parity_scale_codec::Decode, - scale_info::TypeInfo - ) - )] - #[cfg_attr( - feature = "borsh", - derive(borsh::BorshSerialize, borsh::BorshDeserialize) - )] - struct InnerAny { - pub type_url: String, - pub value: Vec, - } - - #[cfg(feature = "borsh")] - impl borsh::BorshSerialize for Any { - fn serialize(&self, writer: &mut W) -> borsh::io::Result<()> { - let inner_any = InnerAny { - type_url: self.type_url.clone(), - value: self.value.clone(), - }; - - borsh::BorshSerialize::serialize(&inner_any, writer) - } - } - - #[cfg(feature = "borsh")] - impl borsh::BorshDeserialize for Any { - fn deserialize_reader(reader: &mut R) -> borsh::io::Result { - let inner_any = InnerAny::deserialize_reader(reader)?; - - Ok(Any { - type_url: inner_any.type_url, - value: inner_any.value, - }) - } - } - - #[cfg(feature = "parity-scale-codec")] - impl parity_scale_codec::Encode for Any { - fn encode_to(&self, writer: &mut T) { - let inner_any = InnerAny { - type_url: self.type_url.clone(), - value: self.value.clone(), - }; - inner_any.encode_to(writer); - } - } - #[cfg(feature = "parity-scale-codec")] - impl parity_scale_codec::Decode for Any { - fn decode( - input: &mut I, - ) -> Result { - let inner_any = InnerAny::decode(input)?; - Ok(Any { - type_url: inner_any.type_url.clone(), - value: inner_any.value, - }) - } - } - - #[cfg(feature = "parity-scale-codec")] - impl scale_info::TypeInfo for Any { - type Identity = Self; - - fn type_info() -> scale_info::Type { - scale_info::Type::builder() - .path(scale_info::Path::new("Any", "ibc_proto::google::protobuf")) - // i128 is chosen before we represent the timestamp is nanoseconds, which is represented as a i128 by Time - .composite( - scale_info::build::Fields::named() - .field(|f| f.ty::().name("type_url").type_name("String")) - .field(|f| f.ty::>().name("value").type_name("Vec")), - ) - } - } - } -} diff --git a/src/lib.rs b/src/lib.rs index f1aaa7c1..d55f3dbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,8 +12,6 @@ #![allow(rustdoc::bare_urls)] #![forbid(unsafe_code)] -pub mod google; - pub use tendermint_proto::Error; pub use tendermint_proto::Protobuf; diff --git a/src/prost/cosmos.auth.v1beta1.rs b/src/prost/cosmos.auth.v1beta1.rs index 43a40dec..0b886cfa 100644 --- a/src/prost/cosmos.auth.v1beta1.rs +++ b/src/prost/cosmos.auth.v1beta1.rs @@ -8,7 +8,7 @@ pub struct BaseAccount { #[prost(string, tag = "1")] pub address: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option, + pub pub_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(uint64, tag = "3")] pub account_number: u64, #[prost(uint64, tag = "4")] @@ -458,7 +458,7 @@ impl ::prost::Name for QueryAccountsRequest { pub struct QueryAccountsResponse { /// accounts are the existing accounts #[prost(message, repeated, tag = "1")] - pub accounts: ::prost::alloc::vec::Vec, + pub accounts: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, /// pagination defines the pagination in the response. #[prost(message, optional, tag = "2")] pub pagination: ::core::option::Option< @@ -499,7 +499,7 @@ impl ::prost::Name for QueryAccountRequest { pub struct QueryAccountResponse { /// account defines the account of the corresponding address. #[prost(message, optional, tag = "1")] - pub account: ::core::option::Option, + pub account: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for QueryAccountResponse { const NAME: &'static str = "QueryAccountResponse"; @@ -566,7 +566,7 @@ impl ::prost::Name for QueryModuleAccountsRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryModuleAccountsResponse { #[prost(message, repeated, tag = "1")] - pub accounts: ::prost::alloc::vec::Vec, + pub accounts: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for QueryModuleAccountsResponse { const NAME: &'static str = "QueryModuleAccountsResponse"; @@ -600,7 +600,7 @@ impl ::prost::Name for QueryModuleAccountByNameRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryModuleAccountByNameResponse { #[prost(message, optional, tag = "1")] - pub account: ::core::option::Option, + pub account: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for QueryModuleAccountByNameResponse { const NAME: &'static str = "QueryModuleAccountByNameResponse"; @@ -1864,7 +1864,7 @@ pub struct GenesisState { pub params: ::core::option::Option, /// accounts are the accounts present at genesis. #[prost(message, repeated, tag = "2")] - pub accounts: ::prost::alloc::vec::Vec, + pub accounts: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for GenesisState { const NAME: &'static str = "GenesisState"; diff --git a/src/prost/cosmos.base.abci.v1beta1.rs b/src/prost/cosmos.base.abci.v1beta1.rs index 6a9a1b96..5a445a56 100644 --- a/src/prost/cosmos.base.abci.v1beta1.rs +++ b/src/prost/cosmos.base.abci.v1beta1.rs @@ -37,7 +37,7 @@ pub struct TxResponse { pub gas_used: i64, /// The request transaction bytes. #[prost(message, optional, tag = "11")] - pub tx: ::core::option::Option, + pub tx: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// Time of the previous block. For heights > 1, it's the weighted median of /// the timestamps of the valid votes in the block.LastCommit. For height == 1, /// it's genesis time. @@ -169,7 +169,7 @@ pub struct Result { /// Since: cosmos-sdk 0.46 #[prost(message, repeated, tag = "4")] pub msg_responses: ::prost::alloc::vec::Vec< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for Result { @@ -236,7 +236,7 @@ pub struct TxMsgData { /// Since: cosmos-sdk 0.46 #[prost(message, repeated, tag = "2")] pub msg_responses: ::prost::alloc::vec::Vec< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for TxMsgData { diff --git a/src/prost/cosmos.base.tendermint.v1beta1.rs b/src/prost/cosmos.base.tendermint.v1beta1.rs index 5c4bee50..3db44e40 100644 --- a/src/prost/cosmos.base.tendermint.v1beta1.rs +++ b/src/prost/cosmos.base.tendermint.v1beta1.rs @@ -35,9 +35,7 @@ pub struct Header { #[prost(int64, tag = "3")] pub height: i64, #[prost(message, optional, tag = "4")] - pub time: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, - >, + pub time: ::core::option::Option<::tendermint_proto::google::protobuf::Timestamp>, /// prev block info #[prost(message, optional, tag = "5")] pub last_block_id: ::core::option::Option<::tendermint_proto::types::BlockId>, @@ -178,9 +176,7 @@ pub struct Validator { #[prost(string, tag = "1")] pub address: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub pub_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(int64, tag = "3")] pub voting_power: i64, #[prost(int64, tag = "4")] diff --git a/src/prost/cosmos.crypto.keyring.v1.rs b/src/prost/cosmos.crypto.keyring.v1.rs index 22ead0d6..ec40ada8 100644 --- a/src/prost/cosmos.crypto.keyring.v1.rs +++ b/src/prost/cosmos.crypto.keyring.v1.rs @@ -8,9 +8,7 @@ pub struct Record { pub name: ::prost::alloc::string::String, /// pub_key represents a public key in any format #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub pub_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// Record contains one of the following items #[prost(oneof = "record::Item", tags = "3, 4, 5, 6")] pub item: ::core::option::Option, @@ -23,9 +21,7 @@ pub mod record { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Local { #[prost(message, optional, tag = "1")] - pub priv_key: ::core::option::Option< - super::super::super::super::super::google::protobuf::Any, - >, + pub priv_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for Local { const NAME: &'static str = "Local"; diff --git a/src/prost/cosmos.crypto.multisig.rs b/src/prost/cosmos.crypto.multisig.rs index c799f002..207e7260 100644 --- a/src/prost/cosmos.crypto.multisig.rs +++ b/src/prost/cosmos.crypto.multisig.rs @@ -8,9 +8,7 @@ pub struct LegacyAminoPubKey { #[prost(uint32, tag = "1")] pub threshold: u32, #[prost(message, repeated, tag = "2")] - pub public_keys: ::prost::alloc::vec::Vec< - super::super::super::google::protobuf::Any, - >, + pub public_keys: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for LegacyAminoPubKey { const NAME: &'static str = "LegacyAminoPubKey"; diff --git a/src/prost/cosmos.gov.v1.rs b/src/prost/cosmos.gov.v1.rs index b7086b3b..728fc705 100644 --- a/src/prost/cosmos.gov.v1.rs +++ b/src/prost/cosmos.gov.v1.rs @@ -54,7 +54,7 @@ pub struct Proposal { pub id: u64, /// messages are the arbitrary messages to be executed if the proposal passes. #[prost(message, repeated, tag = "2")] - pub messages: ::prost::alloc::vec::Vec, + pub messages: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, /// status defines the proposal status. #[prost(enumeration = "ProposalStatus", tag = "3")] pub status: i32, @@ -66,12 +66,12 @@ pub struct Proposal { /// submit_time is the time of proposal submission. #[prost(message, optional, tag = "5")] pub submit_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// deposit_end_time is the end time for deposition. #[prost(message, optional, tag = "6")] pub deposit_end_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// total_deposit is the total deposit on the proposal. #[prost(message, repeated, tag = "7")] @@ -79,12 +79,12 @@ pub struct Proposal { /// voting_start_time is the starting time to vote on a proposal. #[prost(message, optional, tag = "8")] pub voting_start_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// voting_end_time is the end time of voting on a proposal. #[prost(message, optional, tag = "9")] pub voting_end_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// metadata is any arbitrary metadata attached to the proposal. #[prost(string, tag = "10")] @@ -181,7 +181,7 @@ pub struct DepositParams { /// months. #[prost(message, optional, tag = "2")] pub max_deposit_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, } impl ::prost::Name for DepositParams { @@ -201,7 +201,7 @@ pub struct VotingParams { /// Duration of the voting period. #[prost(message, optional, tag = "1")] pub voting_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, } impl ::prost::Name for VotingParams { @@ -253,12 +253,12 @@ pub struct Params { /// months. #[prost(message, optional, tag = "2")] pub max_deposit_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Duration of the voting period. #[prost(message, optional, tag = "3")] pub voting_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Minimum percentage of total stake needed to vote for a result to be /// considered valid. @@ -392,7 +392,7 @@ impl ProposalStatus { pub struct MsgSubmitProposal { /// messages are the arbitrary messages to be executed if proposal passes. #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec, + pub messages: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, /// initial_deposit is the deposit value that must be paid at proposal submission. #[prost(message, repeated, tag = "2")] pub initial_deposit: ::prost::alloc::vec::Vec, @@ -448,7 +448,7 @@ impl ::prost::Name for MsgSubmitProposalResponse { pub struct MsgExecLegacyContent { /// content is the proposal's content. #[prost(message, optional, tag = "1")] - pub content: ::core::option::Option, + pub content: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// authority must be the gov module address. #[prost(string, tag = "2")] pub authority: ::prost::alloc::string::String, diff --git a/src/prost/cosmos.gov.v1beta1.rs b/src/prost/cosmos.gov.v1beta1.rs index 4028f192..4ebad1a4 100644 --- a/src/prost/cosmos.gov.v1beta1.rs +++ b/src/prost/cosmos.gov.v1beta1.rs @@ -78,7 +78,7 @@ pub struct Proposal { pub proposal_id: u64, /// content is the proposal's content. #[prost(message, optional, tag = "2")] - pub content: ::core::option::Option, + pub content: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// status defines the proposal status. #[prost(enumeration = "ProposalStatus", tag = "3")] pub status: i32, @@ -90,12 +90,12 @@ pub struct Proposal { /// submit_time is the time of proposal submission. #[prost(message, optional, tag = "5")] pub submit_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// deposit_end_time is the end time for deposition. #[prost(message, optional, tag = "6")] pub deposit_end_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// total_deposit is the total deposit on the proposal. #[prost(message, repeated, tag = "7")] @@ -103,12 +103,12 @@ pub struct Proposal { /// voting_start_time is the starting time to vote on a proposal. #[prost(message, optional, tag = "8")] pub voting_start_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// voting_end_time is the end time of voting on a proposal. #[prost(message, optional, tag = "9")] pub voting_end_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for Proposal { @@ -192,7 +192,7 @@ pub struct DepositParams { /// months. #[prost(message, optional, tag = "2")] pub max_deposit_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, } impl ::prost::Name for DepositParams { @@ -212,7 +212,7 @@ pub struct VotingParams { /// Duration of the voting period. #[prost(message, optional, tag = "1")] pub voting_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, } impl ::prost::Name for VotingParams { @@ -349,7 +349,7 @@ impl ProposalStatus { pub struct MsgSubmitProposal { /// content is the proposal's content. #[prost(message, optional, tag = "1")] - pub content: ::core::option::Option, + pub content: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// initial_deposit is the deposit value that must be paid at proposal submission. #[prost(message, repeated, tag = "2")] pub initial_deposit: ::prost::alloc::vec::Vec, diff --git a/src/prost/cosmos.staking.v1beta1.rs b/src/prost/cosmos.staking.v1beta1.rs index 2a92fb35..12664b88 100644 --- a/src/prost/cosmos.staking.v1beta1.rs +++ b/src/prost/cosmos.staking.v1beta1.rs @@ -56,7 +56,7 @@ pub struct Commission { /// update_time is the last time the commission rate was changed. #[prost(message, optional, tag = "2")] pub update_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for Commission { @@ -116,7 +116,7 @@ pub struct Validator { /// consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. #[prost(message, optional, tag = "2")] pub consensus_pubkey: ::core::option::Option< - super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// jailed defined whether the validator has been jailed from bonded status or not. #[prost(bool, tag = "3")] @@ -139,7 +139,7 @@ pub struct Validator { /// unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. #[prost(message, optional, tag = "9")] pub unbonding_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// commission defines the commission parameters. #[prost(message, optional, tag = "10")] @@ -325,7 +325,7 @@ pub struct UnbondingDelegationEntry { /// completion_time is the unix time for unbonding completion. #[prost(message, optional, tag = "2")] pub completion_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// initial_balance defines the tokens initially scheduled to receive at completion. #[prost(string, tag = "3")] @@ -360,7 +360,7 @@ pub struct RedelegationEntry { /// completion_time defines the unix time for redelegation completion. #[prost(message, optional, tag = "2")] pub completion_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// initial_balance defines the initial balance when redelegation started. #[prost(string, tag = "3")] @@ -422,7 +422,7 @@ pub struct Params { /// unbonding_time is the time duration of unbonding. #[prost(message, optional, tag = "1")] pub unbonding_time: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// max_validators is the maximum number of validators. #[prost(uint32, tag = "2")] @@ -668,7 +668,7 @@ pub struct MsgCreateValidator { #[prost(string, tag = "5")] pub validator_address: ::prost::alloc::string::String, #[prost(message, optional, tag = "6")] - pub pubkey: ::core::option::Option, + pub pubkey: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(message, optional, tag = "7")] pub value: ::core::option::Option, } @@ -803,7 +803,7 @@ impl ::prost::Name for MsgBeginRedelegate { pub struct MsgBeginRedelegateResponse { #[prost(message, optional, tag = "1")] pub completion_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for MsgBeginRedelegateResponse { @@ -844,7 +844,7 @@ impl ::prost::Name for MsgUndelegate { pub struct MsgUndelegateResponse { #[prost(message, optional, tag = "1")] pub completion_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for MsgUndelegateResponse { diff --git a/src/prost/cosmos.tx.signing.v1beta1.rs b/src/prost/cosmos.tx.signing.v1beta1.rs index 0a203e9c..d956303e 100644 --- a/src/prost/cosmos.tx.signing.v1beta1.rs +++ b/src/prost/cosmos.tx.signing.v1beta1.rs @@ -26,9 +26,7 @@ impl ::prost::Name for SignatureDescriptors { pub struct SignatureDescriptor { /// public_key is the public key of the signer #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub public_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(message, optional, tag = "2")] pub data: ::core::option::Option, /// sequence is the sequence of the account, which describes the diff --git a/src/prost/cosmos.tx.v1beta1.rs b/src/prost/cosmos.tx.v1beta1.rs index 1d16a55c..f70a32d3 100644 --- a/src/prost/cosmos.tx.v1beta1.rs +++ b/src/prost/cosmos.tx.v1beta1.rs @@ -102,7 +102,7 @@ pub struct SignDocDirectAux { pub body_bytes: ::prost::alloc::vec::Vec, /// public_key is the public key of the signing account. #[prost(message, optional, tag = "2")] - pub public_key: ::core::option::Option, + pub public_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// chain_id is the identifier of the chain this transaction targets. /// It prevents signed transactions from being used on another chain by an /// attacker. @@ -145,7 +145,7 @@ pub struct TxBody { /// is referred to as the primary signer and pays the fee for the whole /// transaction. #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec, + pub messages: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, /// memo is any arbitrary note/comment to be added to the transaction. /// WARNING: in clients, any publicly exposed text should not be called memo, /// but should be called `note` instead (see ). @@ -160,14 +160,14 @@ pub struct TxBody { /// and can't be handled, the transaction will be rejected #[prost(message, repeated, tag = "1023")] pub extension_options: ::prost::alloc::vec::Vec< - super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// extension_options are arbitrary options that can be added by chains /// when the default options are not sufficient. If any of these are present /// and can't be handled, they will be ignored #[prost(message, repeated, tag = "2047")] pub non_critical_extension_options: ::prost::alloc::vec::Vec< - super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for TxBody { @@ -225,7 +225,7 @@ pub struct SignerInfo { /// that already exist in state. If unset, the verifier can use the required \ /// signer address for this position and lookup the public key. #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option, + pub public_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// mode_info describes the signing mode of the signer and is a nested /// structure to support nested multisig pubkey's #[prost(message, optional, tag = "2")] diff --git a/src/prost/cosmos.upgrade.v1beta1.rs b/src/prost/cosmos.upgrade.v1beta1.rs index cf8a8825..f0a4c981 100644 --- a/src/prost/cosmos.upgrade.v1beta1.rs +++ b/src/prost/cosmos.upgrade.v1beta1.rs @@ -17,7 +17,7 @@ pub struct Plan { /// If this field is not empty, an error will be thrown. #[deprecated] #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, + pub time: ::core::option::Option<::tendermint_proto::google::protobuf::Timestamp>, /// The height at which the upgrade must be performed. #[prost(int64, tag = "3")] pub height: i64, @@ -31,7 +31,7 @@ pub struct Plan { #[deprecated] #[prost(message, optional, tag = "5")] pub upgraded_client_state: ::core::option::Option< - super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for Plan { diff --git a/src/prost/google.api.rs b/src/prost/google.api.rs deleted file mode 100644 index 08318f49..00000000 --- a/src/prost/google.api.rs +++ /dev/null @@ -1,402 +0,0 @@ -// This file is @generated by prost-build. -/// Defines the HTTP configuration for an API service. It contains a list of -/// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -/// to one or more HTTP REST API methods. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Http { - /// A list of HTTP configuration rules that apply to individual API methods. - /// - /// **NOTE:** All service configuration rules follow "last one wins" order. - #[prost(message, repeated, tag = "1")] - pub rules: ::prost::alloc::vec::Vec, - /// When set to true, URL path parameters will be fully URI-decoded except in - /// cases of single segment matches in reserved expansion, where "%2F" will be - /// left encoded. - /// - /// The default behavior is to not decode RFC 6570 reserved characters in multi - /// segment matches. - #[prost(bool, tag = "2")] - pub fully_decode_reserved_expansion: bool, -} -impl ::prost::Name for Http { - const NAME: &'static str = "Http"; - const PACKAGE: &'static str = "google.api"; - fn full_name() -> ::prost::alloc::string::String { - "google.api.Http".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.api.Http".into() - } -} -/// # gRPC Transcoding -/// -/// gRPC Transcoding is a feature for mapping between a gRPC method and one or -/// more HTTP REST endpoints. It allows developers to build a single API service -/// that supports both gRPC APIs and REST APIs. Many systems, including [Google -/// APIs](), -/// [Cloud Endpoints](), [gRPC -/// Gateway](), -/// and [Envoy]() proxy support this feature -/// and use it for large scale production services. -/// -/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies -/// how different portions of the gRPC request message are mapped to the URL -/// path, URL query parameters, and HTTP request body. It also controls how the -/// gRPC response message is mapped to the HTTP response body. `HttpRule` is -/// typically specified as an `google.api.http` annotation on the gRPC method. -/// -/// Each mapping specifies a URL path template and an HTTP method. The path -/// template may refer to one or more fields in the gRPC request message, as long -/// as each field is a non-repeated field with a primitive (non-message) type. -/// The path template controls how fields of the request message are mapped to -/// the URL path. -/// -/// Example: -/// -/// service Messaging { -/// rpc GetMessage(GetMessageRequest) returns (Message) { -/// option (google.api.http) = { -/// get: "/v1/{name=messages/*}" -/// }; -/// } -/// } -/// message GetMessageRequest { -/// string name = 1; // Mapped to URL path. -/// } -/// message Message { -/// string text = 1; // The resource content. -/// } -/// -/// This enables an HTTP REST to gRPC mapping as below: -/// -/// HTTP | gRPC -/// -----|----- -/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` -/// -/// Any fields in the request message which are not bound by the path template -/// automatically become HTTP query parameters if there is no HTTP request body. -/// For example: -/// -/// service Messaging { -/// rpc GetMessage(GetMessageRequest) returns (Message) { -/// option (google.api.http) = { -/// get:"/v1/messages/{message_id}" -/// }; -/// } -/// } -/// message GetMessageRequest { -/// message SubMessage { -/// string subfield = 1; -/// } -/// string message_id = 1; // Mapped to URL path. -/// int64 revision = 2; // Mapped to URL query parameter `revision`. -/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. -/// } -/// -/// This enables a HTTP JSON to RPC mapping as below: -/// -/// HTTP | gRPC -/// -----|----- -/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | -/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: -/// "foo"))` -/// -/// Note that fields which are mapped to URL query parameters must have a -/// primitive type or a repeated primitive type or a non-repeated message type. -/// In the case of a repeated type, the parameter can be repeated in the URL -/// as `...?param=A¶m=B`. In the case of a message type, each field of the -/// message is mapped to a separate parameter, such as -/// `...?foo.a=A&foo.b=B&foo.c=C`. -/// -/// For HTTP methods that allow a request body, the `body` field -/// specifies the mapping. Consider a REST update method on the -/// message resource collection: -/// -/// service Messaging { -/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -/// option (google.api.http) = { -/// patch: "/v1/messages/{message_id}" -/// body: "message" -/// }; -/// } -/// } -/// message UpdateMessageRequest { -/// string message_id = 1; // mapped to the URL -/// Message message = 2; // mapped to the body -/// } -/// -/// The following HTTP JSON to RPC mapping is enabled, where the -/// representation of the JSON in the request body is determined by -/// protos JSON encoding: -/// -/// HTTP | gRPC -/// -----|----- -/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -/// "123456" message { text: "Hi!" })` -/// -/// The special name `*` can be used in the body mapping to define that -/// every field not bound by the path template should be mapped to the -/// request body. This enables the following alternative definition of -/// the update method: -/// -/// service Messaging { -/// rpc UpdateMessage(Message) returns (Message) { -/// option (google.api.http) = { -/// patch: "/v1/messages/{message_id}" -/// body: "*" -/// }; -/// } -/// } -/// message Message { -/// string message_id = 1; -/// string text = 2; -/// } -/// -/// -/// The following HTTP JSON to RPC mapping is enabled: -/// -/// HTTP | gRPC -/// -----|----- -/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -/// "123456" text: "Hi!")` -/// -/// Note that when using `*` in the body mapping, it is not possible to -/// have HTTP parameters, as all fields not bound by the path end in -/// the body. This makes this option more rarely used in practice when -/// defining REST APIs. The common usage of `*` is in custom methods -/// which don't use the URL at all for transferring data. -/// -/// It is possible to define multiple HTTP methods for one RPC by using -/// the `additional_bindings` option. Example: -/// -/// service Messaging { -/// rpc GetMessage(GetMessageRequest) returns (Message) { -/// option (google.api.http) = { -/// get: "/v1/messages/{message_id}" -/// additional_bindings { -/// get: "/v1/users/{user_id}/messages/{message_id}" -/// } -/// }; -/// } -/// } -/// message GetMessageRequest { -/// string message_id = 1; -/// string user_id = 2; -/// } -/// -/// This enables the following two alternative HTTP JSON to RPC mappings: -/// -/// HTTP | gRPC -/// -----|----- -/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: -/// "123456")` -/// -/// ## Rules for HTTP mapping -/// -/// 1. Leaf request fields (recursive expansion nested messages in the request -/// message) are classified into three categories: -/// - Fields referred by the path template. They are passed via the URL path. -/// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They -/// are passed via the HTTP -/// request body. -/// - All other fields are passed via the URL query parameters, and the -/// parameter name is the field path in the request message. A repeated -/// field can be represented as multiple query parameters under the same -/// name. -/// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL -/// query parameter, all fields -/// are passed via URL path and HTTP request body. -/// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP -/// request body, all -/// fields are passed via URL path and URL query parameters. -/// -/// ### Path template syntax -/// -/// Template = "/" Segments \[ Verb \] ; -/// Segments = Segment { "/" Segment } ; -/// Segment = "*" | "**" | LITERAL | Variable ; -/// Variable = "{" FieldPath \[ "=" Segments \] "}" ; -/// FieldPath = IDENT { "." IDENT } ; -/// Verb = ":" LITERAL ; -/// -/// The syntax `*` matches a single URL path segment. The syntax `**` matches -/// zero or more URL path segments, which must be the last part of the URL path -/// except the `Verb`. -/// -/// The syntax `Variable` matches part of the URL path as specified by its -/// template. A variable template must not contain other variables. If a variable -/// matches a single path segment, its template may be omitted, e.g. `{var}` -/// is equivalent to `{var=*}`. -/// -/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` -/// contains any reserved character, such characters should be percent-encoded -/// before the matching. -/// -/// If a variable contains exactly one path segment, such as `"{var}"` or -/// `"{var=*}"`, when such a variable is expanded into a URL path on the client -/// side, all characters except `\[-_.~0-9a-zA-Z\]` are percent-encoded. The -/// server side does the reverse decoding. Such variables show up in the -/// [Discovery -/// Document]() as -/// `{var}`. -/// -/// If a variable contains multiple path segments, such as `"{var=foo/*}"` -/// or `"{var=**}"`, when such a variable is expanded into a URL path on the -/// client side, all characters except `\[-_.~/0-9a-zA-Z\]` are percent-encoded. -/// The server side does the reverse decoding, except "%2F" and "%2f" are left -/// unchanged. Such variables show up in the -/// [Discovery -/// Document]() as -/// `{+var}`. -/// -/// ## Using gRPC API Service Configuration -/// -/// gRPC API Service Configuration (service config) is a configuration language -/// for configuring a gRPC service to become a user-facing product. The -/// service config is simply the YAML representation of the `google.api.Service` -/// proto message. -/// -/// As an alternative to annotating your proto file, you can configure gRPC -/// transcoding in your service config YAML files. You do this by specifying a -/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same -/// effect as the proto annotation. This can be particularly useful if you -/// have a proto that is reused in multiple services. Note that any transcoding -/// specified in the service config will override any matching transcoding -/// configuration in the proto. -/// -/// Example: -/// -/// http: -/// rules: -/// # Selects a gRPC method and applies HttpRule to it. -/// - selector: example.v1.Messaging.GetMessage -/// get: /v1/messages/{message_id}/{sub.subfield} -/// -/// ## Special notes -/// -/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the -/// proto to JSON conversion must follow the [proto3 -/// specification](). -/// -/// While the single segment variable follows the semantics of -/// [RFC 6570]() Section 3.2.2 Simple String -/// Expansion, the multi segment variable **does not** follow RFC 6570 Section -/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion -/// does not expand special characters like `?` and `#`, which would lead -/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding -/// for multi segment variables. -/// -/// The path variables **must not** refer to any repeated or mapped field, -/// because client libraries are not capable of handling such variable expansion. -/// -/// The path variables **must not** capture the leading "/" character. The reason -/// is that the most common use case "{var}" does not capture the leading "/" -/// character. For consistency, all path variables must share the same behavior. -/// -/// Repeated message fields must not be mapped to URL query parameters, because -/// no client library can support such complicated mapping. -/// -/// If an API needs to use a JSON array for request or response body, it can map -/// the request or response body to a repeated field. However, some gRPC -/// Transcoding implementations may not support this feature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct HttpRule { - /// Selects a method to which this rule applies. - /// - /// Refer to [selector][google.api.DocumentationRule.selector] for syntax - /// details. - #[prost(string, tag = "1")] - pub selector: ::prost::alloc::string::String, - /// The name of the request field whose value is mapped to the HTTP request - /// body, or `*` for mapping all request fields not captured by the path - /// pattern to the HTTP body, or omitted for not having any HTTP request body. - /// - /// NOTE: the referred field must be present at the top-level of the request - /// message type. - #[prost(string, tag = "7")] - pub body: ::prost::alloc::string::String, - /// Optional. The name of the response field whose value is mapped to the HTTP - /// response body. When omitted, the entire response message will be used - /// as the HTTP response body. - /// - /// NOTE: The referred field must be present at the top-level of the response - /// message type. - #[prost(string, tag = "12")] - pub response_body: ::prost::alloc::string::String, - /// Additional HTTP bindings for the selector. Nested bindings must - /// not contain an `additional_bindings` field themselves (that is, - /// the nesting may only be one level deep). - #[prost(message, repeated, tag = "11")] - pub additional_bindings: ::prost::alloc::vec::Vec, - /// Determines the URL pattern is matched by this rules. This pattern can be - /// used with any of the {get|put|post|delete|patch} methods. A custom method - /// can be defined using the 'custom' field. - #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] - pub pattern: ::core::option::Option, -} -/// Nested message and enum types in `HttpRule`. -pub mod http_rule { - /// Determines the URL pattern is matched by this rules. This pattern can be - /// used with any of the {get|put|post|delete|patch} methods. A custom method - /// can be defined using the 'custom' field. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Pattern { - /// Maps to HTTP GET. Used for listing and getting information about - /// resources. - #[prost(string, tag = "2")] - Get(::prost::alloc::string::String), - /// Maps to HTTP PUT. Used for replacing a resource. - #[prost(string, tag = "3")] - Put(::prost::alloc::string::String), - /// Maps to HTTP POST. Used for creating a resource or performing an action. - #[prost(string, tag = "4")] - Post(::prost::alloc::string::String), - /// Maps to HTTP DELETE. Used for deleting a resource. - #[prost(string, tag = "5")] - Delete(::prost::alloc::string::String), - /// Maps to HTTP PATCH. Used for updating a resource. - #[prost(string, tag = "6")] - Patch(::prost::alloc::string::String), - /// The custom pattern is used for specifying an HTTP method that is not - /// included in the `pattern` field, such as HEAD, or "*" to leave the - /// HTTP method unspecified for this rule. The wild-card rule is useful - /// for services that provide content to Web (HTML) clients. - #[prost(message, tag = "8")] - Custom(super::CustomHttpPattern), - } -} -impl ::prost::Name for HttpRule { - const NAME: &'static str = "HttpRule"; - const PACKAGE: &'static str = "google.api"; - fn full_name() -> ::prost::alloc::string::String { - "google.api.HttpRule".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.api.HttpRule".into() - } -} -/// A custom pattern is used for defining custom HTTP verb. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct CustomHttpPattern { - /// The name of this custom HTTP verb. - #[prost(string, tag = "1")] - pub kind: ::prost::alloc::string::String, - /// The path matched by this custom verb. - #[prost(string, tag = "2")] - pub path: ::prost::alloc::string::String, -} -impl ::prost::Name for CustomHttpPattern { - const NAME: &'static str = "CustomHttpPattern"; - const PACKAGE: &'static str = "google.api"; - fn full_name() -> ::prost::alloc::string::String { - "google.api.CustomHttpPattern".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.api.CustomHttpPattern".into() - } -} diff --git a/src/prost/google.api.serde.rs b/src/prost/google.api.serde.rs deleted file mode 100644 index 9e4882b4..00000000 --- a/src/prost/google.api.serde.rs +++ /dev/null @@ -1,443 +0,0 @@ -impl serde::Serialize for CustomHttpPattern { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.api.CustomHttpPattern", len)?; - if true { - struct_ser.serialize_field("kind", &self.kind)?; - } - if true { - struct_ser.serialize_field("path", &self.path)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for CustomHttpPattern { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "kind", - "path", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Kind, - Path, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "kind" => Ok(GeneratedField::Kind), - "path" => Ok(GeneratedField::Path), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = CustomHttpPattern; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.api.CustomHttpPattern") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut kind__ = None; - let mut path__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Kind => { - if kind__.is_some() { - return Err(serde::de::Error::duplicate_field("kind")); - } - kind__ = Some(map_.next_value()?); - } - GeneratedField::Path => { - if path__.is_some() { - return Err(serde::de::Error::duplicate_field("path")); - } - path__ = Some(map_.next_value()?); - } - } - } - Ok(CustomHttpPattern { - kind: kind__.unwrap_or_default(), - path: path__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.api.CustomHttpPattern", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for Http { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.api.Http", len)?; - if true { - struct_ser.serialize_field("rules", &self.rules)?; - } - if true { - struct_ser.serialize_field("fullyDecodeReservedExpansion", &self.fully_decode_reserved_expansion)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for Http { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "rules", - "fully_decode_reserved_expansion", - "fullyDecodeReservedExpansion", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Rules, - FullyDecodeReservedExpansion, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "rules" => Ok(GeneratedField::Rules), - "fullyDecodeReservedExpansion" | "fully_decode_reserved_expansion" => Ok(GeneratedField::FullyDecodeReservedExpansion), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Http; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.api.Http") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut rules__ = None; - let mut fully_decode_reserved_expansion__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Rules => { - if rules__.is_some() { - return Err(serde::de::Error::duplicate_field("rules")); - } - rules__ = Some(map_.next_value()?); - } - GeneratedField::FullyDecodeReservedExpansion => { - if fully_decode_reserved_expansion__.is_some() { - return Err(serde::de::Error::duplicate_field("fullyDecodeReservedExpansion")); - } - fully_decode_reserved_expansion__ = Some(map_.next_value()?); - } - } - } - Ok(Http { - rules: rules__.unwrap_or_default(), - fully_decode_reserved_expansion: fully_decode_reserved_expansion__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.api.Http", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for HttpRule { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if self.pattern.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.api.HttpRule", len)?; - if true { - struct_ser.serialize_field("selector", &self.selector)?; - } - if true { - struct_ser.serialize_field("body", &self.body)?; - } - if true { - struct_ser.serialize_field("responseBody", &self.response_body)?; - } - if true { - struct_ser.serialize_field("additionalBindings", &self.additional_bindings)?; - } - if let Some(v) = self.pattern.as_ref() { - match v { - http_rule::Pattern::Get(v) => { - struct_ser.serialize_field("get", v)?; - } - http_rule::Pattern::Put(v) => { - struct_ser.serialize_field("put", v)?; - } - http_rule::Pattern::Post(v) => { - struct_ser.serialize_field("post", v)?; - } - http_rule::Pattern::Delete(v) => { - struct_ser.serialize_field("delete", v)?; - } - http_rule::Pattern::Patch(v) => { - struct_ser.serialize_field("patch", v)?; - } - http_rule::Pattern::Custom(v) => { - struct_ser.serialize_field("custom", v)?; - } - } - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for HttpRule { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "selector", - "body", - "response_body", - "responseBody", - "additional_bindings", - "additionalBindings", - "get", - "put", - "post", - "delete", - "patch", - "custom", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Selector, - Body, - ResponseBody, - AdditionalBindings, - Get, - Put, - Post, - Delete, - Patch, - Custom, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "selector" => Ok(GeneratedField::Selector), - "body" => Ok(GeneratedField::Body), - "responseBody" | "response_body" => Ok(GeneratedField::ResponseBody), - "additionalBindings" | "additional_bindings" => Ok(GeneratedField::AdditionalBindings), - "get" => Ok(GeneratedField::Get), - "put" => Ok(GeneratedField::Put), - "post" => Ok(GeneratedField::Post), - "delete" => Ok(GeneratedField::Delete), - "patch" => Ok(GeneratedField::Patch), - "custom" => Ok(GeneratedField::Custom), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = HttpRule; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.api.HttpRule") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut selector__ = None; - let mut body__ = None; - let mut response_body__ = None; - let mut additional_bindings__ = None; - let mut pattern__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Selector => { - if selector__.is_some() { - return Err(serde::de::Error::duplicate_field("selector")); - } - selector__ = Some(map_.next_value()?); - } - GeneratedField::Body => { - if body__.is_some() { - return Err(serde::de::Error::duplicate_field("body")); - } - body__ = Some(map_.next_value()?); - } - GeneratedField::ResponseBody => { - if response_body__.is_some() { - return Err(serde::de::Error::duplicate_field("responseBody")); - } - response_body__ = Some(map_.next_value()?); - } - GeneratedField::AdditionalBindings => { - if additional_bindings__.is_some() { - return Err(serde::de::Error::duplicate_field("additionalBindings")); - } - additional_bindings__ = Some(map_.next_value()?); - } - GeneratedField::Get => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("get")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Get); - } - GeneratedField::Put => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("put")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Put); - } - GeneratedField::Post => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("post")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Post); - } - GeneratedField::Delete => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("delete")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Delete); - } - GeneratedField::Patch => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("patch")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Patch); - } - GeneratedField::Custom => { - if pattern__.is_some() { - return Err(serde::de::Error::duplicate_field("custom")); - } - pattern__ = map_.next_value::<::core::option::Option<_>>()?.map(http_rule::Pattern::Custom) -; - } - } - } - Ok(HttpRule { - selector: selector__.unwrap_or_default(), - body: body__.unwrap_or_default(), - response_body: response_body__.unwrap_or_default(), - additional_bindings: additional_bindings__.unwrap_or_default(), - pattern: pattern__, - }) - } - } - deserializer.deserialize_struct("google.api.HttpRule", FIELDS, GeneratedVisitor) - } -} diff --git a/src/prost/google.protobuf.rs b/src/prost/google.protobuf.rs deleted file mode 100644 index 4822b53e..00000000 --- a/src/prost/google.protobuf.rs +++ /dev/null @@ -1,2551 +0,0 @@ -// This file is @generated by prost-build. -/// `Any` contains an arbitrary serialized protocol buffer message along with a -/// URL that describes the type of the serialized message. -/// -/// Protobuf library provides support to pack/unpack Any values in the form -/// of utility functions or additional generated methods of the Any type. -/// -/// Example 1: Pack and unpack a message in C++. -/// -/// Foo foo = ...; -/// Any any; -/// any.PackFrom(foo); -/// ... -/// if (any.UnpackTo(&foo)) { -/// ... -/// } -/// -/// Example 2: Pack and unpack a message in Java. -/// -/// Foo foo = ...; -/// Any any = Any.pack(foo); -/// ... -/// if (any.is(Foo.class)) { -/// foo = any.unpack(Foo.class); -/// } -/// // or ... -/// if (any.isSameTypeAs(Foo.getDefaultInstance())) { -/// foo = any.unpack(Foo.getDefaultInstance()); -/// } -/// -/// Example 3: Pack and unpack a message in Python. -/// -/// foo = Foo(...) -/// any = Any() -/// any.Pack(foo) -/// ... -/// if any.Is(Foo.DESCRIPTOR): -/// any.Unpack(foo) -/// ... -/// -/// Example 4: Pack and unpack a message in Go -/// -/// foo := &pb.Foo{...} -/// any, err := anypb.New(foo) -/// if err != nil { -/// ... -/// } -/// ... -/// foo := &pb.Foo{} -/// if err := any.UnmarshalTo(foo); err != nil { -/// ... -/// } -/// -/// The pack methods provided by protobuf library will by default use -/// 'type.googleapis.com/full.type.name' as the type URL and the unpack -/// methods only use the fully qualified type name after the last '/' -/// in the type URL, for example "foo.bar.com/x/y.z" will yield type -/// name "y.z". -/// -/// JSON -/// ==== -/// The JSON representation of an `Any` value uses the regular -/// representation of the deserialized, embedded message, with an -/// additional field `@type` which contains the type URL. Example: -/// -/// package google.profile; -/// message Person { -/// string first_name = 1; -/// string last_name = 2; -/// } -/// -/// { -/// "@type": "type.googleapis.com/google.profile.Person", -/// "firstName": , -/// "lastName": -/// } -/// -/// If the embedded message type is well-known and has a custom JSON -/// representation, that representation will be embedded adding a field -/// `value` which holds the custom JSON in addition to the `@type` -/// field. Example (for message [google.protobuf.Duration][]): -/// -/// { -/// "@type": "type.googleapis.com/google.protobuf.Duration", -/// "value": "1.212s" -/// } -/// -#[derive(Eq)] -#[cfg_attr( - all(feature = "json-schema", feature = "serde"), - derive(::schemars::JsonSchema) -)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Any { - /// A URL/resource name that uniquely identifies the type of the serialized - /// protocol buffer message. This string must contain at least - /// one "/" character. The last segment of the URL's path must represent - /// the fully qualified name of the type (as in - /// `path/google.protobuf.Duration`). The name should be in a canonical form - /// (e.g., leading "." is not accepted). - /// - /// In practice, teams usually precompile into the binary all types that they - /// expect it to use in the context of Any. However, for URLs which use the - /// scheme `http`, `https`, or no scheme, one can optionally set up a type - /// server that maps type URLs to message definitions as follows: - /// - /// * If no scheme is provided, `https` is assumed. - /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] - /// value in binary format, or produce an error. - /// * Applications are allowed to cache lookup results based on the - /// URL, or have them precompiled into a binary to avoid any - /// lookup. Therefore, binary compatibility needs to be preserved - /// on changes to types. (Use versioned type names to manage - /// breaking changes.) - /// - /// Note: this functionality is not currently available in the official - /// protobuf release, and it is not used for type URLs beginning with - /// type.googleapis.com. As of May 2023, there are no widely used type server - /// implementations and no plans to implement one. - /// - /// Schemes other than `http`, `https` (or the empty scheme) might be - /// used with implementation specific semantics. - /// - #[prost(string, tag = "1")] - pub type_url: ::prost::alloc::string::String, - /// Must be a valid serialized protocol buffer of the above specified type. - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for Any { - const NAME: &'static str = "Any"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.Any".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.Any".into() - } -} -/// The protocol compiler can output a FileDescriptorSet containing the .proto -/// files it parses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FileDescriptorSet { - #[prost(message, repeated, tag = "1")] - pub file: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for FileDescriptorSet { - const NAME: &'static str = "FileDescriptorSet"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FileDescriptorSet".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FileDescriptorSet".into() - } -} -/// Describes a complete .proto file. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FileDescriptorProto { - /// file name, relative to root of source tree - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - /// e.g. "foo", "foo.bar", etc. - #[prost(string, optional, tag = "2")] - pub package: ::core::option::Option<::prost::alloc::string::String>, - /// Names of files imported by this file. - #[prost(string, repeated, tag = "3")] - pub dependency: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Indexes of the public imported files in the dependency list above. - #[prost(int32, repeated, packed = "false", tag = "10")] - pub public_dependency: ::prost::alloc::vec::Vec, - /// Indexes of the weak imported files in the dependency list. - /// For Google-internal migration only. Do not use. - #[prost(int32, repeated, packed = "false", tag = "11")] - pub weak_dependency: ::prost::alloc::vec::Vec, - /// All top-level definitions in this file. - #[prost(message, repeated, tag = "4")] - pub message_type: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub enum_type: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "6")] - pub service: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "7")] - pub extension: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "8")] - pub options: ::core::option::Option, - /// This field contains optional information about the original source code. - /// You may safely remove this entire field without harming runtime - /// functionality of the descriptors -- the information is needed only by - /// development tools. - #[prost(message, optional, tag = "9")] - pub source_code_info: ::core::option::Option, - /// The syntax of the proto file. - /// The supported values are "proto2", "proto3", and "editions". - /// - /// If `edition` is present, this value must be "editions". - #[prost(string, optional, tag = "12")] - pub syntax: ::core::option::Option<::prost::alloc::string::String>, - /// The edition of the proto file. - #[prost(enumeration = "Edition", optional, tag = "14")] - pub edition: ::core::option::Option, -} -impl ::prost::Name for FileDescriptorProto { - const NAME: &'static str = "FileDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FileDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FileDescriptorProto".into() - } -} -/// Describes a message type. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "2")] - pub field: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "6")] - pub extension: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub nested_type: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub enum_type: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub extension_range: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "8")] - pub oneof_decl: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "7")] - pub options: ::core::option::Option, - #[prost(message, repeated, tag = "9")] - pub reserved_range: ::prost::alloc::vec::Vec, - /// Reserved field names, which may not be used by fields in the same message. - /// A given name may only be reserved once. - #[prost(string, repeated, tag = "10")] - pub reserved_name: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Nested message and enum types in `DescriptorProto`. -pub mod descriptor_proto { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct ExtensionRange { - /// Inclusive. - #[prost(int32, optional, tag = "1")] - pub start: ::core::option::Option, - /// Exclusive. - #[prost(int32, optional, tag = "2")] - pub end: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub options: ::core::option::Option, - } - impl ::prost::Name for ExtensionRange { - const NAME: &'static str = "ExtensionRange"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.DescriptorProto.ExtensionRange".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.DescriptorProto.ExtensionRange".into() - } - } - /// Range of reserved tag numbers. Reserved tag numbers may not be used by - /// fields or extension ranges in the same message. Reserved ranges may - /// not overlap. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct ReservedRange { - /// Inclusive. - #[prost(int32, optional, tag = "1")] - pub start: ::core::option::Option, - /// Exclusive. - #[prost(int32, optional, tag = "2")] - pub end: ::core::option::Option, - } - impl ::prost::Name for ReservedRange { - const NAME: &'static str = "ReservedRange"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.DescriptorProto.ReservedRange".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.DescriptorProto.ReservedRange".into() - } - } -} -impl ::prost::Name for DescriptorProto { - const NAME: &'static str = "DescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.DescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.DescriptorProto".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ExtensionRangeOptions { - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, - /// For external users: DO NOT USE. We are in the process of open sourcing - /// extension declaration and executing internal cleanups before it can be - /// used externally. - #[prost(message, repeated, tag = "2")] - pub declaration: ::prost::alloc::vec::Vec, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "50")] - pub features: ::core::option::Option, - /// The verification state of the range. - /// TODO: flip the default to DECLARATION once all empty ranges - /// are marked as UNVERIFIED. - #[prost( - enumeration = "extension_range_options::VerificationState", - optional, - tag = "3", - default = "Unverified" - )] - pub verification: ::core::option::Option, -} -/// Nested message and enum types in `ExtensionRangeOptions`. -pub mod extension_range_options { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Declaration { - /// The extension number declared within the extension range. - #[prost(int32, optional, tag = "1")] - pub number: ::core::option::Option, - /// The fully-qualified name of the extension field. There must be a leading - /// dot in front of the full name. - #[prost(string, optional, tag = "2")] - pub full_name: ::core::option::Option<::prost::alloc::string::String>, - /// The fully-qualified type name of the extension field. Unlike - /// Metadata.type, Declaration.type must have a leading dot for messages - /// and enums. - #[prost(string, optional, tag = "3")] - pub r#type: ::core::option::Option<::prost::alloc::string::String>, - /// If true, indicates that the number is reserved in the extension range, - /// and any extension field with the number will fail to compile. Set this - /// when a declared extension field is deleted. - #[prost(bool, optional, tag = "5")] - pub reserved: ::core::option::Option, - /// If true, indicates that the extension must be defined as repeated. - /// Otherwise the extension must be defined as optional. - #[prost(bool, optional, tag = "6")] - pub repeated: ::core::option::Option, - } - impl ::prost::Name for Declaration { - const NAME: &'static str = "Declaration"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.ExtensionRangeOptions.Declaration".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.ExtensionRangeOptions.Declaration".into() - } - } - /// The verification state of the extension range. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum VerificationState { - /// All the extensions of the range must be declared. - Declaration = 0, - Unverified = 1, - } - impl VerificationState { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - VerificationState::Declaration => "DECLARATION", - VerificationState::Unverified => "UNVERIFIED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "DECLARATION" => Some(Self::Declaration), - "UNVERIFIED" => Some(Self::Unverified), - _ => None, - } - } - } -} -impl ::prost::Name for ExtensionRangeOptions { - const NAME: &'static str = "ExtensionRangeOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.ExtensionRangeOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.ExtensionRangeOptions".into() - } -} -/// Describes a field within a message. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FieldDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(int32, optional, tag = "3")] - pub number: ::core::option::Option, - #[prost(enumeration = "field_descriptor_proto::Label", optional, tag = "4")] - pub label: ::core::option::Option, - /// If type_name is set, this need not be set. If both this and type_name - /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - #[prost(enumeration = "field_descriptor_proto::Type", optional, tag = "5")] - pub r#type: ::core::option::Option, - /// For message and enum types, this is the name of the type. If the name - /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - /// rules are used to find the type (i.e. first the nested types within this - /// message are searched, then within the parent, on up to the root - /// namespace). - #[prost(string, optional, tag = "6")] - pub type_name: ::core::option::Option<::prost::alloc::string::String>, - /// For extensions, this is the name of the type being extended. It is - /// resolved in the same manner as type_name. - #[prost(string, optional, tag = "2")] - pub extendee: ::core::option::Option<::prost::alloc::string::String>, - /// For numeric types, contains the original text representation of the value. - /// For booleans, "true" or "false". - /// For strings, contains the default text contents (not escaped in any way). - /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - #[prost(string, optional, tag = "7")] - pub default_value: ::core::option::Option<::prost::alloc::string::String>, - /// If set, gives the index of a oneof in the containing type's oneof_decl - /// list. This field is a member of that oneof. - #[prost(int32, optional, tag = "9")] - pub oneof_index: ::core::option::Option, - /// JSON name of this field. The value is set by protocol compiler. If the - /// user has set a "json_name" option on this field, that option's value - /// will be used. Otherwise, it's deduced from the field's name by converting - /// it to camelCase. - #[prost(string, optional, tag = "10")] - pub json_name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, optional, tag = "8")] - pub options: ::core::option::Option, - /// If true, this is a proto3 "optional". When a proto3 field is optional, it - /// tracks presence regardless of field type. - /// - /// When proto3_optional is true, this field must belong to a oneof to signal - /// to old proto3 clients that presence is tracked for this field. This oneof - /// is known as a "synthetic" oneof, and this field must be its sole member - /// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs - /// exist in the descriptor only, and do not generate any API. Synthetic oneofs - /// must be ordered after all "real" oneofs. - /// - /// For message fields, proto3_optional doesn't create any semantic change, - /// since non-repeated message fields always track presence. However it still - /// indicates the semantic detail of whether the user wrote "optional" or not. - /// This can be useful for round-tripping the .proto file. For consistency we - /// give message fields a synthetic oneof also, even though it is not required - /// to track presence. This is especially important because the parser can't - /// tell if a field is a message or an enum, so it must always create a - /// synthetic oneof. - /// - /// Proto2 optional fields do not set this flag, because they already indicate - /// optional with `LABEL_OPTIONAL`. - #[prost(bool, optional, tag = "17")] - pub proto3_optional: ::core::option::Option, -} -/// Nested message and enum types in `FieldDescriptorProto`. -pub mod field_descriptor_proto { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Type { - /// 0 is reserved for errors. - /// Order is weird for historical reasons. - Double = 1, - Float = 2, - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - /// negative values are likely. - Int64 = 3, - Uint64 = 4, - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - /// negative values are likely. - Int32 = 5, - Fixed64 = 6, - Fixed32 = 7, - Bool = 8, - String = 9, - /// Tag-delimited aggregate. - /// Group type is deprecated and not supported after google.protobuf. However, Proto3 - /// implementations should still be able to parse the group wire format and - /// treat group fields as unknown fields. In Editions, the group wire format - /// can be enabled via the `message_encoding` feature. - Group = 10, - /// Length-delimited aggregate. - Message = 11, - /// New in version 2. - Bytes = 12, - Uint32 = 13, - Enum = 14, - Sfixed32 = 15, - Sfixed64 = 16, - /// Uses ZigZag encoding. - Sint32 = 17, - /// Uses ZigZag encoding. - Sint64 = 18, - } - impl Type { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Type::Double => "TYPE_DOUBLE", - Type::Float => "TYPE_FLOAT", - Type::Int64 => "TYPE_INT64", - Type::Uint64 => "TYPE_UINT64", - Type::Int32 => "TYPE_INT32", - Type::Fixed64 => "TYPE_FIXED64", - Type::Fixed32 => "TYPE_FIXED32", - Type::Bool => "TYPE_BOOL", - Type::String => "TYPE_STRING", - Type::Group => "TYPE_GROUP", - Type::Message => "TYPE_MESSAGE", - Type::Bytes => "TYPE_BYTES", - Type::Uint32 => "TYPE_UINT32", - Type::Enum => "TYPE_ENUM", - Type::Sfixed32 => "TYPE_SFIXED32", - Type::Sfixed64 => "TYPE_SFIXED64", - Type::Sint32 => "TYPE_SINT32", - Type::Sint64 => "TYPE_SINT64", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "TYPE_DOUBLE" => Some(Self::Double), - "TYPE_FLOAT" => Some(Self::Float), - "TYPE_INT64" => Some(Self::Int64), - "TYPE_UINT64" => Some(Self::Uint64), - "TYPE_INT32" => Some(Self::Int32), - "TYPE_FIXED64" => Some(Self::Fixed64), - "TYPE_FIXED32" => Some(Self::Fixed32), - "TYPE_BOOL" => Some(Self::Bool), - "TYPE_STRING" => Some(Self::String), - "TYPE_GROUP" => Some(Self::Group), - "TYPE_MESSAGE" => Some(Self::Message), - "TYPE_BYTES" => Some(Self::Bytes), - "TYPE_UINT32" => Some(Self::Uint32), - "TYPE_ENUM" => Some(Self::Enum), - "TYPE_SFIXED32" => Some(Self::Sfixed32), - "TYPE_SFIXED64" => Some(Self::Sfixed64), - "TYPE_SINT32" => Some(Self::Sint32), - "TYPE_SINT64" => Some(Self::Sint64), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Label { - /// 0 is reserved for errors - Optional = 1, - Repeated = 3, - /// The required label is only allowed in google.protobuf. In proto3 and Editions - /// it's explicitly prohibited. In Editions, the `field_presence` feature - /// can be used to get this behavior. - Required = 2, - } - impl Label { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Label::Optional => "LABEL_OPTIONAL", - Label::Repeated => "LABEL_REPEATED", - Label::Required => "LABEL_REQUIRED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "LABEL_OPTIONAL" => Some(Self::Optional), - "LABEL_REPEATED" => Some(Self::Repeated), - "LABEL_REQUIRED" => Some(Self::Required), - _ => None, - } - } - } -} -impl ::prost::Name for FieldDescriptorProto { - const NAME: &'static str = "FieldDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FieldDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FieldDescriptorProto".into() - } -} -/// Describes a oneof. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct OneofDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, optional, tag = "2")] - pub options: ::core::option::Option, -} -impl ::prost::Name for OneofDescriptorProto { - const NAME: &'static str = "OneofDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.OneofDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.OneofDescriptorProto".into() - } -} -/// Describes an enum type. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EnumDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "2")] - pub value: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub options: ::core::option::Option, - /// Range of reserved numeric values. Reserved numeric values may not be used - /// by enum values in the same enum declaration. Reserved ranges may not - /// overlap. - #[prost(message, repeated, tag = "4")] - pub reserved_range: ::prost::alloc::vec::Vec< - enum_descriptor_proto::EnumReservedRange, - >, - /// Reserved enum value names, which may not be reused. A given name may only - /// be reserved once. - #[prost(string, repeated, tag = "5")] - pub reserved_name: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Nested message and enum types in `EnumDescriptorProto`. -pub mod enum_descriptor_proto { - /// Range of reserved numeric values. Reserved values may not be used by - /// entries in the same enum. Reserved ranges may not overlap. - /// - /// Note that this is distinct from DescriptorProto.ReservedRange in that it - /// is inclusive such that it can appropriately represent the entire int32 - /// domain. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct EnumReservedRange { - /// Inclusive. - #[prost(int32, optional, tag = "1")] - pub start: ::core::option::Option, - /// Inclusive. - #[prost(int32, optional, tag = "2")] - pub end: ::core::option::Option, - } - impl ::prost::Name for EnumReservedRange { - const NAME: &'static str = "EnumReservedRange"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.EnumDescriptorProto.EnumReservedRange".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.EnumDescriptorProto.EnumReservedRange".into() - } - } -} -impl ::prost::Name for EnumDescriptorProto { - const NAME: &'static str = "EnumDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.EnumDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.EnumDescriptorProto".into() - } -} -/// Describes a value within an enum. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EnumValueDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(int32, optional, tag = "2")] - pub number: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub options: ::core::option::Option, -} -impl ::prost::Name for EnumValueDescriptorProto { - const NAME: &'static str = "EnumValueDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.EnumValueDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.EnumValueDescriptorProto".into() - } -} -/// Describes a service. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ServiceDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "2")] - pub method: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub options: ::core::option::Option, -} -impl ::prost::Name for ServiceDescriptorProto { - const NAME: &'static str = "ServiceDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.ServiceDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.ServiceDescriptorProto".into() - } -} -/// Describes a method of a service. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MethodDescriptorProto { - #[prost(string, optional, tag = "1")] - pub name: ::core::option::Option<::prost::alloc::string::String>, - /// Input and output type names. These are resolved in the same way as - /// FieldDescriptorProto.type_name, but must refer to a message type. - #[prost(string, optional, tag = "2")] - pub input_type: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "3")] - pub output_type: ::core::option::Option<::prost::alloc::string::String>, - #[prost(message, optional, tag = "4")] - pub options: ::core::option::Option, - /// Identifies if client streams multiple client messages - #[prost(bool, optional, tag = "5", default = "false")] - pub client_streaming: ::core::option::Option, - /// Identifies if server streams multiple server messages - #[prost(bool, optional, tag = "6", default = "false")] - pub server_streaming: ::core::option::Option, -} -impl ::prost::Name for MethodDescriptorProto { - const NAME: &'static str = "MethodDescriptorProto"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.MethodDescriptorProto".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.MethodDescriptorProto".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FileOptions { - /// Sets the Java package where classes generated from this .proto will be - /// placed. By default, the proto package is used, but this is often - /// inappropriate because proto packages do not normally start with backwards - /// domain names. - #[prost(string, optional, tag = "1")] - pub java_package: ::core::option::Option<::prost::alloc::string::String>, - /// Controls the name of the wrapper Java class generated for the .proto file. - /// That class will always contain the .proto file's getDescriptor() method as - /// well as any top-level extensions defined in the .proto file. - /// If java_multiple_files is disabled, then all the other classes from the - /// .proto file will be nested inside the single wrapper outer class. - #[prost(string, optional, tag = "8")] - pub java_outer_classname: ::core::option::Option<::prost::alloc::string::String>, - /// If enabled, then the Java code generator will generate a separate .java - /// file for each top-level message, enum, and service defined in the .proto - /// file. Thus, these types will *not* be nested inside the wrapper class - /// named by java_outer_classname. However, the wrapper class will still be - /// generated to contain the file's getDescriptor() method as well as any - /// top-level extensions defined in the file. - #[prost(bool, optional, tag = "10", default = "false")] - pub java_multiple_files: ::core::option::Option, - /// This option does nothing. - #[deprecated] - #[prost(bool, optional, tag = "20")] - pub java_generate_equals_and_hash: ::core::option::Option, - /// A proto2 file can set this to true to opt in to UTF-8 checking for Java, - /// which will throw an exception if invalid UTF-8 is parsed from the wire or - /// assigned to a string field. - /// - /// TODO: clarify exactly what kinds of field types this option - /// applies to, and update these docs accordingly. - /// - /// Proto3 files already perform these checks. Setting the option explicitly to - /// false has no effect: it cannot be used to opt proto3 files out of UTF-8 - /// checks. - #[prost(bool, optional, tag = "27", default = "false")] - pub java_string_check_utf8: ::core::option::Option, - #[prost( - enumeration = "file_options::OptimizeMode", - optional, - tag = "9", - default = "Speed" - )] - pub optimize_for: ::core::option::Option, - /// Sets the Go package where structs generated from this .proto will be - /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. - #[prost(string, optional, tag = "11")] - pub go_package: ::core::option::Option<::prost::alloc::string::String>, - /// Should generic services be generated in each language? "Generic" services - /// are not specific to any particular RPC system. They are generated by the - /// main code generators in each language (without additional plugins). - /// Generic services were the only kind of service generation supported by - /// early versions of google.protobuf. - /// - /// Generic services are now considered deprecated in favor of using plugins - /// that generate code specific to your particular RPC system. Therefore, - /// these default to false. Old code which depends on generic services should - /// explicitly set them to true. - #[prost(bool, optional, tag = "16", default = "false")] - pub cc_generic_services: ::core::option::Option, - #[prost(bool, optional, tag = "17", default = "false")] - pub java_generic_services: ::core::option::Option, - #[prost(bool, optional, tag = "18", default = "false")] - pub py_generic_services: ::core::option::Option, - /// Is this file deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for everything in the file, or it will be completely ignored; in the very - /// least, this is a formalization for deprecating files. - #[prost(bool, optional, tag = "23", default = "false")] - pub deprecated: ::core::option::Option, - /// Enables the use of arenas for the proto messages in this file. This applies - /// only to generated classes for C++. - #[prost(bool, optional, tag = "31", default = "true")] - pub cc_enable_arenas: ::core::option::Option, - /// Sets the objective c class prefix which is prepended to all objective c - /// generated classes from this .proto. There is no default. - #[prost(string, optional, tag = "36")] - pub objc_class_prefix: ::core::option::Option<::prost::alloc::string::String>, - /// Namespace for generated classes; defaults to the package. - #[prost(string, optional, tag = "37")] - pub csharp_namespace: ::core::option::Option<::prost::alloc::string::String>, - /// By default Swift generators will take the proto package and CamelCase it - /// replacing '.' with underscore and use that to prefix the types/symbols - /// defined. When this options is provided, they will use this value instead - /// to prefix the types/symbols defined. - #[prost(string, optional, tag = "39")] - pub swift_prefix: ::core::option::Option<::prost::alloc::string::String>, - /// Sets the php class prefix which is prepended to all php generated classes - /// from this .proto. Default is empty. - #[prost(string, optional, tag = "40")] - pub php_class_prefix: ::core::option::Option<::prost::alloc::string::String>, - /// Use this option to change the namespace of php generated classes. Default - /// is empty. When this option is empty, the package name will be used for - /// determining the namespace. - #[prost(string, optional, tag = "41")] - pub php_namespace: ::core::option::Option<::prost::alloc::string::String>, - /// Use this option to change the namespace of php generated metadata classes. - /// Default is empty. When this option is empty, the proto file name will be - /// used for determining the namespace. - #[prost(string, optional, tag = "44")] - pub php_metadata_namespace: ::core::option::Option<::prost::alloc::string::String>, - /// Use this option to change the package of ruby generated classes. Default - /// is empty. When this option is not set, the package name will be used for - /// determining the ruby package. - #[prost(string, optional, tag = "45")] - pub ruby_package: ::core::option::Option<::prost::alloc::string::String>, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "50")] - pub features: ::core::option::Option, - /// The parser stores options it doesn't recognize here. - /// See the documentation for the "Options" section above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `FileOptions`. -pub mod file_options { - /// Generated classes can be optimized for speed or code size. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum OptimizeMode { - /// Generate complete code for parsing, serialization, - Speed = 1, - /// etc. - /// - /// Use ReflectionOps to implement these methods. - CodeSize = 2, - /// Generate code using MessageLite and the lite runtime. - LiteRuntime = 3, - } - impl OptimizeMode { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - OptimizeMode::Speed => "SPEED", - OptimizeMode::CodeSize => "CODE_SIZE", - OptimizeMode::LiteRuntime => "LITE_RUNTIME", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SPEED" => Some(Self::Speed), - "CODE_SIZE" => Some(Self::CodeSize), - "LITE_RUNTIME" => Some(Self::LiteRuntime), - _ => None, - } - } - } -} -impl ::prost::Name for FileOptions { - const NAME: &'static str = "FileOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FileOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FileOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MessageOptions { - /// Set true to use the old proto1 MessageSet wire format for extensions. - /// This is provided for backwards-compatibility with the MessageSet wire - /// format. You should not use this for any other reason: It's less - /// efficient, has fewer features, and is more complicated. - /// - /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } - /// Note that the message cannot have any defined fields; MessageSets only - /// have extensions. - /// - /// All extensions of your type must be singular messages; e.g. they cannot - /// be int32s, enums, or repeated messages. - /// - /// Because this is an option, the above two restrictions are not enforced by - /// the protocol compiler. - #[prost(bool, optional, tag = "1", default = "false")] - pub message_set_wire_format: ::core::option::Option, - /// Disables the generation of the standard "descriptor()" accessor, which can - /// conflict with a field of the same name. This is meant to make migration - /// from proto1 easier; new code should avoid fields named "descriptor". - #[prost(bool, optional, tag = "2", default = "false")] - pub no_standard_descriptor_accessor: ::core::option::Option, - /// Is this message deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the message, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating messages. - #[prost(bool, optional, tag = "3", default = "false")] - pub deprecated: ::core::option::Option, - /// Whether the message is an automatically generated map entry type for the - /// maps field. - /// - /// For maps fields: - /// map map_field = 1; - /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; - /// - /// Implementations may choose not to generate the map_entry=true message, but - /// use a native map in the target language to hold the keys and values. - /// The reflection APIs in such implementations still need to work as - /// if the field is a repeated message field. - /// - /// NOTE: Do not set the option in .proto files. Always use the maps syntax - /// instead. The option should only be implicitly set by the proto compiler - /// parser. - #[prost(bool, optional, tag = "7")] - pub map_entry: ::core::option::Option, - /// Enable the legacy handling of JSON field name conflicts. This lowercases - /// and strips underscored from the fields before comparison in proto3 only. - /// The new behavior takes `json_name` into account and applies to proto2 as - /// well. - /// - /// This should only be used as a temporary measure against broken builds due - /// to the change in behavior for JSON field name conflicts. - /// - /// TODO This is legacy behavior we plan to remove once downstream - /// teams have had time to migrate. - #[deprecated] - #[prost(bool, optional, tag = "11")] - pub deprecated_legacy_json_field_conflicts: ::core::option::Option, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "12")] - pub features: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for MessageOptions { - const NAME: &'static str = "MessageOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.MessageOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.MessageOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FieldOptions { - /// The ctype option instructs the C++ code generator to use a different - /// representation of the field than it normally would. See the specific - /// options below. This option is only implemented to support use of - /// \[ctype=CORD\] and \[ctype=STRING\] (the default) on non-repeated fields of - /// type "bytes" in the open source release -- sorry, we'll try to include - /// other types in a future version! - #[prost( - enumeration = "field_options::CType", - optional, - tag = "1", - default = "String" - )] - pub ctype: ::core::option::Option, - /// The packed option can be enabled for repeated primitive fields to enable - /// a more efficient representation on the wire. Rather than repeatedly - /// writing the tag and type for each element, the entire array is encoded as - /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. This option is prohibited in - /// Editions, but the `repeated_field_encoding` feature can be used to control - /// the behavior. - #[prost(bool, optional, tag = "2")] - pub packed: ::core::option::Option, - /// The jstype option determines the JavaScript type used for values of the - /// field. The option is permitted only for 64 bit integral and fixed types - /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - /// is represented as JavaScript string, which avoids loss of precision that - /// can happen when a large value is converted to a floating point JavaScript. - /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - /// use the JavaScript "number" type. The behavior of the default option - /// JS_NORMAL is implementation dependent. - /// - /// This option is an enum to permit additional types to be added, e.g. - /// goog.math.Integer. - #[prost( - enumeration = "field_options::JsType", - optional, - tag = "6", - default = "JsNormal" - )] - pub jstype: ::core::option::Option, - /// Should this field be parsed lazily? Lazy applies only to message-type - /// fields. It means that when the outer message is initially parsed, the - /// inner message's contents will not be parsed but instead stored in encoded - /// form. The inner message will actually be parsed when it is first accessed. - /// - /// This is only a hint. Implementations are free to choose whether to use - /// eager or lazy parsing regardless of the value of this option. However, - /// setting this option true suggests that the protocol author believes that - /// using lazy parsing on this field is worth the additional bookkeeping - /// overhead typically needed to implement it. - /// - /// This option does not affect the public interface of any generated code; - /// all method signatures remain the same. Furthermore, thread-safety of the - /// interface is not affected by this option; const methods remain safe to - /// call from multiple threads concurrently, while non-const methods continue - /// to require exclusive access. - /// - /// Note that lazy message fields are still eagerly verified to check - /// ill-formed wireformat or missing required fields. Calling IsInitialized() - /// on the outer message would fail if the inner message has missing required - /// fields. Failed verification would result in parsing failure (except when - /// uninitialized messages are acceptable). - #[prost(bool, optional, tag = "5", default = "false")] - pub lazy: ::core::option::Option, - /// unverified_lazy does no correctness checks on the byte stream. This should - /// only be used where lazy with verification is prohibitive for performance - /// reasons. - #[prost(bool, optional, tag = "15", default = "false")] - pub unverified_lazy: ::core::option::Option, - /// Is this field deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for accessors, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating fields. - #[prost(bool, optional, tag = "3", default = "false")] - pub deprecated: ::core::option::Option, - /// For Google-internal migration only. Do not use. - #[prost(bool, optional, tag = "10", default = "false")] - pub weak: ::core::option::Option, - /// Indicate that the field value should not be printed out when using debug - /// formats, e.g. when the field contains sensitive credentials. - #[prost(bool, optional, tag = "16", default = "false")] - pub debug_redact: ::core::option::Option, - #[prost(enumeration = "field_options::OptionRetention", optional, tag = "17")] - pub retention: ::core::option::Option, - #[prost( - enumeration = "field_options::OptionTargetType", - repeated, - packed = "false", - tag = "19" - )] - pub targets: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "20")] - pub edition_defaults: ::prost::alloc::vec::Vec, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "21")] - pub features: ::core::option::Option, - #[prost(message, optional, tag = "22")] - pub feature_support: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `FieldOptions`. -pub mod field_options { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct EditionDefault { - #[prost(enumeration = "super::Edition", optional, tag = "3")] - pub edition: ::core::option::Option, - /// Textproto value. - #[prost(string, optional, tag = "2")] - pub value: ::core::option::Option<::prost::alloc::string::String>, - } - impl ::prost::Name for EditionDefault { - const NAME: &'static str = "EditionDefault"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FieldOptions.EditionDefault".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FieldOptions.EditionDefault".into() - } - } - /// Information about the support window of a feature. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct FeatureSupport { - /// The edition that this feature was first available in. In editions - /// earlier than this one, the default assigned to EDITION_LEGACY will be - /// used, and proto files will not be able to override it. - #[prost(enumeration = "super::Edition", optional, tag = "1")] - pub edition_introduced: ::core::option::Option, - /// The edition this feature becomes deprecated in. Using this after this - /// edition may trigger warnings. - #[prost(enumeration = "super::Edition", optional, tag = "2")] - pub edition_deprecated: ::core::option::Option, - /// The deprecation warning text if this feature is used after the edition it - /// was marked deprecated in. - #[prost(string, optional, tag = "3")] - pub deprecation_warning: ::core::option::Option<::prost::alloc::string::String>, - /// The edition this feature is no longer available in. In editions after - /// this one, the last default assigned will be used, and proto files will - /// not be able to override it. - #[prost(enumeration = "super::Edition", optional, tag = "4")] - pub edition_removed: ::core::option::Option, - } - impl ::prost::Name for FeatureSupport { - const NAME: &'static str = "FeatureSupport"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FieldOptions.FeatureSupport".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FieldOptions.FeatureSupport".into() - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum CType { - /// Default mode. - String = 0, - /// The option \[ctype=CORD\] may be applied to a non-repeated field of type - /// "bytes". It indicates that in C++, the data should be stored in a Cord - /// instead of a string. For very large strings, this may reduce memory - /// fragmentation. It may also allow better performance when parsing from a - /// Cord, or when parsing with aliasing enabled, as the parsed Cord may then - /// alias the original buffer. - Cord = 1, - StringPiece = 2, - } - impl CType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - CType::String => "STRING", - CType::Cord => "CORD", - CType::StringPiece => "STRING_PIECE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "STRING" => Some(Self::String), - "CORD" => Some(Self::Cord), - "STRING_PIECE" => Some(Self::StringPiece), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum JsType { - /// Use the default type. - JsNormal = 0, - /// Use JavaScript strings. - JsString = 1, - /// Use JavaScript numbers. - JsNumber = 2, - } - impl JsType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - JsType::JsNormal => "JS_NORMAL", - JsType::JsString => "JS_STRING", - JsType::JsNumber => "JS_NUMBER", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "JS_NORMAL" => Some(Self::JsNormal), - "JS_STRING" => Some(Self::JsString), - "JS_NUMBER" => Some(Self::JsNumber), - _ => None, - } - } - } - /// If set to RETENTION_SOURCE, the option will be omitted from the binary. - /// Note: as of January 2023, support for this is in progress and does not yet - /// have an effect (b/264593489). - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum OptionRetention { - RetentionUnknown = 0, - RetentionRuntime = 1, - RetentionSource = 2, - } - impl OptionRetention { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - OptionRetention::RetentionUnknown => "RETENTION_UNKNOWN", - OptionRetention::RetentionRuntime => "RETENTION_RUNTIME", - OptionRetention::RetentionSource => "RETENTION_SOURCE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "RETENTION_UNKNOWN" => Some(Self::RetentionUnknown), - "RETENTION_RUNTIME" => Some(Self::RetentionRuntime), - "RETENTION_SOURCE" => Some(Self::RetentionSource), - _ => None, - } - } - } - /// This indicates the types of entities that the field may apply to when used - /// as an option. If it is unset, then the field may be freely used as an - /// option on any kind of entity. Note: as of January 2023, support for this is - /// in progress and does not yet have an effect (b/264593489). - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum OptionTargetType { - TargetTypeUnknown = 0, - TargetTypeFile = 1, - TargetTypeExtensionRange = 2, - TargetTypeMessage = 3, - TargetTypeField = 4, - TargetTypeOneof = 5, - TargetTypeEnum = 6, - TargetTypeEnumEntry = 7, - TargetTypeService = 8, - TargetTypeMethod = 9, - } - impl OptionTargetType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - OptionTargetType::TargetTypeUnknown => "TARGET_TYPE_UNKNOWN", - OptionTargetType::TargetTypeFile => "TARGET_TYPE_FILE", - OptionTargetType::TargetTypeExtensionRange => { - "TARGET_TYPE_EXTENSION_RANGE" - } - OptionTargetType::TargetTypeMessage => "TARGET_TYPE_MESSAGE", - OptionTargetType::TargetTypeField => "TARGET_TYPE_FIELD", - OptionTargetType::TargetTypeOneof => "TARGET_TYPE_ONEOF", - OptionTargetType::TargetTypeEnum => "TARGET_TYPE_ENUM", - OptionTargetType::TargetTypeEnumEntry => "TARGET_TYPE_ENUM_ENTRY", - OptionTargetType::TargetTypeService => "TARGET_TYPE_SERVICE", - OptionTargetType::TargetTypeMethod => "TARGET_TYPE_METHOD", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "TARGET_TYPE_UNKNOWN" => Some(Self::TargetTypeUnknown), - "TARGET_TYPE_FILE" => Some(Self::TargetTypeFile), - "TARGET_TYPE_EXTENSION_RANGE" => Some(Self::TargetTypeExtensionRange), - "TARGET_TYPE_MESSAGE" => Some(Self::TargetTypeMessage), - "TARGET_TYPE_FIELD" => Some(Self::TargetTypeField), - "TARGET_TYPE_ONEOF" => Some(Self::TargetTypeOneof), - "TARGET_TYPE_ENUM" => Some(Self::TargetTypeEnum), - "TARGET_TYPE_ENUM_ENTRY" => Some(Self::TargetTypeEnumEntry), - "TARGET_TYPE_SERVICE" => Some(Self::TargetTypeService), - "TARGET_TYPE_METHOD" => Some(Self::TargetTypeMethod), - _ => None, - } - } - } -} -impl ::prost::Name for FieldOptions { - const NAME: &'static str = "FieldOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FieldOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FieldOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct OneofOptions { - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "1")] - pub features: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for OneofOptions { - const NAME: &'static str = "OneofOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.OneofOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.OneofOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EnumOptions { - /// Set this option to true to allow mapping different tag names to the same - /// value. - #[prost(bool, optional, tag = "2")] - pub allow_alias: ::core::option::Option, - /// Is this enum deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating enums. - #[prost(bool, optional, tag = "3", default = "false")] - pub deprecated: ::core::option::Option, - /// Enable the legacy handling of JSON field name conflicts. This lowercases - /// and strips underscored from the fields before comparison in proto3 only. - /// The new behavior takes `json_name` into account and applies to proto2 as - /// well. - /// TODO Remove this legacy behavior once downstream teams have - /// had time to migrate. - #[deprecated] - #[prost(bool, optional, tag = "6")] - pub deprecated_legacy_json_field_conflicts: ::core::option::Option, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "7")] - pub features: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for EnumOptions { - const NAME: &'static str = "EnumOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.EnumOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.EnumOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EnumValueOptions { - /// Is this enum value deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum value, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating enum values. - #[prost(bool, optional, tag = "1", default = "false")] - pub deprecated: ::core::option::Option, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "2")] - pub features: ::core::option::Option, - /// Indicate that fields annotated with this enum value should not be printed - /// out when using debug formats, e.g. when the field contains sensitive - /// credentials. - #[prost(bool, optional, tag = "3", default = "false")] - pub debug_redact: ::core::option::Option, - /// Information about the support window of a feature value. - #[prost(message, optional, tag = "4")] - pub feature_support: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for EnumValueOptions { - const NAME: &'static str = "EnumValueOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.EnumValueOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.EnumValueOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ServiceOptions { - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "34")] - pub features: ::core::option::Option, - /// Is this service deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the service, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating services. - #[prost(bool, optional, tag = "33", default = "false")] - pub deprecated: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for ServiceOptions { - const NAME: &'static str = "ServiceOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.ServiceOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.ServiceOptions".into() - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MethodOptions { - /// Is this method deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the method, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating methods. - #[prost(bool, optional, tag = "33", default = "false")] - pub deprecated: ::core::option::Option, - #[prost( - enumeration = "method_options::IdempotencyLevel", - optional, - tag = "34", - default = "IdempotencyUnknown" - )] - pub idempotency_level: ::core::option::Option, - /// Any features defined in the specific edition. - #[prost(message, optional, tag = "35")] - pub features: ::core::option::Option, - /// The parser stores options it doesn't recognize here. See above. - #[prost(message, repeated, tag = "999")] - pub uninterpreted_option: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `MethodOptions`. -pub mod method_options { - /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - /// or neither? HTTP based RPC implementation may choose GET verb for safe - /// methods, and PUT verb for idempotent methods instead of the default POST. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum IdempotencyLevel { - IdempotencyUnknown = 0, - /// implies idempotent - NoSideEffects = 1, - /// idempotent, but may have side effects - Idempotent = 2, - } - impl IdempotencyLevel { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - IdempotencyLevel::IdempotencyUnknown => "IDEMPOTENCY_UNKNOWN", - IdempotencyLevel::NoSideEffects => "NO_SIDE_EFFECTS", - IdempotencyLevel::Idempotent => "IDEMPOTENT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "IDEMPOTENCY_UNKNOWN" => Some(Self::IdempotencyUnknown), - "NO_SIDE_EFFECTS" => Some(Self::NoSideEffects), - "IDEMPOTENT" => Some(Self::Idempotent), - _ => None, - } - } - } -} -impl ::prost::Name for MethodOptions { - const NAME: &'static str = "MethodOptions"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.MethodOptions".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.MethodOptions".into() - } -} -/// A message representing a option the parser does not recognize. This only -/// appears in options protos created by the compiler::Parser class. -/// DescriptorPool resolves these when building Descriptor objects. Therefore, -/// options protos in descriptor objects (e.g. returned by Descriptor::options(), -/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -/// in them. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct UninterpretedOption { - #[prost(message, repeated, tag = "2")] - pub name: ::prost::alloc::vec::Vec, - /// The value of the uninterpreted option, in whatever type the tokenizer - /// identified it as during parsing. Exactly one of these should be set. - #[prost(string, optional, tag = "3")] - pub identifier_value: ::core::option::Option<::prost::alloc::string::String>, - #[prost(uint64, optional, tag = "4")] - pub positive_int_value: ::core::option::Option, - #[prost(int64, optional, tag = "5")] - pub negative_int_value: ::core::option::Option, - #[prost(double, optional, tag = "6")] - pub double_value: ::core::option::Option, - #[prost(bytes = "vec", optional, tag = "7")] - pub string_value: ::core::option::Option<::prost::alloc::vec::Vec>, - #[prost(string, optional, tag = "8")] - pub aggregate_value: ::core::option::Option<::prost::alloc::string::String>, -} -/// Nested message and enum types in `UninterpretedOption`. -pub mod uninterpreted_option { - /// The name of the uninterpreted option. Each string represents a segment in - /// a dot-separated name. is_extension is true iff a segment represents an - /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ \["foo", false\], \["bar.baz", true\], \["moo", false\] } represents - /// "foo.(bar.baz).moo". - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct NamePart { - #[prost(string, required, tag = "1")] - pub name_part: ::prost::alloc::string::String, - #[prost(bool, required, tag = "2")] - pub is_extension: bool, - } - impl ::prost::Name for NamePart { - const NAME: &'static str = "NamePart"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.UninterpretedOption.NamePart".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.UninterpretedOption.NamePart".into() - } - } -} -impl ::prost::Name for UninterpretedOption { - const NAME: &'static str = "UninterpretedOption"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.UninterpretedOption".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.UninterpretedOption".into() - } -} -/// TODO Enums in C++ gencode (and potentially other languages) are -/// not well scoped. This means that each of the feature enums below can clash -/// with each other. The short names we've chosen maximize call-site -/// readability, but leave us very open to this scenario. A future feature will -/// be designed and implemented to handle this, hopefully before we ever hit a -/// conflict here. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct FeatureSet { - #[prost(enumeration = "feature_set::FieldPresence", optional, tag = "1")] - pub field_presence: ::core::option::Option, - #[prost(enumeration = "feature_set::EnumType", optional, tag = "2")] - pub enum_type: ::core::option::Option, - #[prost(enumeration = "feature_set::RepeatedFieldEncoding", optional, tag = "3")] - pub repeated_field_encoding: ::core::option::Option, - #[prost(enumeration = "feature_set::Utf8Validation", optional, tag = "4")] - pub utf8_validation: ::core::option::Option, - #[prost(enumeration = "feature_set::MessageEncoding", optional, tag = "5")] - pub message_encoding: ::core::option::Option, - #[prost(enumeration = "feature_set::JsonFormat", optional, tag = "6")] - pub json_format: ::core::option::Option, -} -/// Nested message and enum types in `FeatureSet`. -pub mod feature_set { - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum FieldPresence { - Unknown = 0, - Explicit = 1, - Implicit = 2, - LegacyRequired = 3, - } - impl FieldPresence { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - FieldPresence::Unknown => "FIELD_PRESENCE_UNKNOWN", - FieldPresence::Explicit => "EXPLICIT", - FieldPresence::Implicit => "IMPLICIT", - FieldPresence::LegacyRequired => "LEGACY_REQUIRED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "FIELD_PRESENCE_UNKNOWN" => Some(Self::Unknown), - "EXPLICIT" => Some(Self::Explicit), - "IMPLICIT" => Some(Self::Implicit), - "LEGACY_REQUIRED" => Some(Self::LegacyRequired), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum EnumType { - Unknown = 0, - Open = 1, - Closed = 2, - } - impl EnumType { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - EnumType::Unknown => "ENUM_TYPE_UNKNOWN", - EnumType::Open => "OPEN", - EnumType::Closed => "CLOSED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ENUM_TYPE_UNKNOWN" => Some(Self::Unknown), - "OPEN" => Some(Self::Open), - "CLOSED" => Some(Self::Closed), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum RepeatedFieldEncoding { - Unknown = 0, - Packed = 1, - Expanded = 2, - } - impl RepeatedFieldEncoding { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - RepeatedFieldEncoding::Unknown => "REPEATED_FIELD_ENCODING_UNKNOWN", - RepeatedFieldEncoding::Packed => "PACKED", - RepeatedFieldEncoding::Expanded => "EXPANDED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "REPEATED_FIELD_ENCODING_UNKNOWN" => Some(Self::Unknown), - "PACKED" => Some(Self::Packed), - "EXPANDED" => Some(Self::Expanded), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Utf8Validation { - Unknown = 0, - Verify = 2, - None = 3, - } - impl Utf8Validation { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Utf8Validation::Unknown => "UTF8_VALIDATION_UNKNOWN", - Utf8Validation::Verify => "VERIFY", - Utf8Validation::None => "NONE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UTF8_VALIDATION_UNKNOWN" => Some(Self::Unknown), - "VERIFY" => Some(Self::Verify), - "NONE" => Some(Self::None), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum MessageEncoding { - Unknown = 0, - LengthPrefixed = 1, - Delimited = 2, - } - impl MessageEncoding { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - MessageEncoding::Unknown => "MESSAGE_ENCODING_UNKNOWN", - MessageEncoding::LengthPrefixed => "LENGTH_PREFIXED", - MessageEncoding::Delimited => "DELIMITED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "MESSAGE_ENCODING_UNKNOWN" => Some(Self::Unknown), - "LENGTH_PREFIXED" => Some(Self::LengthPrefixed), - "DELIMITED" => Some(Self::Delimited), - _ => None, - } - } - } - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum JsonFormat { - Unknown = 0, - Allow = 1, - LegacyBestEffort = 2, - } - impl JsonFormat { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - JsonFormat::Unknown => "JSON_FORMAT_UNKNOWN", - JsonFormat::Allow => "ALLOW", - JsonFormat::LegacyBestEffort => "LEGACY_BEST_EFFORT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "JSON_FORMAT_UNKNOWN" => Some(Self::Unknown), - "ALLOW" => Some(Self::Allow), - "LEGACY_BEST_EFFORT" => Some(Self::LegacyBestEffort), - _ => None, - } - } - } -} -impl ::prost::Name for FeatureSet { - const NAME: &'static str = "FeatureSet"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FeatureSet".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FeatureSet".into() - } -} -/// A compiled specification for the defaults of a set of features. These -/// messages are generated from FeatureSet extensions and can be used to seed -/// feature resolution. The resolution with this object becomes a simple search -/// for the closest matching edition, followed by proto merges. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct FeatureSetDefaults { - #[prost(message, repeated, tag = "1")] - pub defaults: ::prost::alloc::vec::Vec< - feature_set_defaults::FeatureSetEditionDefault, - >, - /// The minimum supported edition (inclusive) when this was constructed. - /// Editions before this will not have defaults. - #[prost(enumeration = "Edition", optional, tag = "4")] - pub minimum_edition: ::core::option::Option, - /// The maximum known edition (inclusive) when this was constructed. Editions - /// after this will not have reliable defaults. - #[prost(enumeration = "Edition", optional, tag = "5")] - pub maximum_edition: ::core::option::Option, -} -/// Nested message and enum types in `FeatureSetDefaults`. -pub mod feature_set_defaults { - /// A map from every known edition with a unique set of defaults to its - /// defaults. Not all editions may be contained here. For a given edition, - /// the defaults at the closest matching edition ordered at or before it should - /// be used. This field must be in strict ascending order by edition. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, Copy, PartialEq, ::prost::Message)] - pub struct FeatureSetEditionDefault { - #[prost(enumeration = "super::Edition", optional, tag = "3")] - pub edition: ::core::option::Option, - /// Defaults of features that can be overridden in this edition. - #[prost(message, optional, tag = "4")] - pub overridable_features: ::core::option::Option, - /// Defaults of features that can't be overridden in this edition. - #[prost(message, optional, tag = "5")] - pub fixed_features: ::core::option::Option, - } - impl ::prost::Name for FeatureSetEditionDefault { - const NAME: &'static str = "FeatureSetEditionDefault"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault".into() - } - } -} -impl ::prost::Name for FeatureSetDefaults { - const NAME: &'static str = "FeatureSetDefaults"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.FeatureSetDefaults".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.FeatureSetDefaults".into() - } -} -/// Encapsulates information about the original source file from which a -/// FileDescriptorProto was generated. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SourceCodeInfo { - /// A Location identifies a piece of source code in a .proto file which - /// corresponds to a particular definition. This information is intended - /// to be useful to IDEs, code indexers, documentation generators, and similar - /// tools. - /// - /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } - /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi - /// We have the following locations: - /// span path represents - /// \[a,i) [ 4, 0, 2, 0 \] The whole field definition. - /// \[a,b) [ 4, 0, 2, 0, 4 \] The label (optional). - /// \[c,d) [ 4, 0, 2, 0, 5 \] The type (string). - /// \[e,f) [ 4, 0, 2, 0, 1 \] The name (foo). - /// \[g,h) [ 4, 0, 2, 0, 3 \] The number (1). - /// - /// Notes: - /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. - /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. - /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. - /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendant. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. - /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. - #[prost(message, repeated, tag = "1")] - pub location: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `SourceCodeInfo`. -pub mod source_code_info { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Location { - /// Identifies which part of the FileDescriptorProto was defined at this - /// location. - /// - /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition appears. - /// For example, this path: - /// \[ 4, 3, 2, 7, 1 \] - /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 - /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; - /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; - /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; - /// - /// Thus, the above path gives the location of a field name. If we removed - /// the last element: - /// \[ 4, 3, 2, 7 \] - /// this path refers to the whole field declaration (from the beginning - /// of the label to the terminating semicolon). - #[prost(int32, repeated, tag = "1")] - pub path: ::prost::alloc::vec::Vec, - /// Always has exactly three or four elements: start line, start column, - /// end line (optional, otherwise assumed same as start line), end column. - /// These are packed into a single field for efficiency. Note that line - /// and column numbers are zero-based -- typically you will want to add - /// 1 to each before displaying to a user. - #[prost(int32, repeated, tag = "2")] - pub span: ::prost::alloc::vec::Vec, - /// If this SourceCodeInfo represents a complete declaration, these are any - /// comments appearing before and after the declaration which appear to be - /// attached to the declaration. - /// - /// A series of line comments appearing on consecutive lines, with no other - /// tokens appearing on those lines, will be treated as a single comment. - /// - /// leading_detached_comments will keep paragraphs of comments that appear - /// before (but not connected to) the current element. Each paragraph, - /// separated by empty lines, will be one comment element in the repeated - /// field. - /// - /// Only the comment content is provided; comment markers (e.g. //) are - /// stripped out. For block comments, leading whitespace and an asterisk - /// will be stripped from the beginning of each line other than the first. - /// Newlines are included in the output. - /// - /// Examples: - /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; - /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. - /// - /// // Comment attached to moo. - /// // - /// // Another line attached to moo. - /// optional double moo = 4; - /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to moo or corge because there are blank lines separating it from - /// // both. - /// - /// // Detached comment for corge paragraph 2. - /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; - /// - /// // ignored detached comments. - #[prost(string, optional, tag = "3")] - pub leading_comments: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "4")] - pub trailing_comments: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, repeated, tag = "6")] - pub leading_detached_comments: ::prost::alloc::vec::Vec< - ::prost::alloc::string::String, - >, - } - impl ::prost::Name for Location { - const NAME: &'static str = "Location"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.SourceCodeInfo.Location".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.SourceCodeInfo.Location".into() - } - } -} -impl ::prost::Name for SourceCodeInfo { - const NAME: &'static str = "SourceCodeInfo"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.SourceCodeInfo".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.SourceCodeInfo".into() - } -} -/// Describes the relationship between generated code and its original source -/// file. A GeneratedCodeInfo message is associated with only one generated -/// source file, but may contain references to different source .proto files. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GeneratedCodeInfo { - /// An Annotation connects some span of text in generated code to an element - /// of its generating .proto file. - #[prost(message, repeated, tag = "1")] - pub annotation: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `GeneratedCodeInfo`. -pub mod generated_code_info { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] - pub struct Annotation { - /// Identifies the element in the original source .proto file. This field - /// is formatted the same as SourceCodeInfo.Location.path. - #[prost(int32, repeated, tag = "1")] - pub path: ::prost::alloc::vec::Vec, - /// Identifies the filesystem path to the original source .proto. - #[prost(string, optional, tag = "2")] - pub source_file: ::core::option::Option<::prost::alloc::string::String>, - /// Identifies the starting offset in bytes in the generated code - /// that relates to the identified object. - #[prost(int32, optional, tag = "3")] - pub begin: ::core::option::Option, - /// Identifies the ending offset in bytes in the generated code that - /// relates to the identified object. The end offset should be one past - /// the last relevant byte (so the length of the text = end - begin). - #[prost(int32, optional, tag = "4")] - pub end: ::core::option::Option, - #[prost(enumeration = "annotation::Semantic", optional, tag = "5")] - pub semantic: ::core::option::Option, - } - /// Nested message and enum types in `Annotation`. - pub mod annotation { - /// Represents the identified object's effect on the element in the original - /// .proto file. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Semantic { - /// There is no effect or the effect is indescribable. - None = 0, - /// The element is set or otherwise mutated. - Set = 1, - /// An alias to the element is returned. - Alias = 2, - } - impl Semantic { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Semantic::None => "NONE", - Semantic::Set => "SET", - Semantic::Alias => "ALIAS", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NONE" => Some(Self::None), - "SET" => Some(Self::Set), - "ALIAS" => Some(Self::Alias), - _ => None, - } - } - } - } - impl ::prost::Name for Annotation { - const NAME: &'static str = "Annotation"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.GeneratedCodeInfo.Annotation".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.GeneratedCodeInfo.Annotation".into() - } - } -} -impl ::prost::Name for GeneratedCodeInfo { - const NAME: &'static str = "GeneratedCodeInfo"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.GeneratedCodeInfo".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.GeneratedCodeInfo".into() - } -} -/// The full set of known editions. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum Edition { - /// A placeholder for an unknown edition value. - Unknown = 0, - /// A placeholder edition for specifying default behaviors *before* a feature - /// was first introduced. This is effectively an "infinite past". - Legacy = 900, - /// Legacy syntax "editions". These pre-date editions, but behave much like - /// distinct editions. These can't be used to specify the edition of proto - /// files, but feature definitions must supply proto2/proto3 defaults for - /// backwards compatibility. - Proto2 = 998, - Proto3 = 999, - /// Editions that have been released. The specific values are arbitrary and - /// should not be depended on, but they will always be time-ordered for easy - /// comparison. - Edition2023 = 1000, - Edition2024 = 1001, - /// Placeholder editions for testing feature resolution. These should not be - /// used or relyed on outside of tests. - Edition1TestOnly = 1, - Edition2TestOnly = 2, - Edition99997TestOnly = 99997, - Edition99998TestOnly = 99998, - Edition99999TestOnly = 99999, - /// Placeholder for specifying unbounded edition support. This should only - /// ever be used by plugins that can expect to never require any changes to - /// support a new edition. - Max = 2147483647, -} -impl Edition { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Edition::Unknown => "EDITION_UNKNOWN", - Edition::Legacy => "EDITION_LEGACY", - Edition::Proto2 => "EDITION_PROTO2", - Edition::Proto3 => "EDITION_PROTO3", - Edition::Edition2023 => "EDITION_2023", - Edition::Edition2024 => "EDITION_2024", - Edition::Edition1TestOnly => "EDITION_1_TEST_ONLY", - Edition::Edition2TestOnly => "EDITION_2_TEST_ONLY", - Edition::Edition99997TestOnly => "EDITION_99997_TEST_ONLY", - Edition::Edition99998TestOnly => "EDITION_99998_TEST_ONLY", - Edition::Edition99999TestOnly => "EDITION_99999_TEST_ONLY", - Edition::Max => "EDITION_MAX", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "EDITION_UNKNOWN" => Some(Self::Unknown), - "EDITION_LEGACY" => Some(Self::Legacy), - "EDITION_PROTO2" => Some(Self::Proto2), - "EDITION_PROTO3" => Some(Self::Proto3), - "EDITION_2023" => Some(Self::Edition2023), - "EDITION_2024" => Some(Self::Edition2024), - "EDITION_1_TEST_ONLY" => Some(Self::Edition1TestOnly), - "EDITION_2_TEST_ONLY" => Some(Self::Edition2TestOnly), - "EDITION_99997_TEST_ONLY" => Some(Self::Edition99997TestOnly), - "EDITION_99998_TEST_ONLY" => Some(Self::Edition99998TestOnly), - "EDITION_99999_TEST_ONLY" => Some(Self::Edition99999TestOnly), - "EDITION_MAX" => Some(Self::Max), - _ => None, - } - } -} -/// A Timestamp represents a point in time independent of any time zone or local -/// calendar, encoded as a count of seconds and fractions of seconds at -/// nanosecond resolution. The count is relative to an epoch at UTC midnight on -/// January 1, 1970, in the proleptic Gregorian calendar which extends the -/// Gregorian calendar backwards to year one. -/// -/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -/// second table is needed for interpretation, using a [24-hour linear -/// smear](). -/// -/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -/// restricting to that range, we ensure that we can convert to and from [RFC -/// 3339]() date strings. -/// -/// # Examples -/// -/// Example 1: Compute Timestamp from POSIX `time()`. -/// -/// Timestamp timestamp; -/// timestamp.set_seconds(time(NULL)); -/// timestamp.set_nanos(0); -/// -/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -/// -/// struct timeval tv; -/// gettimeofday(&tv, NULL); -/// -/// Timestamp timestamp; -/// timestamp.set_seconds(tv.tv_sec); -/// timestamp.set_nanos(tv.tv_usec * 1000); -/// -/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -/// -/// FILETIME ft; -/// GetSystemTimeAsFileTime(&ft); -/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -/// -/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -/// Timestamp timestamp; -/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -/// -/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -/// -/// long millis = System.currentTimeMillis(); -/// -/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -/// .setNanos((int) ((millis % 1000) * 1000000)).build(); -/// -/// Example 5: Compute Timestamp from Java `Instant.now()`. -/// -/// Instant now = Instant.now(); -/// -/// Timestamp timestamp = -/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) -/// .setNanos(now.getNano()).build(); -/// -/// Example 6: Compute Timestamp from current time in Python. -/// -/// timestamp = Timestamp() -/// timestamp.GetCurrentTime() -/// -/// # JSON Mapping -/// -/// In JSON format, the Timestamp type is encoded as a string in the -/// [RFC 3339]() format. That is, the -/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}\[.{frac_sec}\]Z" -/// where {year} is always expressed using four digits while {month}, {day}, -/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -/// is required. A proto3 JSON serializer should always use UTC (as indicated by -/// "Z") when printing the Timestamp type and a proto3 JSON parser should be -/// able to accept both UTC and other timezones (as indicated by an offset). -/// -/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -/// 01:30 UTC on January 15, 2017. -/// -/// In JavaScript, one can convert a Date object to this format using the -/// standard -/// [toISOString()]() -/// method. In Python, a standard `datetime.datetime` object can be converted -/// to this format using -/// [`strftime`]() with -/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -/// ) -/// ) to obtain a formatter capable of generating timestamps in this format. -/// -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Timestamp { - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} -impl ::prost::Name for Timestamp { - const NAME: &'static str = "Timestamp"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.Timestamp".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.Timestamp".into() - } -} -/// A Duration represents a signed, fixed-length span of time represented -/// as a count of seconds and fractions of seconds at nanosecond -/// resolution. It is independent of any calendar and concepts like "day" -/// or "month". It is related to Timestamp in that the difference between -/// two Timestamp values is a Duration and it can be added or subtracted -/// from a Timestamp. Range is approximately +-10,000 years. -/// -/// # Examples -/// -/// Example 1: Compute Duration from two Timestamps in pseudo code. -/// -/// Timestamp start = ...; -/// Timestamp end = ...; -/// Duration duration = ...; -/// -/// duration.seconds = end.seconds - start.seconds; -/// duration.nanos = end.nanos - start.nanos; -/// -/// if (duration.seconds < 0 && duration.nanos > 0) { -/// duration.seconds += 1; -/// duration.nanos -= 1000000000; -/// } else if (duration.seconds > 0 && duration.nanos < 0) { -/// duration.seconds -= 1; -/// duration.nanos += 1000000000; -/// } -/// -/// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. -/// -/// Timestamp start = ...; -/// Duration duration = ...; -/// Timestamp end = ...; -/// -/// end.seconds = start.seconds + duration.seconds; -/// end.nanos = start.nanos + duration.nanos; -/// -/// if (end.nanos < 0) { -/// end.seconds -= 1; -/// end.nanos += 1000000000; -/// } else if (end.nanos >= 1000000000) { -/// end.seconds += 1; -/// end.nanos -= 1000000000; -/// } -/// -/// Example 3: Compute Duration from datetime.timedelta in Python. -/// -/// td = datetime.timedelta(days=3, minutes=10) -/// duration = Duration() -/// duration.FromTimedelta(td) -/// -/// # JSON Mapping -/// -/// In JSON format, the Duration type is encoded as a string rather than an -/// object, where the string ends in the suffix "s" (indicating seconds) and -/// is preceded by the number of seconds, with nanoseconds expressed as -/// fractional seconds. For example, 3 seconds with 0 nanoseconds should be -/// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should -/// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 -/// microsecond should be expressed in JSON format as "3.000001s". -/// -#[derive(Eq)] -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Duration { - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. Note: these bounds are computed from: - /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} -impl ::prost::Name for Duration { - const NAME: &'static str = "Duration"; - const PACKAGE: &'static str = "google.protobuf"; - fn full_name() -> ::prost::alloc::string::String { - "google.protobuf.Duration".into() - } - fn type_url() -> ::prost::alloc::string::String { - "/google.protobuf.Duration".into() - } -} diff --git a/src/prost/google.protobuf.serde.rs b/src/prost/google.protobuf.serde.rs deleted file mode 100644 index b47f4a59..00000000 --- a/src/prost/google.protobuf.serde.rs +++ /dev/null @@ -1,7200 +0,0 @@ -impl serde::Serialize for Any { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.Any", len)?; - if true { - struct_ser.serialize_field("typeUrl", &self.type_url)?; - } - if true { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("value", pbjson::private::base64::encode(&self.value).as_str())?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for Any { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "type_url", - "typeUrl", - "value", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - TypeUrl, - Value, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "typeUrl" | "type_url" => Ok(GeneratedField::TypeUrl), - "value" => Ok(GeneratedField::Value), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Any; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.Any") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut type_url__ = None; - let mut value__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::TypeUrl => { - if type_url__.is_some() { - return Err(serde::de::Error::duplicate_field("typeUrl")); - } - type_url__ = Some(map_.next_value()?); - } - GeneratedField::Value => { - if value__.is_some() { - return Err(serde::de::Error::duplicate_field("value")); - } - value__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; - } - } - } - Ok(Any { - type_url: type_url__.unwrap_or_default(), - value: value__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.Any", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for DescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.DescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if true { - struct_ser.serialize_field("field", &self.field)?; - } - if true { - struct_ser.serialize_field("extension", &self.extension)?; - } - if true { - struct_ser.serialize_field("nestedType", &self.nested_type)?; - } - if true { - struct_ser.serialize_field("enumType", &self.enum_type)?; - } - if true { - struct_ser.serialize_field("extensionRange", &self.extension_range)?; - } - if true { - struct_ser.serialize_field("oneofDecl", &self.oneof_decl)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - if true { - struct_ser.serialize_field("reservedRange", &self.reserved_range)?; - } - if true { - struct_ser.serialize_field("reservedName", &self.reserved_name)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for DescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "field", - "extension", - "nested_type", - "nestedType", - "enum_type", - "enumType", - "extension_range", - "extensionRange", - "oneof_decl", - "oneofDecl", - "options", - "reserved_range", - "reservedRange", - "reserved_name", - "reservedName", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Field, - Extension, - NestedType, - EnumType, - ExtensionRange, - OneofDecl, - Options, - ReservedRange, - ReservedName, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "field" => Ok(GeneratedField::Field), - "extension" => Ok(GeneratedField::Extension), - "nestedType" | "nested_type" => Ok(GeneratedField::NestedType), - "enumType" | "enum_type" => Ok(GeneratedField::EnumType), - "extensionRange" | "extension_range" => Ok(GeneratedField::ExtensionRange), - "oneofDecl" | "oneof_decl" => Ok(GeneratedField::OneofDecl), - "options" => Ok(GeneratedField::Options), - "reservedRange" | "reserved_range" => Ok(GeneratedField::ReservedRange), - "reservedName" | "reserved_name" => Ok(GeneratedField::ReservedName), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.DescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut field__ = None; - let mut extension__ = None; - let mut nested_type__ = None; - let mut enum_type__ = None; - let mut extension_range__ = None; - let mut oneof_decl__ = None; - let mut options__ = None; - let mut reserved_range__ = None; - let mut reserved_name__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Field => { - if field__.is_some() { - return Err(serde::de::Error::duplicate_field("field")); - } - field__ = Some(map_.next_value()?); - } - GeneratedField::Extension => { - if extension__.is_some() { - return Err(serde::de::Error::duplicate_field("extension")); - } - extension__ = Some(map_.next_value()?); - } - GeneratedField::NestedType => { - if nested_type__.is_some() { - return Err(serde::de::Error::duplicate_field("nestedType")); - } - nested_type__ = Some(map_.next_value()?); - } - GeneratedField::EnumType => { - if enum_type__.is_some() { - return Err(serde::de::Error::duplicate_field("enumType")); - } - enum_type__ = Some(map_.next_value()?); - } - GeneratedField::ExtensionRange => { - if extension_range__.is_some() { - return Err(serde::de::Error::duplicate_field("extensionRange")); - } - extension_range__ = Some(map_.next_value()?); - } - GeneratedField::OneofDecl => { - if oneof_decl__.is_some() { - return Err(serde::de::Error::duplicate_field("oneofDecl")); - } - oneof_decl__ = Some(map_.next_value()?); - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - GeneratedField::ReservedRange => { - if reserved_range__.is_some() { - return Err(serde::de::Error::duplicate_field("reservedRange")); - } - reserved_range__ = Some(map_.next_value()?); - } - GeneratedField::ReservedName => { - if reserved_name__.is_some() { - return Err(serde::de::Error::duplicate_field("reservedName")); - } - reserved_name__ = Some(map_.next_value()?); - } - } - } - Ok(DescriptorProto { - name: name__, - field: field__.unwrap_or_default(), - extension: extension__.unwrap_or_default(), - nested_type: nested_type__.unwrap_or_default(), - enum_type: enum_type__.unwrap_or_default(), - extension_range: extension_range__.unwrap_or_default(), - oneof_decl: oneof_decl__.unwrap_or_default(), - options: options__, - reserved_range: reserved_range__.unwrap_or_default(), - reserved_name: reserved_name__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.DescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for descriptor_proto::ExtensionRange { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.DescriptorProto.ExtensionRange", len)?; - if let Some(v) = self.start.as_ref() { - struct_ser.serialize_field("start", v)?; - } - if let Some(v) = self.end.as_ref() { - struct_ser.serialize_field("end", v)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for descriptor_proto::ExtensionRange { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "start", - "end", - "options", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Start, - End, - Options, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "start" => Ok(GeneratedField::Start), - "end" => Ok(GeneratedField::End), - "options" => Ok(GeneratedField::Options), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = descriptor_proto::ExtensionRange; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.DescriptorProto.ExtensionRange") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut start__ = None; - let mut end__ = None; - let mut options__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Start => { - if start__.is_some() { - return Err(serde::de::Error::duplicate_field("start")); - } - start__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::End => { - if end__.is_some() { - return Err(serde::de::Error::duplicate_field("end")); - } - end__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - } - } - Ok(descriptor_proto::ExtensionRange { - start: start__, - end: end__, - options: options__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.DescriptorProto.ExtensionRange", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for descriptor_proto::ReservedRange { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.DescriptorProto.ReservedRange", len)?; - if let Some(v) = self.start.as_ref() { - struct_ser.serialize_field("start", v)?; - } - if let Some(v) = self.end.as_ref() { - struct_ser.serialize_field("end", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for descriptor_proto::ReservedRange { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "start", - "end", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Start, - End, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "start" => Ok(GeneratedField::Start), - "end" => Ok(GeneratedField::End), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = descriptor_proto::ReservedRange; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.DescriptorProto.ReservedRange") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut start__ = None; - let mut end__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Start => { - if start__.is_some() { - return Err(serde::de::Error::duplicate_field("start")); - } - start__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::End => { - if end__.is_some() { - return Err(serde::de::Error::duplicate_field("end")); - } - end__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - } - } - Ok(descriptor_proto::ReservedRange { - start: start__, - end: end__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.DescriptorProto.ReservedRange", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for Duration { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.Duration", len)?; - if true { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seconds", ::alloc::string::ToString::to_string(&self.seconds).as_str())?; - } - if true { - struct_ser.serialize_field("nanos", &self.nanos)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for Duration { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "seconds", - "nanos", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Seconds, - Nanos, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "seconds" => Ok(GeneratedField::Seconds), - "nanos" => Ok(GeneratedField::Nanos), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Duration; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.Duration") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut seconds__ = None; - let mut nanos__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Seconds => { - if seconds__.is_some() { - return Err(serde::de::Error::duplicate_field("seconds")); - } - seconds__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Nanos => { - if nanos__.is_some() { - return Err(serde::de::Error::duplicate_field("nanos")); - } - nanos__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - } - } - Ok(Duration { - seconds: seconds__.unwrap_or_default(), - nanos: nanos__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.Duration", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for Edition { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "EDITION_UNKNOWN", - Self::Legacy => "EDITION_LEGACY", - Self::Proto2 => "EDITION_PROTO2", - Self::Proto3 => "EDITION_PROTO3", - Self::Edition2023 => "EDITION_2023", - Self::Edition2024 => "EDITION_2024", - Self::Edition1TestOnly => "EDITION_1_TEST_ONLY", - Self::Edition2TestOnly => "EDITION_2_TEST_ONLY", - Self::Edition99997TestOnly => "EDITION_99997_TEST_ONLY", - Self::Edition99998TestOnly => "EDITION_99998_TEST_ONLY", - Self::Edition99999TestOnly => "EDITION_99999_TEST_ONLY", - Self::Max => "EDITION_MAX", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for Edition { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "EDITION_UNKNOWN", - "EDITION_LEGACY", - "EDITION_PROTO2", - "EDITION_PROTO3", - "EDITION_2023", - "EDITION_2024", - "EDITION_1_TEST_ONLY", - "EDITION_2_TEST_ONLY", - "EDITION_99997_TEST_ONLY", - "EDITION_99998_TEST_ONLY", - "EDITION_99999_TEST_ONLY", - "EDITION_MAX", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Edition; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "EDITION_UNKNOWN" => Ok(Edition::Unknown), - "EDITION_LEGACY" => Ok(Edition::Legacy), - "EDITION_PROTO2" => Ok(Edition::Proto2), - "EDITION_PROTO3" => Ok(Edition::Proto3), - "EDITION_2023" => Ok(Edition::Edition2023), - "EDITION_2024" => Ok(Edition::Edition2024), - "EDITION_1_TEST_ONLY" => Ok(Edition::Edition1TestOnly), - "EDITION_2_TEST_ONLY" => Ok(Edition::Edition2TestOnly), - "EDITION_99997_TEST_ONLY" => Ok(Edition::Edition99997TestOnly), - "EDITION_99998_TEST_ONLY" => Ok(Edition::Edition99998TestOnly), - "EDITION_99999_TEST_ONLY" => Ok(Edition::Edition99999TestOnly), - "EDITION_MAX" => Ok(Edition::Max), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for EnumDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.EnumDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if true { - struct_ser.serialize_field("value", &self.value)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - if true { - struct_ser.serialize_field("reservedRange", &self.reserved_range)?; - } - if true { - struct_ser.serialize_field("reservedName", &self.reserved_name)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EnumDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "value", - "options", - "reserved_range", - "reservedRange", - "reserved_name", - "reservedName", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Value, - Options, - ReservedRange, - ReservedName, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "value" => Ok(GeneratedField::Value), - "options" => Ok(GeneratedField::Options), - "reservedRange" | "reserved_range" => Ok(GeneratedField::ReservedRange), - "reservedName" | "reserved_name" => Ok(GeneratedField::ReservedName), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EnumDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.EnumDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut value__ = None; - let mut options__ = None; - let mut reserved_range__ = None; - let mut reserved_name__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Value => { - if value__.is_some() { - return Err(serde::de::Error::duplicate_field("value")); - } - value__ = Some(map_.next_value()?); - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - GeneratedField::ReservedRange => { - if reserved_range__.is_some() { - return Err(serde::de::Error::duplicate_field("reservedRange")); - } - reserved_range__ = Some(map_.next_value()?); - } - GeneratedField::ReservedName => { - if reserved_name__.is_some() { - return Err(serde::de::Error::duplicate_field("reservedName")); - } - reserved_name__ = Some(map_.next_value()?); - } - } - } - Ok(EnumDescriptorProto { - name: name__, - value: value__.unwrap_or_default(), - options: options__, - reserved_range: reserved_range__.unwrap_or_default(), - reserved_name: reserved_name__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.EnumDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for enum_descriptor_proto::EnumReservedRange { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.EnumDescriptorProto.EnumReservedRange", len)?; - if let Some(v) = self.start.as_ref() { - struct_ser.serialize_field("start", v)?; - } - if let Some(v) = self.end.as_ref() { - struct_ser.serialize_field("end", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for enum_descriptor_proto::EnumReservedRange { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "start", - "end", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Start, - End, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "start" => Ok(GeneratedField::Start), - "end" => Ok(GeneratedField::End), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = enum_descriptor_proto::EnumReservedRange; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.EnumDescriptorProto.EnumReservedRange") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut start__ = None; - let mut end__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Start => { - if start__.is_some() { - return Err(serde::de::Error::duplicate_field("start")); - } - start__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::End => { - if end__.is_some() { - return Err(serde::de::Error::duplicate_field("end")); - } - end__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - } - } - Ok(enum_descriptor_proto::EnumReservedRange { - start: start__, - end: end__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.EnumDescriptorProto.EnumReservedRange", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EnumOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.EnumOptions", len)?; - if let Some(v) = self.allow_alias.as_ref() { - struct_ser.serialize_field("allowAlias", v)?; - } - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.deprecated_legacy_json_field_conflicts.as_ref() { - struct_ser.serialize_field("deprecatedLegacyJsonFieldConflicts", v)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EnumOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "allow_alias", - "allowAlias", - "deprecated", - "deprecated_legacy_json_field_conflicts", - "deprecatedLegacyJsonFieldConflicts", - "features", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AllowAlias, - Deprecated, - DeprecatedLegacyJsonFieldConflicts, - Features, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "allowAlias" | "allow_alias" => Ok(GeneratedField::AllowAlias), - "deprecated" => Ok(GeneratedField::Deprecated), - "deprecatedLegacyJsonFieldConflicts" | "deprecated_legacy_json_field_conflicts" => Ok(GeneratedField::DeprecatedLegacyJsonFieldConflicts), - "features" => Ok(GeneratedField::Features), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EnumOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.EnumOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut allow_alias__ = None; - let mut deprecated__ = None; - let mut deprecated_legacy_json_field_conflicts__ = None; - let mut features__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AllowAlias => { - if allow_alias__.is_some() { - return Err(serde::de::Error::duplicate_field("allowAlias")); - } - allow_alias__ = map_.next_value()?; - } - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::DeprecatedLegacyJsonFieldConflicts => { - if deprecated_legacy_json_field_conflicts__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecatedLegacyJsonFieldConflicts")); - } - deprecated_legacy_json_field_conflicts__ = map_.next_value()?; - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(EnumOptions { - allow_alias: allow_alias__, - deprecated: deprecated__, - deprecated_legacy_json_field_conflicts: deprecated_legacy_json_field_conflicts__, - features: features__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.EnumOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EnumValueDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.EnumValueDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if let Some(v) = self.number.as_ref() { - struct_ser.serialize_field("number", v)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EnumValueDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "number", - "options", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Number, - Options, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "number" => Ok(GeneratedField::Number), - "options" => Ok(GeneratedField::Options), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EnumValueDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.EnumValueDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut number__ = None; - let mut options__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Number => { - if number__.is_some() { - return Err(serde::de::Error::duplicate_field("number")); - } - number__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - } - } - Ok(EnumValueDescriptorProto { - name: name__, - number: number__, - options: options__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.EnumValueDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EnumValueOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.EnumValueOptions", len)?; - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if let Some(v) = self.debug_redact.as_ref() { - struct_ser.serialize_field("debugRedact", v)?; - } - if let Some(v) = self.feature_support.as_ref() { - struct_ser.serialize_field("featureSupport", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EnumValueOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "deprecated", - "features", - "debug_redact", - "debugRedact", - "feature_support", - "featureSupport", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Deprecated, - Features, - DebugRedact, - FeatureSupport, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "deprecated" => Ok(GeneratedField::Deprecated), - "features" => Ok(GeneratedField::Features), - "debugRedact" | "debug_redact" => Ok(GeneratedField::DebugRedact), - "featureSupport" | "feature_support" => Ok(GeneratedField::FeatureSupport), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EnumValueOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.EnumValueOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut deprecated__ = None; - let mut features__ = None; - let mut debug_redact__ = None; - let mut feature_support__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::DebugRedact => { - if debug_redact__.is_some() { - return Err(serde::de::Error::duplicate_field("debugRedact")); - } - debug_redact__ = map_.next_value()?; - } - GeneratedField::FeatureSupport => { - if feature_support__.is_some() { - return Err(serde::de::Error::duplicate_field("featureSupport")); - } - feature_support__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(EnumValueOptions { - deprecated: deprecated__, - features: features__, - debug_redact: debug_redact__, - feature_support: feature_support__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.EnumValueOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ExtensionRangeOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.ExtensionRangeOptions", len)?; - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - if true { - struct_ser.serialize_field("declaration", &self.declaration)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if let Some(v) = self.verification.as_ref() { - let v = extension_range_options::VerificationState::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("verification", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ExtensionRangeOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "uninterpreted_option", - "uninterpretedOption", - "declaration", - "features", - "verification", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - UninterpretedOption, - Declaration, - Features, - Verification, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - "declaration" => Ok(GeneratedField::Declaration), - "features" => Ok(GeneratedField::Features), - "verification" => Ok(GeneratedField::Verification), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ExtensionRangeOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.ExtensionRangeOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut uninterpreted_option__ = None; - let mut declaration__ = None; - let mut features__ = None; - let mut verification__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - GeneratedField::Declaration => { - if declaration__.is_some() { - return Err(serde::de::Error::duplicate_field("declaration")); - } - declaration__ = Some(map_.next_value()?); - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::Verification => { - if verification__.is_some() { - return Err(serde::de::Error::duplicate_field("verification")); - } - verification__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(ExtensionRangeOptions { - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - declaration: declaration__.unwrap_or_default(), - features: features__, - verification: verification__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.ExtensionRangeOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for extension_range_options::Declaration { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.ExtensionRangeOptions.Declaration", len)?; - if let Some(v) = self.number.as_ref() { - struct_ser.serialize_field("number", v)?; - } - if let Some(v) = self.full_name.as_ref() { - struct_ser.serialize_field("fullName", v)?; - } - if let Some(v) = self.r#type.as_ref() { - struct_ser.serialize_field("type", v)?; - } - if let Some(v) = self.reserved.as_ref() { - struct_ser.serialize_field("reserved", v)?; - } - if let Some(v) = self.repeated.as_ref() { - struct_ser.serialize_field("repeated", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for extension_range_options::Declaration { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "number", - "full_name", - "fullName", - "type", - "reserved", - "repeated", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Number, - FullName, - Type, - Reserved, - Repeated, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "number" => Ok(GeneratedField::Number), - "fullName" | "full_name" => Ok(GeneratedField::FullName), - "type" => Ok(GeneratedField::Type), - "reserved" => Ok(GeneratedField::Reserved), - "repeated" => Ok(GeneratedField::Repeated), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = extension_range_options::Declaration; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.ExtensionRangeOptions.Declaration") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut number__ = None; - let mut full_name__ = None; - let mut r#type__ = None; - let mut reserved__ = None; - let mut repeated__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Number => { - if number__.is_some() { - return Err(serde::de::Error::duplicate_field("number")); - } - number__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::FullName => { - if full_name__.is_some() { - return Err(serde::de::Error::duplicate_field("fullName")); - } - full_name__ = map_.next_value()?; - } - GeneratedField::Type => { - if r#type__.is_some() { - return Err(serde::de::Error::duplicate_field("type")); - } - r#type__ = map_.next_value()?; - } - GeneratedField::Reserved => { - if reserved__.is_some() { - return Err(serde::de::Error::duplicate_field("reserved")); - } - reserved__ = map_.next_value()?; - } - GeneratedField::Repeated => { - if repeated__.is_some() { - return Err(serde::de::Error::duplicate_field("repeated")); - } - repeated__ = map_.next_value()?; - } - } - } - Ok(extension_range_options::Declaration { - number: number__, - full_name: full_name__, - r#type: r#type__, - reserved: reserved__, - repeated: repeated__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.ExtensionRangeOptions.Declaration", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for extension_range_options::VerificationState { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Declaration => "DECLARATION", - Self::Unverified => "UNVERIFIED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for extension_range_options::VerificationState { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "DECLARATION", - "UNVERIFIED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = extension_range_options::VerificationState; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "DECLARATION" => Ok(extension_range_options::VerificationState::Declaration), - "UNVERIFIED" => Ok(extension_range_options::VerificationState::Unverified), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for FeatureSet { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FeatureSet", len)?; - if let Some(v) = self.field_presence.as_ref() { - let v = feature_set::FieldPresence::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("fieldPresence", &v)?; - } - if let Some(v) = self.enum_type.as_ref() { - let v = feature_set::EnumType::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("enumType", &v)?; - } - if let Some(v) = self.repeated_field_encoding.as_ref() { - let v = feature_set::RepeatedFieldEncoding::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("repeatedFieldEncoding", &v)?; - } - if let Some(v) = self.utf8_validation.as_ref() { - let v = feature_set::Utf8Validation::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("utf8Validation", &v)?; - } - if let Some(v) = self.message_encoding.as_ref() { - let v = feature_set::MessageEncoding::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("messageEncoding", &v)?; - } - if let Some(v) = self.json_format.as_ref() { - let v = feature_set::JsonFormat::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("jsonFormat", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FeatureSet { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "field_presence", - "fieldPresence", - "enum_type", - "enumType", - "repeated_field_encoding", - "repeatedFieldEncoding", - "utf8_validation", - "utf8Validation", - "message_encoding", - "messageEncoding", - "json_format", - "jsonFormat", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - FieldPresence, - EnumType, - RepeatedFieldEncoding, - Utf8Validation, - MessageEncoding, - JsonFormat, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "fieldPresence" | "field_presence" => Ok(GeneratedField::FieldPresence), - "enumType" | "enum_type" => Ok(GeneratedField::EnumType), - "repeatedFieldEncoding" | "repeated_field_encoding" => Ok(GeneratedField::RepeatedFieldEncoding), - "utf8Validation" | "utf8_validation" => Ok(GeneratedField::Utf8Validation), - "messageEncoding" | "message_encoding" => Ok(GeneratedField::MessageEncoding), - "jsonFormat" | "json_format" => Ok(GeneratedField::JsonFormat), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FeatureSet; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FeatureSet") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut field_presence__ = None; - let mut enum_type__ = None; - let mut repeated_field_encoding__ = None; - let mut utf8_validation__ = None; - let mut message_encoding__ = None; - let mut json_format__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::FieldPresence => { - if field_presence__.is_some() { - return Err(serde::de::Error::duplicate_field("fieldPresence")); - } - field_presence__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::EnumType => { - if enum_type__.is_some() { - return Err(serde::de::Error::duplicate_field("enumType")); - } - enum_type__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::RepeatedFieldEncoding => { - if repeated_field_encoding__.is_some() { - return Err(serde::de::Error::duplicate_field("repeatedFieldEncoding")); - } - repeated_field_encoding__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Utf8Validation => { - if utf8_validation__.is_some() { - return Err(serde::de::Error::duplicate_field("utf8Validation")); - } - utf8_validation__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::MessageEncoding => { - if message_encoding__.is_some() { - return Err(serde::de::Error::duplicate_field("messageEncoding")); - } - message_encoding__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::JsonFormat => { - if json_format__.is_some() { - return Err(serde::de::Error::duplicate_field("jsonFormat")); - } - json_format__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(FeatureSet { - field_presence: field_presence__, - enum_type: enum_type__, - repeated_field_encoding: repeated_field_encoding__, - utf8_validation: utf8_validation__, - message_encoding: message_encoding__, - json_format: json_format__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FeatureSet", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::EnumType { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "ENUM_TYPE_UNKNOWN", - Self::Open => "OPEN", - Self::Closed => "CLOSED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::EnumType { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "ENUM_TYPE_UNKNOWN", - "OPEN", - "CLOSED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::EnumType; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "ENUM_TYPE_UNKNOWN" => Ok(feature_set::EnumType::Unknown), - "OPEN" => Ok(feature_set::EnumType::Open), - "CLOSED" => Ok(feature_set::EnumType::Closed), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::FieldPresence { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "FIELD_PRESENCE_UNKNOWN", - Self::Explicit => "EXPLICIT", - Self::Implicit => "IMPLICIT", - Self::LegacyRequired => "LEGACY_REQUIRED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::FieldPresence { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "FIELD_PRESENCE_UNKNOWN", - "EXPLICIT", - "IMPLICIT", - "LEGACY_REQUIRED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::FieldPresence; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "FIELD_PRESENCE_UNKNOWN" => Ok(feature_set::FieldPresence::Unknown), - "EXPLICIT" => Ok(feature_set::FieldPresence::Explicit), - "IMPLICIT" => Ok(feature_set::FieldPresence::Implicit), - "LEGACY_REQUIRED" => Ok(feature_set::FieldPresence::LegacyRequired), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::JsonFormat { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "JSON_FORMAT_UNKNOWN", - Self::Allow => "ALLOW", - Self::LegacyBestEffort => "LEGACY_BEST_EFFORT", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::JsonFormat { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "JSON_FORMAT_UNKNOWN", - "ALLOW", - "LEGACY_BEST_EFFORT", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::JsonFormat; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "JSON_FORMAT_UNKNOWN" => Ok(feature_set::JsonFormat::Unknown), - "ALLOW" => Ok(feature_set::JsonFormat::Allow), - "LEGACY_BEST_EFFORT" => Ok(feature_set::JsonFormat::LegacyBestEffort), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::MessageEncoding { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "MESSAGE_ENCODING_UNKNOWN", - Self::LengthPrefixed => "LENGTH_PREFIXED", - Self::Delimited => "DELIMITED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::MessageEncoding { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "MESSAGE_ENCODING_UNKNOWN", - "LENGTH_PREFIXED", - "DELIMITED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::MessageEncoding; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "MESSAGE_ENCODING_UNKNOWN" => Ok(feature_set::MessageEncoding::Unknown), - "LENGTH_PREFIXED" => Ok(feature_set::MessageEncoding::LengthPrefixed), - "DELIMITED" => Ok(feature_set::MessageEncoding::Delimited), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::RepeatedFieldEncoding { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "REPEATED_FIELD_ENCODING_UNKNOWN", - Self::Packed => "PACKED", - Self::Expanded => "EXPANDED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::RepeatedFieldEncoding { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "REPEATED_FIELD_ENCODING_UNKNOWN", - "PACKED", - "EXPANDED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::RepeatedFieldEncoding; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "REPEATED_FIELD_ENCODING_UNKNOWN" => Ok(feature_set::RepeatedFieldEncoding::Unknown), - "PACKED" => Ok(feature_set::RepeatedFieldEncoding::Packed), - "EXPANDED" => Ok(feature_set::RepeatedFieldEncoding::Expanded), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for feature_set::Utf8Validation { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unknown => "UTF8_VALIDATION_UNKNOWN", - Self::Verify => "VERIFY", - Self::None => "NONE", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for feature_set::Utf8Validation { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "UTF8_VALIDATION_UNKNOWN", - "VERIFY", - "NONE", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set::Utf8Validation; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "UTF8_VALIDATION_UNKNOWN" => Ok(feature_set::Utf8Validation::Unknown), - "VERIFY" => Ok(feature_set::Utf8Validation::Verify), - "NONE" => Ok(feature_set::Utf8Validation::None), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for FeatureSetDefaults { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FeatureSetDefaults", len)?; - if true { - struct_ser.serialize_field("defaults", &self.defaults)?; - } - if let Some(v) = self.minimum_edition.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("minimumEdition", &v)?; - } - if let Some(v) = self.maximum_edition.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("maximumEdition", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FeatureSetDefaults { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "defaults", - "minimum_edition", - "minimumEdition", - "maximum_edition", - "maximumEdition", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Defaults, - MinimumEdition, - MaximumEdition, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "defaults" => Ok(GeneratedField::Defaults), - "minimumEdition" | "minimum_edition" => Ok(GeneratedField::MinimumEdition), - "maximumEdition" | "maximum_edition" => Ok(GeneratedField::MaximumEdition), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FeatureSetDefaults; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FeatureSetDefaults") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut defaults__ = None; - let mut minimum_edition__ = None; - let mut maximum_edition__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Defaults => { - if defaults__.is_some() { - return Err(serde::de::Error::duplicate_field("defaults")); - } - defaults__ = Some(map_.next_value()?); - } - GeneratedField::MinimumEdition => { - if minimum_edition__.is_some() { - return Err(serde::de::Error::duplicate_field("minimumEdition")); - } - minimum_edition__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::MaximumEdition => { - if maximum_edition__.is_some() { - return Err(serde::de::Error::duplicate_field("maximumEdition")); - } - maximum_edition__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(FeatureSetDefaults { - defaults: defaults__.unwrap_or_default(), - minimum_edition: minimum_edition__, - maximum_edition: maximum_edition__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FeatureSetDefaults", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for feature_set_defaults::FeatureSetEditionDefault { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault", len)?; - if let Some(v) = self.edition.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("edition", &v)?; - } - if let Some(v) = self.overridable_features.as_ref() { - struct_ser.serialize_field("overridableFeatures", v)?; - } - if let Some(v) = self.fixed_features.as_ref() { - struct_ser.serialize_field("fixedFeatures", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for feature_set_defaults::FeatureSetEditionDefault { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "edition", - "overridable_features", - "overridableFeatures", - "fixed_features", - "fixedFeatures", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Edition, - OverridableFeatures, - FixedFeatures, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "edition" => Ok(GeneratedField::Edition), - "overridableFeatures" | "overridable_features" => Ok(GeneratedField::OverridableFeatures), - "fixedFeatures" | "fixed_features" => Ok(GeneratedField::FixedFeatures), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = feature_set_defaults::FeatureSetEditionDefault; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut edition__ = None; - let mut overridable_features__ = None; - let mut fixed_features__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Edition => { - if edition__.is_some() { - return Err(serde::de::Error::duplicate_field("edition")); - } - edition__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::OverridableFeatures => { - if overridable_features__.is_some() { - return Err(serde::de::Error::duplicate_field("overridableFeatures")); - } - overridable_features__ = map_.next_value()?; - } - GeneratedField::FixedFeatures => { - if fixed_features__.is_some() { - return Err(serde::de::Error::duplicate_field("fixedFeatures")); - } - fixed_features__ = map_.next_value()?; - } - } - } - Ok(feature_set_defaults::FeatureSetEditionDefault { - edition: edition__, - overridable_features: overridable_features__, - fixed_features: fixed_features__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for FieldDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FieldDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if let Some(v) = self.number.as_ref() { - struct_ser.serialize_field("number", v)?; - } - if let Some(v) = self.label.as_ref() { - let v = field_descriptor_proto::Label::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("label", &v)?; - } - if let Some(v) = self.r#type.as_ref() { - let v = field_descriptor_proto::Type::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("type", &v)?; - } - if let Some(v) = self.type_name.as_ref() { - struct_ser.serialize_field("typeName", v)?; - } - if let Some(v) = self.extendee.as_ref() { - struct_ser.serialize_field("extendee", v)?; - } - if let Some(v) = self.default_value.as_ref() { - struct_ser.serialize_field("defaultValue", v)?; - } - if let Some(v) = self.oneof_index.as_ref() { - struct_ser.serialize_field("oneofIndex", v)?; - } - if let Some(v) = self.json_name.as_ref() { - struct_ser.serialize_field("jsonName", v)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - if let Some(v) = self.proto3_optional.as_ref() { - struct_ser.serialize_field("proto3Optional", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FieldDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "number", - "label", - "type", - "type_name", - "typeName", - "extendee", - "default_value", - "defaultValue", - "oneof_index", - "oneofIndex", - "json_name", - "jsonName", - "options", - "proto3_optional", - "proto3Optional", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Number, - Label, - Type, - TypeName, - Extendee, - DefaultValue, - OneofIndex, - JsonName, - Options, - Proto3Optional, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "number" => Ok(GeneratedField::Number), - "label" => Ok(GeneratedField::Label), - "type" => Ok(GeneratedField::Type), - "typeName" | "type_name" => Ok(GeneratedField::TypeName), - "extendee" => Ok(GeneratedField::Extendee), - "defaultValue" | "default_value" => Ok(GeneratedField::DefaultValue), - "oneofIndex" | "oneof_index" => Ok(GeneratedField::OneofIndex), - "jsonName" | "json_name" => Ok(GeneratedField::JsonName), - "options" => Ok(GeneratedField::Options), - "proto3Optional" | "proto3_optional" => Ok(GeneratedField::Proto3Optional), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FieldDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FieldDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut number__ = None; - let mut label__ = None; - let mut r#type__ = None; - let mut type_name__ = None; - let mut extendee__ = None; - let mut default_value__ = None; - let mut oneof_index__ = None; - let mut json_name__ = None; - let mut options__ = None; - let mut proto3_optional__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Number => { - if number__.is_some() { - return Err(serde::de::Error::duplicate_field("number")); - } - number__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::Label => { - if label__.is_some() { - return Err(serde::de::Error::duplicate_field("label")); - } - label__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Type => { - if r#type__.is_some() { - return Err(serde::de::Error::duplicate_field("type")); - } - r#type__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::TypeName => { - if type_name__.is_some() { - return Err(serde::de::Error::duplicate_field("typeName")); - } - type_name__ = map_.next_value()?; - } - GeneratedField::Extendee => { - if extendee__.is_some() { - return Err(serde::de::Error::duplicate_field("extendee")); - } - extendee__ = map_.next_value()?; - } - GeneratedField::DefaultValue => { - if default_value__.is_some() { - return Err(serde::de::Error::duplicate_field("defaultValue")); - } - default_value__ = map_.next_value()?; - } - GeneratedField::OneofIndex => { - if oneof_index__.is_some() { - return Err(serde::de::Error::duplicate_field("oneofIndex")); - } - oneof_index__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::JsonName => { - if json_name__.is_some() { - return Err(serde::de::Error::duplicate_field("jsonName")); - } - json_name__ = map_.next_value()?; - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - GeneratedField::Proto3Optional => { - if proto3_optional__.is_some() { - return Err(serde::de::Error::duplicate_field("proto3Optional")); - } - proto3_optional__ = map_.next_value()?; - } - } - } - Ok(FieldDescriptorProto { - name: name__, - number: number__, - label: label__, - r#type: r#type__, - type_name: type_name__, - extendee: extendee__, - default_value: default_value__, - oneof_index: oneof_index__, - json_name: json_name__, - options: options__, - proto3_optional: proto3_optional__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FieldDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for field_descriptor_proto::Label { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Optional => "LABEL_OPTIONAL", - Self::Repeated => "LABEL_REPEATED", - Self::Required => "LABEL_REQUIRED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_descriptor_proto::Label { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "LABEL_OPTIONAL", - "LABEL_REPEATED", - "LABEL_REQUIRED", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_descriptor_proto::Label; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "LABEL_OPTIONAL" => Ok(field_descriptor_proto::Label::Optional), - "LABEL_REPEATED" => Ok(field_descriptor_proto::Label::Repeated), - "LABEL_REQUIRED" => Ok(field_descriptor_proto::Label::Required), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for field_descriptor_proto::Type { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Double => "TYPE_DOUBLE", - Self::Float => "TYPE_FLOAT", - Self::Int64 => "TYPE_INT64", - Self::Uint64 => "TYPE_UINT64", - Self::Int32 => "TYPE_INT32", - Self::Fixed64 => "TYPE_FIXED64", - Self::Fixed32 => "TYPE_FIXED32", - Self::Bool => "TYPE_BOOL", - Self::String => "TYPE_STRING", - Self::Group => "TYPE_GROUP", - Self::Message => "TYPE_MESSAGE", - Self::Bytes => "TYPE_BYTES", - Self::Uint32 => "TYPE_UINT32", - Self::Enum => "TYPE_ENUM", - Self::Sfixed32 => "TYPE_SFIXED32", - Self::Sfixed64 => "TYPE_SFIXED64", - Self::Sint32 => "TYPE_SINT32", - Self::Sint64 => "TYPE_SINT64", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_descriptor_proto::Type { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "TYPE_DOUBLE", - "TYPE_FLOAT", - "TYPE_INT64", - "TYPE_UINT64", - "TYPE_INT32", - "TYPE_FIXED64", - "TYPE_FIXED32", - "TYPE_BOOL", - "TYPE_STRING", - "TYPE_GROUP", - "TYPE_MESSAGE", - "TYPE_BYTES", - "TYPE_UINT32", - "TYPE_ENUM", - "TYPE_SFIXED32", - "TYPE_SFIXED64", - "TYPE_SINT32", - "TYPE_SINT64", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_descriptor_proto::Type; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "TYPE_DOUBLE" => Ok(field_descriptor_proto::Type::Double), - "TYPE_FLOAT" => Ok(field_descriptor_proto::Type::Float), - "TYPE_INT64" => Ok(field_descriptor_proto::Type::Int64), - "TYPE_UINT64" => Ok(field_descriptor_proto::Type::Uint64), - "TYPE_INT32" => Ok(field_descriptor_proto::Type::Int32), - "TYPE_FIXED64" => Ok(field_descriptor_proto::Type::Fixed64), - "TYPE_FIXED32" => Ok(field_descriptor_proto::Type::Fixed32), - "TYPE_BOOL" => Ok(field_descriptor_proto::Type::Bool), - "TYPE_STRING" => Ok(field_descriptor_proto::Type::String), - "TYPE_GROUP" => Ok(field_descriptor_proto::Type::Group), - "TYPE_MESSAGE" => Ok(field_descriptor_proto::Type::Message), - "TYPE_BYTES" => Ok(field_descriptor_proto::Type::Bytes), - "TYPE_UINT32" => Ok(field_descriptor_proto::Type::Uint32), - "TYPE_ENUM" => Ok(field_descriptor_proto::Type::Enum), - "TYPE_SFIXED32" => Ok(field_descriptor_proto::Type::Sfixed32), - "TYPE_SFIXED64" => Ok(field_descriptor_proto::Type::Sfixed64), - "TYPE_SINT32" => Ok(field_descriptor_proto::Type::Sint32), - "TYPE_SINT64" => Ok(field_descriptor_proto::Type::Sint64), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for FieldOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FieldOptions", len)?; - if let Some(v) = self.ctype.as_ref() { - let v = field_options::CType::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("ctype", &v)?; - } - if let Some(v) = self.packed.as_ref() { - struct_ser.serialize_field("packed", v)?; - } - if let Some(v) = self.jstype.as_ref() { - let v = field_options::JsType::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("jstype", &v)?; - } - if let Some(v) = self.lazy.as_ref() { - struct_ser.serialize_field("lazy", v)?; - } - if let Some(v) = self.unverified_lazy.as_ref() { - struct_ser.serialize_field("unverifiedLazy", v)?; - } - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.weak.as_ref() { - struct_ser.serialize_field("weak", v)?; - } - if let Some(v) = self.debug_redact.as_ref() { - struct_ser.serialize_field("debugRedact", v)?; - } - if let Some(v) = self.retention.as_ref() { - let v = field_options::OptionRetention::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("retention", &v)?; - } - if true { - let v = self.targets.iter().cloned().map(|v| { - field_options::OptionTargetType::try_from(v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", v))) - }).collect::, _>>()?; - struct_ser.serialize_field("targets", &v)?; - } - if true { - struct_ser.serialize_field("editionDefaults", &self.edition_defaults)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if let Some(v) = self.feature_support.as_ref() { - struct_ser.serialize_field("featureSupport", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FieldOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "ctype", - "packed", - "jstype", - "lazy", - "unverified_lazy", - "unverifiedLazy", - "deprecated", - "weak", - "debug_redact", - "debugRedact", - "retention", - "targets", - "edition_defaults", - "editionDefaults", - "features", - "feature_support", - "featureSupport", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Ctype, - Packed, - Jstype, - Lazy, - UnverifiedLazy, - Deprecated, - Weak, - DebugRedact, - Retention, - Targets, - EditionDefaults, - Features, - FeatureSupport, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "ctype" => Ok(GeneratedField::Ctype), - "packed" => Ok(GeneratedField::Packed), - "jstype" => Ok(GeneratedField::Jstype), - "lazy" => Ok(GeneratedField::Lazy), - "unverifiedLazy" | "unverified_lazy" => Ok(GeneratedField::UnverifiedLazy), - "deprecated" => Ok(GeneratedField::Deprecated), - "weak" => Ok(GeneratedField::Weak), - "debugRedact" | "debug_redact" => Ok(GeneratedField::DebugRedact), - "retention" => Ok(GeneratedField::Retention), - "targets" => Ok(GeneratedField::Targets), - "editionDefaults" | "edition_defaults" => Ok(GeneratedField::EditionDefaults), - "features" => Ok(GeneratedField::Features), - "featureSupport" | "feature_support" => Ok(GeneratedField::FeatureSupport), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FieldOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FieldOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut ctype__ = None; - let mut packed__ = None; - let mut jstype__ = None; - let mut lazy__ = None; - let mut unverified_lazy__ = None; - let mut deprecated__ = None; - let mut weak__ = None; - let mut debug_redact__ = None; - let mut retention__ = None; - let mut targets__ = None; - let mut edition_defaults__ = None; - let mut features__ = None; - let mut feature_support__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Ctype => { - if ctype__.is_some() { - return Err(serde::de::Error::duplicate_field("ctype")); - } - ctype__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Packed => { - if packed__.is_some() { - return Err(serde::de::Error::duplicate_field("packed")); - } - packed__ = map_.next_value()?; - } - GeneratedField::Jstype => { - if jstype__.is_some() { - return Err(serde::de::Error::duplicate_field("jstype")); - } - jstype__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Lazy => { - if lazy__.is_some() { - return Err(serde::de::Error::duplicate_field("lazy")); - } - lazy__ = map_.next_value()?; - } - GeneratedField::UnverifiedLazy => { - if unverified_lazy__.is_some() { - return Err(serde::de::Error::duplicate_field("unverifiedLazy")); - } - unverified_lazy__ = map_.next_value()?; - } - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::Weak => { - if weak__.is_some() { - return Err(serde::de::Error::duplicate_field("weak")); - } - weak__ = map_.next_value()?; - } - GeneratedField::DebugRedact => { - if debug_redact__.is_some() { - return Err(serde::de::Error::duplicate_field("debugRedact")); - } - debug_redact__ = map_.next_value()?; - } - GeneratedField::Retention => { - if retention__.is_some() { - return Err(serde::de::Error::duplicate_field("retention")); - } - retention__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Targets => { - if targets__.is_some() { - return Err(serde::de::Error::duplicate_field("targets")); - } - targets__ = Some(map_.next_value::<::alloc::vec::Vec>()?.into_iter().map(|x| x as i32).collect()); - } - GeneratedField::EditionDefaults => { - if edition_defaults__.is_some() { - return Err(serde::de::Error::duplicate_field("editionDefaults")); - } - edition_defaults__ = Some(map_.next_value()?); - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::FeatureSupport => { - if feature_support__.is_some() { - return Err(serde::de::Error::duplicate_field("featureSupport")); - } - feature_support__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(FieldOptions { - ctype: ctype__, - packed: packed__, - jstype: jstype__, - lazy: lazy__, - unverified_lazy: unverified_lazy__, - deprecated: deprecated__, - weak: weak__, - debug_redact: debug_redact__, - retention: retention__, - targets: targets__.unwrap_or_default(), - edition_defaults: edition_defaults__.unwrap_or_default(), - features: features__, - feature_support: feature_support__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.FieldOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for field_options::CType { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::String => "STRING", - Self::Cord => "CORD", - Self::StringPiece => "STRING_PIECE", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_options::CType { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "STRING", - "CORD", - "STRING_PIECE", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::CType; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "STRING" => Ok(field_options::CType::String), - "CORD" => Ok(field_options::CType::Cord), - "STRING_PIECE" => Ok(field_options::CType::StringPiece), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for field_options::EditionDefault { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FieldOptions.EditionDefault", len)?; - if let Some(v) = self.edition.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("edition", &v)?; - } - if let Some(v) = self.value.as_ref() { - struct_ser.serialize_field("value", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for field_options::EditionDefault { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "edition", - "value", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Edition, - Value, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "edition" => Ok(GeneratedField::Edition), - "value" => Ok(GeneratedField::Value), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::EditionDefault; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FieldOptions.EditionDefault") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut edition__ = None; - let mut value__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Edition => { - if edition__.is_some() { - return Err(serde::de::Error::duplicate_field("edition")); - } - edition__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Value => { - if value__.is_some() { - return Err(serde::de::Error::duplicate_field("value")); - } - value__ = map_.next_value()?; - } - } - } - Ok(field_options::EditionDefault { - edition: edition__, - value: value__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FieldOptions.EditionDefault", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for field_options::FeatureSupport { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FieldOptions.FeatureSupport", len)?; - if let Some(v) = self.edition_introduced.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("editionIntroduced", &v)?; - } - if let Some(v) = self.edition_deprecated.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("editionDeprecated", &v)?; - } - if let Some(v) = self.deprecation_warning.as_ref() { - struct_ser.serialize_field("deprecationWarning", v)?; - } - if let Some(v) = self.edition_removed.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("editionRemoved", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for field_options::FeatureSupport { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "edition_introduced", - "editionIntroduced", - "edition_deprecated", - "editionDeprecated", - "deprecation_warning", - "deprecationWarning", - "edition_removed", - "editionRemoved", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - EditionIntroduced, - EditionDeprecated, - DeprecationWarning, - EditionRemoved, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "editionIntroduced" | "edition_introduced" => Ok(GeneratedField::EditionIntroduced), - "editionDeprecated" | "edition_deprecated" => Ok(GeneratedField::EditionDeprecated), - "deprecationWarning" | "deprecation_warning" => Ok(GeneratedField::DeprecationWarning), - "editionRemoved" | "edition_removed" => Ok(GeneratedField::EditionRemoved), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::FeatureSupport; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FieldOptions.FeatureSupport") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut edition_introduced__ = None; - let mut edition_deprecated__ = None; - let mut deprecation_warning__ = None; - let mut edition_removed__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::EditionIntroduced => { - if edition_introduced__.is_some() { - return Err(serde::de::Error::duplicate_field("editionIntroduced")); - } - edition_introduced__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::EditionDeprecated => { - if edition_deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("editionDeprecated")); - } - edition_deprecated__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::DeprecationWarning => { - if deprecation_warning__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecationWarning")); - } - deprecation_warning__ = map_.next_value()?; - } - GeneratedField::EditionRemoved => { - if edition_removed__.is_some() { - return Err(serde::de::Error::duplicate_field("editionRemoved")); - } - edition_removed__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(field_options::FeatureSupport { - edition_introduced: edition_introduced__, - edition_deprecated: edition_deprecated__, - deprecation_warning: deprecation_warning__, - edition_removed: edition_removed__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FieldOptions.FeatureSupport", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for field_options::JsType { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::JsNormal => "JS_NORMAL", - Self::JsString => "JS_STRING", - Self::JsNumber => "JS_NUMBER", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_options::JsType { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "JS_NORMAL", - "JS_STRING", - "JS_NUMBER", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::JsType; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "JS_NORMAL" => Ok(field_options::JsType::JsNormal), - "JS_STRING" => Ok(field_options::JsType::JsString), - "JS_NUMBER" => Ok(field_options::JsType::JsNumber), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for field_options::OptionRetention { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::RetentionUnknown => "RETENTION_UNKNOWN", - Self::RetentionRuntime => "RETENTION_RUNTIME", - Self::RetentionSource => "RETENTION_SOURCE", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_options::OptionRetention { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "RETENTION_UNKNOWN", - "RETENTION_RUNTIME", - "RETENTION_SOURCE", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::OptionRetention; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "RETENTION_UNKNOWN" => Ok(field_options::OptionRetention::RetentionUnknown), - "RETENTION_RUNTIME" => Ok(field_options::OptionRetention::RetentionRuntime), - "RETENTION_SOURCE" => Ok(field_options::OptionRetention::RetentionSource), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for field_options::OptionTargetType { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::TargetTypeUnknown => "TARGET_TYPE_UNKNOWN", - Self::TargetTypeFile => "TARGET_TYPE_FILE", - Self::TargetTypeExtensionRange => "TARGET_TYPE_EXTENSION_RANGE", - Self::TargetTypeMessage => "TARGET_TYPE_MESSAGE", - Self::TargetTypeField => "TARGET_TYPE_FIELD", - Self::TargetTypeOneof => "TARGET_TYPE_ONEOF", - Self::TargetTypeEnum => "TARGET_TYPE_ENUM", - Self::TargetTypeEnumEntry => "TARGET_TYPE_ENUM_ENTRY", - Self::TargetTypeService => "TARGET_TYPE_SERVICE", - Self::TargetTypeMethod => "TARGET_TYPE_METHOD", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for field_options::OptionTargetType { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "TARGET_TYPE_UNKNOWN", - "TARGET_TYPE_FILE", - "TARGET_TYPE_EXTENSION_RANGE", - "TARGET_TYPE_MESSAGE", - "TARGET_TYPE_FIELD", - "TARGET_TYPE_ONEOF", - "TARGET_TYPE_ENUM", - "TARGET_TYPE_ENUM_ENTRY", - "TARGET_TYPE_SERVICE", - "TARGET_TYPE_METHOD", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = field_options::OptionTargetType; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "TARGET_TYPE_UNKNOWN" => Ok(field_options::OptionTargetType::TargetTypeUnknown), - "TARGET_TYPE_FILE" => Ok(field_options::OptionTargetType::TargetTypeFile), - "TARGET_TYPE_EXTENSION_RANGE" => Ok(field_options::OptionTargetType::TargetTypeExtensionRange), - "TARGET_TYPE_MESSAGE" => Ok(field_options::OptionTargetType::TargetTypeMessage), - "TARGET_TYPE_FIELD" => Ok(field_options::OptionTargetType::TargetTypeField), - "TARGET_TYPE_ONEOF" => Ok(field_options::OptionTargetType::TargetTypeOneof), - "TARGET_TYPE_ENUM" => Ok(field_options::OptionTargetType::TargetTypeEnum), - "TARGET_TYPE_ENUM_ENTRY" => Ok(field_options::OptionTargetType::TargetTypeEnumEntry), - "TARGET_TYPE_SERVICE" => Ok(field_options::OptionTargetType::TargetTypeService), - "TARGET_TYPE_METHOD" => Ok(field_options::OptionTargetType::TargetTypeMethod), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for FileDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FileDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if let Some(v) = self.package.as_ref() { - struct_ser.serialize_field("package", v)?; - } - if true { - struct_ser.serialize_field("dependency", &self.dependency)?; - } - if true { - struct_ser.serialize_field("publicDependency", &self.public_dependency)?; - } - if true { - struct_ser.serialize_field("weakDependency", &self.weak_dependency)?; - } - if true { - struct_ser.serialize_field("messageType", &self.message_type)?; - } - if true { - struct_ser.serialize_field("enumType", &self.enum_type)?; - } - if true { - struct_ser.serialize_field("service", &self.service)?; - } - if true { - struct_ser.serialize_field("extension", &self.extension)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - if let Some(v) = self.source_code_info.as_ref() { - struct_ser.serialize_field("sourceCodeInfo", v)?; - } - if let Some(v) = self.syntax.as_ref() { - struct_ser.serialize_field("syntax", v)?; - } - if let Some(v) = self.edition.as_ref() { - let v = Edition::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("edition", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FileDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "package", - "dependency", - "public_dependency", - "publicDependency", - "weak_dependency", - "weakDependency", - "message_type", - "messageType", - "enum_type", - "enumType", - "service", - "extension", - "options", - "source_code_info", - "sourceCodeInfo", - "syntax", - "edition", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Package, - Dependency, - PublicDependency, - WeakDependency, - MessageType, - EnumType, - Service, - Extension, - Options, - SourceCodeInfo, - Syntax, - Edition, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "package" => Ok(GeneratedField::Package), - "dependency" => Ok(GeneratedField::Dependency), - "publicDependency" | "public_dependency" => Ok(GeneratedField::PublicDependency), - "weakDependency" | "weak_dependency" => Ok(GeneratedField::WeakDependency), - "messageType" | "message_type" => Ok(GeneratedField::MessageType), - "enumType" | "enum_type" => Ok(GeneratedField::EnumType), - "service" => Ok(GeneratedField::Service), - "extension" => Ok(GeneratedField::Extension), - "options" => Ok(GeneratedField::Options), - "sourceCodeInfo" | "source_code_info" => Ok(GeneratedField::SourceCodeInfo), - "syntax" => Ok(GeneratedField::Syntax), - "edition" => Ok(GeneratedField::Edition), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FileDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FileDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut package__ = None; - let mut dependency__ = None; - let mut public_dependency__ = None; - let mut weak_dependency__ = None; - let mut message_type__ = None; - let mut enum_type__ = None; - let mut service__ = None; - let mut extension__ = None; - let mut options__ = None; - let mut source_code_info__ = None; - let mut syntax__ = None; - let mut edition__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Package => { - if package__.is_some() { - return Err(serde::de::Error::duplicate_field("package")); - } - package__ = map_.next_value()?; - } - GeneratedField::Dependency => { - if dependency__.is_some() { - return Err(serde::de::Error::duplicate_field("dependency")); - } - dependency__ = Some(map_.next_value()?); - } - GeneratedField::PublicDependency => { - if public_dependency__.is_some() { - return Err(serde::de::Error::duplicate_field("publicDependency")); - } - public_dependency__ = - Some(map_.next_value::<::alloc::vec::Vec<::pbjson::private::NumberDeserialize<_>>>()? - .into_iter().map(|x| x.0).collect()) - ; - } - GeneratedField::WeakDependency => { - if weak_dependency__.is_some() { - return Err(serde::de::Error::duplicate_field("weakDependency")); - } - weak_dependency__ = - Some(map_.next_value::<::alloc::vec::Vec<::pbjson::private::NumberDeserialize<_>>>()? - .into_iter().map(|x| x.0).collect()) - ; - } - GeneratedField::MessageType => { - if message_type__.is_some() { - return Err(serde::de::Error::duplicate_field("messageType")); - } - message_type__ = Some(map_.next_value()?); - } - GeneratedField::EnumType => { - if enum_type__.is_some() { - return Err(serde::de::Error::duplicate_field("enumType")); - } - enum_type__ = Some(map_.next_value()?); - } - GeneratedField::Service => { - if service__.is_some() { - return Err(serde::de::Error::duplicate_field("service")); - } - service__ = Some(map_.next_value()?); - } - GeneratedField::Extension => { - if extension__.is_some() { - return Err(serde::de::Error::duplicate_field("extension")); - } - extension__ = Some(map_.next_value()?); - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - GeneratedField::SourceCodeInfo => { - if source_code_info__.is_some() { - return Err(serde::de::Error::duplicate_field("sourceCodeInfo")); - } - source_code_info__ = map_.next_value()?; - } - GeneratedField::Syntax => { - if syntax__.is_some() { - return Err(serde::de::Error::duplicate_field("syntax")); - } - syntax__ = map_.next_value()?; - } - GeneratedField::Edition => { - if edition__.is_some() { - return Err(serde::de::Error::duplicate_field("edition")); - } - edition__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(FileDescriptorProto { - name: name__, - package: package__, - dependency: dependency__.unwrap_or_default(), - public_dependency: public_dependency__.unwrap_or_default(), - weak_dependency: weak_dependency__.unwrap_or_default(), - message_type: message_type__.unwrap_or_default(), - enum_type: enum_type__.unwrap_or_default(), - service: service__.unwrap_or_default(), - extension: extension__.unwrap_or_default(), - options: options__, - source_code_info: source_code_info__, - syntax: syntax__, - edition: edition__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.FileDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for FileDescriptorSet { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FileDescriptorSet", len)?; - if true { - struct_ser.serialize_field("file", &self.file)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FileDescriptorSet { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "file", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - File, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "file" => Ok(GeneratedField::File), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FileDescriptorSet; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FileDescriptorSet") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut file__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::File => { - if file__.is_some() { - return Err(serde::de::Error::duplicate_field("file")); - } - file__ = Some(map_.next_value()?); - } - } - } - Ok(FileDescriptorSet { - file: file__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.FileDescriptorSet", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for FileOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.FileOptions", len)?; - if let Some(v) = self.java_package.as_ref() { - struct_ser.serialize_field("javaPackage", v)?; - } - if let Some(v) = self.java_outer_classname.as_ref() { - struct_ser.serialize_field("javaOuterClassname", v)?; - } - if let Some(v) = self.java_multiple_files.as_ref() { - struct_ser.serialize_field("javaMultipleFiles", v)?; - } - if let Some(v) = self.java_generate_equals_and_hash.as_ref() { - struct_ser.serialize_field("javaGenerateEqualsAndHash", v)?; - } - if let Some(v) = self.java_string_check_utf8.as_ref() { - struct_ser.serialize_field("javaStringCheckUtf8", v)?; - } - if let Some(v) = self.optimize_for.as_ref() { - let v = file_options::OptimizeMode::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("optimizeFor", &v)?; - } - if let Some(v) = self.go_package.as_ref() { - struct_ser.serialize_field("goPackage", v)?; - } - if let Some(v) = self.cc_generic_services.as_ref() { - struct_ser.serialize_field("ccGenericServices", v)?; - } - if let Some(v) = self.java_generic_services.as_ref() { - struct_ser.serialize_field("javaGenericServices", v)?; - } - if let Some(v) = self.py_generic_services.as_ref() { - struct_ser.serialize_field("pyGenericServices", v)?; - } - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.cc_enable_arenas.as_ref() { - struct_ser.serialize_field("ccEnableArenas", v)?; - } - if let Some(v) = self.objc_class_prefix.as_ref() { - struct_ser.serialize_field("objcClassPrefix", v)?; - } - if let Some(v) = self.csharp_namespace.as_ref() { - struct_ser.serialize_field("csharpNamespace", v)?; - } - if let Some(v) = self.swift_prefix.as_ref() { - struct_ser.serialize_field("swiftPrefix", v)?; - } - if let Some(v) = self.php_class_prefix.as_ref() { - struct_ser.serialize_field("phpClassPrefix", v)?; - } - if let Some(v) = self.php_namespace.as_ref() { - struct_ser.serialize_field("phpNamespace", v)?; - } - if let Some(v) = self.php_metadata_namespace.as_ref() { - struct_ser.serialize_field("phpMetadataNamespace", v)?; - } - if let Some(v) = self.ruby_package.as_ref() { - struct_ser.serialize_field("rubyPackage", v)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for FileOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "java_package", - "javaPackage", - "java_outer_classname", - "javaOuterClassname", - "java_multiple_files", - "javaMultipleFiles", - "java_generate_equals_and_hash", - "javaGenerateEqualsAndHash", - "java_string_check_utf8", - "javaStringCheckUtf8", - "optimize_for", - "optimizeFor", - "go_package", - "goPackage", - "cc_generic_services", - "ccGenericServices", - "java_generic_services", - "javaGenericServices", - "py_generic_services", - "pyGenericServices", - "deprecated", - "cc_enable_arenas", - "ccEnableArenas", - "objc_class_prefix", - "objcClassPrefix", - "csharp_namespace", - "csharpNamespace", - "swift_prefix", - "swiftPrefix", - "php_class_prefix", - "phpClassPrefix", - "php_namespace", - "phpNamespace", - "php_metadata_namespace", - "phpMetadataNamespace", - "ruby_package", - "rubyPackage", - "features", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - JavaPackage, - JavaOuterClassname, - JavaMultipleFiles, - JavaGenerateEqualsAndHash, - JavaStringCheckUtf8, - OptimizeFor, - GoPackage, - CcGenericServices, - JavaGenericServices, - PyGenericServices, - Deprecated, - CcEnableArenas, - ObjcClassPrefix, - CsharpNamespace, - SwiftPrefix, - PhpClassPrefix, - PhpNamespace, - PhpMetadataNamespace, - RubyPackage, - Features, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "javaPackage" | "java_package" => Ok(GeneratedField::JavaPackage), - "javaOuterClassname" | "java_outer_classname" => Ok(GeneratedField::JavaOuterClassname), - "javaMultipleFiles" | "java_multiple_files" => Ok(GeneratedField::JavaMultipleFiles), - "javaGenerateEqualsAndHash" | "java_generate_equals_and_hash" => Ok(GeneratedField::JavaGenerateEqualsAndHash), - "javaStringCheckUtf8" | "java_string_check_utf8" => Ok(GeneratedField::JavaStringCheckUtf8), - "optimizeFor" | "optimize_for" => Ok(GeneratedField::OptimizeFor), - "goPackage" | "go_package" => Ok(GeneratedField::GoPackage), - "ccGenericServices" | "cc_generic_services" => Ok(GeneratedField::CcGenericServices), - "javaGenericServices" | "java_generic_services" => Ok(GeneratedField::JavaGenericServices), - "pyGenericServices" | "py_generic_services" => Ok(GeneratedField::PyGenericServices), - "deprecated" => Ok(GeneratedField::Deprecated), - "ccEnableArenas" | "cc_enable_arenas" => Ok(GeneratedField::CcEnableArenas), - "objcClassPrefix" | "objc_class_prefix" => Ok(GeneratedField::ObjcClassPrefix), - "csharpNamespace" | "csharp_namespace" => Ok(GeneratedField::CsharpNamespace), - "swiftPrefix" | "swift_prefix" => Ok(GeneratedField::SwiftPrefix), - "phpClassPrefix" | "php_class_prefix" => Ok(GeneratedField::PhpClassPrefix), - "phpNamespace" | "php_namespace" => Ok(GeneratedField::PhpNamespace), - "phpMetadataNamespace" | "php_metadata_namespace" => Ok(GeneratedField::PhpMetadataNamespace), - "rubyPackage" | "ruby_package" => Ok(GeneratedField::RubyPackage), - "features" => Ok(GeneratedField::Features), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FileOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.FileOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut java_package__ = None; - let mut java_outer_classname__ = None; - let mut java_multiple_files__ = None; - let mut java_generate_equals_and_hash__ = None; - let mut java_string_check_utf8__ = None; - let mut optimize_for__ = None; - let mut go_package__ = None; - let mut cc_generic_services__ = None; - let mut java_generic_services__ = None; - let mut py_generic_services__ = None; - let mut deprecated__ = None; - let mut cc_enable_arenas__ = None; - let mut objc_class_prefix__ = None; - let mut csharp_namespace__ = None; - let mut swift_prefix__ = None; - let mut php_class_prefix__ = None; - let mut php_namespace__ = None; - let mut php_metadata_namespace__ = None; - let mut ruby_package__ = None; - let mut features__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::JavaPackage => { - if java_package__.is_some() { - return Err(serde::de::Error::duplicate_field("javaPackage")); - } - java_package__ = map_.next_value()?; - } - GeneratedField::JavaOuterClassname => { - if java_outer_classname__.is_some() { - return Err(serde::de::Error::duplicate_field("javaOuterClassname")); - } - java_outer_classname__ = map_.next_value()?; - } - GeneratedField::JavaMultipleFiles => { - if java_multiple_files__.is_some() { - return Err(serde::de::Error::duplicate_field("javaMultipleFiles")); - } - java_multiple_files__ = map_.next_value()?; - } - GeneratedField::JavaGenerateEqualsAndHash => { - if java_generate_equals_and_hash__.is_some() { - return Err(serde::de::Error::duplicate_field("javaGenerateEqualsAndHash")); - } - java_generate_equals_and_hash__ = map_.next_value()?; - } - GeneratedField::JavaStringCheckUtf8 => { - if java_string_check_utf8__.is_some() { - return Err(serde::de::Error::duplicate_field("javaStringCheckUtf8")); - } - java_string_check_utf8__ = map_.next_value()?; - } - GeneratedField::OptimizeFor => { - if optimize_for__.is_some() { - return Err(serde::de::Error::duplicate_field("optimizeFor")); - } - optimize_for__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::GoPackage => { - if go_package__.is_some() { - return Err(serde::de::Error::duplicate_field("goPackage")); - } - go_package__ = map_.next_value()?; - } - GeneratedField::CcGenericServices => { - if cc_generic_services__.is_some() { - return Err(serde::de::Error::duplicate_field("ccGenericServices")); - } - cc_generic_services__ = map_.next_value()?; - } - GeneratedField::JavaGenericServices => { - if java_generic_services__.is_some() { - return Err(serde::de::Error::duplicate_field("javaGenericServices")); - } - java_generic_services__ = map_.next_value()?; - } - GeneratedField::PyGenericServices => { - if py_generic_services__.is_some() { - return Err(serde::de::Error::duplicate_field("pyGenericServices")); - } - py_generic_services__ = map_.next_value()?; - } - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::CcEnableArenas => { - if cc_enable_arenas__.is_some() { - return Err(serde::de::Error::duplicate_field("ccEnableArenas")); - } - cc_enable_arenas__ = map_.next_value()?; - } - GeneratedField::ObjcClassPrefix => { - if objc_class_prefix__.is_some() { - return Err(serde::de::Error::duplicate_field("objcClassPrefix")); - } - objc_class_prefix__ = map_.next_value()?; - } - GeneratedField::CsharpNamespace => { - if csharp_namespace__.is_some() { - return Err(serde::de::Error::duplicate_field("csharpNamespace")); - } - csharp_namespace__ = map_.next_value()?; - } - GeneratedField::SwiftPrefix => { - if swift_prefix__.is_some() { - return Err(serde::de::Error::duplicate_field("swiftPrefix")); - } - swift_prefix__ = map_.next_value()?; - } - GeneratedField::PhpClassPrefix => { - if php_class_prefix__.is_some() { - return Err(serde::de::Error::duplicate_field("phpClassPrefix")); - } - php_class_prefix__ = map_.next_value()?; - } - GeneratedField::PhpNamespace => { - if php_namespace__.is_some() { - return Err(serde::de::Error::duplicate_field("phpNamespace")); - } - php_namespace__ = map_.next_value()?; - } - GeneratedField::PhpMetadataNamespace => { - if php_metadata_namespace__.is_some() { - return Err(serde::de::Error::duplicate_field("phpMetadataNamespace")); - } - php_metadata_namespace__ = map_.next_value()?; - } - GeneratedField::RubyPackage => { - if ruby_package__.is_some() { - return Err(serde::de::Error::duplicate_field("rubyPackage")); - } - ruby_package__ = map_.next_value()?; - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(FileOptions { - java_package: java_package__, - java_outer_classname: java_outer_classname__, - java_multiple_files: java_multiple_files__, - java_generate_equals_and_hash: java_generate_equals_and_hash__, - java_string_check_utf8: java_string_check_utf8__, - optimize_for: optimize_for__, - go_package: go_package__, - cc_generic_services: cc_generic_services__, - java_generic_services: java_generic_services__, - py_generic_services: py_generic_services__, - deprecated: deprecated__, - cc_enable_arenas: cc_enable_arenas__, - objc_class_prefix: objc_class_prefix__, - csharp_namespace: csharp_namespace__, - swift_prefix: swift_prefix__, - php_class_prefix: php_class_prefix__, - php_namespace: php_namespace__, - php_metadata_namespace: php_metadata_namespace__, - ruby_package: ruby_package__, - features: features__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.FileOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for file_options::OptimizeMode { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Speed => "SPEED", - Self::CodeSize => "CODE_SIZE", - Self::LiteRuntime => "LITE_RUNTIME", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for file_options::OptimizeMode { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "SPEED", - "CODE_SIZE", - "LITE_RUNTIME", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = file_options::OptimizeMode; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "SPEED" => Ok(file_options::OptimizeMode::Speed), - "CODE_SIZE" => Ok(file_options::OptimizeMode::CodeSize), - "LITE_RUNTIME" => Ok(file_options::OptimizeMode::LiteRuntime), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for GeneratedCodeInfo { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.GeneratedCodeInfo", len)?; - if true { - struct_ser.serialize_field("annotation", &self.annotation)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GeneratedCodeInfo { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "annotation", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Annotation, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "annotation" => Ok(GeneratedField::Annotation), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedCodeInfo; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.GeneratedCodeInfo") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut annotation__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Annotation => { - if annotation__.is_some() { - return Err(serde::de::Error::duplicate_field("annotation")); - } - annotation__ = Some(map_.next_value()?); - } - } - } - Ok(GeneratedCodeInfo { - annotation: annotation__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.GeneratedCodeInfo", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for generated_code_info::Annotation { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.GeneratedCodeInfo.Annotation", len)?; - if true { - struct_ser.serialize_field("path", &self.path)?; - } - if let Some(v) = self.source_file.as_ref() { - struct_ser.serialize_field("sourceFile", v)?; - } - if let Some(v) = self.begin.as_ref() { - struct_ser.serialize_field("begin", v)?; - } - if let Some(v) = self.end.as_ref() { - struct_ser.serialize_field("end", v)?; - } - if let Some(v) = self.semantic.as_ref() { - let v = generated_code_info::annotation::Semantic::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("semantic", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for generated_code_info::Annotation { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "path", - "source_file", - "sourceFile", - "begin", - "end", - "semantic", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Path, - SourceFile, - Begin, - End, - Semantic, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "path" => Ok(GeneratedField::Path), - "sourceFile" | "source_file" => Ok(GeneratedField::SourceFile), - "begin" => Ok(GeneratedField::Begin), - "end" => Ok(GeneratedField::End), - "semantic" => Ok(GeneratedField::Semantic), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = generated_code_info::Annotation; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.GeneratedCodeInfo.Annotation") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut path__ = None; - let mut source_file__ = None; - let mut begin__ = None; - let mut end__ = None; - let mut semantic__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Path => { - if path__.is_some() { - return Err(serde::de::Error::duplicate_field("path")); - } - path__ = - Some(map_.next_value::<::alloc::vec::Vec<::pbjson::private::NumberDeserialize<_>>>()? - .into_iter().map(|x| x.0).collect()) - ; - } - GeneratedField::SourceFile => { - if source_file__.is_some() { - return Err(serde::de::Error::duplicate_field("sourceFile")); - } - source_file__ = map_.next_value()?; - } - GeneratedField::Begin => { - if begin__.is_some() { - return Err(serde::de::Error::duplicate_field("begin")); - } - begin__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::End => { - if end__.is_some() { - return Err(serde::de::Error::duplicate_field("end")); - } - end__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::Semantic => { - if semantic__.is_some() { - return Err(serde::de::Error::duplicate_field("semantic")); - } - semantic__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - } - } - Ok(generated_code_info::Annotation { - path: path__.unwrap_or_default(), - source_file: source_file__, - begin: begin__, - end: end__, - semantic: semantic__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.GeneratedCodeInfo.Annotation", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for generated_code_info::annotation::Semantic { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::None => "NONE", - Self::Set => "SET", - Self::Alias => "ALIAS", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for generated_code_info::annotation::Semantic { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "NONE", - "SET", - "ALIAS", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = generated_code_info::annotation::Semantic; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "NONE" => Ok(generated_code_info::annotation::Semantic::None), - "SET" => Ok(generated_code_info::annotation::Semantic::Set), - "ALIAS" => Ok(generated_code_info::annotation::Semantic::Alias), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for MessageOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.MessageOptions", len)?; - if let Some(v) = self.message_set_wire_format.as_ref() { - struct_ser.serialize_field("messageSetWireFormat", v)?; - } - if let Some(v) = self.no_standard_descriptor_accessor.as_ref() { - struct_ser.serialize_field("noStandardDescriptorAccessor", v)?; - } - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.map_entry.as_ref() { - struct_ser.serialize_field("mapEntry", v)?; - } - if let Some(v) = self.deprecated_legacy_json_field_conflicts.as_ref() { - struct_ser.serialize_field("deprecatedLegacyJsonFieldConflicts", v)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for MessageOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "message_set_wire_format", - "messageSetWireFormat", - "no_standard_descriptor_accessor", - "noStandardDescriptorAccessor", - "deprecated", - "map_entry", - "mapEntry", - "deprecated_legacy_json_field_conflicts", - "deprecatedLegacyJsonFieldConflicts", - "features", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - MessageSetWireFormat, - NoStandardDescriptorAccessor, - Deprecated, - MapEntry, - DeprecatedLegacyJsonFieldConflicts, - Features, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "messageSetWireFormat" | "message_set_wire_format" => Ok(GeneratedField::MessageSetWireFormat), - "noStandardDescriptorAccessor" | "no_standard_descriptor_accessor" => Ok(GeneratedField::NoStandardDescriptorAccessor), - "deprecated" => Ok(GeneratedField::Deprecated), - "mapEntry" | "map_entry" => Ok(GeneratedField::MapEntry), - "deprecatedLegacyJsonFieldConflicts" | "deprecated_legacy_json_field_conflicts" => Ok(GeneratedField::DeprecatedLegacyJsonFieldConflicts), - "features" => Ok(GeneratedField::Features), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MessageOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.MessageOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut message_set_wire_format__ = None; - let mut no_standard_descriptor_accessor__ = None; - let mut deprecated__ = None; - let mut map_entry__ = None; - let mut deprecated_legacy_json_field_conflicts__ = None; - let mut features__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::MessageSetWireFormat => { - if message_set_wire_format__.is_some() { - return Err(serde::de::Error::duplicate_field("messageSetWireFormat")); - } - message_set_wire_format__ = map_.next_value()?; - } - GeneratedField::NoStandardDescriptorAccessor => { - if no_standard_descriptor_accessor__.is_some() { - return Err(serde::de::Error::duplicate_field("noStandardDescriptorAccessor")); - } - no_standard_descriptor_accessor__ = map_.next_value()?; - } - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::MapEntry => { - if map_entry__.is_some() { - return Err(serde::de::Error::duplicate_field("mapEntry")); - } - map_entry__ = map_.next_value()?; - } - GeneratedField::DeprecatedLegacyJsonFieldConflicts => { - if deprecated_legacy_json_field_conflicts__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecatedLegacyJsonFieldConflicts")); - } - deprecated_legacy_json_field_conflicts__ = map_.next_value()?; - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(MessageOptions { - message_set_wire_format: message_set_wire_format__, - no_standard_descriptor_accessor: no_standard_descriptor_accessor__, - deprecated: deprecated__, - map_entry: map_entry__, - deprecated_legacy_json_field_conflicts: deprecated_legacy_json_field_conflicts__, - features: features__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.MessageOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for MethodDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.MethodDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if let Some(v) = self.input_type.as_ref() { - struct_ser.serialize_field("inputType", v)?; - } - if let Some(v) = self.output_type.as_ref() { - struct_ser.serialize_field("outputType", v)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - if let Some(v) = self.client_streaming.as_ref() { - struct_ser.serialize_field("clientStreaming", v)?; - } - if let Some(v) = self.server_streaming.as_ref() { - struct_ser.serialize_field("serverStreaming", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for MethodDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "input_type", - "inputType", - "output_type", - "outputType", - "options", - "client_streaming", - "clientStreaming", - "server_streaming", - "serverStreaming", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - InputType, - OutputType, - Options, - ClientStreaming, - ServerStreaming, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "inputType" | "input_type" => Ok(GeneratedField::InputType), - "outputType" | "output_type" => Ok(GeneratedField::OutputType), - "options" => Ok(GeneratedField::Options), - "clientStreaming" | "client_streaming" => Ok(GeneratedField::ClientStreaming), - "serverStreaming" | "server_streaming" => Ok(GeneratedField::ServerStreaming), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MethodDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.MethodDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut input_type__ = None; - let mut output_type__ = None; - let mut options__ = None; - let mut client_streaming__ = None; - let mut server_streaming__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::InputType => { - if input_type__.is_some() { - return Err(serde::de::Error::duplicate_field("inputType")); - } - input_type__ = map_.next_value()?; - } - GeneratedField::OutputType => { - if output_type__.is_some() { - return Err(serde::de::Error::duplicate_field("outputType")); - } - output_type__ = map_.next_value()?; - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - GeneratedField::ClientStreaming => { - if client_streaming__.is_some() { - return Err(serde::de::Error::duplicate_field("clientStreaming")); - } - client_streaming__ = map_.next_value()?; - } - GeneratedField::ServerStreaming => { - if server_streaming__.is_some() { - return Err(serde::de::Error::duplicate_field("serverStreaming")); - } - server_streaming__ = map_.next_value()?; - } - } - } - Ok(MethodDescriptorProto { - name: name__, - input_type: input_type__, - output_type: output_type__, - options: options__, - client_streaming: client_streaming__, - server_streaming: server_streaming__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.MethodDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for MethodOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.MethodOptions", len)?; - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if let Some(v) = self.idempotency_level.as_ref() { - let v = method_options::IdempotencyLevel::try_from(*v) - .map_err(|_| serde::ser::Error::custom(::alloc::format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("idempotencyLevel", &v)?; - } - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for MethodOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "deprecated", - "idempotency_level", - "idempotencyLevel", - "features", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Deprecated, - IdempotencyLevel, - Features, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "deprecated" => Ok(GeneratedField::Deprecated), - "idempotencyLevel" | "idempotency_level" => Ok(GeneratedField::IdempotencyLevel), - "features" => Ok(GeneratedField::Features), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MethodOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.MethodOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut deprecated__ = None; - let mut idempotency_level__ = None; - let mut features__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::IdempotencyLevel => { - if idempotency_level__.is_some() { - return Err(serde::de::Error::duplicate_field("idempotencyLevel")); - } - idempotency_level__ = map_.next_value::<::core::option::Option>()?.map(|x| x as i32); - } - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(MethodOptions { - deprecated: deprecated__, - idempotency_level: idempotency_level__, - features: features__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.MethodOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for method_options::IdempotencyLevel { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::IdempotencyUnknown => "IDEMPOTENCY_UNKNOWN", - Self::NoSideEffects => "NO_SIDE_EFFECTS", - Self::Idempotent => "IDEMPOTENT", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for method_options::IdempotencyLevel { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "IDEMPOTENCY_UNKNOWN", - "NO_SIDE_EFFECTS", - "IDEMPOTENT", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = method_options::IdempotencyLevel; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> core::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "IDEMPOTENCY_UNKNOWN" => Ok(method_options::IdempotencyLevel::IdempotencyUnknown), - "NO_SIDE_EFFECTS" => Ok(method_options::IdempotencyLevel::NoSideEffects), - "IDEMPOTENT" => Ok(method_options::IdempotencyLevel::Idempotent), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for OneofDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.OneofDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for OneofDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "options", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Options, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "options" => Ok(GeneratedField::Options), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = OneofDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.OneofDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut options__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - } - } - Ok(OneofDescriptorProto { - name: name__, - options: options__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.OneofDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for OneofOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.OneofOptions", len)?; - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for OneofOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "features", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Features, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "features" => Ok(GeneratedField::Features), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = OneofOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.OneofOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut features__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(OneofOptions { - features: features__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.OneofOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ServiceDescriptorProto { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.ServiceDescriptorProto", len)?; - if let Some(v) = self.name.as_ref() { - struct_ser.serialize_field("name", v)?; - } - if true { - struct_ser.serialize_field("method", &self.method)?; - } - if let Some(v) = self.options.as_ref() { - struct_ser.serialize_field("options", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ServiceDescriptorProto { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "method", - "options", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - Method, - Options, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "method" => Ok(GeneratedField::Method), - "options" => Ok(GeneratedField::Options), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ServiceDescriptorProto; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.ServiceDescriptorProto") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut method__ = None; - let mut options__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = map_.next_value()?; - } - GeneratedField::Method => { - if method__.is_some() { - return Err(serde::de::Error::duplicate_field("method")); - } - method__ = Some(map_.next_value()?); - } - GeneratedField::Options => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); - } - options__ = map_.next_value()?; - } - } - } - Ok(ServiceDescriptorProto { - name: name__, - method: method__.unwrap_or_default(), - options: options__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.ServiceDescriptorProto", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ServiceOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.ServiceOptions", len)?; - if let Some(v) = self.features.as_ref() { - struct_ser.serialize_field("features", v)?; - } - if let Some(v) = self.deprecated.as_ref() { - struct_ser.serialize_field("deprecated", v)?; - } - if true { - struct_ser.serialize_field("uninterpretedOption", &self.uninterpreted_option)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ServiceOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "features", - "deprecated", - "uninterpreted_option", - "uninterpretedOption", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Features, - Deprecated, - UninterpretedOption, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "features" => Ok(GeneratedField::Features), - "deprecated" => Ok(GeneratedField::Deprecated), - "uninterpretedOption" | "uninterpreted_option" => Ok(GeneratedField::UninterpretedOption), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ServiceOptions; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.ServiceOptions") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut features__ = None; - let mut deprecated__ = None; - let mut uninterpreted_option__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Features => { - if features__.is_some() { - return Err(serde::de::Error::duplicate_field("features")); - } - features__ = map_.next_value()?; - } - GeneratedField::Deprecated => { - if deprecated__.is_some() { - return Err(serde::de::Error::duplicate_field("deprecated")); - } - deprecated__ = map_.next_value()?; - } - GeneratedField::UninterpretedOption => { - if uninterpreted_option__.is_some() { - return Err(serde::de::Error::duplicate_field("uninterpretedOption")); - } - uninterpreted_option__ = Some(map_.next_value()?); - } - } - } - Ok(ServiceOptions { - features: features__, - deprecated: deprecated__, - uninterpreted_option: uninterpreted_option__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.ServiceOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for SourceCodeInfo { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.SourceCodeInfo", len)?; - if true { - struct_ser.serialize_field("location", &self.location)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for SourceCodeInfo { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "location", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Location, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "location" => Ok(GeneratedField::Location), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = SourceCodeInfo; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.SourceCodeInfo") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut location__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Location => { - if location__.is_some() { - return Err(serde::de::Error::duplicate_field("location")); - } - location__ = Some(map_.next_value()?); - } - } - } - Ok(SourceCodeInfo { - location: location__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.SourceCodeInfo", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for source_code_info::Location { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.SourceCodeInfo.Location", len)?; - if true { - struct_ser.serialize_field("path", &self.path)?; - } - if true { - struct_ser.serialize_field("span", &self.span)?; - } - if let Some(v) = self.leading_comments.as_ref() { - struct_ser.serialize_field("leadingComments", v)?; - } - if let Some(v) = self.trailing_comments.as_ref() { - struct_ser.serialize_field("trailingComments", v)?; - } - if true { - struct_ser.serialize_field("leadingDetachedComments", &self.leading_detached_comments)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for source_code_info::Location { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "path", - "span", - "leading_comments", - "leadingComments", - "trailing_comments", - "trailingComments", - "leading_detached_comments", - "leadingDetachedComments", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Path, - Span, - LeadingComments, - TrailingComments, - LeadingDetachedComments, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "path" => Ok(GeneratedField::Path), - "span" => Ok(GeneratedField::Span), - "leadingComments" | "leading_comments" => Ok(GeneratedField::LeadingComments), - "trailingComments" | "trailing_comments" => Ok(GeneratedField::TrailingComments), - "leadingDetachedComments" | "leading_detached_comments" => Ok(GeneratedField::LeadingDetachedComments), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = source_code_info::Location; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.SourceCodeInfo.Location") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut path__ = None; - let mut span__ = None; - let mut leading_comments__ = None; - let mut trailing_comments__ = None; - let mut leading_detached_comments__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Path => { - if path__.is_some() { - return Err(serde::de::Error::duplicate_field("path")); - } - path__ = - Some(map_.next_value::<::alloc::vec::Vec<::pbjson::private::NumberDeserialize<_>>>()? - .into_iter().map(|x| x.0).collect()) - ; - } - GeneratedField::Span => { - if span__.is_some() { - return Err(serde::de::Error::duplicate_field("span")); - } - span__ = - Some(map_.next_value::<::alloc::vec::Vec<::pbjson::private::NumberDeserialize<_>>>()? - .into_iter().map(|x| x.0).collect()) - ; - } - GeneratedField::LeadingComments => { - if leading_comments__.is_some() { - return Err(serde::de::Error::duplicate_field("leadingComments")); - } - leading_comments__ = map_.next_value()?; - } - GeneratedField::TrailingComments => { - if trailing_comments__.is_some() { - return Err(serde::de::Error::duplicate_field("trailingComments")); - } - trailing_comments__ = map_.next_value()?; - } - GeneratedField::LeadingDetachedComments => { - if leading_detached_comments__.is_some() { - return Err(serde::de::Error::duplicate_field("leadingDetachedComments")); - } - leading_detached_comments__ = Some(map_.next_value()?); - } - } - } - Ok(source_code_info::Location { - path: path__.unwrap_or_default(), - span: span__.unwrap_or_default(), - leading_comments: leading_comments__, - trailing_comments: trailing_comments__, - leading_detached_comments: leading_detached_comments__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.SourceCodeInfo.Location", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for Timestamp { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.Timestamp", len)?; - if true { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seconds", ::alloc::string::ToString::to_string(&self.seconds).as_str())?; - } - if true { - struct_ser.serialize_field("nanos", &self.nanos)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for Timestamp { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "seconds", - "nanos", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Seconds, - Nanos, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "seconds" => Ok(GeneratedField::Seconds), - "nanos" => Ok(GeneratedField::Nanos), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Timestamp; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.Timestamp") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut seconds__ = None; - let mut nanos__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Seconds => { - if seconds__.is_some() { - return Err(serde::de::Error::duplicate_field("seconds")); - } - seconds__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Nanos => { - if nanos__.is_some() { - return Err(serde::de::Error::duplicate_field("nanos")); - } - nanos__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - } - } - Ok(Timestamp { - seconds: seconds__.unwrap_or_default(), - nanos: nanos__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("google.protobuf.Timestamp", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for UninterpretedOption { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("google.protobuf.UninterpretedOption", len)?; - if true { - struct_ser.serialize_field("name", &self.name)?; - } - if let Some(v) = self.identifier_value.as_ref() { - struct_ser.serialize_field("identifierValue", v)?; - } - if let Some(v) = self.positive_int_value.as_ref() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("positiveIntValue", ::alloc::string::ToString::to_string(&v).as_str())?; - } - if let Some(v) = self.negative_int_value.as_ref() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("negativeIntValue", ::alloc::string::ToString::to_string(&v).as_str())?; - } - if let Some(v) = self.double_value.as_ref() { - struct_ser.serialize_field("doubleValue", v)?; - } - if let Some(v) = self.string_value.as_ref() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("stringValue", pbjson::private::base64::encode(&v).as_str())?; - } - if let Some(v) = self.aggregate_value.as_ref() { - struct_ser.serialize_field("aggregateValue", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for UninterpretedOption { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name", - "identifier_value", - "identifierValue", - "positive_int_value", - "positiveIntValue", - "negative_int_value", - "negativeIntValue", - "double_value", - "doubleValue", - "string_value", - "stringValue", - "aggregate_value", - "aggregateValue", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Name, - IdentifierValue, - PositiveIntValue, - NegativeIntValue, - DoubleValue, - StringValue, - AggregateValue, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "name" => Ok(GeneratedField::Name), - "identifierValue" | "identifier_value" => Ok(GeneratedField::IdentifierValue), - "positiveIntValue" | "positive_int_value" => Ok(GeneratedField::PositiveIntValue), - "negativeIntValue" | "negative_int_value" => Ok(GeneratedField::NegativeIntValue), - "doubleValue" | "double_value" => Ok(GeneratedField::DoubleValue), - "stringValue" | "string_value" => Ok(GeneratedField::StringValue), - "aggregateValue" | "aggregate_value" => Ok(GeneratedField::AggregateValue), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = UninterpretedOption; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.UninterpretedOption") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name__ = None; - let mut identifier_value__ = None; - let mut positive_int_value__ = None; - let mut negative_int_value__ = None; - let mut double_value__ = None; - let mut string_value__ = None; - let mut aggregate_value__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = Some(map_.next_value()?); - } - GeneratedField::IdentifierValue => { - if identifier_value__.is_some() { - return Err(serde::de::Error::duplicate_field("identifierValue")); - } - identifier_value__ = map_.next_value()?; - } - GeneratedField::PositiveIntValue => { - if positive_int_value__.is_some() { - return Err(serde::de::Error::duplicate_field("positiveIntValue")); - } - positive_int_value__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::NegativeIntValue => { - if negative_int_value__.is_some() { - return Err(serde::de::Error::duplicate_field("negativeIntValue")); - } - negative_int_value__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::DoubleValue => { - if double_value__.is_some() { - return Err(serde::de::Error::duplicate_field("doubleValue")); - } - double_value__ = - map_.next_value::<::core::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::StringValue => { - if string_value__.is_some() { - return Err(serde::de::Error::duplicate_field("stringValue")); - } - string_value__ = - map_.next_value::<::core::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0) - ; - } - GeneratedField::AggregateValue => { - if aggregate_value__.is_some() { - return Err(serde::de::Error::duplicate_field("aggregateValue")); - } - aggregate_value__ = map_.next_value()?; - } - } - } - Ok(UninterpretedOption { - name: name__.unwrap_or_default(), - identifier_value: identifier_value__, - positive_int_value: positive_int_value__, - negative_int_value: negative_int_value__, - double_value: double_value__, - string_value: string_value__, - aggregate_value: aggregate_value__, - }) - } - } - deserializer.deserialize_struct("google.protobuf.UninterpretedOption", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for uninterpreted_option::NamePart { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let len = 2; - let mut struct_ser = serializer.serialize_struct("google.protobuf.UninterpretedOption.NamePart", len)?; - struct_ser.serialize_field("namePart", &self.name_part)?; - struct_ser.serialize_field("isExtension", &self.is_extension)?; - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for uninterpreted_option::NamePart { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "name_part", - "namePart", - "is_extension", - "isExtension", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - NamePart, - IsExtension, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "namePart" | "name_part" => Ok(GeneratedField::NamePart), - "isExtension" | "is_extension" => Ok(GeneratedField::IsExtension), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = uninterpreted_option::NamePart; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct google.protobuf.UninterpretedOption.NamePart") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut name_part__ = None; - let mut is_extension__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::NamePart => { - if name_part__.is_some() { - return Err(serde::de::Error::duplicate_field("namePart")); - } - name_part__ = Some(map_.next_value()?); - } - GeneratedField::IsExtension => { - if is_extension__.is_some() { - return Err(serde::de::Error::duplicate_field("isExtension")); - } - is_extension__ = Some(map_.next_value()?); - } - } - } - Ok(uninterpreted_option::NamePart { - name_part: name_part__.ok_or_else(|| serde::de::Error::missing_field("namePart"))?, - is_extension: is_extension__.ok_or_else(|| serde::de::Error::missing_field("isExtension"))?, - }) - } - } - deserializer.deserialize_struct("google.protobuf.UninterpretedOption.NamePart", FIELDS, GeneratedVisitor) - } -} diff --git a/src/prost/ibc.applications.interchain_accounts.v1.rs b/src/prost/ibc.applications.interchain_accounts.v1.rs index ae774eb9..6f5ceae0 100644 --- a/src/prost/ibc.applications.interchain_accounts.v1.rs +++ b/src/prost/ibc.applications.interchain_accounts.v1.rs @@ -46,9 +46,7 @@ impl ::prost::Name for InterchainAccountPacketData { #[derive(Clone, PartialEq, ::prost::Message)] pub struct CosmosTx { #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec< - super::super::super::super::google::protobuf::Any, - >, + pub messages: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for CosmosTx { const NAME: &'static str = "CosmosTx"; diff --git a/src/prost/ibc.core.channel.v1.rs b/src/prost/ibc.core.channel.v1.rs index 684f59bd..666459f3 100644 --- a/src/prost/ibc.core.channel.v1.rs +++ b/src/prost/ibc.core.channel.v1.rs @@ -3298,7 +3298,7 @@ pub struct QueryChannelConsensusStateResponse { /// consensus state associated with the channel #[prost(message, optional, tag = "1")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// client ID associated with the consensus state #[prost(string, tag = "2")] diff --git a/src/prost/ibc.core.client.v1.rs b/src/prost/ibc.core.client.v1.rs index c7176a41..4070e592 100644 --- a/src/prost/ibc.core.client.v1.rs +++ b/src/prost/ibc.core.client.v1.rs @@ -9,9 +9,7 @@ pub struct IdentifiedClientState { pub client_id: ::prost::alloc::string::String, /// client state #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for IdentifiedClientState { const NAME: &'static str = "IdentifiedClientState"; @@ -34,7 +32,7 @@ pub struct ConsensusStateWithHeight { /// consensus state #[prost(message, optional, tag = "2")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for ConsensusStateWithHeight { @@ -180,7 +178,7 @@ pub struct UpgradeProposal { /// planned chain upgrades #[prost(message, optional, tag = "4")] pub upgraded_client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for UpgradeProposal { @@ -275,14 +273,12 @@ impl ::prost::Name for IdentifiedGenesisMetadata { pub struct MsgCreateClient { /// light client state #[prost(message, optional, tag = "1")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// consensus state associated with the client that corresponds to a given /// height. #[prost(message, optional, tag = "2")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// signer address #[prost(string, tag = "3")] @@ -323,7 +319,7 @@ pub struct MsgUpdateClient { /// client message to update the light client #[prost(message, optional, tag = "2")] pub client_message: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// signer address #[prost(string, tag = "3")] @@ -363,14 +359,12 @@ pub struct MsgUpgradeClient { pub client_id: ::prost::alloc::string::String, /// upgraded client state #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// upgraded consensus state, only contains enough information to serve as a /// basis of trust in update logic #[prost(message, optional, tag = "3")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// proof that old chain committed to new client #[prost(bytes = "vec", tag = "4")] @@ -417,9 +411,7 @@ pub struct MsgSubmitMisbehaviour { pub client_id: ::prost::alloc::string::String, /// misbehaviour used for freezing the light client #[prost(message, optional, tag = "2")] - pub misbehaviour: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub misbehaviour: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// signer address #[prost(string, tag = "3")] pub signer: ::prost::alloc::string::String, @@ -506,7 +498,7 @@ pub struct MsgIbcSoftwareUpgrade { /// the 02-client module. #[prost(message, optional, tag = "2")] pub upgraded_client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// signer address #[prost(string, tag = "3")] @@ -1352,9 +1344,7 @@ impl ::prost::Name for QueryClientStateRequest { pub struct QueryClientStateResponse { /// client state associated with the request identifier #[prost(message, optional, tag = "1")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// merkle proof of existence #[prost(bytes = "vec", tag = "2")] pub proof: ::prost::alloc::vec::Vec, @@ -1455,7 +1445,7 @@ pub struct QueryConsensusStateResponse { /// consensus state associated with the client identifier at the given height #[prost(message, optional, tag = "1")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// merkle proof of existence #[prost(bytes = "vec", tag = "2")] @@ -1664,7 +1654,7 @@ pub struct QueryUpgradedClientStateResponse { /// client state associated with the request identifier #[prost(message, optional, tag = "1")] pub upgraded_client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for QueryUpgradedClientStateResponse { @@ -1700,7 +1690,7 @@ pub struct QueryUpgradedConsensusStateResponse { /// Consensus state associated with the request identifier #[prost(message, optional, tag = "1")] pub upgraded_consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for QueryUpgradedConsensusStateResponse { diff --git a/src/prost/ibc.core.connection.v1.rs b/src/prost/ibc.core.connection.v1.rs index d26254df..fd37ee91 100644 --- a/src/prost/ibc.core.connection.v1.rs +++ b/src/prost/ibc.core.connection.v1.rs @@ -305,9 +305,7 @@ pub struct MsgConnectionOpenTry { #[prost(string, tag = "2")] pub previous_connection_id: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(message, optional, tag = "4")] pub counterparty: ::core::option::Option, #[prost(uint64, tag = "5")] @@ -370,9 +368,7 @@ pub struct MsgConnectionOpenAck { #[prost(message, optional, tag = "3")] pub version: ::core::option::Option, #[prost(message, optional, tag = "4")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, #[prost(message, optional, tag = "5")] pub proof_height: ::core::option::Option, /// proof of the initialization the connection on Chain B: `UNITIALIZED -> @@ -1325,7 +1321,7 @@ pub struct QueryConnectionConsensusStateResponse { /// consensus state associated with the channel #[prost(message, optional, tag = "1")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, /// client ID associated with the consensus state #[prost(string, tag = "2")] diff --git a/src/prost/ibc.lightclients.solomachine.v2.rs b/src/prost/ibc.lightclients.solomachine.v2.rs index dd87794f..7ae9f3e4 100644 --- a/src/prost/ibc.lightclients.solomachine.v2.rs +++ b/src/prost/ibc.lightclients.solomachine.v2.rs @@ -35,9 +35,7 @@ impl ::prost::Name for ClientState { pub struct ConsensusState { /// public key of the solo machine #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub public_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// diversifier allows the same public key to be re-used across different solo /// machine clients (potentially on different chains) without being considered /// misbehaviour. @@ -69,7 +67,7 @@ pub struct Header { pub signature: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "4")] pub new_public_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, #[prost(string, tag = "5")] pub new_diversifier: ::prost::alloc::string::String, @@ -185,9 +183,7 @@ impl ::prost::Name for SignBytes { pub struct HeaderData { /// header public key #[prost(message, optional, tag = "1")] - pub new_pub_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub new_pub_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// header diversifier #[prost(string, tag = "2")] pub new_diversifier: ::prost::alloc::string::String, @@ -209,9 +205,7 @@ pub struct ClientStateData { #[prost(bytes = "vec", tag = "1")] pub path: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub client_state: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for ClientStateData { const NAME: &'static str = "ClientStateData"; @@ -232,7 +226,7 @@ pub struct ConsensusStateData { pub path: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "2")] pub consensus_state: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, } impl ::prost::Name for ConsensusStateData { diff --git a/src/prost/ibc.lightclients.solomachine.v3.rs b/src/prost/ibc.lightclients.solomachine.v3.rs index d245e636..a1dc0a14 100644 --- a/src/prost/ibc.lightclients.solomachine.v3.rs +++ b/src/prost/ibc.lightclients.solomachine.v3.rs @@ -31,9 +31,7 @@ impl ::prost::Name for ClientState { pub struct ConsensusState { /// public key of the solo machine #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub public_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// diversifier allows the same public key to be re-used across different solo /// machine clients (potentially on different chains) without being considered /// misbehaviour. @@ -62,7 +60,7 @@ pub struct Header { pub signature: ::prost::alloc::vec::Vec, #[prost(message, optional, tag = "3")] pub new_public_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, + ::tendermint_proto::google::protobuf::Any, >, #[prost(string, tag = "4")] pub new_diversifier: ::prost::alloc::string::String, @@ -179,9 +177,7 @@ impl ::prost::Name for SignBytes { pub struct HeaderData { /// header public key #[prost(message, optional, tag = "1")] - pub new_pub_key: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub new_pub_key: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, /// header diversifier #[prost(string, tag = "2")] pub new_diversifier: ::prost::alloc::string::String, diff --git a/src/prost/ibc.lightclients.tendermint.v1.rs b/src/prost/ibc.lightclients.tendermint.v1.rs index a1eb7a29..b58c0e12 100644 --- a/src/prost/ibc.lightclients.tendermint.v1.rs +++ b/src/prost/ibc.lightclients.tendermint.v1.rs @@ -12,17 +12,17 @@ pub struct ClientState { /// submitted headers are valid for upgrade #[prost(message, optional, tag = "3")] pub trusting_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// duration of the staking unbonding period #[prost(message, optional, tag = "4")] pub unbonding_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// defines how much new (untrusted) header's Time can drift into the future. #[prost(message, optional, tag = "5")] pub max_clock_drift: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Block height when the client was frozen due to a misbehaviour #[prost(message, optional, tag = "6")] @@ -75,7 +75,7 @@ pub struct ConsensusState { /// was stored. #[prost(message, optional, tag = "1")] pub timestamp: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// commitment root (i.e app hash) #[prost(message, optional, tag = "2")] diff --git a/src/prost/interchain_security.ccv.consumer.v1.rs b/src/prost/interchain_security.ccv.consumer.v1.rs index 418b0e43..9e5254b3 100644 --- a/src/prost/interchain_security.ccv.consumer.v1.rs +++ b/src/prost/interchain_security.ccv.consumer.v1.rs @@ -14,9 +14,7 @@ pub struct CrossChainValidator { pub power: i64, /// pubkey is the consensus public key of the validator, as a Protobuf Any. #[prost(message, optional, tag = "3")] - pub pubkey: ::core::option::Option< - super::super::super::super::google::protobuf::Any, - >, + pub pubkey: ::core::option::Option<::tendermint_proto::google::protobuf::Any>, } impl ::prost::Name for CrossChainValidator { const NAME: &'static str = "CrossChainValidator"; @@ -39,7 +37,7 @@ pub struct SlashRecord { pub waiting_on_reply: bool, #[prost(message, optional, tag = "2")] pub send_time: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for SlashRecord { diff --git a/src/prost/interchain_security.ccv.provider.v1.rs b/src/prost/interchain_security.ccv.provider.v1.rs index 5c2a3e14..5bfab6ae 100644 --- a/src/prost/interchain_security.ccv.provider.v1.rs +++ b/src/prost/interchain_security.ccv.provider.v1.rs @@ -615,23 +615,23 @@ pub struct ConsumerAdditionProposal { /// their consumer chain validator node. #[prost(message, optional, tag = "7")] pub spawn_time: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// Unbonding period for the consumer, /// which should be smaller than that of the provider in general. #[prost(message, optional, tag = "8")] pub unbonding_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Sent CCV related IBC packets will timeout after this duration #[prost(message, optional, tag = "9")] pub ccv_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Sent transfer related IBC packets will timeout after this duration #[prost(message, optional, tag = "10")] pub transfer_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The fraction of tokens allocated to the consumer redistribution address /// during distribution events. The fraction is a string representing a @@ -688,7 +688,7 @@ pub struct ConsumerRemovalProposal { /// stop their consumer chain validator node #[prost(message, optional, tag = "4")] pub stop_time: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for ConsumerRemovalProposal { @@ -739,7 +739,7 @@ pub struct GlobalSlashEntry { /// This field is used for store key iteration ordering. #[prost(message, optional, tag = "1")] pub recv_time: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// The consumer that sent a slash packet. #[prost(string, tag = "2")] @@ -781,13 +781,13 @@ pub struct Params { /// Sent IBC packets will timeout after this duration #[prost(message, optional, tag = "3")] pub ccv_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The channel initialization (IBC channel opening handshake) will timeout /// after this duration #[prost(message, optional, tag = "4")] pub init_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The VSC packets sent by the provider will timeout after this duration. /// Note that unlike ccv_timeout_period which is an IBC param, @@ -795,12 +795,12 @@ pub struct Params { /// to timeout VSC packets even when a consumer chain is not live. #[prost(message, optional, tag = "5")] pub vsc_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The period for which the slash meter is replenished #[prost(message, optional, tag = "6")] pub slash_meter_replenish_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The fraction of total voting power that is replenished to the slash meter /// every replenish period. This param also serves as a maximum fraction of @@ -986,7 +986,7 @@ pub struct VscSendTimestamp { pub vsc_id: u64, #[prost(message, optional, tag = "2")] pub timestamp: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for VscSendTimestamp { @@ -1387,7 +1387,7 @@ pub struct QueryThrottleStateResponse { /// full #[prost(message, optional, tag = "3")] pub next_replenish_candidate: ::core::option::Option< - super::super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, /// data relevant to currently throttled slash packets #[prost(message, repeated, tag = "4")] diff --git a/src/prost/interchain_security.ccv.v1.rs b/src/prost/interchain_security.ccv.v1.rs index f9cca6c6..575d0449 100644 --- a/src/prost/interchain_security.ccv.v1.rs +++ b/src/prost/interchain_security.ccv.v1.rs @@ -283,12 +283,12 @@ pub struct ConsumerParams { /// Sent CCV related IBC packets will timeout after this duration #[prost(message, optional, tag = "5")] pub ccv_timeout_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// Sent transfer related IBC packets will timeout after this duration #[prost(message, optional, tag = "6")] pub transfer_timeout_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The fraction of tokens allocated to the consumer redistribution address /// during distribution events. The fraction is a string representing a @@ -304,7 +304,7 @@ pub struct ConsumerParams { /// which should be smaller than that of the provider in general. #[prost(message, optional, tag = "9")] pub unbonding_period: ::core::option::Option< - super::super::super::google::protobuf::Duration, + ::tendermint_proto::google::protobuf::Duration, >, /// The threshold for the percentage of validators at the bottom of the set who /// can opt out of running the consumer chain without being punished. For @@ -464,7 +464,7 @@ pub struct MaturingVscPacket { pub vsc_id: u64, #[prost(message, optional, tag = "2")] pub maturity_time: ::core::option::Option< - super::super::super::google::protobuf::Timestamp, + ::tendermint_proto::google::protobuf::Timestamp, >, } impl ::prost::Name for MaturingVscPacket { diff --git a/src/prost/proto_descriptor.bin b/src/prost/proto_descriptor.bin index 7a44e269b6107e65ffadf54f6baf77c5d894df48..3603045be599b26f37414bcc96cd97687a53ba22 100644 GIT binary patch delta 1118 zcmaLWTSyd97y#h?|2;E1a~5yoCA@@_*_C!dQzM^JyZ9oQ8bm~>v|egcag~x@ddi1_ z@aa?!K`((+FBy#_hO#0^Lb;WRQeaE4fq8>cqqKjNJ-t*92sbGA3DAvWUN*hi?89f?DFX4H8qvR zV&Vg&^IEQZ^v0^nvSQ;|2xRB>*&=moQt(O0Pvd%ZXMKe)5U6YP?GJR;H#GbF7mJOm zNho4l@ZmIgx50^N$TYrBLlgdY#mi6d_@Cz6w9 zexDu?T??=)xvoX8E$`@PtLpUoYW0p*y}3i2UVuHKZvh&Oor`c&O6)@=k>3H%7@$LA z{i5#&^yKv;Dm;!$<{;20s!6fbX{ITu{H*{ zitdDH7pJ)hwPapu5vH**@qQJKd&X=+Z;OqgJ9bD$WXwEdiA5xhjf)d&Q05)Ci9}=^ z-HFjI5|MFCPT_aaGP1@(#)~z`0B;CcYIK!MD1>QQv6N5PgKAt9xd_c*ViLc%i4={6jrQM=3Er@c6hdKC)1pWr6vp&SKCpS!s>UK>;13Lz zMG#}xqtd1$=uVCrl}bb~WnV0%5)nLjh@YZ=5jA-Z9n17D9@R_4&>CckkL!?|Fo#My z&!;bd=4+Z4d;}RsBrb2jk?bX#n2%=3CO~AVdw2sV Xkitp9C?pD*!bPD_sK)RH?|JeU)EWd% delta 1142 zcma*mPe>F|7y$77zIi)4`xf2ZSrt|VN0?Skf?2#VA)FM*_oh>DapGn9-~@UT#J zF)9g9uP)IcI+&Ltnu7#_TGE20sK|x~k)SZz4QzF#v~R{;<|Yk%!+dYv@0<7W-aK6j z%`JuQyn)UMSkZ4xzzcM~j&O%+&$Vso{`W9x_l>o1WT47pX#0gwING8G^q(Pes39G?zKdt7o$3@uv99) z!o~d+2p9uzS75)FYh@LcN2;o8%IFo>0s;N|3Otac06j&%!ibFYQ2YZ@=s4Zq*4@(; z7MBvRPYP%)qC5em?xx<}o^yR&VXgP3*4Y~p{Ry~bm~ROfw0p)-@$g5$83VMbY+T&_ z4Z{`Vhzif)c4H7|6rJ8|Dj8{BKL2bQ#iq(rh+jlq3O>1~P;v8%W-U_FqGSUu2d9zo z3AvA9hJCS*Gc`{$I z6PZU}9)FCckyRGg@1~&;LUCmInOQQSI2IIVQ$lep(fH&pa;R)o|F{K>5L&f%z(Hsg zojDogAhe1eFMqO&6qT*%C;rgM46Rv6A+(0hf(%j!t)ah&kL_-?Q)Njp_!r(CPatPAZYayaU;kN+j{nVSa{wS5)P7v~7ujZD@3_qvGe4)HWJNC?yuRp(>cl zu7w7vP%7I1rBoA|5Lpg;GEhWC{m`LgCbh IcKGn