diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 44e65b0a..969dab24 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -15,6 +15,15 @@ ], "groupName": "GitHub Actions" }, + { + "matchManagers": [ + "git-submodules" + ], + // third_party/ is checked out by `poe generate-vendored` at the pinned + // cel-cpp and the versions bazel resolves for it. Moving a submodule on + // its own would desync it from the filelists and gen/. + "enabled": false + }, { "matchManagers": [ "pep621" diff --git a/.gitmodules b/.gitmodules index ca6fdf6e..0b690f65 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,15 @@ -[submodule "crates/deps-sys/third_party/abseil-cpp"] - path = crates/protovalidate-rs/third_party/abseil-cpp +[submodule "third_party/abseil-cpp"] + path = crates/protovalidate-deps/third_party/abseil-cpp url = https://github.com/abseil/abseil-cpp -[submodule "crates/deps-sys/third_party/protobuf"] - path = crates/protovalidate-rs/third_party/protobuf - url = https://github.com/protocolbuffers/protobuf -[submodule "crates/deps-sys/third_party/re2"] - path = crates/protovalidate-rs/third_party/re2 - url = https://github.com/google/re2 -[submodule "crates/deps-sys/third_party/antlr4"] - path = crates/protovalidate-rs/third_party/antlr4 +[submodule "third_party/antlr4"] + path = crates/protovalidate-deps/third_party/antlr4 url = https://github.com/antlr/antlr4 -[submodule "crates/deps-sys/third_party/cel-cpp"] - path = crates/protovalidate-rs/third_party/cel-cpp +[submodule "third_party/cel-cpp"] + path = crates/protovalidate-deps/third_party/cel-cpp url = https://github.com/google/cel-cpp -[submodule "crates/protovalidate-sys/third_party/protovalidate-cc"] - path = crates/protovalidate-rs/third_party/protovalidate-cc - url = https://github.com/bufbuild/protovalidate-cc +[submodule "third_party/protobuf"] + path = crates/protovalidate-deps/third_party/protobuf + url = https://github.com/protocolbuffers/protobuf +[submodule "third_party/re2"] + path = crates/protovalidate-deps/third_party/re2 + url = https://github.com/google/re2 diff --git a/Cargo.lock b/Cargo.lock index 5d510e2b..386f6915 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,71 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "buffa" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92f2f5df67a9d5ccfc65237bfc954c56328aee40a04a9b92381ecba370be246" +dependencies = [ + "bytes", + "foldhash", + "hashbrown", + "once_cell", + "rustversion", + "serde", + "serde_json", + "smoothutf8", + "thiserror", +] + +[[package]] +name = "buffa-descriptor" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b7dd79a6898e70dac8adae959c8ad2cae51ed96397935c91c996280cedcb55e" +dependencies = [ + "buffa", + "rustversion", + "serde", + "serde_json", +] + +[[package]] +name = "buffa-types" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15b05c8418f1e200e406e5b19df97400dffa833e2450e4392c506896cbc97ac" +dependencies = [ + "buffa", + "buffa-descriptor", + "bytes", + "jiff", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + [[package]] name = "cc" version = "1.4.7" @@ -9,39 +74,194 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54413ede23c2daf518f35156dfde027feb2374004d63bd497f983c8db9c0e313" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "defmt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2953bfe4f93bbd20cc71198842756f77d161884c99ebbabc41d80231ded88d1" +dependencies = [ + "bitflags", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad9c72e7ca2137e0dc3813245a0d282fd6daad32fd800af018306a9169b5fe8" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "defmt-parser" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" +dependencies = [ + "thiserror", +] + [[package]] name = "find-msvc-tools" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef25905e51abafe4dcea6c15fec58c57b601cdbd0ee53d22ea1d3016c587d39b" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "iri-string" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1663ee7d8cf2900cc1414b1e1eec9f348d6eaa3bcab07579f4726a4b8499f447" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1baf72f08796de0260609515130699b890ac25f30e610ad894bc5856cafdb" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "378268a1116ad67ae6228701118ac9f491d78fda38a40a1f1a9e1348de6f7212" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom", + "libc", +] + [[package]] name = "libc" version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + [[package]] name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + [[package]] name = "portable-atomic" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -54,6 +274,21 @@ dependencies = [ [[package]] name = "protovalidate" version = "0.0.0" +dependencies = [ + "buffa", + "buffa-descriptor", + "buffa-types", + "foldhash", + "iri-string", + "jiff", + "percent-encoding", + "protovalidate-deps", + "regex", +] + +[[package]] +name = "protovalidate-deps" +version = "0.0.0" dependencies = [ "cc", ] @@ -109,7 +344,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -121,7 +356,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.119", ] [[package]] @@ -133,12 +368,111 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "shlex" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "smoothutf8" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4ec95892483d6d94284caccfddb9b77111a4dcac33ed25d624248def0fa5f1" +dependencies = [ + "simdutf8", +] + [[package]] name = "syn" version = "2.0.119" @@ -150,14 +484,51 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "target-lexicon" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "unicode-ident" version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index eafc4605..2c9a8c46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,27 +24,41 @@ members = ["crates/*"] [workspace.package] version = "0.0.0" edition = "2024" +rust-version = "1.88" +license = "Apache-2.0" publish = false [workspace.dependencies] -protovalidate = { path = "crates/protovalidate-rs" } +protovalidate = { path = "crates/protovalidate", default-features = false } +protovalidate-deps = { path = "crates/protovalidate-deps" } -cc = "1" +buffa = "0.9.2" +buffa-descriptor = { version = "0.9.2", features = ["reflect"] } +buffa-types = { version = "0.9.2", features = ["reflect"] } +cc = { version = "1.4.3", features = ["parallel"] } +foldhash = "0.1.5" +iri-string = "0.7.14" +jiff = { version = "0.2.37", default-features = false, features = ["std"] } +percent-encoding = "2.3.2" +regex = "1.13.1" + +[workspace.lints.clippy] +pedantic = { level = "warn", priority = -1 } +undocumented_unsafe_blocks = "warn" [lib] crate-type = ["cdylib"] name = "protovalidate" [dependencies] -protovalidate.workspace = true +protovalidate = { workspace = true, features = ["cel"] } pyo3 = { version = "0.29.1", features = ["experimental-inspect"] } [build-dependencies] pyo3-build-config = { version = "0.29.1", features = ["resolve-config"] } -# Negative priority lets individual lint entries below override the group. -[lints.clippy] -pedantic = { level = "warn", priority = -1 } +[lints] +workspace = true [profile.release] debug = 0 diff --git a/buf.gen.yaml b/buf.gen.yaml index 95fad37a..ee7ec6d9 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -4,3 +4,8 @@ managed: plugins: - remote: buf.build/bufbuild/py:v0.1.1 out: protovalidate/_gen + - remote: buf.build/anthropics/buffa:v0.9.2 + out: crates/protovalidate/src/gen + opt: + - views=false + - with_setters=false diff --git a/crates/protovalidate-rs/Cargo.toml b/crates/protovalidate-deps/Cargo.toml similarity index 74% rename from crates/protovalidate-rs/Cargo.toml rename to crates/protovalidate-deps/Cargo.toml index 98a337ea..a5fef35a 100644 --- a/crates/protovalidate-rs/Cargo.toml +++ b/crates/protovalidate-deps/Cargo.toml @@ -13,11 +13,17 @@ # limitations under the License. [package] -name = "protovalidate" +name = "protovalidate-deps" version.workspace = true edition.workspace = true -links = "protovalidate" +rust-version.workspace = true +description = "Compiled cel-cpp and its C++ dependencies, behind a safe Rust API. Internal support crate for `protovalidate`." +license.workspace = true +links = "cel-cpp" publish.workspace = true [build-dependencies] cc.workspace = true + +[lints] +workspace = true diff --git a/crates/protovalidate-rs/build.rs b/crates/protovalidate-deps/build.rs similarity index 68% rename from crates/protovalidate-rs/build.rs rename to crates/protovalidate-deps/build.rs index 788eece3..822d823a 100644 --- a/crates/protovalidate-rs/build.rs +++ b/crates/protovalidate-deps/build.rs @@ -12,15 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Compiles protovalidate-cc and the C++ libraries it builds on. +//! Compiles the CEL runtime behind the shim: cel-cpp and the C++ libraries +//! it builds on, plus the shim itself. //! -//! Upstream sources are git submodules under `third_party/`, pinned to the -//! versions bazel resolves. Code that has no upstream file to point at -- -//! protoc output, the ANTLR-generated CEL parser -- is checked in under -//! `gen/`, because regenerating it would need protoc and a JVM at build time. -//! Which files to compile is recorded per library in `filelists/`. All of it -//! is produced by `scripts/extract_native_sources.py` from bazel's action -//! graph; nothing here is maintained by hand. +//! Upstream sources are git submodules under `third_party/` with code generated +//! by Bazel (protoc output, the ANTLR-generated CEL parser) checked +//! in under `gen/`. The files each library compiles are listed in +//! `filelists/`. All of it is produced by `scripts/extract_native_sources.py` +//! from bazel's action graph without hand maintenance. use std::env; use std::ffi::OsStr; @@ -35,14 +34,29 @@ fn rerun_if_changed(path: &Path) { println!("cargo::rerun-if-changed={}", path.display()); } -/// Whether the C++ compilation can be skipped for this build. We skip it with -/// clippy or when maturin generates pyi stubs since they don't need the actual -/// native binary built, which also lets a checkout without the `third_party/` -/// submodules lint and generate stubs. +/// Whether to skip the C++ compilation: under clippy, rust-analyzer and +/// docs.rs, none of which links the native code, or when +/// `PROTOVALIDATE_SKIP_CPP` is set. fn should_skip_cpp() -> bool { - println!("cargo::rerun-if-env-changed=CLIPPY_ARGS"); - println!("cargo::rerun-if-env-changed=PROTOVALIDATE_SKIP_CPP"); - env::var_os("CLIPPY_ARGS").is_some() || env::var_os("PROTOVALIDATE_SKIP_CPP").is_some() + for var in [ + "CLIPPY_ARGS", + "DOCS_RS", + "PROTOVALIDATE_SKIP_CPP", + "RA_RUSTC_WRAPPER", + "RUSTC_WRAPPER", + "RUSTC_WORKSPACE_WRAPPER", + ] { + println!("cargo::rerun-if-env-changed={var}"); + } + let wraps_rust_analyzer = |var: &str| { + env::var_os(var).is_some_and(|wrapper| wrapper.to_string_lossy().contains("rust-analyzer")) + }; + env::var_os("CLIPPY_ARGS").is_some() + || env::var_os("DOCS_RS").is_some() + || env::var_os("PROTOVALIDATE_SKIP_CPP").is_some() + || env::var_os("RA_RUSTC_WRAPPER").is_some() + || wraps_rust_analyzer("RUSTC_WRAPPER") + || wraps_rust_analyzer("RUSTC_WORKSPACE_WRAPPER") } /// A submodule checkout under `third_party/`. @@ -85,7 +99,7 @@ fn gen_dir() -> PathBuf { /// Source files a library compiles, as paths relative to the crate root. /// /// A `windows:`/`linux:`/`macos:` prefix marks a file bazel adds through a -/// platform select(); it is compiled only when the target OS matches. +/// platform `select()`; it is compiled only when the target OS matches. fn read_filelist(path: &Path) -> Vec { let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS"); rerun_if_changed(path); @@ -104,11 +118,10 @@ fn read_filelist(path: &Path) -> Vec { /// Routes MSVC C++ compiles through `RUSTC_WRAPPER` when set. /// -/// cc applies the wrapper only to compilers named via CC/CXX, so the cl.exe it -/// discovers through the registry bypasses that fallback. We import the -/// discovered toolchain's environment (PATH/INCLUDE/LIB) and name the compiler -/// explicitly, which sends compiler resolution down the env-var branch where -/// the wrapper is attached. +/// cc applies the wrapper only to compilers named via `CC`/`CXX`, not to the +/// cl.exe it finds through the registry, so the discovered toolchain's +/// environment (`PATH`/`INCLUDE`/`LIB`) is imported and the compiler named +/// explicitly. fn reroute_msvc_through_wrapper() { if env::var("CARGO_CFG_TARGET_ENV").as_deref() != Ok("msvc") || env::var_os("RUSTC_WRAPPER").is_none() @@ -121,11 +134,12 @@ fn reroute_msvc_through_wrapper() { let Some(tool) = cc::windows_registry::find_tool(&target, "cl.exe") else { return; }; - // SAFETY: build scripts are single-threaded when this runs, before any - // cc::Build is constructed. for (key, value) in tool.env() { + // SAFETY: build scripts are single-threaded when this runs, before any + // cc::Build is constructed. unsafe { env::set_var(key, value) }; } + // SAFETY: as above. unsafe { // Bare `cl`, resolved via the PATH set for the toolchain. env::set_var("CC", "cl"); @@ -133,6 +147,24 @@ fn reroute_msvc_through_wrapper() { } } +/// Every C++ source under `dir`, recursively, in a stable order. +fn cxx_sources(dir: &Path) -> Vec { + let mut found = Vec::new(); + let mut pending = vec![dir.to_path_buf()]; + while let Some(dir) = pending.pop() { + for entry in std::fs::read_dir(&dir).unwrap_or_else(|e| panic!("{}: {e}", dir.display())) { + let path = entry.expect("read_dir entry").path(); + if path.is_dir() { + pending.push(path); + } else if path.extension().is_some_and(|extension| extension == "cc") { + found.push(path); + } + } + } + found.sort(); + found +} + /// One static library built from the C++ sources. struct CxxLib { name: String, @@ -140,10 +172,21 @@ struct CxxLib { } impl CxxLib { + /// A library over the files `filelists/.txt` records. fn new(name: &str, includes: &[&Path]) -> Self { + let root = manifest_dir(); + let files = read_filelist(&root.join(format!("filelists/{name}.txt"))) + .into_iter() + .map(|file| root.join(file)) + .collect(); + Self::with_files(name, includes, files) + } + + fn with_files(name: &str, includes: &[&Path], files: Vec) -> Self { reroute_msvc_through_wrapper(); let mut build = cc::Build::new(); - build.cpp(true).warnings(false); + // Debug info bloats target directory for no real benefit. + build.cpp(true).warnings(false).debug(false); if build.get_compiler().is_like_msvc() { build.std("c++20"); @@ -158,8 +201,8 @@ impl CxxLib { build.std("c++17"); build.flag_if_supported("-fsized-deallocation"); build.flag_if_supported("-faligned-allocation"); - // Everything here is an implementation detail of the extension - // module, which exports only its PyInit symbol. + // Everything here is an implementation detail of this crate; + // no C++ symbol is part of its public surface. build.flag_if_supported("-fvisibility=hidden"); build.flag_if_supported("-fvisibility-inlines-hidden"); } @@ -167,9 +210,8 @@ impl CxxLib { build.include(dir); } - let root = manifest_dir(); - for file in read_filelist(&root.join(format!("filelists/{name}.txt"))) { - build.file(root.join(file)); + for file in files { + build.file(file); } Self { name: name.to_owned(), @@ -199,7 +241,6 @@ fn main() { let re2 = third_party_dir("re2"); let protobuf_root = third_party_dir("protobuf"); let celcpp = third_party_dir("cel-cpp"); - let pvcc = third_party_dir("protovalidate-cc"); let generated = gen_dir(); let protobuf = protobuf_root.join("src"); @@ -209,7 +250,6 @@ fn main() { // gen/ is listed after the upstream include roots so that where protobuf // ships a checked-in copy of a generated header, the checked-in one wins. let mut absl_lib = CxxLib::new("absl", &[&absl]); - absl_lib.build.define("NOMINMAX", None); let mut antlr4_lib = CxxLib::new("antlr4", &[&antlr4, &absl]); antlr4_lib.antlr4_defines(); @@ -224,22 +264,20 @@ fn main() { ); celcpp_lib.antlr4_defines(); - let mut pv_lib = CxxLib::new( - "protovalidate", + rerun_if_changed(&shim); + let mut shim_lib = CxxLib::with_files( + "celshim", &[ - &pvcc, &generated, &shim, &celcpp, &absl, &protobuf, &utf8, &re2, &antlr4, + &shim, &generated, &celcpp, &absl, &protobuf, &utf8, &re2, &antlr4, ], + cxx_sources(&shim), ); - pv_lib.antlr4_defines(); - // The C ABI the Rust bindings call through. - rerun_if_changed(&shim.join("pv_shim.cc")); - rerun_if_changed(&shim.join("pv_shim.h")); - pv_lib.build.file(shim.join("pv_shim.cc")); + shim_lib.antlr4_defines(); // Static archives must precede the archives they reference on the link // line, so compile (and therefore emit link directives) most-dependent // first. - pv_lib.compile(); + shim_lib.compile(); celcpp_lib.compile(); protobuf_lib.compile(); re2_lib.compile(); diff --git a/crates/protovalidate-rs/filelists/absl.txt b/crates/protovalidate-deps/filelists/absl.txt similarity index 99% rename from crates/protovalidate-rs/filelists/absl.txt rename to crates/protovalidate-deps/filelists/absl.txt index a68757fb..02d19720 100644 --- a/crates/protovalidate-rs/filelists/absl.txt +++ b/crates/protovalidate-deps/filelists/absl.txt @@ -1,5 +1,5 @@ # Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. +# C++ sources the crate compiles, relative to this crate's directory. # A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. third_party/abseil-cpp/absl/base/casts.cc third_party/abseil-cpp/absl/base/internal/cycleclock.cc diff --git a/crates/protovalidate-rs/filelists/antlr4.txt b/crates/protovalidate-deps/filelists/antlr4.txt similarity index 99% rename from crates/protovalidate-rs/filelists/antlr4.txt rename to crates/protovalidate-deps/filelists/antlr4.txt index 93fa5d38..a9b38f76 100644 --- a/crates/protovalidate-rs/filelists/antlr4.txt +++ b/crates/protovalidate-deps/filelists/antlr4.txt @@ -1,5 +1,5 @@ # Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. +# C++ sources the crate compiles, relative to this crate's directory. # A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. third_party/antlr4/runtime/Cpp/runtime/src/ANTLRErrorListener.cpp third_party/antlr4/runtime/Cpp/runtime/src/ANTLRErrorStrategy.cpp diff --git a/crates/protovalidate-rs/filelists/celcpp.txt b/crates/protovalidate-deps/filelists/celcpp.txt similarity index 98% rename from crates/protovalidate-rs/filelists/celcpp.txt rename to crates/protovalidate-deps/filelists/celcpp.txt index 9ee3fd07..4369d88e 100644 --- a/crates/protovalidate-rs/filelists/celcpp.txt +++ b/crates/protovalidate-deps/filelists/celcpp.txt @@ -1,5 +1,5 @@ # Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. +# C++ sources the crate compiles, relative to this crate's directory. # A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. gen/cel/expr/checked.pb.cc gen/cel/expr/syntax.pb.cc @@ -141,6 +141,7 @@ third_party/cel-cpp/eval/public/containers/field_access.cc third_party/cel-cpp/eval/public/containers/internal_field_backed_list_impl.cc third_party/cel-cpp/eval/public/containers/internal_field_backed_map_impl.cc third_party/cel-cpp/eval/public/string_extension_func_registrar.cc +third_party/cel-cpp/eval/public/structs/cel_proto_descriptor_pool_builder.cc third_party/cel-cpp/eval/public/structs/cel_proto_wrap_util.cc third_party/cel-cpp/eval/public/structs/cel_proto_wrapper.cc third_party/cel-cpp/eval/public/structs/field_access_impl.cc diff --git a/crates/protovalidate-rs/filelists/protobuf.txt b/crates/protovalidate-deps/filelists/protobuf.txt similarity index 98% rename from crates/protovalidate-rs/filelists/protobuf.txt rename to crates/protovalidate-deps/filelists/protobuf.txt index cdca3afa..49db06d5 100644 --- a/crates/protovalidate-rs/filelists/protobuf.txt +++ b/crates/protovalidate-deps/filelists/protobuf.txt @@ -1,5 +1,5 @@ # Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. +# C++ sources the crate compiles, relative to this crate's directory. # A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. third_party/protobuf/src/google/protobuf/any.cc third_party/protobuf/src/google/protobuf/any.pb.cc diff --git a/crates/protovalidate-rs/filelists/re2.txt b/crates/protovalidate-deps/filelists/re2.txt similarity index 91% rename from crates/protovalidate-rs/filelists/re2.txt rename to crates/protovalidate-deps/filelists/re2.txt index f6e72bb2..fc6046c7 100644 --- a/crates/protovalidate-rs/filelists/re2.txt +++ b/crates/protovalidate-deps/filelists/re2.txt @@ -1,5 +1,5 @@ # Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. +# C++ sources the crate compiles, relative to this crate's directory. # A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. third_party/re2/re2/bitmap256.cc third_party/re2/re2/bitstate.cc diff --git a/crates/protovalidate-rs/gen/cel/expr/checked.pb.cc b/crates/protovalidate-deps/gen/cel/expr/checked.pb.cc similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/checked.pb.cc rename to crates/protovalidate-deps/gen/cel/expr/checked.pb.cc diff --git a/crates/protovalidate-rs/gen/cel/expr/checked.pb.h b/crates/protovalidate-deps/gen/cel/expr/checked.pb.h similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/checked.pb.h rename to crates/protovalidate-deps/gen/cel/expr/checked.pb.h diff --git a/crates/protovalidate-rs/gen/cel/expr/syntax.pb.cc b/crates/protovalidate-deps/gen/cel/expr/syntax.pb.cc similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/syntax.pb.cc rename to crates/protovalidate-deps/gen/cel/expr/syntax.pb.cc diff --git a/crates/protovalidate-rs/gen/cel/expr/syntax.pb.h b/crates/protovalidate-deps/gen/cel/expr/syntax.pb.h similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/syntax.pb.h rename to crates/protovalidate-deps/gen/cel/expr/syntax.pb.h diff --git a/crates/protovalidate-rs/gen/cel/expr/value.pb.cc b/crates/protovalidate-deps/gen/cel/expr/value.pb.cc similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/value.pb.cc rename to crates/protovalidate-deps/gen/cel/expr/value.pb.cc diff --git a/crates/protovalidate-rs/gen/cel/expr/value.pb.h b/crates/protovalidate-deps/gen/cel/expr/value.pb.h similarity index 100% rename from crates/protovalidate-rs/gen/cel/expr/value.pb.h rename to crates/protovalidate-deps/gen/cel/expr/value.pb.h diff --git a/crates/protovalidate-deps/gen/internal/empty_descriptor_set_embed.inc b/crates/protovalidate-deps/gen/internal/empty_descriptor_set_embed.inc new file mode 100644 index 00000000..b24f1b37 --- /dev/null +++ b/crates/protovalidate-deps/gen/internal/empty_descriptor_set_embed.inc @@ -0,0 +1 @@ +0x0a, 0xbe, 0x01, 0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.cpp b/crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.cpp new file mode 100644 index 00000000..f1569eb8 --- /dev/null +++ b/crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.cpp @@ -0,0 +1,9 @@ + +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 + + +#include "CelBaseVisitor.h" + + +using namespace cel_parser_internal; + diff --git a/crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.h b/crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.h similarity index 98% rename from crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.h rename to crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.h index 6e17890c..b4ce430a 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.h +++ b/crates/protovalidate-deps/gen/parser/internal/CelBaseVisitor.h @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #pragma once diff --git a/crates/protovalidate-rs/gen/parser/internal/CelLexer.cpp b/crates/protovalidate-deps/gen/parser/internal/CelLexer.cpp similarity index 99% rename from crates/protovalidate-rs/gen/parser/internal/CelLexer.cpp rename to crates/protovalidate-deps/gen/parser/internal/CelLexer.cpp index 1d77d264..a219430c 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelLexer.cpp +++ b/crates/protovalidate-deps/gen/parser/internal/CelLexer.cpp @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #include "CelLexer.h" diff --git a/crates/protovalidate-rs/gen/parser/internal/CelLexer.h b/crates/protovalidate-deps/gen/parser/internal/CelLexer.h similarity index 95% rename from crates/protovalidate-rs/gen/parser/internal/CelLexer.h rename to crates/protovalidate-deps/gen/parser/internal/CelLexer.h index 01f0dfd3..8cfa0cc2 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelLexer.h +++ b/crates/protovalidate-deps/gen/parser/internal/CelLexer.h @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #pragma once diff --git a/crates/protovalidate-rs/gen/parser/internal/CelParser.cpp b/crates/protovalidate-deps/gen/parser/internal/CelParser.cpp similarity index 99% rename from crates/protovalidate-rs/gen/parser/internal/CelParser.cpp rename to crates/protovalidate-deps/gen/parser/internal/CelParser.cpp index 752d6eee..958f155d 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelParser.cpp +++ b/crates/protovalidate-deps/gen/parser/internal/CelParser.cpp @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #include "CelVisitor.h" diff --git a/crates/protovalidate-rs/gen/parser/internal/CelParser.h b/crates/protovalidate-deps/gen/parser/internal/CelParser.h similarity index 99% rename from crates/protovalidate-rs/gen/parser/internal/CelParser.h rename to crates/protovalidate-deps/gen/parser/internal/CelParser.h index 56fd882a..1c6f50f5 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelParser.h +++ b/crates/protovalidate-deps/gen/parser/internal/CelParser.h @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #pragma once diff --git a/crates/protovalidate-deps/gen/parser/internal/CelVisitor.cpp b/crates/protovalidate-deps/gen/parser/internal/CelVisitor.cpp new file mode 100644 index 00000000..0b36506f --- /dev/null +++ b/crates/protovalidate-deps/gen/parser/internal/CelVisitor.cpp @@ -0,0 +1,9 @@ + +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 + + +#include "CelVisitor.h" + + +using namespace cel_parser_internal; + diff --git a/crates/protovalidate-rs/gen/parser/internal/CelVisitor.h b/crates/protovalidate-deps/gen/parser/internal/CelVisitor.h similarity index 97% rename from crates/protovalidate-rs/gen/parser/internal/CelVisitor.h rename to crates/protovalidate-deps/gen/parser/internal/CelVisitor.h index a5a99d20..50a24e88 100644 --- a/crates/protovalidate-rs/gen/parser/internal/CelVisitor.h +++ b/crates/protovalidate-deps/gen/parser/internal/CelVisitor.h @@ -1,5 +1,5 @@ -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 +// Generated from parser/internal/Cel.g4 by ANTLR 4.13.2 #pragma once diff --git a/crates/protovalidate-deps/shim/cel_shim.cc b/crates/protovalidate-deps/shim/cel_shim.cc new file mode 100644 index 00000000..e42c2995 --- /dev/null +++ b/crates/protovalidate-deps/shim/cel_shim.cc @@ -0,0 +1,540 @@ +// Copyright 2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "cel_shim.h" + +#include +#include +#include +#include +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "eval/public/activation.h" +#include "eval/public/builtin_func_registrar.h" +#include "eval/public/cel_expr_builder_factory.h" +#include "eval/public/cel_expression.h" +#include "eval/public/cel_function.h" +#include "eval/public/cel_function_adapter.h" +#include "eval/public/cel_function_registry.h" +#include "eval/public/cel_options.h" +#include "eval/public/cel_value.h" +#include "eval/public/containers/field_access.h" +#include "eval/public/containers/field_backed_list_impl.h" +#include "eval/public/containers/field_backed_map_impl.h" +#include "eval/public/string_extension_func_registrar.h" +#include "eval/public/structs/cel_proto_descriptor_pool_builder.h" +#include "eval/public/structs/cel_proto_wrapper.h" +#include "google/protobuf/arena.h" +#include "google/protobuf/descriptor.h" +#include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/dynamic_message.h" +#include "google/protobuf/message.h" +#include "parser/parser.h" + +namespace celrt = google::api::expr::runtime; + +namespace { + +// Collects BuildFile errors so they reach the caller instead of being logged. +class StringErrorCollector : public google::protobuf::DescriptorPool::ErrorCollector { + public: + void RecordError(absl::string_view filename, absl::string_view element_name, + const google::protobuf::Message* descriptor, + ErrorLocation location, absl::string_view message) override { + if (!text_.empty()) text_ += "; "; + absl::StrAppend(&text_, filename, ": ", element_name, ": ", message); + } + + const std::string& text() const { return text_; } + + private: + std::string text_; +}; + +char* CopyCString(absl::string_view value) { + char* out = static_cast(std::malloc(value.size() + 1)); + if (out == nullptr) return nullptr; + std::memcpy(out, value.data(), value.size()); + out[value.size()] = '\0'; + return out; +} + +void SetError(char** error, absl::string_view message) { + *error = CopyCString(message); +} + +// Resolves a field of `message` by number, extensions included. +const google::protobuf::FieldDescriptor* FindField( + const google::protobuf::Message& message, int32_t number) { + const google::protobuf::FieldDescriptor* field = + message.GetDescriptor()->FindFieldByNumber(number); + if (field == nullptr) { + field = message.GetReflection()->FindKnownExtensionByNumber(number); + } + return field; +} + +// The CEL value of one field of a message: a list, a map, or the wrapped +// singular value. +celrt::CelValue FieldToCelValue(const google::protobuf::Message* message, + const google::protobuf::FieldDescriptor* field, + google::protobuf::Arena* arena) { + if (field->is_map()) { + return celrt::CelValue::CreateMap( + google::protobuf::Arena::Create( + arena, message, field, arena)); + } + if (field->is_repeated()) { + return celrt::CelValue::CreateList( + google::protobuf::Arena::Create( + arena, message, field, arena)); + } + celrt::CelValue result; + if (celrt::CreateValueFromSingleField(message, field, arena, &result).ok()) { + return result; + } + return celrt::CelValue::CreateNull(); +} + +celrt::CelValue Error(google::protobuf::Arena* arena, absl::string_view message) { + return celrt::CelValue::CreateError(google::protobuf::Arena::Create( + arena, absl::StatusCode::kInvalidArgument, std::string(message))); +} + +// protovalidate's `getField(message, name)`. Strictly an operator on protobuf-cpp so +// we implement it in C++ instead of Rust. All other functions are implemented in Rust. +celrt::CelValue GetField(google::protobuf::Arena* arena, celrt::CelValue message, + celrt::CelValue name) { + if (!message.IsMessage()) return Error(arena, "expected a message value for first argument"); + if (!name.IsString()) return Error(arena, "expected a string value for second argument"); + const google::protobuf::Message* msg = message.MessageOrDie(); + const google::protobuf::FieldDescriptor* field = + msg->GetDescriptor()->FindFieldByName(name.StringOrDie().value()); + if (field == nullptr) return Error(arena, "no such field"); + return FieldToCelValue(msg, field, arena); +} + +celrt::CelValue ScalarToCelValue(const cel_value& value) { + absl::string_view text(reinterpret_cast(value.data), value.len); + switch (value.kind) { + case CEL_VALUE_BOOL: + return celrt::CelValue::CreateBool(value.bool_value != 0); + case CEL_VALUE_INT: + return celrt::CelValue::CreateInt64(value.int_value); + case CEL_VALUE_UINT: + return celrt::CelValue::CreateUint64(value.uint_value); + case CEL_VALUE_DOUBLE: + return celrt::CelValue::CreateDouble(value.double_value); + case CEL_VALUE_STRING: + return celrt::CelValue::CreateStringView(text); + case CEL_VALUE_BYTES: + return celrt::CelValue::CreateBytesView(text); + default: + return celrt::CelValue::CreateNull(); + } +} + +// The `cel_value` form of a value, borrowing its storage; CEL_VALUE_OTHER for +// a kind that has none. +cel_value ToValue(const celrt::CelValue& value) { + cel_value out{}; + out.kind = CEL_VALUE_OTHER; + switch (value.type()) { + case celrt::CelValue::Type::kBool: + out.kind = CEL_VALUE_BOOL; + out.bool_value = value.BoolOrDie() ? 1 : 0; + break; + case celrt::CelValue::Type::kInt64: + out.kind = CEL_VALUE_INT; + out.int_value = value.Int64OrDie(); + break; + case celrt::CelValue::Type::kUint64: + out.kind = CEL_VALUE_UINT; + out.uint_value = value.Uint64OrDie(); + break; + case celrt::CelValue::Type::kDouble: + out.kind = CEL_VALUE_DOUBLE; + out.double_value = value.DoubleOrDie(); + break; + case celrt::CelValue::Type::kString: { + absl::string_view text = value.StringOrDie().value(); + out.kind = CEL_VALUE_STRING; + out.data = reinterpret_cast(text.data()); + out.len = text.size(); + break; + } + case celrt::CelValue::Type::kBytes: { + absl::string_view text = value.BytesOrDie().value(); + out.kind = CEL_VALUE_BYTES; + out.data = reinterpret_cast(text.data()); + out.len = text.size(); + break; + } + case celrt::CelValue::Type::kList: + out.kind = CEL_VALUE_LIST; + out.list = reinterpret_cast(value.ListOrDie()); + break; + default: + break; + } + return out; +} + +celrt::CelValue::Type TypeOfKind(int32_t kind) { + switch (kind) { + case CEL_VALUE_BOOL: + return celrt::CelValue::Type::kBool; + case CEL_VALUE_INT: + return celrt::CelValue::Type::kInt64; + case CEL_VALUE_UINT: + return celrt::CelValue::Type::kUint64; + case CEL_VALUE_DOUBLE: + return celrt::CelValue::Type::kDouble; + case CEL_VALUE_STRING: + return celrt::CelValue::Type::kString; + case CEL_VALUE_BYTES: + return celrt::CelValue::Type::kBytes; + default: + return celrt::CelValue::Type::kList; + } +} + +// A predicate implemented by the caller through `cel_native_fn`. +class NativeFunction : public celrt::CelFunction { + public: + NativeFunction(celrt::CelFunctionDescriptor descriptor, cel_native_fn fn, + void* ctx) + : celrt::CelFunction(std::move(descriptor)), fn_(fn), ctx_(ctx) {} + + absl::Status Evaluate(absl::Span arguments, + celrt::CelValue* result, + google::protobuf::Arena* arena) const override { + std::vector args(arguments.size()); + for (size_t i = 0; i < arguments.size(); i++) args[i] = ToValue(arguments[i]); + int out = 0; + char* error = nullptr; + if (fn_(ctx_, args.data(), args.size(), &out, &error) != CEL_OK) { + *result = Error(arena, error != nullptr ? error : "function failed"); + std::free(error); + } else { + *result = celrt::CelValue::CreateBool(out != 0); + } + return absl::OkStatus(); + } + + private: + cel_native_fn fn_; + void* ctx_; +}; + +// The expression builder, with the options and functions rules need. +absl::StatusOr> NewBuilder( + const google::protobuf::DescriptorPool* pool, + google::protobuf::MessageFactory* message_factory, + google::protobuf::Arena* arena) { + celrt::InterpreterOptions options; + options.enable_qualified_type_identifiers = true; + options.enable_timestamp_duration_overflow_errors = true; + options.enable_heterogeneous_equality = true; + options.enable_empty_wrapper_null_unboxing = true; + options.enable_regex_precompilation = true; + options.constant_folding = true; + options.constant_arena = arena; + + std::unique_ptr builder = + celrt::CreateCelExpressionBuilder(pool, message_factory, options); + celrt::CelFunctionRegistry* registry = builder->GetRegistry(); + absl::Status status = celrt::RegisterBuiltinFunctions(registry, options); + if (!status.ok()) return status; + status = celrt::RegisterStringExtensionFunctions(registry); + if (!status.ok()) return status; + status = celrt::FunctionAdapter:: + CreateAndRegister("getField", false, &GetField, registry); + if (!status.ok()) return status; + return builder; +} + +} // namespace + +// The pool holds every descriptor the engine knows, starting with the +// well-known types. +// +// Files are added with BuildFile rather than through a DescriptorDatabase, +// because the engine learns about descriptors incrementally and a +// database-backed pool must not be mutated after construction. The +// consequence for callers: a file's imports must be added before the file. +struct cel_engine { + cel_engine() : message_factory(&pool) {} + + google::protobuf::DescriptorPool pool; + google::protobuf::DynamicMessageFactory message_factory; + google::protobuf::Arena constant_arena; + std::unique_ptr builder; +}; + +struct CompiledRule { + std::unique_ptr expression; + bool has_rule = false; + celrt::CelValue rule; +}; + +struct cel_program { + // Owns the rules message and the containers the `rule` values view. + google::protobuf::Arena arena; + celrt::CelValue rules = celrt::CelValue::CreateNull(); + std::vector exprs; +}; + +struct cel_frame { + google::protobuf::Arena arena; + const google::protobuf::Message* message = nullptr; +}; + +namespace { + +// Parses `payload` as `descriptor` into `arena`. +absl::StatusOr ParseMessage( + cel_engine* engine, const google::protobuf::Descriptor* descriptor, + const uint8_t* payload, size_t payload_len, google::protobuf::Arena* arena) { + google::protobuf::Message* message = + engine->message_factory.GetPrototype(descriptor)->New(arena); + if (!message->ParseFromArray(payload, static_cast(payload_len))) { + return absl::InvalidArgumentError( + absl::StrCat("could not parse payload as ", descriptor->full_name())); + } + return message; +} + +} // namespace + +extern "C" { + +cel_engine* cel_engine_new(char** error) { + auto engine = std::make_unique(); + absl::Status status = + celrt::AddStandardMessageTypesToDescriptorPool(engine->pool); + if (!status.ok()) { + SetError(error, status.message()); + return nullptr; + } + auto builder = NewBuilder(&engine->pool, &engine->message_factory, + &engine->constant_arena); + if (!builder.ok()) { + SetError(error, builder.status().message()); + return nullptr; + } + engine->builder = std::move(*builder); + return engine.release(); +} + +void cel_engine_free(cel_engine* engine) { delete engine; } + +int cel_engine_register(cel_engine* engine, const char* name, size_t name_len, + int receiver_style, const int32_t* arg_kinds, + size_t arity, cel_native_fn fn, void* ctx, + char** error) { + std::vector types; + types.reserve(arity); + for (size_t i = 0; i < arity; i++) types.push_back(TypeOfKind(arg_kinds[i])); + celrt::CelFunctionDescriptor descriptor(std::string(name, name_len), + receiver_style != 0, + std::move(types)); + absl::Status status = engine->builder->GetRegistry()->Register( + std::make_unique(std::move(descriptor), fn, ctx)); + if (!status.ok()) { + SetError(error, status.message()); + return CEL_ERR_ARGUMENT; + } + return CEL_OK; +} + +size_t cel_list_len(const cel_list* list) { + return static_cast( + reinterpret_cast(list)->size()); +} + +void cel_list_get(const cel_list* list, size_t index, cel_value* out) { + *out = ToValue((*reinterpret_cast(list))[static_cast(index)]); +} + +char* cel_string_new(const char* data, size_t len) { + return CopyCString(absl::string_view(data, len)); +} + +int cel_engine_add_file(cel_engine* engine, const uint8_t* file_descriptor_proto, + size_t len, char** error) { + google::protobuf::FileDescriptorProto proto; + if (!proto.ParseFromArray(file_descriptor_proto, static_cast(len))) { + SetError(error, "could not parse FileDescriptorProto"); + return CEL_ERR_ARGUMENT; + } + if (engine->pool.FindFileByName(proto.name()) != nullptr) return CEL_OK; + + StringErrorCollector collector; + if (engine->pool.BuildFileCollectingErrors(proto, &collector) == nullptr) { + std::string message = + "could not add " + proto.name() + " to descriptor pool"; + if (!collector.text().empty()) message += ": " + collector.text(); + SetError(error, message); + return CEL_ERR_ARGUMENT; + } + return CEL_OK; +} + +int cel_program_new(cel_engine* engine, const char* rules_type_name, + size_t rules_type_name_len, const uint8_t* rules, + size_t rules_len, const cel_rule* exprs, size_t exprs_len, + cel_program** out, char** error) { + auto program = std::make_unique(); + const google::protobuf::Message* rules_message = nullptr; + if (rules_type_name_len > 0) { + absl::string_view name(rules_type_name, rules_type_name_len); + const google::protobuf::Descriptor* descriptor = + engine->pool.FindMessageTypeByName(name); + if (descriptor == nullptr) { + SetError(error, absl::StrCat("unknown rules type: ", name)); + return CEL_ERR_ARGUMENT; + } + auto parsed = + ParseMessage(engine, descriptor, rules, rules_len, &program->arena); + if (!parsed.ok()) { + SetError(error, parsed.status().message()); + return CEL_ERR_ARGUMENT; + } + rules_message = *parsed; + program->rules = + celrt::CelProtoWrapper::CreateMessage(rules_message, &program->arena); + } + + program->exprs.reserve(exprs_len); + for (size_t i = 0; i < exprs_len; i++) { + const cel_rule& rule = exprs[i]; + absl::string_view expression(rule.expression, rule.expression_len); + auto parsed = google::api::expr::parser::Parse(expression); + if (!parsed.ok()) { + SetError(error, parsed.status().message()); + return CEL_ERR_COMPILATION; + } + auto compiled = engine->builder->CreateExpression(&parsed->expr(), + &parsed->source_info()); + if (!compiled.ok()) { + SetError(error, compiled.status().message()); + return CEL_ERR_COMPILATION; + } + CompiledRule entry; + entry.expression = std::move(*compiled); + if (rules_message != nullptr && rule.rule_field_number != 0) { + const google::protobuf::FieldDescriptor* field = + FindField(*rules_message, rule.rule_field_number); + if (field == nullptr) { + SetError(error, absl::StrCat("no rule field ", rule.rule_field_number, + " in ", + rules_message->GetDescriptor()->full_name())); + return CEL_ERR_ARGUMENT; + } + entry.has_rule = true; + entry.rule = FieldToCelValue(rules_message, field, &program->arena); + } + program->exprs.push_back(std::move(entry)); + } + *out = program.release(); + return CEL_OK; +} + +void cel_program_free(cel_program* program) { delete program; } + +int cel_frame_new(cel_engine* engine, const char* type_name, + size_t type_name_len, const uint8_t* payload, + size_t payload_len, cel_frame** out, char** error) { + absl::string_view name(type_name, type_name_len); + const google::protobuf::Descriptor* descriptor = + engine->pool.FindMessageTypeByName(name); + if (descriptor == nullptr) { + SetError(error, absl::StrCat("unknown message type: ", name)); + return CEL_ERR_ARGUMENT; + } + auto frame = std::make_unique(); + auto parsed = + ParseMessage(engine, descriptor, payload, payload_len, &frame->arena); + if (!parsed.ok()) { + SetError(error, parsed.status().message()); + return CEL_ERR_ARGUMENT; + } + frame->message = *parsed; + *out = frame.release(); + return CEL_OK; +} + +void cel_frame_free(cel_frame* frame) { delete frame; } + +int cel_program_eval(const cel_program* program, size_t index, int this_kind, + const cel_value* scalar, const cel_frame* frame, + int32_t field_number, cel_value* out, char** error) { + google::protobuf::Arena arena; + celrt::CelValue this_value; + switch (this_kind) { + case CEL_THIS_SCALAR: + this_value = ScalarToCelValue(*scalar); + break; + case CEL_THIS_MESSAGE: + this_value = celrt::CelProtoWrapper::CreateMessage(frame->message, &arena); + break; + default: { + const google::protobuf::FieldDescriptor* field = + FindField(*frame->message, field_number); + if (field == nullptr) { + SetError(error, absl::StrCat("no field ", field_number, " in ", + frame->message->GetDescriptor()->full_name())); + return CEL_ERR_ARGUMENT; + } + this_value = FieldToCelValue(frame->message, field, &arena); + } + } + + const CompiledRule& rule = program->exprs[index]; + celrt::Activation activation; + activation.InsertValue("this", this_value); + activation.InsertValue("rules", program->rules); + activation.InsertValue("now", celrt::CelValue::CreateTimestamp(absl::Now())); + if (rule.has_rule) activation.InsertValue("rule", rule.rule); + + auto result = rule.expression->Evaluate(activation, &arena); + if (!result.ok()) { + SetError(error, result.status().message()); + return CEL_ERR_RUNTIME; + } + if (result->IsError()) { + SetError(error, result->ErrorOrDie()->message()); + return CEL_ERR_RUNTIME; + } + *out = ToValue(*result); + if (out->kind == CEL_VALUE_STRING) { + // The arena the string lives in ends with this call. + out->data = reinterpret_cast( + CopyCString(absl::string_view(reinterpret_cast(out->data), out->len))); + } else if (out->kind != CEL_VALUE_BOOL) { + out->kind = CEL_VALUE_OTHER; + } + return CEL_OK; +} + +void cel_free(void* ptr) { std::free(ptr); } + +} // extern "C" diff --git a/crates/protovalidate-deps/shim/cel_shim.h b/crates/protovalidate-deps/shim/cel_shim.h new file mode 100644 index 00000000..8deed383 --- /dev/null +++ b/crates/protovalidate-deps/shim/cel_shim.h @@ -0,0 +1,179 @@ +// Copyright 2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The unsafe C ABI over cel-cpp that the `protovalidate-deps` crate calls. +// As much as possible, logic including validation is kept to the Rust layer +// instead of here. + +#ifndef PROTOVALIDATE_SHIM_CEL_SHIM_H_ +#define PROTOVALIDATE_SHIM_CEL_SHIM_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// A descriptor pool, message factory, and CEL expression builder. +// cel_engine_add_file, cel_engine_register and cel_program_new mutate it. +// cel_frame_new only reads the pool and the message factory, both safe for +// concurrent readers. +typedef struct cel_engine cel_engine; + +// A set of compiled CEL expressions sharing one `rules` message. Immutable +// once built, but bound to the engine's function registry: the engine must +// outlive it. +typedef struct cel_program cel_program; + +// A parsed message, owning the arena it lives in. Its type comes from the +// engine's message factory, so the engine must outlive it too. +typedef struct cel_frame cel_frame; + +// Status codes returned by the fallible entry points. Every failure stores a +// malloc'd message in *error, which the caller releases with cel_free. +enum { + CEL_OK = 0, + CEL_ERR_COMPILATION = 1, // an expression could not be compiled + CEL_ERR_RUNTIME = 2, // an expression failed while being evaluated + CEL_ERR_ARGUMENT = 3, // bad descriptor / unknown type / unparsable payload +}; + +// The kind of a cel_value. CEL_VALUE_OTHER is anything without a cel_value +// form -- a message, a map, null -- where it can be handed over at all. +enum { + CEL_VALUE_OTHER = 0, + CEL_VALUE_BOOL = 1, + CEL_VALUE_INT = 2, // int32/int64/sint*/sfixed*/enum + CEL_VALUE_UINT = 3, // uint32/uint64/fixed* + CEL_VALUE_DOUBLE = 4, // float/double + CEL_VALUE_STRING = 5, + CEL_VALUE_BYTES = 6, + CEL_VALUE_LIST = 7, // only as an argument of a registered function +}; + +typedef struct cel_list cel_list; + +// A value. `data`/`len` are only read for strings and bytes, `list` only for +// lists. Unless a function says otherwise they are borrowed for the call. +typedef struct cel_value { + int32_t kind; + int32_t bool_value; + int64_t int_value; + uint64_t uint_value; + double double_value; + const uint8_t* data; + size_t len; + const cel_list* list; +} cel_value; + +// One expression to compile. `rule_field_number` names the field of the +// rules message that the `rule` variable is bound to while this expression +// runs, or 0 for none. +typedef struct cel_rule { + const char* expression; + size_t expression_len; + int32_t rule_field_number; +} cel_rule; + +// What the `this` variable is bound to during evaluation. +enum { + CEL_THIS_SCALAR = 0, // `scalar` + CEL_THIS_MESSAGE = 1, // the frame's message + CEL_THIS_FIELD = 2, // field `field_number` of the frame's message: a list, + // a map, or a singular value, by the field's descriptor +}; + +// Creates an engine over a descriptor pool layered on the descriptors linked +// into this library (the well-known types). +cel_engine* cel_engine_new(char** error); + +void cel_engine_free(cel_engine* engine); + +// A predicate implemented by the caller. `args` are the call's arguments, of +// the kinds the function was registered with. Returns CEL_OK with the result +// in *out, or another code with a message from cel_string_new in *error, +// which the expression sees as an error value. +typedef int (*cel_native_fn)(void* ctx, const cel_value* args, size_t len, + int* out, char** error); + +// Registers `fn` as CEL function `name`, callable on arguments of the given +// kinds (CEL_VALUE_*, one per argument); `receiver_style` makes the first +// argument the receiver, as in `this.isEmail()`. The same name may be +// registered with several kind lists, which CEL resolves by argument type. +// Register before compiling anything. +int cel_engine_register(cel_engine* engine, const char* name, size_t name_len, + int receiver_style, const int32_t* arg_kinds, + size_t arity, cel_native_fn fn, void* ctx, + char** error); + +// A list passed to a registered function, valid for that call. +size_t cel_list_len(const cel_list* list); + +// Reads element `index` into *out; one without a cel_value form reads as +// CEL_VALUE_OTHER. +void cel_list_get(const cel_list* list, size_t index, cel_value* out); + +// Allocates a string the shim releases: for a registered function's error. +char* cel_string_new(const char* data, size_t len); + +// Adds one serialized FileDescriptorProto to the engine's pool. Adding a file +// the pool already has -- linked in, or added before -- is a no-op success. +// A file's imports must be added before the file itself. +int cel_engine_add_file(cel_engine* engine, const uint8_t* file_descriptor_proto, + size_t len, char** error); + +// Compiles expressions that share one `rules` message: a serialized message +// of the type named by `rules_type_name`, or none when `rules_type_name_len` +// is 0, in which case `rules` is bound to null. +// +// On CEL_OK stores the program in *out. Returns CEL_ERR_COMPILATION for an +// expression that does not compile and CEL_ERR_ARGUMENT for an unknown rules +// type, unparsable rules, or a rule field that does not exist. +int cel_program_new(cel_engine* engine, const char* rules_type_name, + size_t rules_type_name_len, const uint8_t* rules, + size_t rules_len, const cel_rule* exprs, size_t exprs_len, + cel_program** out, char** error); + +void cel_program_free(cel_program* program); + +// Parses `payload` as the message type named by `type_name`. On CEL_OK stores +// the frame in *out; returns CEL_ERR_ARGUMENT for an unknown type or a payload +// that does not parse. +int cel_frame_new(cel_engine* engine, const char* type_name, + size_t type_name_len, const uint8_t* payload, + size_t payload_len, cel_frame** out, char** error); + +void cel_frame_free(cel_frame* frame); + +// Evaluates expression `index` of `program` against `this`, described by +// `this_kind` and, depending on it, `scalar`, `frame`, and `field_number`. +// +// On CEL_OK stores the result in *out: CEL_VALUE_BOOL, CEL_VALUE_STRING with +// `data` malloc'd for the caller to release with cel_free, or CEL_VALUE_OTHER +// for anything else. Returns CEL_ERR_RUNTIME when the expression fails to +// evaluate or produces an error value, and CEL_ERR_ARGUMENT for a `this` +// field that does not exist. +int cel_program_eval(const cel_program* program, size_t index, int this_kind, + const cel_value* scalar, const cel_frame* frame, + int32_t field_number, cel_value* out, char** error); + +// Releases a string or buffer the shim allocated. +void cel_free(void* ptr); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // PROTOVALIDATE_SHIM_CEL_SHIM_H_ diff --git a/crates/protovalidate-deps/shim/re2_shim.cc b/crates/protovalidate-deps/shim/re2_shim.cc new file mode 100644 index 00000000..fe75525b --- /dev/null +++ b/crates/protovalidate-deps/shim/re2_shim.cc @@ -0,0 +1,50 @@ +// Copyright 2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include "re2_shim.h" + +#include +#include + +#include "absl/strings/string_view.h" +#include "cel_shim.h" +#include "internal/re2_options.h" +#include "re2/re2.h" + +struct re2_regex { + explicit re2_regex(absl::string_view pattern) + : re(pattern, cel::internal::MakeRE2Options()) {} + RE2 re; +}; + +extern "C" { + +int re2_regex_new(const char* pattern, size_t len, re2_regex** out, + char** error) { + auto regex = std::make_unique(absl::string_view(pattern, len)); + if (!regex->re.ok()) { + const std::string& message = regex->re.error(); + *error = cel_string_new(message.data(), message.size()); + return CEL_ERR_COMPILATION; + } + *out = regex.release(); + return CEL_OK; +} + +void re2_regex_free(re2_regex* regex) { delete regex; } + +int re2_regex_matches(const re2_regex* regex, const char* text, size_t len) { + return RE2::PartialMatch(absl::string_view(text, len), regex->re) ? 1 : 0; +} + +} // extern "C" diff --git a/crates/protovalidate-deps/shim/re2_shim.h b/crates/protovalidate-deps/shim/re2_shim.h new file mode 100644 index 00000000..25da2753 --- /dev/null +++ b/crates/protovalidate-deps/shim/re2_shim.h @@ -0,0 +1,44 @@ +// Copyright 2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// A C API over RE2, the regular expression engine cel-cpp's `matches()` +// uses, so that the validator's native `pattern` rules share its syntax. +// Status codes and error strings follow cel_shim.h: an error string is +// allocated with cel_string_new and released with cel_free. + +#ifndef PROTOVALIDATE_SHIM_RE2_SHIM_H_ +#define PROTOVALIDATE_SHIM_RE2_SHIM_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct re2_regex re2_regex; + +// Compiles `pattern` (UTF-8, RE2 syntax) into `*out`. Returns CEL_OK, or +// CEL_ERR_COMPILATION with the engine's message in `*error`. +int re2_regex_new(const char* pattern, size_t len, re2_regex** out, + char** error); + +void re2_regex_free(re2_regex* regex); + +// Whether `text` contains a match of the pattern, as RE2::PartialMatch. +int re2_regex_matches(const re2_regex* regex, const char* text, size_t len); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // PROTOVALIDATE_SHIM_RE2_SHIM_H_ diff --git a/crates/protovalidate-deps/src/engine.rs b/crates/protovalidate-deps/src/engine.rs new file mode 100644 index 00000000..aa5a2680 --- /dev/null +++ b/crates/protovalidate-deps/src/engine.rs @@ -0,0 +1,526 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The safe API over the shim: engines, programs, frames and the +//! marshalling of values across the boundary. + +use std::ffi::{CStr, c_char, c_int, c_void}; +use std::ptr; +use std::slice; +use std::sync::Arc; + +use crate::ffi::{ + CEL_ERR_ARGUMENT, CEL_ERR_COMPILATION, CEL_ERR_RUNTIME, CEL_OK, CEL_THIS_FIELD, + CEL_THIS_MESSAGE, CEL_THIS_SCALAR, CEL_VALUE_BOOL, CEL_VALUE_BYTES, CEL_VALUE_DOUBLE, + CEL_VALUE_INT, CEL_VALUE_LIST, CEL_VALUE_STRING, CEL_VALUE_UINT, CelEngine, CelFrame, CelList, + CelProgram, CelRule, CelValue, cel_engine_add_file, cel_engine_free, cel_engine_new, + cel_engine_register, cel_frame_free, cel_frame_new, cel_free, cel_list_get, cel_list_len, + cel_program_eval, cel_program_free, cel_program_new, cel_string_new, +}; +use crate::{Arg, Element, Error, Expression, Kind, NativeFn, ScalarValue, This, Value}; + +/// The shim hands lengths to protobuf as `int`, so a buffer at or above 2 GiB +/// would narrow to a negative one. Protobuf cannot represent a message that +/// large so it is safe to reject. +fn check_len(what: &str, bytes: &[u8]) -> Result<(), Error> { + if i32::try_from(bytes.len()).is_ok() { + Ok(()) + } else { + Err(Error::Argument(format!("{what} is too large"))) + } +} + +/// Takes ownership of a shim-allocated error string. +unsafe fn take_error(error: *mut c_char) -> String { + if error.is_null() { + return "unknown error".to_owned(); + } + // SAFETY: the shim allocated a NUL-terminated string the caller has not + // released, so it stays live until the free below. + let message = unsafe { CStr::from_ptr(error) } + .to_string_lossy() + .into_owned(); + // SAFETY: shim-allocated, and this is the last use of the pointer. + unsafe { cel_free(error.cast()) }; + message +} + +/// The outcome of a shim call that reports a status code, and on any code +/// but `CEL_OK` stores an error string the caller owns in `error`. +pub(crate) unsafe fn finish(code: c_int, error: *mut c_char) -> Result<(), Error> { + if code == CEL_OK { + return Ok(()); + } + // SAFETY: a non-OK code means the shim stored an owned message. + let message = unsafe { take_error(error) }; + Err(match code { + CEL_ERR_COMPILATION => Error::Compilation(message), + CEL_ERR_RUNTIME => Error::Runtime(message), + CEL_ERR_ARGUMENT => Error::Argument(message), + code => Error::Unexpected(format!("unknown status {code}: {message}")), + }) +} + +impl ScalarValue<'_> { + fn to_ffi(self) -> CelValue { + let mut value = CelValue::default(); + match self { + Self::Bool(b) => { + value.kind = CEL_VALUE_BOOL; + value.bool_value = c_int::from(b); + } + Self::Int(i) => { + value.kind = CEL_VALUE_INT; + value.int_value = i; + } + Self::Uint(u) => { + value.kind = CEL_VALUE_UINT; + value.uint_value = u; + } + Self::Double(d) => { + value.kind = CEL_VALUE_DOUBLE; + value.double_value = d; + } + Self::String(s) => { + value.kind = CEL_VALUE_STRING; + value.data = s.as_ptr(); + value.len = s.len(); + } + Self::Bytes(b) => { + value.kind = CEL_VALUE_BYTES; + value.data = b.as_ptr(); + value.len = b.len(); + } + } + value + } +} + +impl Kind { + fn code(self) -> i32 { + match self { + Self::Bool => CEL_VALUE_BOOL, + Self::Int => CEL_VALUE_INT, + Self::Uint => CEL_VALUE_UINT, + Self::Double => CEL_VALUE_DOUBLE, + Self::String => CEL_VALUE_STRING, + Self::Bytes => CEL_VALUE_BYTES, + Self::List => CEL_VALUE_LIST, + } + } +} + +/// The bytes a `cel_value` points at, borrowed for the call. +unsafe fn ffi_bytes<'a>(value: &CelValue) -> &'a [u8] { + if value.data.is_null() { + return &[]; + } + // SAFETY: the shim points `data` at `len` bytes that outlive the call. + unsafe { slice::from_raw_parts(value.data, value.len) } +} + +/// A list element, read through the shim. `index` is in range. +unsafe fn element<'a>(list: *const CelList, index: usize) -> Element<'a> { + let mut value = CelValue::default(); + // SAFETY: `list` is the live list of the current call, `index` is below + // its length, and `value` is a live out-param. + unsafe { cel_list_get(list, index, &raw mut value) }; + match value.kind { + CEL_VALUE_BOOL => Element::Bool(value.bool_value != 0), + CEL_VALUE_INT => Element::Int(value.int_value), + CEL_VALUE_UINT => Element::Uint(value.uint_value), + CEL_VALUE_DOUBLE => Element::Double(value.double_value), + // SAFETY: a string value points at bytes that outlive the call. + CEL_VALUE_STRING => Element::String(String::from_utf8_lossy(unsafe { ffi_bytes(&value) })), + // SAFETY: a bytes value points at bytes that outlive the call. + CEL_VALUE_BYTES => Element::Bytes(unsafe { ffi_bytes(&value) }), + _ => Element::Other, + } +} + +/// An argument of a registered function, as the shim hands it over. +unsafe fn argument<'a>(value: &CelValue) -> Result, String> { + Ok(match value.kind { + CEL_VALUE_BOOL => Arg::Bool(value.bool_value != 0), + CEL_VALUE_INT => Arg::Int(value.int_value), + CEL_VALUE_UINT => Arg::Uint(value.uint_value), + CEL_VALUE_DOUBLE => Arg::Double(value.double_value), + // SAFETY: a string value points at bytes that outlive the call. + CEL_VALUE_STRING => Arg::String(String::from_utf8_lossy(unsafe { ffi_bytes(value) })), + // SAFETY: a bytes value points at bytes that outlive the call. + CEL_VALUE_BYTES => Arg::Bytes(unsafe { ffi_bytes(value) }), + CEL_VALUE_LIST => { + // SAFETY: `list` is the live list of the current call. + let len = unsafe { cel_list_len(value.list) }; + let mut elements = Vec::with_capacity(len); + for index in 0..len { + // SAFETY: as above, and `index` is below the length just read. + elements.push(unsafe { element(value.list, index) }); + } + Arg::List(elements) + } + kind => return Err(format!("unsupported argument kind {kind}")), + }) +} + +/// The shim's entry into a registered function: `ctx` is the [`NativeFn`] +/// itself, carried through the shim as an address. +unsafe extern "C" fn call_function( + ctx: *mut c_void, + args: *const CelValue, + len: usize, + out: *mut c_int, + error: *mut *mut c_char, +) -> c_int { + // SAFETY: `ctx` is the address `register` made from a `NativeFn`, which + // is `'static`, so it is a valid function pointer. + let function: NativeFn = unsafe { std::mem::transmute(ctx.addr()) }; + // SAFETY: `args` is valid for `len` values for the call. + let values = unsafe { slice::from_raw_parts(args, len) }; + // A panic must not unwind into C++, which would abort the process; it + // is reported as the call failing instead. + let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + values + .iter() + // SAFETY: each value's data outlives the call. + .map(|value| unsafe { argument(value) }) + .collect::, _>>() + .and_then(|arguments| function(&arguments)) + })) + .unwrap_or_else(|payload| { + let message = payload + .downcast_ref::<&str>() + .copied() + .or_else(|| payload.downcast_ref::().map(String::as_str)) + .unwrap_or("unknown panic"); + Err(format!("function panicked: {message}")) + }); + match result { + Ok(value) => { + // SAFETY: `out` is a live out-param. + unsafe { out.write(c_int::from(value)) }; + CEL_OK + } + Err(message) => { + // SAFETY: `error` is a live out-param, and the shim releases the + // string it allocates here. + unsafe { + error.write(cel_string_new( + message.as_ptr().cast::(), + message.len(), + )); + } + CEL_ERR_RUNTIME + } + } +} + +/// The shim's engine, freed once the [`Engine`] and every [`Program`] and +/// [`Frame`] made from it are gone: a program's expressions are bound to +/// its function registry, and a frame's message to its message factory, +/// for as long as they live. +struct Shared(*mut CelEngine); + +// SAFETY: the engine has no thread affinity, so it may move between threads. +unsafe impl Send for Shared {} +// SAFETY: what programs and frames reach through the engine, the function +// registry and the message factory, is read-only once they exist; the +// calls that write to the engine are on `Engine`, whose `&mut self` the +// borrow checker serializes, and the descriptor pool they add to locks +// internally against the reads. +unsafe impl Sync for Shared {} + +impl Drop for Shared { + fn drop(&mut self) { + // SAFETY: `self.0` came from `cel_engine_new` and is freed once, after + // its last program and frame. + unsafe { cel_engine_free(self.0) }; + } +} + +/// The CEL environment: a descriptor pool for the messages expressions see, +/// the functions they can call, and the expression builder. +pub struct Engine { + shared: Arc, +} + +impl Engine { + fn raw(&self) -> *mut CelEngine { + self.shared.0 + } + + /// Creates an engine with CEL's own functions and the well-known types. + /// + /// # Errors + /// + /// Fails if the runtime cannot be initialized, which indicates a broken + /// build rather than bad input. + pub fn new() -> Result { + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: `error` is a live out-param the shim writes only on failure. + let raw = unsafe { cel_engine_new(&raw mut error) }; + if raw.is_null() { + // SAFETY: a null engine means the shim stored an owned message. + return Err(Error::Unexpected(unsafe { take_error(error) })); + } + Ok(Self { + shared: Arc::new(Shared(raw)), + }) + } + + /// Makes `function` callable from expressions as `name`, on arguments of + /// the given kinds; `receiver` makes the first argument the receiver, as + /// in `this.isEmail()`. The same name may be registered for several kind + /// lists, which CEL resolves by argument type. Register before compiling. + /// + /// # Errors + /// + /// [`Error::Argument`] for a registration CEL rejects, such as a + /// duplicate. + pub fn register( + &mut self, + name: &str, + receiver: bool, + args: &[Kind], + function: NativeFn, + ) -> Result<(), Error> { + let kinds: Vec = args.iter().map(|kind| kind.code()).collect(); + // The shim hands the opaque context back to `call_function`, which + // is the C-ABI entry point; the function pointer itself travels as + // that context, so nothing needs to outlive the call but the engine. + let ctx = ptr::without_provenance_mut::(function as usize); + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: the engine is live; the name and kinds are valid for their + // lengths for the call; `error` is a live out-param. + let code = unsafe { + cel_engine_register( + self.raw(), + name.as_ptr().cast::(), + name.len(), + c_int::from(receiver), + kinds.as_ptr(), + kinds.len(), + call_function, + ctx, + &raw mut error, + ) + }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) } + } + + /// Adds a serialized `FileDescriptorProto` to the pool. Its imports must + /// already be there. + /// + /// # Errors + /// + /// [`Error::Argument`] for a file that does not parse or link. + pub fn add_file(&mut self, bytes: &[u8]) -> Result<(), Error> { + check_len("FileDescriptorProto", bytes)?; + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: the engine is live, `bytes` is valid for its own length, + // and `error` is a live out-param. + let code = + unsafe { cel_engine_add_file(self.raw(), bytes.as_ptr(), bytes.len(), &raw mut error) }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) } + } + + /// Compiles `expressions` sharing one `rules` message: a serialized + /// message of the named type, or none. + /// + /// # Errors + /// + /// [`Error::Compilation`] for an expression that does not compile; + /// [`Error::Argument`] for a rules message that does not parse. + pub fn compile( + &mut self, + rules: Option<(&str, &[u8])>, + expressions: &[Expression<'_>], + ) -> Result { + let (type_name, bytes) = rules.unwrap_or(("", &[])); + check_len("rules message", bytes)?; + let ffi_rules: Vec = expressions + .iter() + .map(|expression| CelRule { + expression: expression.expression.as_ptr().cast::(), + expression_len: expression.expression.len(), + rule_field_number: expression.rule_field_number, + }) + .collect(); + let mut out: *mut CelProgram = ptr::null_mut(); + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: the engine is live; every pointer/length pair is valid for + // the duration of the call, which does not retain them; `out` and + // `error` are live out-params. + let code = unsafe { + cel_program_new( + self.raw(), + type_name.as_ptr().cast::(), + type_name.len(), + bytes.as_ptr(), + bytes.len(), + ffi_rules.as_ptr(), + ffi_rules.len(), + &raw mut out, + &raw mut error, + ) + }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) }?; + Ok(Program { + raw: out, + len: expressions.len(), + _engine: Arc::clone(&self.shared), + }) + } + + /// Parses `payload` as the named message type. + /// + /// # Errors + /// + /// [`Error::Argument`] for an unknown type or a payload that does not + /// parse. + pub fn frame(&self, type_name: &str, payload: &[u8]) -> Result { + check_len("payload", payload)?; + let mut out: *mut CelFrame = ptr::null_mut(); + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: the engine is live; `type_name` and `payload` are valid for + // their lengths and not retained; `out` and `error` are live + // out-params. + let code = unsafe { + cel_frame_new( + self.raw(), + type_name.as_ptr().cast::(), + type_name.len(), + payload.as_ptr(), + payload.len(), + &raw mut out, + &raw mut error, + ) + }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) }?; + Ok(Frame { + raw: out, + _engine: Arc::clone(&self.shared), + }) + } +} + +/// A set of compiled expressions sharing one `rules` message. It keeps the +/// engine that compiled it alive. +pub struct Program { + raw: *mut CelProgram, + /// The number of expressions, which `eval` indexes. + len: usize, + _engine: Arc, +} + +// SAFETY: a program is immutable once built, and evaluation is thread-safe. +unsafe impl Send for Program {} +// SAFETY: as above. +unsafe impl Sync for Program {} + +impl Program { + /// Evaluates expression `index` against `this`, returning what it + /// produced. + /// + /// # Errors + /// + /// [`Error::Runtime`] for an expression that fails to evaluate or + /// produces an error; [`Error::Argument`] for a `this` field that does + /// not exist, or an `index` the program has no expression at. + pub fn eval(&self, index: usize, this: This<'_>) -> Result { + if index >= self.len { + return Err(Error::Argument(format!( + "no expression {index} in a program of {}", + self.len + ))); + } + let (kind, scalar, frame, field_number) = match this { + This::Scalar(scalar) => (CEL_THIS_SCALAR, Some(scalar.to_ffi()), ptr::null(), 0), + This::Message(frame) => (CEL_THIS_MESSAGE, None, frame.raw.cast_const(), 0), + This::Field(frame, number) => (CEL_THIS_FIELD, None, frame.raw.cast_const(), number), + }; + let mut out = CelValue::default(); + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: `self.raw` is a live program and `index` is one of its + // expressions, checked above; the scalar and its borrowed string + // storage outlive the call, as does `frame` (`This`'s lifetime); + // `out` and `error` are live out-params. + let code = unsafe { + cel_program_eval( + self.raw, + index, + kind, + scalar + .as_ref() + .map_or(ptr::null(), |scalar| &raw const *scalar), + frame, + field_number, + &raw mut out, + &raw mut error, + ) + }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) }?; + Ok(match out.kind { + CEL_VALUE_BOOL => Value::Bool(out.bool_value != 0), + CEL_VALUE_STRING => { + // SAFETY: a string result points at `len` bytes the shim + // allocated, live until the free below. + let text = String::from_utf8_lossy(unsafe { ffi_bytes(&out) }).into_owned(); + // SAFETY: shim-allocated, and this is the last use of it. + unsafe { cel_free(out.data.cast_mut()) }; + Value::String(text) + } + _ => Value::Other, + }) + } +} + +impl Drop for Program { + fn drop(&mut self) { + // SAFETY: `self.raw` came from `cel_program_new` and is freed once, + // before `self.engine` releases the engine. + unsafe { cel_program_free(self.raw) }; + } +} + +/// A parsed message, owning its storage. It keeps the engine that parsed +/// it alive. +pub struct Frame { + raw: *mut CelFrame, + _engine: Arc, +} + +impl std::fmt::Debug for Frame { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Frame").finish_non_exhaustive() + } +} + +// SAFETY: a frame is immutable once parsed. +unsafe impl Send for Frame {} +// SAFETY: as above. +unsafe impl Sync for Frame {} + +impl Drop for Frame { + fn drop(&mut self) { + // SAFETY: `self.raw` came from `cel_frame_new` and is freed once, + // before `self.engine` releases the engine. + unsafe { cel_frame_free(self.raw) }; + } +} diff --git a/crates/protovalidate-deps/src/ffi.rs b/crates/protovalidate-deps/src/ffi.rs new file mode 100644 index 00000000..e4b02acd --- /dev/null +++ b/crates/protovalidate-deps/src/ffi.rs @@ -0,0 +1,173 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The C ABI of `shim/cel_shim.h`, declaration for declaration. Everything +//! here is raw; the safe API over it is the rest of the crate. + +use std::ffi::{c_char, c_int, c_void}; +use std::ptr; + +pub(crate) const CEL_OK: c_int = 0; +pub(crate) const CEL_ERR_COMPILATION: c_int = 1; +pub(crate) const CEL_ERR_RUNTIME: c_int = 2; +pub(crate) const CEL_ERR_ARGUMENT: c_int = 3; + +pub(crate) const CEL_VALUE_OTHER: i32 = 0; +pub(crate) const CEL_VALUE_BOOL: i32 = 1; +pub(crate) const CEL_VALUE_INT: i32 = 2; +pub(crate) const CEL_VALUE_UINT: i32 = 3; +pub(crate) const CEL_VALUE_DOUBLE: i32 = 4; +pub(crate) const CEL_VALUE_STRING: i32 = 5; +pub(crate) const CEL_VALUE_BYTES: i32 = 6; +pub(crate) const CEL_VALUE_LIST: i32 = 7; + +pub(crate) const CEL_THIS_SCALAR: c_int = 0; +pub(crate) const CEL_THIS_MESSAGE: c_int = 1; +pub(crate) const CEL_THIS_FIELD: c_int = 2; + +/// Opaque engine handle; see `cel_engine` in `shim/cel_shim.h`. +#[repr(C)] +pub(crate) struct CelEngine { + _opaque: [u8; 0], +} + +/// Opaque compiled program; see `cel_program` in `shim/cel_shim.h`. +#[repr(C)] +pub(crate) struct CelProgram { + _opaque: [u8; 0], +} + +/// Opaque parsed message frame; see `cel_frame` in `shim/cel_shim.h`. +#[repr(C)] +pub(crate) struct CelFrame { + _opaque: [u8; 0], +} + +/// A value; see `cel_value` in `shim/cel_shim.h`. +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub(crate) struct CelValue { + pub kind: i32, + pub bool_value: i32, + pub int_value: i64, + pub uint_value: u64, + pub double_value: f64, + pub data: *const u8, + pub len: usize, + pub list: *const CelList, +} + +/// Nothing set: `CEL_VALUE_OTHER` with every field zero. +impl Default for CelValue { + fn default() -> Self { + Self { + kind: CEL_VALUE_OTHER, + bool_value: 0, + int_value: 0, + uint_value: 0, + double_value: 0.0, + data: ptr::null(), + len: 0, + list: ptr::null(), + } + } +} + +/// One expression to compile; see `cel_rule` in `shim/cel_shim.h`. +#[repr(C)] +#[derive(Clone, Copy, Debug)] +pub(crate) struct CelRule { + pub expression: *const c_char, + pub expression_len: usize, + pub rule_field_number: i32, +} + +/// Opaque list passed to a registered function; see `cel_list` in +/// `shim/cel_shim.h`. +#[repr(C)] +pub(crate) struct CelList { + _opaque: [u8; 0], +} + +/// A function registered with `cel_engine_register`; see `cel_native_fn` in +/// `shim/cel_shim.h`. +pub(crate) type CelNativeFn = unsafe extern "C" fn( + ctx: *mut c_void, + args: *const CelValue, + len: usize, + out: *mut c_int, + error: *mut *mut c_char, +) -> c_int; + +unsafe extern "C" { + pub(crate) fn cel_engine_new(error: *mut *mut c_char) -> *mut CelEngine; + pub(crate) fn cel_engine_free(engine: *mut CelEngine); + pub(crate) fn cel_engine_register( + engine: *mut CelEngine, + name: *const c_char, + name_len: usize, + receiver_style: c_int, + arg_kinds: *const i32, + arity: usize, + function: CelNativeFn, + ctx: *mut c_void, + error: *mut *mut c_char, + ) -> c_int; + pub(crate) fn cel_list_len(list: *const CelList) -> usize; + pub(crate) fn cel_list_get(list: *const CelList, index: usize, out: *mut CelValue); + pub(crate) fn cel_string_new(data: *const c_char, len: usize) -> *mut c_char; + pub(crate) fn cel_engine_add_file( + engine: *mut CelEngine, + file_descriptor_proto: *const u8, + len: usize, + error: *mut *mut c_char, + ) -> c_int; + + pub(crate) fn cel_program_new( + engine: *mut CelEngine, + rules_type_name: *const c_char, + rules_type_name_len: usize, + rules: *const u8, + rules_len: usize, + exprs: *const CelRule, + exprs_len: usize, + out: *mut *mut CelProgram, + error: *mut *mut c_char, + ) -> c_int; + pub(crate) fn cel_program_free(program: *mut CelProgram); + + pub(crate) fn cel_frame_new( + engine: *mut CelEngine, + type_name: *const c_char, + type_name_len: usize, + payload: *const u8, + payload_len: usize, + out: *mut *mut CelFrame, + error: *mut *mut c_char, + ) -> c_int; + pub(crate) fn cel_frame_free(frame: *mut CelFrame); + + pub(crate) fn cel_program_eval( + program: *const CelProgram, + index: usize, + this_kind: c_int, + scalar: *const CelValue, + frame: *const CelFrame, + field_number: i32, + out: *mut CelValue, + error: *mut *mut c_char, + ) -> c_int; + + pub(crate) fn cel_free(ptr: *mut u8); +} diff --git a/crates/protovalidate-deps/src/function.rs b/crates/protovalidate-deps/src/function.rs new file mode 100644 index 00000000..c69f28b7 --- /dev/null +++ b/crates/protovalidate-deps/src/function.rs @@ -0,0 +1,64 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Functions written in Rust, as CEL calls them: the types an +//! [`Engine::register`](crate::Engine::register)ed function is declared +//! and called with. + +use std::borrow::Cow; + +/// The type of an argument, as a function is registered. CEL resolves +/// overloads of one name by these. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Kind { + Bool, + Int, + Uint, + Double, + String, + Bytes, + List, +} + +/// An argument, of the [`Kind`] the function was registered with. +#[derive(Debug)] +pub enum Arg<'a> { + Bool(bool), + Int(i64), + Uint(u64), + Double(f64), + /// CEL strings are UTF-8. + String(Cow<'a, str>), + Bytes(&'a [u8]), + /// The list's elements, read up front. + List(Vec>), +} + +/// A list element. [`Other`](Self::Other) is one that is not a scalar, e.g., a message. +#[derive(Debug)] +pub enum Element<'a> { + Bool(bool), + Int(i64), + Uint(u64), + Double(f64), + String(Cow<'a, str>), + Bytes(&'a [u8]), + Other, +} + +/// A function's implementation: a predicate over its arguments, or the +/// message of the error the expression sees instead of a value. +/// +/// protovalidate's functions are all predicates. +pub type NativeFn = fn(&[Arg<'_>]) -> Result; diff --git a/crates/protovalidate-deps/src/lib.rs b/crates/protovalidate-deps/src/lib.rs new file mode 100644 index 00000000..05bb353e --- /dev/null +++ b/crates/protovalidate-deps/src/lib.rs @@ -0,0 +1,111 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The CEL runtime behind the `protovalidate` crate: [cel-cpp], compiled from +//! source with its dependencies, behind a small safe API. +//! +//! An [`Engine`] holds a descriptor pool and compiles expressions into +//! [`Program`]s; a [`Frame`] is a parsed message that programs evaluate +//! against. Both keep the engine they came from alive. Functions written +//! in Rust are added to an engine with [`Engine::register`]. A [`Regex`] +//! is a pattern compiled by RE2, the engine behind CEL's `matches()`. +//! +//! This is an internal support crate: its API follows the shim's needs and +//! changes with it. +//! +//! [cel-cpp]: https://github.com/google/cel-cpp + +mod engine; +mod ffi; +mod function; +mod regex; + +use std::fmt; + +pub use engine::{Engine, Frame, Program}; +pub use function::{Arg, Element, Kind, NativeFn}; +pub use regex::Regex; + +/// A scalar, as an expression's `this`. +#[derive(Clone, Copy, Debug)] +pub enum ScalarValue<'a> { + Bool(bool), + Int(i64), + Uint(u64), + Double(f64), + String(&'a str), + Bytes(&'a [u8]), +} + +/// What `this` is bound to while a program runs. +#[derive(Clone, Copy, Debug)] +pub enum This<'a> { + Scalar(ScalarValue<'a>), + /// The frame's message. + Message(&'a Frame), + /// A field of the frame's message, by number: a list, a map, or a + /// singular value, as the field's descriptor says. + Field(&'a Frame, i32), +} + +/// One expression to compile. +#[derive(Clone, Copy, Debug)] +pub struct Expression<'a> { + pub expression: &'a str, + /// The field of the rules message that `rule` is bound to while the + /// expression runs, or 0 for none. + pub rule_field_number: i32, +} + +/// What an expression produced, as far as the caller can tell them apart. +#[derive(Debug)] +pub enum Value { + Bool(bool), + String(String), + /// Anything else: a number, a message, a list, null. + Other, +} + +/// Why the runtime could not do what was asked. +#[derive(Debug)] +pub enum Error { + /// An expression does not compile. + Compilation(String), + /// An expression failed while being evaluated. + Runtime(String), + /// A bad descriptor, an unknown type, an unparsable payload, or a field + /// that does not exist. + Argument(String), + /// A failure of the runtime itself, or a status the shim does not + /// define. + Unexpected(String), +} + +impl Error { + /// The message, whatever the kind. + #[must_use] + pub fn message(&self) -> &str { + match self { + Self::Compilation(m) | Self::Runtime(m) | Self::Argument(m) | Self::Unexpected(m) => m, + } + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(self.message()) + } +} + +impl std::error::Error for Error {} diff --git a/crates/protovalidate-deps/src/regex.rs b/crates/protovalidate-deps/src/regex.rs new file mode 100644 index 00000000..6cb3027c --- /dev/null +++ b/crates/protovalidate-deps/src/regex.rs @@ -0,0 +1,134 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Regular expressions through RE2, the engine behind cel-cpp's `matches()`, +//! so that patterns compiled here and patterns in CEL expressions share one +//! syntax and one set of limits. + +use std::ffi::{c_char, c_int}; +use std::fmt; +use std::ptr; + +use crate::Error; +use crate::engine::finish; + +#[repr(C)] +struct Re2Regex { + _opaque: [u8; 0], +} + +unsafe extern "C" { + fn re2_regex_new( + pattern: *const c_char, + len: usize, + out: *mut *mut Re2Regex, + error: *mut *mut c_char, + ) -> c_int; + fn re2_regex_free(regex: *mut Re2Regex); + fn re2_regex_matches(regex: *const Re2Regex, text: *const c_char, len: usize) -> c_int; +} + +/// A compiled regular expression, in RE2 syntax. +pub struct Regex { + raw: *mut Re2Regex, +} + +// SAFETY: a compiled RE2 is immutable, and RE2 documents matching as safe +// to call from several threads at once. +unsafe impl Send for Regex {} +// SAFETY: as above. +unsafe impl Sync for Regex {} + +impl Regex { + /// Compiles `pattern`. + /// + /// # Errors + /// + /// [`Error::Compilation`] with RE2's message for a pattern it rejects. + pub fn new(pattern: &str) -> Result { + let mut out: *mut Re2Regex = ptr::null_mut(); + let mut error: *mut c_char = ptr::null_mut(); + // SAFETY: the pattern is valid for its length for the call, which + // copies it; `out` and `error` are live out-params. + let code = unsafe { + re2_regex_new( + pattern.as_ptr().cast::(), + pattern.len(), + &raw mut out, + &raw mut error, + ) + }; + // SAFETY: `code` and `error` are the call's, untouched since. + unsafe { finish(code, error) }?; + Ok(Self { raw: out }) + } + + /// Whether `text` contains a match, anchored only where the pattern + /// anchors itself. + #[must_use] + pub fn is_match(&self, text: &str) -> bool { + // SAFETY: `self.raw` is a live regex, and the text is valid for its + // length for the call. + unsafe { re2_regex_matches(self.raw, text.as_ptr().cast::(), text.len()) != 0 } + } +} + +impl fmt::Debug for Regex { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Regex").finish_non_exhaustive() + } +} + +impl Drop for Regex { + fn drop(&mut self) { + // SAFETY: `self.raw` came from `re2_regex_new` and is freed once. + unsafe { re2_regex_free(self.raw) }; + } +} + +#[cfg(test)] +mod tests { + use super::Regex; + use crate::Error; + + #[test] + fn matches_partially() { + let regex = Regex::new("b+").expect("valid"); + assert!(regex.is_match("abbc")); + assert!(!regex.is_match("ac")); + assert!(Regex::new("^é$").expect("valid").is_match("é")); + } + + #[test] + fn rejects_bad_patterns() { + assert!(matches!(Regex::new("("), Err(Error::Compilation(_)))); + // RE2 caps repeat counts at 1000. + assert!(matches!(Regex::new("a{1001}"), Err(Error::Compilation(_)))); + assert!(Regex::new("a{1000}").is_ok()); + } + + #[test] + fn re2_dialect() { + // Perl classes are ASCII. + let digits = Regex::new(r"^\d+$").expect("valid"); + assert!(digits.is_match("123")); + assert!(!digits.is_match("١٢٣")); + // Quoted literals. + let quoted = Regex::new(r"^\Qa.c\E$").expect("valid"); + assert!(quoted.is_match("a.c")); + assert!(!quoted.is_match("abc")); + // A hyphen after a class escape is literal. + assert!(Regex::new(r"^[\d-z]$").expect("valid").is_match("-")); + } +} diff --git a/crates/protovalidate-rs/third_party/abseil-cpp b/crates/protovalidate-deps/third_party/abseil-cpp similarity index 100% rename from crates/protovalidate-rs/third_party/abseil-cpp rename to crates/protovalidate-deps/third_party/abseil-cpp diff --git a/crates/protovalidate-rs/third_party/antlr4 b/crates/protovalidate-deps/third_party/antlr4 similarity index 100% rename from crates/protovalidate-rs/third_party/antlr4 rename to crates/protovalidate-deps/third_party/antlr4 diff --git a/crates/protovalidate-rs/third_party/cel-cpp b/crates/protovalidate-deps/third_party/cel-cpp similarity index 100% rename from crates/protovalidate-rs/third_party/cel-cpp rename to crates/protovalidate-deps/third_party/cel-cpp diff --git a/crates/protovalidate-rs/third_party/protobuf b/crates/protovalidate-deps/third_party/protobuf similarity index 100% rename from crates/protovalidate-rs/third_party/protobuf rename to crates/protovalidate-deps/third_party/protobuf diff --git a/crates/protovalidate-rs/third_party/re2 b/crates/protovalidate-deps/third_party/re2 similarity index 100% rename from crates/protovalidate-rs/third_party/re2 rename to crates/protovalidate-deps/third_party/re2 diff --git a/crates/protovalidate-rs/filelists/protovalidate.txt b/crates/protovalidate-rs/filelists/protovalidate.txt deleted file mode 100644 index 334519ac..00000000 --- a/crates/protovalidate-rs/filelists/protovalidate.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Generated by scripts/extract_native_sources.py -- do not edit. -# C++ sources the extension compiles, relative to this crate's directory. -# A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only. -gen/buf/validate/validate.pb.cc -third_party/protovalidate-cc/buf/validate/internal/cel_validation_rules.cc -third_party/protovalidate-cc/buf/validate/internal/extra_func.cc -third_party/protovalidate-cc/buf/validate/internal/field_rules.cc -third_party/protovalidate-cc/buf/validate/internal/lib/ipv4.cc -third_party/protovalidate-cc/buf/validate/internal/lib/ipv6.cc -third_party/protovalidate-cc/buf/validate/internal/lib/uri.cc -third_party/protovalidate-cc/buf/validate/internal/message_factory.cc -third_party/protovalidate-cc/buf/validate/internal/message_rules.cc -third_party/protovalidate-cc/buf/validate/internal/rules.cc -third_party/protovalidate-cc/buf/validate/validator.cc diff --git a/crates/protovalidate-rs/gen/buf/validate/validate.pb.cc b/crates/protovalidate-rs/gen/buf/validate/validate.pb.cc deleted file mode 100644 index 49eb73bb..00000000 --- a/crates/protovalidate-rs/gen/buf/validate/validate.pb.cc +++ /dev/null @@ -1,21049 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// NO CHECKED-IN PROTOBUF GENCODE -// source: buf/validate/validate.proto -// Protobuf C++ Version: 6.33.4 - -#include "buf/validate/validate.pb.h" - -#include -#include -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/generated_message_tctable_impl.h" -#include "google/protobuf/extension_set.h" -#include "google/protobuf/generated_message_util.h" -#include "google/protobuf/wire_format_lite.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/generated_message_reflection.h" -#include "google/protobuf/reflection_ops.h" -#include "google/protobuf/wire_format.h" -// @@protoc_insertion_point(includes) - -// Must be included last. -#include "google/protobuf/port_def.inc" -PROTOBUF_PRAGMA_INIT_SEG -namespace _pb = ::google::protobuf; -namespace _pbi = ::google::protobuf::internal; -namespace _fl = ::google::protobuf::internal::field_layout; -namespace buf { -namespace validate { - -inline constexpr UInt64Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{::uint64_t{0u}}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR UInt64Rules::UInt64Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(UInt64Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct UInt64RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR UInt64RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~UInt64RulesDefaultTypeInternal() {} - union { - UInt64Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UInt64RulesDefaultTypeInternal _UInt64Rules_default_instance_; - -inline constexpr UInt32Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0u}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR UInt32Rules::UInt32Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(UInt32Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct UInt32RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR UInt32RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~UInt32RulesDefaultTypeInternal() {} - union { - UInt32Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 UInt32RulesDefaultTypeInternal _UInt32Rules_default_instance_; - -inline constexpr StringRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - pattern_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - prefix_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - suffix_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - contains_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - not_contains_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - min_len_{::uint64_t{0u}}, - max_len_{::uint64_t{0u}}, - min_bytes_{::uint64_t{0u}}, - max_bytes_{::uint64_t{0u}}, - len_{::uint64_t{0u}}, - len_bytes_{::uint64_t{0u}}, - strict_{false}, - well_known_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR StringRules::StringRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(StringRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct StringRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR StringRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~StringRulesDefaultTypeInternal() {} - union { - StringRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StringRulesDefaultTypeInternal _StringRules_default_instance_; - -inline constexpr SInt64Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{::int64_t{0}}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR SInt64Rules::SInt64Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(SInt64Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct SInt64RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR SInt64RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~SInt64RulesDefaultTypeInternal() {} - union { - SInt64Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SInt64RulesDefaultTypeInternal _SInt64Rules_default_instance_; - -inline constexpr SInt32Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR SInt32Rules::SInt32Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(SInt32Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct SInt32RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR SInt32RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~SInt32RulesDefaultTypeInternal() {} - union { - SInt32Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SInt32RulesDefaultTypeInternal _SInt32Rules_default_instance_; - -inline constexpr SFixed64Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{::int64_t{0}}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR SFixed64Rules::SFixed64Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(SFixed64Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct SFixed64RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR SFixed64RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~SFixed64RulesDefaultTypeInternal() {} - union { - SFixed64Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SFixed64RulesDefaultTypeInternal _SFixed64Rules_default_instance_; - -inline constexpr SFixed32Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR SFixed32Rules::SFixed32Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(SFixed32Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct SFixed32RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR SFixed32RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~SFixed32RulesDefaultTypeInternal() {} - union { - SFixed32Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 SFixed32RulesDefaultTypeInternal _SFixed32Rules_default_instance_; - -inline constexpr Rule::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - id_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - message_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - expression_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()) {} - -template -PROTOBUF_CONSTEXPR Rule::Rule(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Rule_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct RuleDefaultTypeInternal { - PROTOBUF_CONSTEXPR RuleDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~RuleDefaultTypeInternal() {} - union { - Rule _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RuleDefaultTypeInternal _Rule_default_instance_; - -inline constexpr OneofRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - required_{false} {} - -template -PROTOBUF_CONSTEXPR OneofRules::OneofRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(OneofRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct OneofRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR OneofRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~OneofRulesDefaultTypeInternal() {} - union { - OneofRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 OneofRulesDefaultTypeInternal _OneofRules_default_instance_; - -inline constexpr MessageOneofRule::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - fields_{}, - required_{false} {} - -template -PROTOBUF_CONSTEXPR MessageOneofRule::MessageOneofRule(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(MessageOneofRule_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct MessageOneofRuleDefaultTypeInternal { - PROTOBUF_CONSTEXPR MessageOneofRuleDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~MessageOneofRuleDefaultTypeInternal() {} - union { - MessageOneofRule _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageOneofRuleDefaultTypeInternal _MessageOneofRule_default_instance_; - -inline constexpr Int64Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - const__{::int64_t{0}}, - example_{}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR Int64Rules::Int64Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Int64Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct Int64RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR Int64RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~Int64RulesDefaultTypeInternal() {} - union { - Int64Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Int64RulesDefaultTypeInternal _Int64Rules_default_instance_; - -inline constexpr Int32Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR Int32Rules::Int32Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Int32Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct Int32RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR Int32RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~Int32RulesDefaultTypeInternal() {} - union { - Int32Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Int32RulesDefaultTypeInternal _Int32Rules_default_instance_; - -inline constexpr FloatRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - const__{0}, - finite_{false}, - example_{}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR FloatRules::FloatRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(FloatRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct FloatRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR FloatRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~FloatRulesDefaultTypeInternal() {} - union { - FloatRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FloatRulesDefaultTypeInternal _FloatRules_default_instance_; - -inline constexpr Fixed64Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{::uint64_t{0u}}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR Fixed64Rules::Fixed64Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Fixed64Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct Fixed64RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR Fixed64RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~Fixed64RulesDefaultTypeInternal() {} - union { - Fixed64Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Fixed64RulesDefaultTypeInternal _Fixed64Rules_default_instance_; - -inline constexpr Fixed32Rules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0u}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR Fixed32Rules::Fixed32Rules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Fixed32Rules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct Fixed32RulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR Fixed32RulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~Fixed32RulesDefaultTypeInternal() {} - union { - Fixed32Rules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 Fixed32RulesDefaultTypeInternal _Fixed32Rules_default_instance_; - -inline constexpr FieldPathElement::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - field_name_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - field_number_{0}, - value_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - field_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - key_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - subscript_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR FieldPathElement::FieldPathElement(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(FieldPathElement_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct FieldPathElementDefaultTypeInternal { - PROTOBUF_CONSTEXPR FieldPathElementDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~FieldPathElementDefaultTypeInternal() {} - union { - FieldPathElement _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldPathElementDefaultTypeInternal _FieldPathElement_default_instance_; - -inline constexpr EnumRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{0}, - defined_only_{false} {} - -template -PROTOBUF_CONSTEXPR EnumRules::EnumRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(EnumRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct EnumRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR EnumRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~EnumRulesDefaultTypeInternal() {} - union { - EnumRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumRulesDefaultTypeInternal _EnumRules_default_instance_; - -inline constexpr DoubleRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - const__{0}, - finite_{false}, - example_{}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR DoubleRules::DoubleRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(DoubleRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct DoubleRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR DoubleRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~DoubleRulesDefaultTypeInternal() {} - union { - DoubleRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DoubleRulesDefaultTypeInternal _DoubleRules_default_instance_; - -inline constexpr BytesRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - pattern_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - prefix_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - suffix_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - contains_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - min_len_{::uint64_t{0u}}, - max_len_{::uint64_t{0u}}, - len_{::uint64_t{0u}}, - well_known_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR BytesRules::BytesRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(BytesRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct BytesRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR BytesRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~BytesRulesDefaultTypeInternal() {} - union { - BytesRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BytesRulesDefaultTypeInternal _BytesRules_default_instance_; - -inline constexpr BoolRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - example_{}, - const__{false} {} - -template -PROTOBUF_CONSTEXPR BoolRules::BoolRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(BoolRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct BoolRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR BoolRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~BoolRulesDefaultTypeInternal() {} - union { - BoolRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BoolRulesDefaultTypeInternal _BoolRules_default_instance_; - -inline constexpr AnyRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{} {} - -template -PROTOBUF_CONSTEXPR AnyRules::AnyRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(AnyRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct AnyRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR AnyRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~AnyRulesDefaultTypeInternal() {} - union { - AnyRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AnyRulesDefaultTypeInternal _AnyRules_default_instance_; - -inline constexpr TimestampRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - const__{nullptr}, - within_{nullptr}, - example_{}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR TimestampRules::TimestampRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(TimestampRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct TimestampRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR TimestampRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~TimestampRulesDefaultTypeInternal() {} - union { - TimestampRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TimestampRulesDefaultTypeInternal _TimestampRules_default_instance_; - -inline constexpr PredefinedRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - cel_{} {} - -template -PROTOBUF_CONSTEXPR PredefinedRules::PredefinedRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(PredefinedRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct PredefinedRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR PredefinedRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~PredefinedRulesDefaultTypeInternal() {} - union { - PredefinedRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PredefinedRulesDefaultTypeInternal _PredefinedRules_default_instance_; - -inline constexpr MessageRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - cel_{}, - oneof_{}, - cel_expression_{} {} - -template -PROTOBUF_CONSTEXPR MessageRules::MessageRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(MessageRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct MessageRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR MessageRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~MessageRulesDefaultTypeInternal() {} - union { - MessageRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MessageRulesDefaultTypeInternal _MessageRules_default_instance_; - -inline constexpr FieldPath::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - elements_{} {} - -template -PROTOBUF_CONSTEXPR FieldPath::FieldPath(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(FieldPath_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct FieldPathDefaultTypeInternal { - PROTOBUF_CONSTEXPR FieldPathDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~FieldPathDefaultTypeInternal() {} - union { - FieldPath _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldPathDefaultTypeInternal _FieldPath_default_instance_; - -inline constexpr FieldMaskRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{nullptr} {} - -template -PROTOBUF_CONSTEXPR FieldMaskRules::FieldMaskRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(FieldMaskRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct FieldMaskRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR FieldMaskRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~FieldMaskRulesDefaultTypeInternal() {} - union { - FieldMaskRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldMaskRulesDefaultTypeInternal _FieldMaskRules_default_instance_; - -inline constexpr DurationRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - in_{}, - not_in_{}, - example_{}, - const__{nullptr}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR DurationRules::DurationRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(DurationRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct DurationRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR DurationRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~DurationRulesDefaultTypeInternal() {} - union { - DurationRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 DurationRulesDefaultTypeInternal _DurationRules_default_instance_; - -inline constexpr Violation::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - rule_id_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - message_( - &::google::protobuf::internal::fixed_address_empty_string, - ::_pbi::ConstantInitialized()), - field_{nullptr}, - rule_{nullptr}, - for_key_{false} {} - -template -PROTOBUF_CONSTEXPR Violation::Violation(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Violation_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct ViolationDefaultTypeInternal { - PROTOBUF_CONSTEXPR ViolationDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~ViolationDefaultTypeInternal() {} - union { - Violation _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ViolationDefaultTypeInternal _Violation_default_instance_; - -inline constexpr FieldRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - cel_{}, - cel_expression_{}, - required_{false}, - ignore_{static_cast< ::buf::validate::Ignore >(0)}, - type_{}, - _oneof_case_{} {} - -template -PROTOBUF_CONSTEXPR FieldRules::FieldRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(FieldRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct FieldRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR FieldRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~FieldRulesDefaultTypeInternal() {} - union { - FieldRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldRulesDefaultTypeInternal _FieldRules_default_instance_; - -inline constexpr MapRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - keys_{nullptr}, - values_{nullptr}, - min_pairs_{::uint64_t{0u}}, - max_pairs_{::uint64_t{0u}} {} - -template -PROTOBUF_CONSTEXPR MapRules::MapRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(MapRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct MapRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR MapRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~MapRulesDefaultTypeInternal() {} - union { - MapRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MapRulesDefaultTypeInternal _MapRules_default_instance_; - -inline constexpr RepeatedRules::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - items_{nullptr}, - min_items_{::uint64_t{0u}}, - max_items_{::uint64_t{0u}}, - unique_{false} {} - -template -PROTOBUF_CONSTEXPR RepeatedRules::RepeatedRules(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(RepeatedRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct RepeatedRulesDefaultTypeInternal { - PROTOBUF_CONSTEXPR RepeatedRulesDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~RepeatedRulesDefaultTypeInternal() {} - union { - RepeatedRules _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RepeatedRulesDefaultTypeInternal _RepeatedRules_default_instance_; - -inline constexpr Violations::Impl_::Impl_( - ::_pbi::ConstantInitialized) noexcept - : _cached_size_{0}, - violations_{} {} - -template -PROTOBUF_CONSTEXPR Violations::Violations(::_pbi::ConstantInitialized) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(Violations_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(::_pbi::ConstantInitialized()) { -} -struct ViolationsDefaultTypeInternal { - PROTOBUF_CONSTEXPR ViolationsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} - ~ViolationsDefaultTypeInternal() {} - union { - Violations _instance; - }; -}; - -PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ViolationsDefaultTypeInternal _Violations_default_instance_; -} // namespace validate -} // namespace buf -static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL - file_level_enum_descriptors_buf_2fvalidate_2fvalidate_2eproto[2]; -static constexpr const ::_pb::ServiceDescriptor* PROTOBUF_NONNULL* PROTOBUF_NULLABLE - file_level_service_descriptors_buf_2fvalidate_2fvalidate_2eproto = nullptr; -const ::uint32_t - TableStruct_buf_2fvalidate_2fvalidate_2eproto::offsets[] ABSL_ATTRIBUTE_SECTION_VARIABLE( - protodesc_cold) = { - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Rule, _impl_._has_bits_), - 6, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Rule, _impl_.id_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Rule, _impl_.message_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Rule, _impl_.expression_), - 0, - 1, - 2, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageRules, _impl_._has_bits_), - 6, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageRules, _impl_.cel_expression_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageRules, _impl_.cel_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageRules, _impl_.oneof_), - 2, - 0, - 1, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageOneofRule, _impl_._has_bits_), - 5, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageOneofRule, _impl_.fields_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MessageOneofRule, _impl_.required_), - 0, - 1, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::OneofRules, _impl_._has_bits_), - 4, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::OneofRules, _impl_.required_), - 0, - 0x085, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_._oneof_case_[0]), - 31, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.cel_expression_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.cel_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.required_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.ignore_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_.type_), - 1, - 0, - 2, - 3, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::PredefinedRules, _impl_._has_bits_), - 4, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::PredefinedRules, _impl_.cel_), - 0, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_._oneof_case_[0]), - 16, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.finite_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_.greater_than_), - 2, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 3, - 4, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_._oneof_case_[0]), - 16, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.finite_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_.greater_than_), - 2, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 3, - 4, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_.greater_than_), - 2, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 3, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x083, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::BoolRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BoolRules, _impl_._extensions_), - 6, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::BoolRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::BoolRules, _impl_.example_), - 1, - 0, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_._oneof_case_[0]), - 43, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.min_len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.max_len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.len_bytes_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.min_bytes_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.max_bytes_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.pattern_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.prefix_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.suffix_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.contains_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.not_contains_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.strict_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_.well_known_), - 3, - 13, - 9, - 10, - 14, - 11, - 12, - 4, - 5, - 6, - 7, - 8, - 0, - 1, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - 15, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_._oneof_case_[0]), - 21, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.min_len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.max_len_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.pattern_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.prefix_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.suffix_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.contains_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.well_known_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_.well_known_), - 3, - 10, - 8, - 9, - 4, - 5, - 6, - 7, - 0, - 1, - ~0u, - ~0u, - ~0u, - ~0u, - 2, - 0x083, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_._extensions_), - 9, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_.defined_only_), - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::EnumRules, _impl_.example_), - 3, - 4, - 0, - 1, - 2, - 0x083, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_._extensions_), - 8, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_.min_items_), - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_.max_items_), - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_.unique_), - PROTOBUF_FIELD_OFFSET(::buf::validate::RepeatedRules, _impl_.items_), - 1, - 2, - 3, - 0, - 0x083, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_._extensions_), - 8, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_.min_pairs_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_.max_pairs_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_.keys_), - PROTOBUF_FIELD_OFFSET(::buf::validate::MapRules, _impl_.values_), - 2, - 3, - 0, - 1, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::AnyRules, _impl_._has_bits_), - 5, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::AnyRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::AnyRules, _impl_.not_in_), - 0, - 1, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_.greater_than_), - 3, - ~0u, - ~0u, - ~0u, - ~0u, - 0, - 1, - 2, - 0x083, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_._extensions_), - 8, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_.in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_.not_in_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldMaskRules, _impl_.example_), - 3, - 0, - 1, - 2, - 0x087, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_._extensions_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_._oneof_case_[0]), - 16, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.const__), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.greater_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.within_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.example_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.less_than_), - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_.greater_than_), - 0, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, - 1, - 2, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Violations, _impl_._has_bits_), - 4, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Violations, _impl_.violations_), - 0, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_._has_bits_), - 8, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_.field_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_.rule_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_.rule_id_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_.message_), - PROTOBUF_FIELD_OFFSET(::buf::validate::Violation, _impl_.for_key_), - 2, - 3, - 0, - 1, - 4, - 0x081, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPath, _impl_._has_bits_), - 4, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPath, _impl_.elements_), - 0, - 0x085, // bitmap - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_._oneof_case_[0]), - 15, // hasbit index offset - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.field_number_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.field_name_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.field_type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.key_type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.value_type_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_.subscript_), - 1, - 0, - 3, - 4, - 2, - ~0u, - ~0u, - ~0u, - ~0u, - ~0u, -}; - -static const ::_pbi::MigrationSchema - schemas[] ABSL_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, sizeof(::buf::validate::Rule)}, - {9, sizeof(::buf::validate::MessageRules)}, - {18, sizeof(::buf::validate::MessageOneofRule)}, - {25, sizeof(::buf::validate::OneofRules)}, - {30, sizeof(::buf::validate::FieldRules)}, - {87, sizeof(::buf::validate::PredefinedRules)}, - {92, sizeof(::buf::validate::FloatRules)}, - {117, sizeof(::buf::validate::DoubleRules)}, - {142, sizeof(::buf::validate::Int32Rules)}, - {165, sizeof(::buf::validate::Int64Rules)}, - {188, sizeof(::buf::validate::UInt32Rules)}, - {211, sizeof(::buf::validate::UInt64Rules)}, - {234, sizeof(::buf::validate::SInt32Rules)}, - {257, sizeof(::buf::validate::SInt64Rules)}, - {280, sizeof(::buf::validate::Fixed32Rules)}, - {303, sizeof(::buf::validate::Fixed64Rules)}, - {326, sizeof(::buf::validate::SFixed32Rules)}, - {349, sizeof(::buf::validate::SFixed64Rules)}, - {372, sizeof(::buf::validate::BoolRules)}, - {380, sizeof(::buf::validate::StringRules)}, - {460, sizeof(::buf::validate::BytesRules)}, - {496, sizeof(::buf::validate::EnumRules)}, - {510, sizeof(::buf::validate::RepeatedRules)}, - {522, sizeof(::buf::validate::MapRules)}, - {534, sizeof(::buf::validate::AnyRules)}, - {541, sizeof(::buf::validate::DurationRules)}, - {564, sizeof(::buf::validate::FieldMaskRules)}, - {576, sizeof(::buf::validate::TimestampRules)}, - {601, sizeof(::buf::validate::Violations)}, - {606, sizeof(::buf::validate::Violation)}, - {619, sizeof(::buf::validate::FieldPath)}, - {624, sizeof(::buf::validate::FieldPathElement)}, -}; -static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { - &::buf::validate::_Rule_default_instance_._instance, - &::buf::validate::_MessageRules_default_instance_._instance, - &::buf::validate::_MessageOneofRule_default_instance_._instance, - &::buf::validate::_OneofRules_default_instance_._instance, - &::buf::validate::_FieldRules_default_instance_._instance, - &::buf::validate::_PredefinedRules_default_instance_._instance, - &::buf::validate::_FloatRules_default_instance_._instance, - &::buf::validate::_DoubleRules_default_instance_._instance, - &::buf::validate::_Int32Rules_default_instance_._instance, - &::buf::validate::_Int64Rules_default_instance_._instance, - &::buf::validate::_UInt32Rules_default_instance_._instance, - &::buf::validate::_UInt64Rules_default_instance_._instance, - &::buf::validate::_SInt32Rules_default_instance_._instance, - &::buf::validate::_SInt64Rules_default_instance_._instance, - &::buf::validate::_Fixed32Rules_default_instance_._instance, - &::buf::validate::_Fixed64Rules_default_instance_._instance, - &::buf::validate::_SFixed32Rules_default_instance_._instance, - &::buf::validate::_SFixed64Rules_default_instance_._instance, - &::buf::validate::_BoolRules_default_instance_._instance, - &::buf::validate::_StringRules_default_instance_._instance, - &::buf::validate::_BytesRules_default_instance_._instance, - &::buf::validate::_EnumRules_default_instance_._instance, - &::buf::validate::_RepeatedRules_default_instance_._instance, - &::buf::validate::_MapRules_default_instance_._instance, - &::buf::validate::_AnyRules_default_instance_._instance, - &::buf::validate::_DurationRules_default_instance_._instance, - &::buf::validate::_FieldMaskRules_default_instance_._instance, - &::buf::validate::_TimestampRules_default_instance_._instance, - &::buf::validate::_Violations_default_instance_._instance, - &::buf::validate::_Violation_default_instance_._instance, - &::buf::validate::_FieldPath_default_instance_._instance, - &::buf::validate::_FieldPathElement_default_instance_._instance, -}; -const char descriptor_table_protodef_buf_2fvalidate_2fvalidate_2eproto[] ABSL_ATTRIBUTE_SECTION_VARIABLE( - protodesc_cold) = { - "\n\033buf/validate/validate.proto\022\014buf.valid" - "ate\032 google/protobuf/descriptor.proto\032\036g" - "oogle/protobuf/duration.proto\032 google/pr" - "otobuf/field_mask.proto\032\037google/protobuf" - "/timestamp.proto\"7\n\004Rule\022\n\n\002id\030\001 \001(\t\022\017\n\007" - "message\030\002 \001(\t\022\022\n\nexpression\030\003 \001(\t\"\206\001\n\014Me" - "ssageRules\022\026\n\016cel_expression\030\005 \003(\t\022\037\n\003ce" - "l\030\003 \003(\0132\022.buf.validate.Rule\022-\n\005oneof\030\004 \003" - "(\0132\036.buf.validate.MessageOneofRuleJ\004\010\001\020\002" - "R\010disabled\"4\n\020MessageOneofRule\022\016\n\006fields" - "\030\001 \003(\t\022\020\n\010required\030\002 \001(\010\"\036\n\nOneofRules\022\020" - "\n\010required\030\001 \001(\010\"\213\t\n\nFieldRules\022\026\n\016cel_e" - "xpression\030\035 \003(\t\022\037\n\003cel\030\027 \003(\0132\022.buf.valid" - "ate.Rule\022\020\n\010required\030\031 \001(\010\022$\n\006ignore\030\033 \001" - "(\0162\024.buf.validate.Ignore\022)\n\005float\030\001 \001(\0132" - "\030.buf.validate.FloatRulesH\000\022+\n\006double\030\002 " - "\001(\0132\031.buf.validate.DoubleRulesH\000\022)\n\005int3" - "2\030\003 \001(\0132\030.buf.validate.Int32RulesH\000\022)\n\005i" - "nt64\030\004 \001(\0132\030.buf.validate.Int64RulesH\000\022+" - "\n\006uint32\030\005 \001(\0132\031.buf.validate.UInt32Rule" - "sH\000\022+\n\006uint64\030\006 \001(\0132\031.buf.validate.UInt6" - "4RulesH\000\022+\n\006sint32\030\007 \001(\0132\031.buf.validate." - "SInt32RulesH\000\022+\n\006sint64\030\010 \001(\0132\031.buf.vali" - "date.SInt64RulesH\000\022-\n\007fixed32\030\t \001(\0132\032.bu" - "f.validate.Fixed32RulesH\000\022-\n\007fixed64\030\n \001" - "(\0132\032.buf.validate.Fixed64RulesH\000\022/\n\010sfix" - "ed32\030\013 \001(\0132\033.buf.validate.SFixed32RulesH" - "\000\022/\n\010sfixed64\030\014 \001(\0132\033.buf.validate.SFixe" - "d64RulesH\000\022\'\n\004bool\030\r \001(\0132\027.buf.validate." - "BoolRulesH\000\022+\n\006string\030\016 \001(\0132\031.buf.valida" - "te.StringRulesH\000\022)\n\005bytes\030\017 \001(\0132\030.buf.va" - "lidate.BytesRulesH\000\022\'\n\004enum\030\020 \001(\0132\027.buf." - "validate.EnumRulesH\000\022/\n\010repeated\030\022 \001(\0132\033" - ".buf.validate.RepeatedRulesH\000\022%\n\003map\030\023 \001" - "(\0132\026.buf.validate.MapRulesH\000\022%\n\003any\030\024 \001(" - "\0132\026.buf.validate.AnyRulesH\000\022/\n\010duration\030" - "\025 \001(\0132\033.buf.validate.DurationRulesH\000\0222\n\n" - "field_mask\030\034 \001(\0132\034.buf.validate.FieldMas" - "kRulesH\000\0221\n\ttimestamp\030\026 \001(\0132\034.buf.valida" - "te.TimestampRulesH\000B\006\n\004typeJ\004\010\030\020\031J\004\010\032\020\033R" - "\007skippedR\014ignore_empty\"U\n\017PredefinedRule" - "s\022\037\n\003cel\030\001 \003(\0132\022.buf.validate.RuleJ\004\010\030\020\031" - "J\004\010\032\020\033R\007skippedR\014ignore_empty\"\370\026\n\nFloatR" - "ules\022}\n\005const\030\001 \001(\002Bn\302Hk\ni\n\013float.const\032" - "Zthis != getField(rules, \'const\') \? \'mus" - "t equal %s\'.format([getField(rules, \'con" - "st\')]) : \'\'\022\231\001\n\002lt\030\002 \001(\002B\212\001\302H\206\001\n\203\001\n\010floa" - "t.lt\032w!has(rules.gte) && !has(rules.gt) " - "&& (this.isNan() || this >= rules.lt)\? \'" - "must be less than %s\'.format([rules.lt])" - " : \'\'H\000\022\251\001\n\003lte\030\003 \001(\002B\231\001\302H\225\001\n\222\001\n\tfloat.l" - "te\032\204\001!has(rules.gte) && !has(rules.gt) &" - "& (this.isNan() || this > rules.lte)\? \'m" - "ust be less than or equal to %s\'.format(" - "[rules.lte]) : \'\'H\000\022\320\007\n\002gt\030\004 \001(\002B\301\007\302H\275\007\n" - "\206\001\n\010float.gt\032z!has(rules.lt) && !has(rul" - "es.lte) && (this.isNan() || this <= rule" - "s.gt)\? \'must be greater than %s\'.format(" - "[rules.gt]) : \'\'\n\275\001\n\013float.gt_lt\032\255\001has(r" - "ules.lt) && rules.lt >= rules.gt && (thi" - "s.isNan() || this >= rules.lt || this <=" - " rules.gt)\? \'must be greater than %s and" - " less than %s\'.format([rules.gt, rules.l" - "t]) : \'\'\n\307\001\n\025float.gt_lt_exclusive\032\255\001has" - "(rules.lt) && rules.lt < rules.gt && (th" - "is.isNan() || (rules.lt <= this && this " - "<= rules.gt))\? \'must be greater than %s " - "or less than %s\'.format([rules.gt, rules" - ".lt]) : \'\'\n\315\001\n\014float.gt_lte\032\274\001has(rules." - "lte) && rules.lte >= rules.gt && (this.i" - "sNan() || this > rules.lte || this <= ru" - "les.gt)\? \'must be greater than %s and le" - "ss than or equal to %s\'.format([rules.gt" - ", rules.lte]) : \'\'\n\327\001\n\026float.gt_lte_excl" - "usive\032\274\001has(rules.lte) && rules.lte < ru" - "les.gt && (this.isNan() || (rules.lte < " - "this && this <= rules.gt))\? \'must be gre" - "ater than %s or less than or equal to %s" - "\'.format([rules.gt, rules.lte]) : \'\'H\001\022\234" - "\010\n\003gte\030\005 \001(\002B\214\010\302H\210\010\n\225\001\n\tfloat.gte\032\207\001!has" - "(rules.lt) && !has(rules.lte) && (this.i" - "sNan() || this < rules.gte)\? \'must be gr" - "eater than or equal to %s\'.format([rules" - ".gte]) : \'\'\n\314\001\n\014float.gte_lt\032\273\001has(rules" - ".lt) && rules.lt >= rules.gte && (this.i" - "sNan() || this >= rules.lt || this < rul" - "es.gte)\? \'must be greater than or equal " - "to %s and less than %s\'.format([rules.gt" - "e, rules.lt]) : \'\'\n\326\001\n\026float.gte_lt_excl" - "usive\032\273\001has(rules.lt) && rules.lt < rule" - "s.gte && (this.isNan() || (rules.lt <= t" - "his && this < rules.gte))\? \'must be grea" - "ter than or equal to %s or less than %s\'" - ".format([rules.gte, rules.lt]) : \'\'\n\334\001\n\r" - "float.gte_lte\032\312\001has(rules.lte) && rules." - "lte >= rules.gte && (this.isNan() || thi" - "s > rules.lte || this < rules.gte)\? \'mus" - "t be greater than or equal to %s and les" - "s than or equal to %s\'.format([rules.gte" - ", rules.lte]) : \'\'\n\346\001\n\027float.gte_lte_exc" - "lusive\032\312\001has(rules.lte) && rules.lte < r" - "ules.gte && (this.isNan() || (rules.lte " - "< this && this < rules.gte))\? \'must be g" - "reater than or equal to %s or less than " - "or equal to %s\'.format([rules.gte, rules" - ".lte]) : \'\'H\001\022y\n\002in\030\006 \003(\002Bm\302Hj\nh\n\010float." - "in\032\\!(this in getField(rules, \'in\')) \? \'" - "must be in list %s\'.format([getField(rul" - "es, \'in\')]) : \'\'\022p\n\006not_in\030\007 \003(\002B`\302H]\n[\n" - "\014float.not_in\032Kthis in rules.not_in \? \'m" - "ust not be in list %s\'.format([rules.not" - "_in]) : \'\'\022o\n\006finite\030\010 \001(\010B_\302H\\\nZ\n\014float" - ".finite\032Jrules.finite \? (this.isNan() ||" - " this.isInf() \? \'must be finite\' : \'\') :" - " \'\'\022+\n\007example\030\t \003(\002B\032\302H\027\n\025\n\rfloat.examp" - "le\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014grea" - "ter_than\"\212\027\n\013DoubleRules\022~\n\005const\030\001 \001(\001B" - "o\302Hl\nj\n\014double.const\032Zthis != getField(r" - "ules, \'const\') \? \'must equal %s\'.format(" - "[getField(rules, \'const\')]) : \'\'\022\232\001\n\002lt\030" - "\002 \001(\001B\213\001\302H\207\001\n\204\001\n\tdouble.lt\032w!has(rules.g" - "te) && !has(rules.gt) && (this.isNan() |" - "| this >= rules.lt)\? \'must be less than " - "%s\'.format([rules.lt]) : \'\'H\000\022\252\001\n\003lte\030\003 " - "\001(\001B\232\001\302H\226\001\n\223\001\n\ndouble.lte\032\204\001!has(rules.g" - "te) && !has(rules.gt) && (this.isNan() |" - "| this > rules.lte)\? \'must be less than " - "or equal to %s\'.format([rules.lte]) : \'\'" - "H\000\022\325\007\n\002gt\030\004 \001(\001B\306\007\302H\302\007\n\207\001\n\tdouble.gt\032z!h" - "as(rules.lt) && !has(rules.lte) && (this" - ".isNan() || this <= rules.gt)\? \'must be " - "greater than %s\'.format([rules.gt]) : \'\'" - "\n\276\001\n\014double.gt_lt\032\255\001has(rules.lt) && rul" - "es.lt >= rules.gt && (this.isNan() || th" - "is >= rules.lt || this <= rules.gt)\? \'mu" - "st be greater than %s and less than %s\'." - "format([rules.gt, rules.lt]) : \'\'\n\310\001\n\026do" - "uble.gt_lt_exclusive\032\255\001has(rules.lt) && " - "rules.lt < rules.gt && (this.isNan() || " - "(rules.lt <= this && this <= rules.gt))\?" - " \'must be greater than %s or less than %" - "s\'.format([rules.gt, rules.lt]) : \'\'\n\316\001\n" - "\rdouble.gt_lte\032\274\001has(rules.lte) && rules" - ".lte >= rules.gt && (this.isNan() || thi" - "s > rules.lte || this <= rules.gt)\? \'mus" - "t be greater than %s and less than or eq" - "ual to %s\'.format([rules.gt, rules.lte])" - " : \'\'\n\330\001\n\027double.gt_lte_exclusive\032\274\001has(" - "rules.lte) && rules.lte < rules.gt && (t" - "his.isNan() || (rules.lte < this && this" - " <= rules.gt))\? \'must be greater than %s" - " or less than or equal to %s\'.format([ru" - "les.gt, rules.lte]) : \'\'H\001\022\241\010\n\003gte\030\005 \001(\001" - "B\221\010\302H\215\010\n\226\001\n\ndouble.gte\032\207\001!has(rules.lt) " - "&& !has(rules.lte) && (this.isNan() || t" - "his < rules.gte)\? \'must be greater than " - "or equal to %s\'.format([rules.gte]) : \'\'" - "\n\315\001\n\rdouble.gte_lt\032\273\001has(rules.lt) && ru" - "les.lt >= rules.gte && (this.isNan() || " - "this >= rules.lt || this < rules.gte)\? \'" - "must be greater than or equal to %s and " - "less than %s\'.format([rules.gte, rules.l" - "t]) : \'\'\n\327\001\n\027double.gte_lt_exclusive\032\273\001h" - "as(rules.lt) && rules.lt < rules.gte && " - "(this.isNan() || (rules.lt <= this && th" - "is < rules.gte))\? \'must be greater than " - "or equal to %s or less than %s\'.format([" - "rules.gte, rules.lt]) : \'\'\n\335\001\n\016double.gt" - "e_lte\032\312\001has(rules.lte) && rules.lte >= r" - "ules.gte && (this.isNan() || this > rule" - "s.lte || this < rules.gte)\? \'must be gre" - "ater than or equal to %s and less than o" - "r equal to %s\'.format([rules.gte, rules." - "lte]) : \'\'\n\347\001\n\030double.gte_lte_exclusive\032" - "\312\001has(rules.lte) && rules.lte < rules.gt" - "e && (this.isNan() || (rules.lte < this " - "&& this < rules.gte))\? \'must be greater " - "than or equal to %s or less than or equa" - "l to %s\'.format([rules.gte, rules.lte]) " - ": \'\'H\001\022z\n\002in\030\006 \003(\001Bn\302Hk\ni\n\tdouble.in\032\\!(" - "this in getField(rules, \'in\')) \? \'must b" - "e in list %s\'.format([getField(rules, \'i" - "n\')]) : \'\'\022q\n\006not_in\030\007 \003(\001Ba\302H^\n\\\n\rdoubl" - "e.not_in\032Kthis in rules.not_in \? \'must n" - "ot be in list %s\'.format([rules.not_in])" - " : \'\'\022p\n\006finite\030\010 \001(\010B`\302H]\n[\n\rdouble.fin" - "ite\032Jrules.finite \? (this.isNan() || thi" - "s.isInf() \? \'must be finite\' : \'\') : \'\'\022" - ",\n\007example\030\t \003(\001B\033\302H\030\n\026\n\016double.example\032" - "\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014greater" - "_than\"\260\024\n\nInt32Rules\022}\n\005const\030\001 \001(\005Bn\302Hk" - "\ni\n\013int32.const\032Zthis != getField(rules," - " \'const\') \? \'must equal %s\'.format([getF" - "ield(rules, \'const\')]) : \'\'\022\204\001\n\002lt\030\002 \001(\005" - "Bv\302Hs\nq\n\010int32.lt\032e!has(rules.gte) && !h" - "as(rules.gt) && this >= rules.lt\? \'must " - "be less than %s\'.format([rules.lt]) : \'\'" - "H\000\022\225\001\n\003lte\030\003 \001(\005B\205\001\302H\201\001\n\177\n\tint32.lte\032r!h" - "as(rules.gte) && !has(rules.gt) && this " - "> rules.lte\? \'must be less than or equal" - " to %s\'.format([rules.lte]) : \'\'H\000\022\371\006\n\002g" - "t\030\004 \001(\005B\352\006\302H\346\006\nt\n\010int32.gt\032h!has(rules.l" - "t) && !has(rules.lte) && this <= rules.g" - "t\? \'must be greater than %s\'.format([rul" - "es.gt]) : \'\'\n\255\001\n\013int32.gt_lt\032\235\001has(rules" - ".lt) && rules.lt >= rules.gt && (this >=" - " rules.lt || this <= rules.gt)\? \'must be" - " greater than %s and less than %s\'.forma" - "t([rules.gt, rules.lt]) : \'\'\n\265\001\n\025int32.g" - "t_lt_exclusive\032\233\001has(rules.lt) && rules." - "lt < rules.gt && (rules.lt <= this && th" - "is <= rules.gt)\? \'must be greater than %" - "s or less than %s\'.format([rules.gt, rul" - "es.lt]) : \'\'\n\275\001\n\014int32.gt_lte\032\254\001has(rule" - "s.lte) && rules.lte >= rules.gt && (this" - " > rules.lte || this <= rules.gt)\? \'must" - " be greater than %s and less than or equ" - "al to %s\'.format([rules.gt, rules.lte]) " - ": \'\'\n\305\001\n\026int32.gt_lte_exclusive\032\252\001has(ru" - "les.lte) && rules.lte < rules.gt && (rul" - "es.lte < this && this <= rules.gt)\? \'mus" - "t be greater than %s or less than or equ" - "al to %s\'.format([rules.gt, rules.lte]) " - ": \'\'H\001\022\305\007\n\003gte\030\005 \001(\005B\265\007\302H\261\007\n\202\001\n\tint32.gt" - "e\032u!has(rules.lt) && !has(rules.lte) && " - "this < rules.gte\? \'must be greater than " - "or equal to %s\'.format([rules.gte]) : \'\'" - "\n\274\001\n\014int32.gte_lt\032\253\001has(rules.lt) && rul" - "es.lt >= rules.gte && (this >= rules.lt " - "|| this < rules.gte)\? \'must be greater t" - "han or equal to %s and less than %s\'.for" - "mat([rules.gte, rules.lt]) : \'\'\n\304\001\n\026int3" - "2.gte_lt_exclusive\032\251\001has(rules.lt) && ru" - "les.lt < rules.gte && (rules.lt <= this " - "&& this < rules.gte)\? \'must be greater t" - "han or equal to %s or less than %s\'.form" - "at([rules.gte, rules.lt]) : \'\'\n\314\001\n\rint32" - ".gte_lte\032\272\001has(rules.lte) && rules.lte >" - "= rules.gte && (this > rules.lte || this" - " < rules.gte)\? \'must be greater than or " - "equal to %s and less than or equal to %s" - "\'.format([rules.gte, rules.lte]) : \'\'\n\324\001" - "\n\027int32.gte_lte_exclusive\032\270\001has(rules.lt" - "e) && rules.lte < rules.gte && (rules.lt" - "e < this && this < rules.gte)\? \'must be " - "greater than or equal to %s or less than" - " or equal to %s\'.format([rules.gte, rule" - "s.lte]) : \'\'H\001\022y\n\002in\030\006 \003(\005Bm\302Hj\nh\n\010int32" - ".in\032\\!(this in getField(rules, \'in\')) \? " - "\'must be in list %s\'.format([getField(ru" - "les, \'in\')]) : \'\'\022p\n\006not_in\030\007 \003(\005B`\302H]\n[" - "\n\014int32.not_in\032Kthis in rules.not_in \? \'" - "must not be in list %s\'.format([rules.no" - "t_in]) : \'\'\022+\n\007example\030\010 \003(\005B\032\302H\027\n\025\n\rint" - "32.example\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_than" - "B\016\n\014greater_than\"\260\024\n\nInt64Rules\022}\n\005const" - "\030\001 \001(\003Bn\302Hk\ni\n\013int64.const\032Zthis != getF" - "ield(rules, \'const\') \? \'must equal %s\'.f" - "ormat([getField(rules, \'const\')]) : \'\'\022\204" - "\001\n\002lt\030\002 \001(\003Bv\302Hs\nq\n\010int64.lt\032e!has(rules" - ".gte) && !has(rules.gt) && this >= rules" - ".lt\? \'must be less than %s\'.format([rule" - "s.lt]) : \'\'H\000\022\225\001\n\003lte\030\003 \001(\003B\205\001\302H\201\001\n\177\n\tin" - "t64.lte\032r!has(rules.gte) && !has(rules.g" - "t) && this > rules.lte\? \'must be less th" - "an or equal to %s\'.format([rules.lte]) :" - " \'\'H\000\022\371\006\n\002gt\030\004 \001(\003B\352\006\302H\346\006\nt\n\010int64.gt\032h!" - "has(rules.lt) && !has(rules.lte) && this" - " <= rules.gt\? \'must be greater than %s\'." - "format([rules.gt]) : \'\'\n\255\001\n\013int64.gt_lt\032" - "\235\001has(rules.lt) && rules.lt >= rules.gt " - "&& (this >= rules.lt || this <= rules.gt" - ")\? \'must be greater than %s and less tha" - "n %s\'.format([rules.gt, rules.lt]) : \'\'\n" - "\265\001\n\025int64.gt_lt_exclusive\032\233\001has(rules.lt" - ") && rules.lt < rules.gt && (rules.lt <=" - " this && this <= rules.gt)\? \'must be gre" - "ater than %s or less than %s\'.format([ru" - "les.gt, rules.lt]) : \'\'\n\275\001\n\014int64.gt_lte" - "\032\254\001has(rules.lte) && rules.lte >= rules." - "gt && (this > rules.lte || this <= rules" - ".gt)\? \'must be greater than %s and less " - "than or equal to %s\'.format([rules.gt, r" - "ules.lte]) : \'\'\n\305\001\n\026int64.gt_lte_exclusi" - "ve\032\252\001has(rules.lte) && rules.lte < rules" - ".gt && (rules.lte < this && this <= rule" - "s.gt)\? \'must be greater than %s or less " - "than or equal to %s\'.format([rules.gt, r" - "ules.lte]) : \'\'H\001\022\305\007\n\003gte\030\005 \001(\003B\265\007\302H\261\007\n\202" - "\001\n\tint64.gte\032u!has(rules.lt) && !has(rul" - "es.lte) && this < rules.gte\? \'must be gr" - "eater than or equal to %s\'.format([rules" - ".gte]) : \'\'\n\274\001\n\014int64.gte_lt\032\253\001has(rules" - ".lt) && rules.lt >= rules.gte && (this >" - "= rules.lt || this < rules.gte)\? \'must b" - "e greater than or equal to %s and less t" - "han %s\'.format([rules.gte, rules.lt]) : " - "\'\'\n\304\001\n\026int64.gte_lt_exclusive\032\251\001has(rule" - "s.lt) && rules.lt < rules.gte && (rules." - "lt <= this && this < rules.gte)\? \'must b" - "e greater than or equal to %s or less th" - "an %s\'.format([rules.gte, rules.lt]) : \'" - "\'\n\314\001\n\rint64.gte_lte\032\272\001has(rules.lte) && " - "rules.lte >= rules.gte && (this > rules." - "lte || this < rules.gte)\? \'must be great" - "er than or equal to %s and less than or " - "equal to %s\'.format([rules.gte, rules.lt" - "e]) : \'\'\n\324\001\n\027int64.gte_lte_exclusive\032\270\001h" - "as(rules.lte) && rules.lte < rules.gte &" - "& (rules.lte < this && this < rules.gte)" - "\? \'must be greater than or equal to %s o" - "r less than or equal to %s\'.format([rule" - "s.gte, rules.lte]) : \'\'H\001\022y\n\002in\030\006 \003(\003Bm\302" - "Hj\nh\n\010int64.in\032\\!(this in getField(rules" - ", \'in\')) \? \'must be in list %s\'.format([" - "getField(rules, \'in\')]) : \'\'\022p\n\006not_in\030\007" - " \003(\003B`\302H]\n[\n\014int64.not_in\032Kthis in rules" - ".not_in \? \'must not be in list %s\'.forma" - "t([rules.not_in]) : \'\'\022+\n\007example\030\t \003(\003B" - "\032\302H\027\n\025\n\rint64.example\032\004true*\t\010\350\007\020\200\200\200\200\002B\013" - "\n\tless_thanB\016\n\014greater_than\"\302\024\n\013UInt32Ru" - "les\022~\n\005const\030\001 \001(\rBo\302Hl\nj\n\014uint32.const\032" - "Zthis != getField(rules, \'const\') \? \'mus" - "t equal %s\'.format([getField(rules, \'con" - "st\')]) : \'\'\022\205\001\n\002lt\030\002 \001(\rBw\302Ht\nr\n\tuint32." - "lt\032e!has(rules.gte) && !has(rules.gt) &&" - " this >= rules.lt\? \'must be less than %s" - "\'.format([rules.lt]) : \'\'H\000\022\227\001\n\003lte\030\003 \001(" - "\rB\207\001\302H\203\001\n\200\001\n\nuint32.lte\032r!has(rules.gte)" - " && !has(rules.gt) && this > rules.lte\? " - "\'must be less than or equal to %s\'.forma" - "t([rules.lte]) : \'\'H\000\022\376\006\n\002gt\030\004 \001(\rB\357\006\302H\353" - "\006\nu\n\tuint32.gt\032h!has(rules.lt) && !has(r" - "ules.lte) && this <= rules.gt\? \'must be " - "greater than %s\'.format([rules.gt]) : \'\'" - "\n\256\001\n\014uint32.gt_lt\032\235\001has(rules.lt) && rul" - "es.lt >= rules.gt && (this >= rules.lt |" - "| this <= rules.gt)\? \'must be greater th" - "an %s and less than %s\'.format([rules.gt" - ", rules.lt]) : \'\'\n\266\001\n\026uint32.gt_lt_exclu" - "sive\032\233\001has(rules.lt) && rules.lt < rules" - ".gt && (rules.lt <= this && this <= rule" - "s.gt)\? \'must be greater than %s or less " - "than %s\'.format([rules.gt, rules.lt]) : " - "\'\'\n\276\001\n\ruint32.gt_lte\032\254\001has(rules.lte) &&" - " rules.lte >= rules.gt && (this > rules." - "lte || this <= rules.gt)\? \'must be great" - "er than %s and less than or equal to %s\'" - ".format([rules.gt, rules.lte]) : \'\'\n\306\001\n\027" - "uint32.gt_lte_exclusive\032\252\001has(rules.lte)" - " && rules.lte < rules.gt && (rules.lte <" - " this && this <= rules.gt)\? \'must be gre" - "ater than %s or less than or equal to %s" - "\'.format([rules.gt, rules.lte]) : \'\'H\001\022\312" - "\007\n\003gte\030\005 \001(\rB\272\007\302H\266\007\n\203\001\n\nuint32.gte\032u!has" - "(rules.lt) && !has(rules.lte) && this < " - "rules.gte\? \'must be greater than or equa" - "l to %s\'.format([rules.gte]) : \'\'\n\275\001\n\rui" - "nt32.gte_lt\032\253\001has(rules.lt) && rules.lt " - ">= rules.gte && (this >= rules.lt || thi" - "s < rules.gte)\? \'must be greater than or" - " equal to %s and less than %s\'.format([r" - "ules.gte, rules.lt]) : \'\'\n\305\001\n\027uint32.gte" - "_lt_exclusive\032\251\001has(rules.lt) && rules.l" - "t < rules.gte && (rules.lt <= this && th" - "is < rules.gte)\? \'must be greater than o" - "r equal to %s or less than %s\'.format([r" - "ules.gte, rules.lt]) : \'\'\n\315\001\n\016uint32.gte" - "_lte\032\272\001has(rules.lte) && rules.lte >= ru" - "les.gte && (this > rules.lte || this < r" - "ules.gte)\? \'must be greater than or equa" - "l to %s and less than or equal to %s\'.fo" - "rmat([rules.gte, rules.lte]) : \'\'\n\325\001\n\030ui" - "nt32.gte_lte_exclusive\032\270\001has(rules.lte) " - "&& rules.lte < rules.gte && (rules.lte <" - " this && this < rules.gte)\? \'must be gre" - "ater than or equal to %s or less than or" - " equal to %s\'.format([rules.gte, rules.l" - "te]) : \'\'H\001\022z\n\002in\030\006 \003(\rBn\302Hk\ni\n\tuint32.i" - "n\032\\!(this in getField(rules, \'in\')) \? \'m" - "ust be in list %s\'.format([getField(rule" - "s, \'in\')]) : \'\'\022q\n\006not_in\030\007 \003(\rBa\302H^\n\\\n\r" - "uint32.not_in\032Kthis in rules.not_in \? \'m" - "ust not be in list %s\'.format([rules.not" - "_in]) : \'\'\022,\n\007example\030\010 \003(\rB\033\302H\030\n\026\n\016uint" - "32.example\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_than" - "B\016\n\014greater_than\"\302\024\n\013UInt64Rules\022~\n\005cons" - "t\030\001 \001(\004Bo\302Hl\nj\n\014uint64.const\032Zthis != ge" - "tField(rules, \'const\') \? \'must equal %s\'" - ".format([getField(rules, \'const\')]) : \'\'" - "\022\205\001\n\002lt\030\002 \001(\004Bw\302Ht\nr\n\tuint64.lt\032e!has(ru" - "les.gte) && !has(rules.gt) && this >= ru" - "les.lt\? \'must be less than %s\'.format([r" - "ules.lt]) : \'\'H\000\022\227\001\n\003lte\030\003 \001(\004B\207\001\302H\203\001\n\200\001" - "\n\nuint64.lte\032r!has(rules.gte) && !has(ru" - "les.gt) && this > rules.lte\? \'must be le" - "ss than or equal to %s\'.format([rules.lt" - "e]) : \'\'H\000\022\376\006\n\002gt\030\004 \001(\004B\357\006\302H\353\006\nu\n\tuint64" - ".gt\032h!has(rules.lt) && !has(rules.lte) &" - "& this <= rules.gt\? \'must be greater tha" - "n %s\'.format([rules.gt]) : \'\'\n\256\001\n\014uint64" - ".gt_lt\032\235\001has(rules.lt) && rules.lt >= ru" - "les.gt && (this >= rules.lt || this <= r" - "ules.gt)\? \'must be greater than %s and l" - "ess than %s\'.format([rules.gt, rules.lt]" - ") : \'\'\n\266\001\n\026uint64.gt_lt_exclusive\032\233\001has(" - "rules.lt) && rules.lt < rules.gt && (rul" - "es.lt <= this && this <= rules.gt)\? \'mus" - "t be greater than %s or less than %s\'.fo" - "rmat([rules.gt, rules.lt]) : \'\'\n\276\001\n\ruint" - "64.gt_lte\032\254\001has(rules.lte) && rules.lte " - ">= rules.gt && (this > rules.lte || this" - " <= rules.gt)\? \'must be greater than %s " - "and less than or equal to %s\'.format([ru" - "les.gt, rules.lte]) : \'\'\n\306\001\n\027uint64.gt_l" - "te_exclusive\032\252\001has(rules.lte) && rules.l" - "te < rules.gt && (rules.lte < this && th" - "is <= rules.gt)\? \'must be greater than %" - "s or less than or equal to %s\'.format([r" - "ules.gt, rules.lte]) : \'\'H\001\022\312\007\n\003gte\030\005 \001(" - "\004B\272\007\302H\266\007\n\203\001\n\nuint64.gte\032u!has(rules.lt) " - "&& !has(rules.lte) && this < rules.gte\? " - "\'must be greater than or equal to %s\'.fo" - "rmat([rules.gte]) : \'\'\n\275\001\n\ruint64.gte_lt" - "\032\253\001has(rules.lt) && rules.lt >= rules.gt" - "e && (this >= rules.lt || this < rules.g" - "te)\? \'must be greater than or equal to %" - "s and less than %s\'.format([rules.gte, r" - "ules.lt]) : \'\'\n\305\001\n\027uint64.gte_lt_exclusi" - "ve\032\251\001has(rules.lt) && rules.lt < rules.g" - "te && (rules.lt <= this && this < rules." - "gte)\? \'must be greater than or equal to " - "%s or less than %s\'.format([rules.gte, r" - "ules.lt]) : \'\'\n\315\001\n\016uint64.gte_lte\032\272\001has(" - "rules.lte) && rules.lte >= rules.gte && " - "(this > rules.lte || this < rules.gte)\? " - "\'must be greater than or equal to %s and" - " less than or equal to %s\'.format([rules" - ".gte, rules.lte]) : \'\'\n\325\001\n\030uint64.gte_lt" - "e_exclusive\032\270\001has(rules.lte) && rules.lt" - "e < rules.gte && (rules.lte < this && th" - "is < rules.gte)\? \'must be greater than o" - "r equal to %s or less than or equal to %" - "s\'.format([rules.gte, rules.lte]) : \'\'H\001" - "\022z\n\002in\030\006 \003(\004Bn\302Hk\ni\n\tuint64.in\032\\!(this i" - "n getField(rules, \'in\')) \? \'must be in l" - "ist %s\'.format([getField(rules, \'in\')]) " - ": \'\'\022q\n\006not_in\030\007 \003(\004Ba\302H^\n\\\n\ruint64.not_" - "in\032Kthis in rules.not_in \? \'must not be " - "in list %s\'.format([rules.not_in]) : \'\'\022" - ",\n\007example\030\010 \003(\004B\033\302H\030\n\026\n\016uint64.example\032" - "\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014greater" - "_than\"\302\024\n\013SInt32Rules\022~\n\005const\030\001 \001(\021Bo\302H" - "l\nj\n\014sint32.const\032Zthis != getField(rule" - "s, \'const\') \? \'must equal %s\'.format([ge" - "tField(rules, \'const\')]) : \'\'\022\205\001\n\002lt\030\002 \001" - "(\021Bw\302Ht\nr\n\tsint32.lt\032e!has(rules.gte) &&" - " !has(rules.gt) && this >= rules.lt\? \'mu" - "st be less than %s\'.format([rules.lt]) :" - " \'\'H\000\022\227\001\n\003lte\030\003 \001(\021B\207\001\302H\203\001\n\200\001\n\nsint32.lt" - "e\032r!has(rules.gte) && !has(rules.gt) && " - "this > rules.lte\? \'must be less than or " - "equal to %s\'.format([rules.lte]) : \'\'H\000\022" - "\376\006\n\002gt\030\004 \001(\021B\357\006\302H\353\006\nu\n\tsint32.gt\032h!has(r" - "ules.lt) && !has(rules.lte) && this <= r" - "ules.gt\? \'must be greater than %s\'.forma" - "t([rules.gt]) : \'\'\n\256\001\n\014sint32.gt_lt\032\235\001ha" - "s(rules.lt) && rules.lt >= rules.gt && (" - "this >= rules.lt || this <= rules.gt)\? \'" - "must be greater than %s and less than %s" - "\'.format([rules.gt, rules.lt]) : \'\'\n\266\001\n\026" - "sint32.gt_lt_exclusive\032\233\001has(rules.lt) &" - "& rules.lt < rules.gt && (rules.lt <= th" - "is && this <= rules.gt)\? \'must be greate" - "r than %s or less than %s\'.format([rules" - ".gt, rules.lt]) : \'\'\n\276\001\n\rsint32.gt_lte\032\254" - "\001has(rules.lte) && rules.lte >= rules.gt" - " && (this > rules.lte || this <= rules.g" - "t)\? \'must be greater than %s and less th" - "an or equal to %s\'.format([rules.gt, rul" - "es.lte]) : \'\'\n\306\001\n\027sint32.gt_lte_exclusiv" - "e\032\252\001has(rules.lte) && rules.lte < rules." - "gt && (rules.lte < this && this <= rules" - ".gt)\? \'must be greater than %s or less t" - "han or equal to %s\'.format([rules.gt, ru" - "les.lte]) : \'\'H\001\022\312\007\n\003gte\030\005 \001(\021B\272\007\302H\266\007\n\203\001" - "\n\nsint32.gte\032u!has(rules.lt) && !has(rul" - "es.lte) && this < rules.gte\? \'must be gr" - "eater than or equal to %s\'.format([rules" - ".gte]) : \'\'\n\275\001\n\rsint32.gte_lt\032\253\001has(rule" - "s.lt) && rules.lt >= rules.gte && (this " - ">= rules.lt || this < rules.gte)\? \'must " - "be greater than or equal to %s and less " - "than %s\'.format([rules.gte, rules.lt]) :" - " \'\'\n\305\001\n\027sint32.gte_lt_exclusive\032\251\001has(ru" - "les.lt) && rules.lt < rules.gte && (rule" - "s.lt <= this && this < rules.gte)\? \'must" - " be greater than or equal to %s or less " - "than %s\'.format([rules.gte, rules.lt]) :" - " \'\'\n\315\001\n\016sint32.gte_lte\032\272\001has(rules.lte) " - "&& rules.lte >= rules.gte && (this > rul" - "es.lte || this < rules.gte)\? \'must be gr" - "eater than or equal to %s and less than " - "or equal to %s\'.format([rules.gte, rules" - ".lte]) : \'\'\n\325\001\n\030sint32.gte_lte_exclusive" - "\032\270\001has(rules.lte) && rules.lte < rules.g" - "te && (rules.lte < this && this < rules." - "gte)\? \'must be greater than or equal to " - "%s or less than or equal to %s\'.format([" - "rules.gte, rules.lte]) : \'\'H\001\022z\n\002in\030\006 \003(" - "\021Bn\302Hk\ni\n\tsint32.in\032\\!(this in getField(" - "rules, \'in\')) \? \'must be in list %s\'.for" - "mat([getField(rules, \'in\')]) : \'\'\022q\n\006not" - "_in\030\007 \003(\021Ba\302H^\n\\\n\rsint32.not_in\032Kthis in" - " rules.not_in \? \'must not be in list %s\'" - ".format([rules.not_in]) : \'\'\022,\n\007example\030" - "\010 \003(\021B\033\302H\030\n\026\n\016sint32.example\032\004true*\t\010\350\007\020" - "\200\200\200\200\002B\013\n\tless_thanB\016\n\014greater_than\"\302\024\n\013S" - "Int64Rules\022~\n\005const\030\001 \001(\022Bo\302Hl\nj\n\014sint64" - ".const\032Zthis != getField(rules, \'const\')" - " \? \'must equal %s\'.format([getField(rule" - "s, \'const\')]) : \'\'\022\205\001\n\002lt\030\002 \001(\022Bw\302Ht\nr\n\t" - "sint64.lt\032e!has(rules.gte) && !has(rules" - ".gt) && this >= rules.lt\? \'must be less " - "than %s\'.format([rules.lt]) : \'\'H\000\022\227\001\n\003l" - "te\030\003 \001(\022B\207\001\302H\203\001\n\200\001\n\nsint64.lte\032r!has(rul" - "es.gte) && !has(rules.gt) && this > rule" - "s.lte\? \'must be less than or equal to %s" - "\'.format([rules.lte]) : \'\'H\000\022\376\006\n\002gt\030\004 \001(" - "\022B\357\006\302H\353\006\nu\n\tsint64.gt\032h!has(rules.lt) &&" - " !has(rules.lte) && this <= rules.gt\? \'m" - "ust be greater than %s\'.format([rules.gt" - "]) : \'\'\n\256\001\n\014sint64.gt_lt\032\235\001has(rules.lt)" - " && rules.lt >= rules.gt && (this >= rul" - "es.lt || this <= rules.gt)\? \'must be gre" - "ater than %s and less than %s\'.format([r" - "ules.gt, rules.lt]) : \'\'\n\266\001\n\026sint64.gt_l" - "t_exclusive\032\233\001has(rules.lt) && rules.lt " - "< rules.gt && (rules.lt <= this && this " - "<= rules.gt)\? \'must be greater than %s o" - "r less than %s\'.format([rules.gt, rules." - "lt]) : \'\'\n\276\001\n\rsint64.gt_lte\032\254\001has(rules." - "lte) && rules.lte >= rules.gt && (this >" - " rules.lte || this <= rules.gt)\? \'must b" - "e greater than %s and less than or equal" - " to %s\'.format([rules.gt, rules.lte]) : " - "\'\'\n\306\001\n\027sint64.gt_lte_exclusive\032\252\001has(rul" - "es.lte) && rules.lte < rules.gt && (rule" - "s.lte < this && this <= rules.gt)\? \'must" - " be greater than %s or less than or equa" - "l to %s\'.format([rules.gt, rules.lte]) :" - " \'\'H\001\022\312\007\n\003gte\030\005 \001(\022B\272\007\302H\266\007\n\203\001\n\nsint64.gt" - "e\032u!has(rules.lt) && !has(rules.lte) && " - "this < rules.gte\? \'must be greater than " - "or equal to %s\'.format([rules.gte]) : \'\'" - "\n\275\001\n\rsint64.gte_lt\032\253\001has(rules.lt) && ru" - "les.lt >= rules.gte && (this >= rules.lt" - " || this < rules.gte)\? \'must be greater " - "than or equal to %s and less than %s\'.fo" - "rmat([rules.gte, rules.lt]) : \'\'\n\305\001\n\027sin" - "t64.gte_lt_exclusive\032\251\001has(rules.lt) && " - "rules.lt < rules.gte && (rules.lt <= thi" - "s && this < rules.gte)\? \'must be greater" - " than or equal to %s or less than %s\'.fo" - "rmat([rules.gte, rules.lt]) : \'\'\n\315\001\n\016sin" - "t64.gte_lte\032\272\001has(rules.lte) && rules.lt" - "e >= rules.gte && (this > rules.lte || t" - "his < rules.gte)\? \'must be greater than " - "or equal to %s and less than or equal to" - " %s\'.format([rules.gte, rules.lte]) : \'\'" - "\n\325\001\n\030sint64.gte_lte_exclusive\032\270\001has(rule" - "s.lte) && rules.lte < rules.gte && (rule" - "s.lte < this && this < rules.gte)\? \'must" - " be greater than or equal to %s or less " - "than or equal to %s\'.format([rules.gte, " - "rules.lte]) : \'\'H\001\022z\n\002in\030\006 \003(\022Bn\302Hk\ni\n\ts" - "int64.in\032\\!(this in getField(rules, \'in\'" - ")) \? \'must be in list %s\'.format([getFie" - "ld(rules, \'in\')]) : \'\'\022q\n\006not_in\030\007 \003(\022Ba" - "\302H^\n\\\n\rsint64.not_in\032Kthis in rules.not_" - "in \? \'must not be in list %s\'.format([ru" - "les.not_in]) : \'\'\022,\n\007example\030\010 \003(\022B\033\302H\030\n" - "\026\n\016sint64.example\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tle" - "ss_thanB\016\n\014greater_than\"\323\024\n\014Fixed32Rules" - "\022\177\n\005const\030\001 \001(\007Bp\302Hm\nk\n\rfixed32.const\032Zt" - "his != getField(rules, \'const\') \? \'must " - "equal %s\'.format([getField(rules, \'const" - "\')]) : \'\'\022\206\001\n\002lt\030\002 \001(\007Bx\302Hu\ns\n\nfixed32.l" - "t\032e!has(rules.gte) && !has(rules.gt) && " - "this >= rules.lt\? \'must be less than %s\'" - ".format([rules.lt]) : \'\'H\000\022\230\001\n\003lte\030\003 \001(\007" - "B\210\001\302H\204\001\n\201\001\n\013fixed32.lte\032r!has(rules.gte)" - " && !has(rules.gt) && this > rules.lte\? " - "\'must be less than or equal to %s\'.forma" - "t([rules.lte]) : \'\'H\000\022\203\007\n\002gt\030\004 \001(\007B\364\006\302H\360" - "\006\nv\n\nfixed32.gt\032h!has(rules.lt) && !has(" - "rules.lte) && this <= rules.gt\? \'must be" - " greater than %s\'.format([rules.gt]) : \'" - "\'\n\257\001\n\rfixed32.gt_lt\032\235\001has(rules.lt) && r" - "ules.lt >= rules.gt && (this >= rules.lt" - " || this <= rules.gt)\? \'must be greater " - "than %s and less than %s\'.format([rules." - "gt, rules.lt]) : \'\'\n\267\001\n\027fixed32.gt_lt_ex" - "clusive\032\233\001has(rules.lt) && rules.lt < ru" - "les.gt && (rules.lt <= this && this <= r" - "ules.gt)\? \'must be greater than %s or le" - "ss than %s\'.format([rules.gt, rules.lt])" - " : \'\'\n\277\001\n\016fixed32.gt_lte\032\254\001has(rules.lte" - ") && rules.lte >= rules.gt && (this > ru" - "les.lte || this <= rules.gt)\? \'must be g" - "reater than %s and less than or equal to" - " %s\'.format([rules.gt, rules.lte]) : \'\'\n" - "\307\001\n\030fixed32.gt_lte_exclusive\032\252\001has(rules" - ".lte) && rules.lte < rules.gt && (rules." - "lte < this && this <= rules.gt)\? \'must b" - "e greater than %s or less than or equal " - "to %s\'.format([rules.gt, rules.lte]) : \'" - "\'H\001\022\317\007\n\003gte\030\005 \001(\007B\277\007\302H\273\007\n\204\001\n\013fixed32.gte" - "\032u!has(rules.lt) && !has(rules.lte) && t" - "his < rules.gte\? \'must be greater than o" - "r equal to %s\'.format([rules.gte]) : \'\'\n" - "\276\001\n\016fixed32.gte_lt\032\253\001has(rules.lt) && ru" - "les.lt >= rules.gte && (this >= rules.lt" - " || this < rules.gte)\? \'must be greater " - "than or equal to %s and less than %s\'.fo" - "rmat([rules.gte, rules.lt]) : \'\'\n\306\001\n\030fix" - "ed32.gte_lt_exclusive\032\251\001has(rules.lt) &&" - " rules.lt < rules.gte && (rules.lt <= th" - "is && this < rules.gte)\? \'must be greate" - "r than or equal to %s or less than %s\'.f" - "ormat([rules.gte, rules.lt]) : \'\'\n\316\001\n\017fi" - "xed32.gte_lte\032\272\001has(rules.lte) && rules." - "lte >= rules.gte && (this > rules.lte ||" - " this < rules.gte)\? \'must be greater tha" - "n or equal to %s and less than or equal " - "to %s\'.format([rules.gte, rules.lte]) : " - "\'\'\n\326\001\n\031fixed32.gte_lte_exclusive\032\270\001has(r" - "ules.lte) && rules.lte < rules.gte && (r" - "ules.lte < this && this < rules.gte)\? \'m" - "ust be greater than or equal to %s or le" - "ss than or equal to %s\'.format([rules.gt" - "e, rules.lte]) : \'\'H\001\022{\n\002in\030\006 \003(\007Bo\302Hl\nj" - "\n\nfixed32.in\032\\!(this in getField(rules, " - "\'in\')) \? \'must be in list %s\'.format([ge" - "tField(rules, \'in\')]) : \'\'\022r\n\006not_in\030\007 \003" - "(\007Bb\302H_\n]\n\016fixed32.not_in\032Kthis in rules" - ".not_in \? \'must not be in list %s\'.forma" - "t([rules.not_in]) : \'\'\022-\n\007example\030\010 \003(\007B" - "\034\302H\031\n\027\n\017fixed32.example\032\004true*\t\010\350\007\020\200\200\200\200\002" - "B\013\n\tless_thanB\016\n\014greater_than\"\323\024\n\014Fixed6" - "4Rules\022\177\n\005const\030\001 \001(\006Bp\302Hm\nk\n\rfixed64.co" - "nst\032Zthis != getField(rules, \'const\') \? " - "\'must equal %s\'.format([getField(rules, " - "\'const\')]) : \'\'\022\206\001\n\002lt\030\002 \001(\006Bx\302Hu\ns\n\nfix" - "ed64.lt\032e!has(rules.gte) && !has(rules.g" - "t) && this >= rules.lt\? \'must be less th" - "an %s\'.format([rules.lt]) : \'\'H\000\022\230\001\n\003lte" - "\030\003 \001(\006B\210\001\302H\204\001\n\201\001\n\013fixed64.lte\032r!has(rule" - "s.gte) && !has(rules.gt) && this > rules" - ".lte\? \'must be less than or equal to %s\'" - ".format([rules.lte]) : \'\'H\000\022\203\007\n\002gt\030\004 \001(\006" - "B\364\006\302H\360\006\nv\n\nfixed64.gt\032h!has(rules.lt) &&" - " !has(rules.lte) && this <= rules.gt\? \'m" - "ust be greater than %s\'.format([rules.gt" - "]) : \'\'\n\257\001\n\rfixed64.gt_lt\032\235\001has(rules.lt" - ") && rules.lt >= rules.gt && (this >= ru" - "les.lt || this <= rules.gt)\? \'must be gr" - "eater than %s and less than %s\'.format([" - "rules.gt, rules.lt]) : \'\'\n\267\001\n\027fixed64.gt" - "_lt_exclusive\032\233\001has(rules.lt) && rules.l" - "t < rules.gt && (rules.lt <= this && thi" - "s <= rules.gt)\? \'must be greater than %s" - " or less than %s\'.format([rules.gt, rule" - "s.lt]) : \'\'\n\277\001\n\016fixed64.gt_lte\032\254\001has(rul" - "es.lte) && rules.lte >= rules.gt && (thi" - "s > rules.lte || this <= rules.gt)\? \'mus" - "t be greater than %s and less than or eq" - "ual to %s\'.format([rules.gt, rules.lte])" - " : \'\'\n\307\001\n\030fixed64.gt_lte_exclusive\032\252\001has" - "(rules.lte) && rules.lte < rules.gt && (" - "rules.lte < this && this <= rules.gt)\? \'" - "must be greater than %s or less than or " - "equal to %s\'.format([rules.gt, rules.lte" - "]) : \'\'H\001\022\317\007\n\003gte\030\005 \001(\006B\277\007\302H\273\007\n\204\001\n\013fixed" - "64.gte\032u!has(rules.lt) && !has(rules.lte" - ") && this < rules.gte\? \'must be greater " - "than or equal to %s\'.format([rules.gte])" - " : \'\'\n\276\001\n\016fixed64.gte_lt\032\253\001has(rules.lt)" - " && rules.lt >= rules.gte && (this >= ru" - "les.lt || this < rules.gte)\? \'must be gr" - "eater than or equal to %s and less than " - "%s\'.format([rules.gte, rules.lt]) : \'\'\n\306" - "\001\n\030fixed64.gte_lt_exclusive\032\251\001has(rules." - "lt) && rules.lt < rules.gte && (rules.lt" - " <= this && this < rules.gte)\? \'must be " - "greater than or equal to %s or less than" - " %s\'.format([rules.gte, rules.lt]) : \'\'\n" - "\316\001\n\017fixed64.gte_lte\032\272\001has(rules.lte) && " - "rules.lte >= rules.gte && (this > rules." - "lte || this < rules.gte)\? \'must be great" - "er than or equal to %s and less than or " - "equal to %s\'.format([rules.gte, rules.lt" - "e]) : \'\'\n\326\001\n\031fixed64.gte_lte_exclusive\032\270" - "\001has(rules.lte) && rules.lte < rules.gte" - " && (rules.lte < this && this < rules.gt" - "e)\? \'must be greater than or equal to %s" - " or less than or equal to %s\'.format([ru" - "les.gte, rules.lte]) : \'\'H\001\022{\n\002in\030\006 \003(\006B" - "o\302Hl\nj\n\nfixed64.in\032\\!(this in getField(r" - "ules, \'in\')) \? \'must be in list %s\'.form" - "at([getField(rules, \'in\')]) : \'\'\022r\n\006not_" - "in\030\007 \003(\006Bb\302H_\n]\n\016fixed64.not_in\032Kthis in" - " rules.not_in \? \'must not be in list %s\'" - ".format([rules.not_in]) : \'\'\022-\n\007example\030" - "\010 \003(\006B\034\302H\031\n\027\n\017fixed64.example\032\004true*\t\010\350\007" - "\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014greater_than\"\345\024\n\r" - "SFixed32Rules\022\200\001\n\005const\030\001 \001(\017Bq\302Hn\nl\n\016sf" - "ixed32.const\032Zthis != getField(rules, \'c" - "onst\') \? \'must equal %s\'.format([getFiel" - "d(rules, \'const\')]) : \'\'\022\207\001\n\002lt\030\002 \001(\017By\302" - "Hv\nt\n\013sfixed32.lt\032e!has(rules.gte) && !h" - "as(rules.gt) && this >= rules.lt\? \'must " - "be less than %s\'.format([rules.lt]) : \'\'" - "H\000\022\231\001\n\003lte\030\003 \001(\017B\211\001\302H\205\001\n\202\001\n\014sfixed32.lte" - "\032r!has(rules.gte) && !has(rules.gt) && t" - "his > rules.lte\? \'must be less than or e" - "qual to %s\'.format([rules.lte]) : \'\'H\000\022\210" - "\007\n\002gt\030\004 \001(\017B\371\006\302H\365\006\nw\n\013sfixed32.gt\032h!has(" - "rules.lt) && !has(rules.lte) && this <= " - "rules.gt\? \'must be greater than %s\'.form" - "at([rules.gt]) : \'\'\n\260\001\n\016sfixed32.gt_lt\032\235" - "\001has(rules.lt) && rules.lt >= rules.gt &" - "& (this >= rules.lt || this <= rules.gt)" - "\? \'must be greater than %s and less than" - " %s\'.format([rules.gt, rules.lt]) : \'\'\n\270" - "\001\n\030sfixed32.gt_lt_exclusive\032\233\001has(rules." - "lt) && rules.lt < rules.gt && (rules.lt " - "<= this && this <= rules.gt)\? \'must be g" - "reater than %s or less than %s\'.format([" - "rules.gt, rules.lt]) : \'\'\n\300\001\n\017sfixed32.g" - "t_lte\032\254\001has(rules.lte) && rules.lte >= r" - "ules.gt && (this > rules.lte || this <= " - "rules.gt)\? \'must be greater than %s and " - "less than or equal to %s\'.format([rules." - "gt, rules.lte]) : \'\'\n\310\001\n\031sfixed32.gt_lte" - "_exclusive\032\252\001has(rules.lte) && rules.lte" - " < rules.gt && (rules.lte < this && this" - " <= rules.gt)\? \'must be greater than %s " - "or less than or equal to %s\'.format([rul" - "es.gt, rules.lte]) : \'\'H\001\022\324\007\n\003gte\030\005 \001(\017B" - "\304\007\302H\300\007\n\205\001\n\014sfixed32.gte\032u!has(rules.lt) " - "&& !has(rules.lte) && this < rules.gte\? " - "\'must be greater than or equal to %s\'.fo" - "rmat([rules.gte]) : \'\'\n\277\001\n\017sfixed32.gte_" - "lt\032\253\001has(rules.lt) && rules.lt >= rules." - "gte && (this >= rules.lt || this < rules" - ".gte)\? \'must be greater than or equal to" - " %s and less than %s\'.format([rules.gte," - " rules.lt]) : \'\'\n\307\001\n\031sfixed32.gte_lt_exc" - "lusive\032\251\001has(rules.lt) && rules.lt < rul" - "es.gte && (rules.lt <= this && this < ru" - "les.gte)\? \'must be greater than or equal" - " to %s or less than %s\'.format([rules.gt" - "e, rules.lt]) : \'\'\n\317\001\n\020sfixed32.gte_lte\032" - "\272\001has(rules.lte) && rules.lte >= rules.g" - "te && (this > rules.lte || this < rules." - "gte)\? \'must be greater than or equal to " - "%s and less than or equal to %s\'.format(" - "[rules.gte, rules.lte]) : \'\'\n\327\001\n\032sfixed3" - "2.gte_lte_exclusive\032\270\001has(rules.lte) && " - "rules.lte < rules.gte && (rules.lte < th" - "is && this < rules.gte)\? \'must be greate" - "r than or equal to %s or less than or eq" - "ual to %s\'.format([rules.gte, rules.lte]" - ") : \'\'H\001\022|\n\002in\030\006 \003(\017Bp\302Hm\nk\n\013sfixed32.in" - "\032\\!(this in getField(rules, \'in\')) \? \'mu" - "st be in list %s\'.format([getField(rules" - ", \'in\')]) : \'\'\022s\n\006not_in\030\007 \003(\017Bc\302H`\n^\n\017s" - "fixed32.not_in\032Kthis in rules.not_in \? \'" - "must not be in list %s\'.format([rules.no" - "t_in]) : \'\'\022.\n\007example\030\010 \003(\017B\035\302H\032\n\030\n\020sfi" - "xed32.example\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_t" - "hanB\016\n\014greater_than\"\345\024\n\rSFixed64Rules\022\200\001" - "\n\005const\030\001 \001(\020Bq\302Hn\nl\n\016sfixed64.const\032Zth" - "is != getField(rules, \'const\') \? \'must e" - "qual %s\'.format([getField(rules, \'const\'" - ")]) : \'\'\022\207\001\n\002lt\030\002 \001(\020By\302Hv\nt\n\013sfixed64.l" - "t\032e!has(rules.gte) && !has(rules.gt) && " - "this >= rules.lt\? \'must be less than %s\'" - ".format([rules.lt]) : \'\'H\000\022\231\001\n\003lte\030\003 \001(\020" - "B\211\001\302H\205\001\n\202\001\n\014sfixed64.lte\032r!has(rules.gte" - ") && !has(rules.gt) && this > rules.lte\?" - " \'must be less than or equal to %s\'.form" - "at([rules.lte]) : \'\'H\000\022\210\007\n\002gt\030\004 \001(\020B\371\006\302H" - "\365\006\nw\n\013sfixed64.gt\032h!has(rules.lt) && !ha" - "s(rules.lte) && this <= rules.gt\? \'must " - "be greater than %s\'.format([rules.gt]) :" - " \'\'\n\260\001\n\016sfixed64.gt_lt\032\235\001has(rules.lt) &" - "& rules.lt >= rules.gt && (this >= rules" - ".lt || this <= rules.gt)\? \'must be great" - "er than %s and less than %s\'.format([rul" - "es.gt, rules.lt]) : \'\'\n\270\001\n\030sfixed64.gt_l" - "t_exclusive\032\233\001has(rules.lt) && rules.lt " - "< rules.gt && (rules.lt <= this && this " - "<= rules.gt)\? \'must be greater than %s o" - "r less than %s\'.format([rules.gt, rules." - "lt]) : \'\'\n\300\001\n\017sfixed64.gt_lte\032\254\001has(rule" - "s.lte) && rules.lte >= rules.gt && (this" - " > rules.lte || this <= rules.gt)\? \'must" - " be greater than %s and less than or equ" - "al to %s\'.format([rules.gt, rules.lte]) " - ": \'\'\n\310\001\n\031sfixed64.gt_lte_exclusive\032\252\001has" - "(rules.lte) && rules.lte < rules.gt && (" - "rules.lte < this && this <= rules.gt)\? \'" - "must be greater than %s or less than or " - "equal to %s\'.format([rules.gt, rules.lte" - "]) : \'\'H\001\022\324\007\n\003gte\030\005 \001(\020B\304\007\302H\300\007\n\205\001\n\014sfixe" - "d64.gte\032u!has(rules.lt) && !has(rules.lt" - "e) && this < rules.gte\? \'must be greater" - " than or equal to %s\'.format([rules.gte]" - ") : \'\'\n\277\001\n\017sfixed64.gte_lt\032\253\001has(rules.l" - "t) && rules.lt >= rules.gte && (this >= " - "rules.lt || this < rules.gte)\? \'must be " - "greater than or equal to %s and less tha" - "n %s\'.format([rules.gte, rules.lt]) : \'\'" - "\n\307\001\n\031sfixed64.gte_lt_exclusive\032\251\001has(rul" - "es.lt) && rules.lt < rules.gte && (rules" - ".lt <= this && this < rules.gte)\? \'must " - "be greater than or equal to %s or less t" - "han %s\'.format([rules.gte, rules.lt]) : " - "\'\'\n\317\001\n\020sfixed64.gte_lte\032\272\001has(rules.lte)" - " && rules.lte >= rules.gte && (this > ru" - "les.lte || this < rules.gte)\? \'must be g" - "reater than or equal to %s and less than" - " or equal to %s\'.format([rules.gte, rule" - "s.lte]) : \'\'\n\327\001\n\032sfixed64.gte_lte_exclus" - "ive\032\270\001has(rules.lte) && rules.lte < rule" - "s.gte && (rules.lte < this && this < rul" - "es.gte)\? \'must be greater than or equal " - "to %s or less than or equal to %s\'.forma" - "t([rules.gte, rules.lte]) : \'\'H\001\022|\n\002in\030\006" - " \003(\020Bp\302Hm\nk\n\013sfixed64.in\032\\!(this in getF" - "ield(rules, \'in\')) \? \'must be in list %s" - "\'.format([getField(rules, \'in\')]) : \'\'\022s" - "\n\006not_in\030\007 \003(\020Bc\302H`\n^\n\017sfixed64.not_in\032K" - "this in rules.not_in \? \'must not be in l" - "ist %s\'.format([rules.not_in]) : \'\'\022.\n\007e" - "xample\030\010 \003(\020B\035\302H\032\n\030\n\020sfixed64.example\032\004t" - "rue*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014greater_t" - "han\"\300\001\n\tBoolRules\022|\n\005const\030\001 \001(\010Bm\302Hj\nh\n" - "\nbool.const\032Zthis != getField(rules, \'co" - "nst\') \? \'must equal %s\'.format([getField" - "(rules, \'const\')]) : \'\'\022*\n\007example\030\002 \003(\010" - "B\031\302H\026\n\024\n\014bool.example\032\004true*\t\010\350\007\020\200\200\200\200\002\"\352" - "<\n\013StringRules\022\200\001\n\005const\030\001 \001(\tBq\302Hn\nl\n\014s" - "tring.const\032\\this != getField(rules, \'co" - "nst\') \? \'must equal `%s`\'.format([getFie" - "ld(rules, \'const\')]) : \'\'\022q\n\003len\030\023 \001(\004Bd" - "\302Ha\n_\n\nstring.len\032Quint(this.size()) != " - "rules.len \? \'must be %s characters\'.form" - "at([rules.len]) : \'\'\022\211\001\n\007min_len\030\002 \001(\004Bx" - "\302Hu\ns\n\016string.min_len\032auint(this.size())" - " < rules.min_len \? \'must be at least %s " - "characters\'.format([rules.min_len]) : \'\'" - "\022\210\001\n\007max_len\030\003 \001(\004Bw\302Ht\nr\n\016string.max_le" - "n\032`uint(this.size()) > rules.max_len \? \'" - "must be at most %s characters\'.format([r" - "ules.max_len]) : \'\'\022\213\001\n\tlen_bytes\030\024 \001(\004B" - "x\302Hu\ns\n\020string.len_bytes\032_uint(bytes(thi" - "s).size()) != rules.len_bytes \? \'must be" - " %s bytes\'.format([rules.len_bytes]) : \'" - "\'\022\224\001\n\tmin_bytes\030\004 \001(\004B\200\001\302H}\n{\n\020string.mi" - "n_bytes\032guint(bytes(this).size()) < rule" - "s.min_bytes \? \'must be at least %s bytes" - "\'.format([rules.min_bytes]) : \'\'\022\222\001\n\tmax" - "_bytes\030\005 \001(\004B\177\302H|\nz\n\020string.max_bytes\032fu" - "int(bytes(this).size()) > rules.max_byte" - "s \? \'must be at most %s bytes\'.format([r" - "ules.max_bytes]) : \'\'\022\207\001\n\007pattern\030\006 \001(\tB" - "v\302Hs\nq\n\016string.pattern\032_!this.matches(ru" - "les.pattern) \? \'does not match regex pat" - "tern `%s`\'.format([rules.pattern]) : \'\'\022" - "~\n\006prefix\030\007 \001(\tBn\302Hk\ni\n\rstring.prefix\032X!" - "this.startsWith(rules.prefix) \? \'does no" - "t have prefix `%s`\'.format([rules.prefix" - "]) : \'\'\022|\n\006suffix\030\010 \001(\tBl\302Hi\ng\n\rstring.s" - "uffix\032V!this.endsWith(rules.suffix) \? \'d" - "oes not have suffix `%s`\'.format([rules." - "suffix]) : \'\'\022\212\001\n\010contains\030\t \001(\tBx\302Hu\ns\n" - "\017string.contains\032`!this.contains(rules.c" - "ontains) \? \'does not contain substring `" - "%s`\'.format([rules.contains]) : \'\'\022\221\001\n\014n" - "ot_contains\030\027 \001(\tB{\302Hx\nv\n\023string.not_con" - "tains\032_this.contains(rules.not_contains)" - " \? \'contains substring `%s`\'.format([rul" - "es.not_contains]) : \'\'\022z\n\002in\030\n \003(\tBn\302Hk\n" - "i\n\tstring.in\032\\!(this in getField(rules, " - "\'in\')) \? \'must be in list %s\'.format([ge" - "tField(rules, \'in\')]) : \'\'\022q\n\006not_in\030\013 \003" - "(\tBa\302H^\n\\\n\rstring.not_in\032Kthis in rules." - "not_in \? \'must not be in list %s\'.format" - "([rules.not_in]) : \'\'\022\331\001\n\005email\030\014 \001(\010B\307\001" - "\302H\303\001\n[\n\014string.email\022\035must be a valid em" - "ail address\032,!rules.email || this == \'\' " - "|| this.isEmail()\nd\n\022string.email_empty\022" - "2value is empty, which is not a valid em" - "ail address\032\032!rules.email || this != \'\'H" - "\000\022\341\001\n\010hostname\030\r \001(\010B\314\001\302H\310\001\n_\n\017string.ho" - "stname\022\030must be a valid hostname\0322!rules" - ".hostname || this == \'\' || this.isHostna" - "me()\ne\n\025string.hostname_empty\022-value is " - "empty, which is not a valid hostname\032\035!r" - "ules.hostname || this != \'\'H\000\022\301\001\n\002ip\030\016 \001" - "(\010B\262\001\302H\256\001\nO\n\tstring.ip\022\032must be a valid " - "IP address\032&!rules.ip || this == \'\' || t" - "his.isIp()\n[\n\017string.ip_empty\022/value is " - "empty, which is not a valid IP address\032\027" - "!rules.ip || this != \'\'H\000\022\320\001\n\004ipv4\030\017 \001(\010" - "B\277\001\302H\273\001\nV\n\013string.ipv4\022\034must be a valid " - "IPv4 address\032)!rules.ipv4 || this == \'\' " - "|| this.isIp(4)\na\n\021string.ipv4_empty\0221va" - "lue is empty, which is not a valid IPv4 " - "address\032\031!rules.ipv4 || this != \'\'H\000\022\320\001\n" - "\004ipv6\030\020 \001(\010B\277\001\302H\273\001\nV\n\013string.ipv6\022\034must " - "be a valid IPv6 address\032)!rules.ipv6 || " - "this == \'\' || this.isIp(6)\na\n\021string.ipv" - "6_empty\0221value is empty, which is not a " - "valid IPv6 address\032\031!rules.ipv6 || this " - "!= \'\'H\000\022\271\001\n\003uri\030\021 \001(\010B\251\001\302H\245\001\nK\n\nstring.u" - "ri\022\023must be a valid URI\032(!rules.uri || t" - "his == \'\' || this.isUri()\nV\n\020string.uri_" - "empty\022(value is empty, which is not a va" - "lid URI\032\030!rules.uri || this != \'\'H\000\022j\n\007u" - "ri_ref\030\022 \001(\010BW\302HT\nR\n\016string.uri_ref\022\035mus" - "t be a valid URI Reference\032!!rules.uri_r" - "ef || this.isUriRef()H\000\022\211\002\n\007address\030\025 \001(" - "\010B\365\001\302H\361\001\n{\n\016string.address\022\'must be a va" - "lid hostname, or ip address\032@!rules.addr" - "ess || this == \'\' || this.isHostname() |" - "| this.isIp()\nr\n\024string.address_empty\022!" - "rules.ipv4_with_prefixlen || this == \'\' " - "|| this.isIpPrefix(4)\n\222\001\n string.ipv4_wi" - "th_prefixlen_empty\022Dvalue is empty, whic" - "h is not a valid IPv4 address with prefi" - "x length\032(!rules.ipv4_with_prefixlen || " - "this != \'\'H\000\022\311\002\n\023ipv6_with_prefixlen\030\034 \001" - "(\010B\251\002\302H\245\002\n\215\001\n\032string.ipv6_with_prefixlen" - "\022/must be a valid IPv6 address with pref" - "ix length\032>!rules.ipv6_with_prefixlen ||" - " this == \'\' || this.isIpPrefix(6)\n\222\001\n st" - "ring.ipv6_with_prefixlen_empty\022Dvalue is" - " empty, which is not a valid IPv6 addres" - "s with prefix length\032(!rules.ipv6_with_p" - "refixlen || this != \'\'H\000\022\354\001\n\tip_prefix\030\035" - " \001(\010B\326\001\302H\322\001\nf\n\020string.ip_prefix\022\031must be" - " a valid IP prefix\0327!rules.ip_prefix || " - "this == \'\' || this.isIpPrefix(true)\nh\n\026s" - "tring.ip_prefix_empty\022.value is empty, w" - "hich is not a valid IP prefix\032\036!rules.ip" - "_prefix || this != \'\'H\000\022\375\001\n\013ipv4_prefix\030" - "\036 \001(\010B\345\001\302H\341\001\no\n\022string.ipv4_prefix\022\033must" - " be a valid IPv4 prefix\032!rules.host_and_port || th" - "is == \'\' || this.isHostAndPort(true)\ny\n\032" - "string.host_and_port_empty\0227value is emp" - "ty, which is not a valid host and port p" - "air\032\"!rules.host_and_port || this != \'\'H" - "\000\022\356\001\n\004ulid\030# \001(\010B\335\001\302H\331\001\n|\n\013string.ulid\022\024" - "must be a valid ULID\032W!rules.ulid || thi" - "s == \'\' || this.matches(\'^[0-7][0-9A-HJK" - "MNP-TV-Za-hjkmnp-tv-z]{25}$\')\nY\n\021string." - "ulid_empty\022)value is empty, which is not" - " a valid ULID\032\031!rules.ulid || this != \'\'" - "H\000\022\324\002\n\014protobuf_fqn\030% \001(\010B\273\002\302H\267\002\n\257\001\n\023str" - "ing.protobuf_fqn\022-must be a valid fully-" - "qualified Protobuf name\032i!rules.protobuf" - "_fqn || this == \'\' || this.matches(\'^[A-" - "Za-z_][A-Za-z_0-9]*(\\\\.[A-Za-z_][A-Za-z_" - "0-9]*)*$\')\n\202\001\n\031string.protobuf_fqn_empty" - "\022Bvalue is empty, which is not a valid f" - "ully-qualified Protobuf name\032!!rules.pro" - "tobuf_fqn || this != \'\'H\000\022\221\003\n\020protobuf_d" - "ot_fqn\030& \001(\010B\364\002\302H\360\002\n\315\001\n\027string.protobuf_" - "dot_fqn\022@must be a valid fully-qualified" - " Protobuf name with a leading dot\032p!rule" - "s.protobuf_dot_fqn || this == \'\' || this" - ".matches(\'^\\\\.[A-Za-z_][A-Za-z_0-9]*(\\\\." - "[A-Za-z_][A-Za-z_0-9]*)*$\')\n\235\001\n\035string.p" - "rotobuf_dot_fqn_empty\022Uvalue is empty, w" - "hich is not a valid fully-qualified Prot" - "obuf name with a leading dot\032%!rules.pro" - "tobuf_dot_fqn || this != \'\'H\000\022\234\005\n\020well_k" - "nown_regex\030\030 \001(\0162\030.buf.validate.KnownReg" - "exB\345\004\302H\341\004\n\352\001\n#string.well_known_regex.he" - "ader_name\022 must be a valid HTTP header n" - "ame\032\240\001rules.well_known_regex != 1 || thi" - "s == \'\' || this.matches(!has(rules.stric" - "t) || rules.strict \?\'^:\?[0-9a-zA-Z!#$%&\\" - "\'*+-.^_|~\\x60]+$\' :\'^[^\\u0000\\u000A\\u000" - "D]+$\')\n\215\001\n)string.well_known_regex.heade" - "r_name_empty\0225value is empty, which is n" - "ot a valid HTTP header name\032)rules.well_" - "known_regex != 1 || this != \'\'\n\341\001\n$strin" - "g.well_known_regex.header_value\022!must be" - " a valid HTTP header value\032\225\001rules.well_" - "known_regex != 2 || this.matches(!has(ru" - "les.strict) || rules.strict \?\'^[^\\u0000-" - "\\u0008\\u000A-\\u001F\\u007F]*$\' :\'^[^\\u000" - "0\\u000A\\u000D]*$\')H\000\022\016\n\006strict\030\031 \001(\010\022,\n\007" - "example\030\" \003(\tB\033\302H\030\n\026\n\016string.example\032\004tr" - "ue*\t\010\350\007\020\200\200\200\200\002B\014\n\nwell_known\"\335\021\n\nBytesRul" - "es\022z\n\005const\030\001 \001(\014Bk\302Hh\nf\n\013bytes.const\032Wt" - "his != getField(rules, \'const\') \? \'must " - "be %x\'.format([getField(rules, \'const\')]" - ") : \'\'\022k\n\003len\030\r \001(\004B^\302H[\nY\n\tbytes.len\032Lu" - "int(this.size()) != rules.len \? \'must be" - " %s bytes\'.format([rules.len]) : \'\'\022\203\001\n\007" - "min_len\030\002 \001(\004Br\302Ho\nm\n\rbytes.min_len\032\\uin" - "t(this.size()) < rules.min_len \? \'must b" - "e at least %s bytes\'.format([rules.min_l" - "en]) : \'\'\022\202\001\n\007max_len\030\003 \001(\004Bq\302Hn\nl\n\rbyte" - "s.max_len\032[uint(this.size()) > rules.max" - "_len \? \'must be at most %s bytes\'.format" - "([rules.max_len]) : \'\'\022\212\001\n\007pattern\030\004 \001(\t" - "By\302Hv\nt\n\rbytes.pattern\032c!string(this).ma" - "tches(rules.pattern) \? \'must match regex" - " pattern `%s`\'.format([rules.pattern]) :" - " \'\'\022{\n\006prefix\030\005 \001(\014Bk\302Hh\nf\n\014bytes.prefix" - "\032V!this.startsWith(rules.prefix) \? \'does" - " not have prefix %x\'.format([rules.prefi" - "x]) : \'\'\022y\n\006suffix\030\006 \001(\014Bi\302Hf\nd\n\014bytes.s" - "uffix\032T!this.endsWith(rules.suffix) \? \'d" - "oes not have suffix %x\'.format([rules.su" - "ffix]) : \'\'\022}\n\010contains\030\007 \001(\014Bk\302Hh\nf\n\016by" - "tes.contains\032T!this.contains(rules.conta" - "ins) \? \'does not contain %x\'.format([rul" - "es.contains]) : \'\'\022\241\001\n\002in\030\010 \003(\014B\224\001\302H\220\001\n\215" - "\001\n\010bytes.in\032\200\001getField(rules, \'in\').size" - "() > 0 && !(this in getField(rules, \'in\'" - ")) \? \'must be in list %s\'.format([getFie" - "ld(rules, \'in\')]) : \'\'\022p\n\006not_in\030\t \003(\014B`" - "\302H]\n[\n\014bytes.not_in\032Kthis in rules.not_i" - "n \? \'must not be in list %s\'.format([rul" - "es.not_in]) : \'\'\022\345\001\n\002ip\030\n \001(\010B\326\001\302H\322\001\nn\n\010" - "bytes.ip\022\032must be a valid IP address\032F!r" - "ules.ip || this.size() == 0 || this.size" - "() == 4 || this.size() == 16\n`\n\016bytes.ip" - "_empty\022/value is empty, which is not a v" - "alid IP address\032\035!rules.ip || this.size(" - ") != 0H\000\022\336\001\n\004ipv4\030\013 \001(\010B\315\001\302H\311\001\n_\n\nbytes." - "ipv4\022\034must be a valid IPv4 address\0323!rul" - "es.ipv4 || this.size() == 0 || this.size" - "() == 4\nf\n\020bytes.ipv4_empty\0221value is em" - "pty, which is not a valid IPv4 address\032\037" - "!rules.ipv4 || this.size() != 0H\000\022\337\001\n\004ip" - "v6\030\014 \001(\010B\316\001\302H\312\001\n`\n\nbytes.ipv6\022\034must be a" - " valid IPv6 address\0324!rules.ipv6 || this" - ".size() == 0 || this.size() == 16\nf\n\020byt" - "es.ipv6_empty\0221value is empty, which is " - "not a valid IPv6 address\032\037!rules.ipv6 ||" - " this.size() != 0H\000\022\317\001\n\004uuid\030\017 \001(\010B\276\001\302H\272" - "\001\nX\n\nbytes.uuid\022\024must be a valid UUID\0324!" - "rules.uuid || this.size() == 0 || this.s" - "ize() == 16\n^\n\020bytes.uuid_empty\022)value i" - "s empty, which is not a valid UUID\032\037!rul" - "es.uuid || this.size() != 0H\000\022+\n\007example" - "\030\016 \003(\014B\032\302H\027\n\025\n\rbytes.example\032\004true*\t\010\350\007\020" - "\200\200\200\200\002B\014\n\nwell_known\"\301\003\n\tEnumRules\022|\n\005con" - "st\030\001 \001(\005Bm\302Hj\nh\n\nenum.const\032Zthis != get" - "Field(rules, \'const\') \? \'must equal %s\'." - "format([getField(rules, \'const\')]) : \'\'\022" - "\024\n\014defined_only\030\002 \001(\010\022x\n\002in\030\003 \003(\005Bl\302Hi\ng" - "\n\007enum.in\032\\!(this in getField(rules, \'in" - "\')) \? \'must be in list %s\'.format([getFi" - "eld(rules, \'in\')]) : \'\'\022o\n\006not_in\030\004 \003(\005B" - "_\302H\\\nZ\n\013enum.not_in\032Kthis in rules.not_i" - "n \? \'must not be in list %s\'.format([rul" - "es.not_in]) : \'\'\022*\n\007example\030\005 \003(\005B\031\302H\026\n\024" - "\n\014enum.example\032\004true*\t\010\350\007\020\200\200\200\200\002\"\355\003\n\rRepe" - "atedRules\022\226\001\n\tmin_items\030\001 \001(\004B\202\001\302H\177\n}\n\022r" - "epeated.min_items\032guint(this.size()) < r" - "ules.min_items \? \'must contain at least " - "%d item(s)\'.format([rules.min_items]) : " - "\'\'\022\234\001\n\tmax_items\030\002 \001(\004B\210\001\302H\204\001\n\201\001\n\022repeat" - "ed.max_items\032kuint(this.size()) > rules." - "max_items \? \'must contain no more than %" - "s item(s)\'.format([rules.max_items]) : \'" - "\'\022p\n\006unique\030\003 \001(\010B`\302H]\n[\n\017repeated.uniqu" - "e\022(repeated value must contain unique it" - "ems\032\036!rules.unique || this.unique()\022\'\n\005i" - "tems\030\004 \001(\0132\030.buf.validate.FieldRules*\t\010\350" - "\007\020\200\200\200\200\002\"\212\003\n\010MapRules\022\217\001\n\tmin_pairs\030\001 \001(\004" - "B|\302Hy\nw\n\rmap.min_pairs\032fuint(this.size()" - ") < rules.min_pairs \? \'map must be at le" - "ast %d entries\'.format([rules.min_pairs]" - ") : \'\'\022\216\001\n\tmax_pairs\030\002 \001(\004B{\302Hx\nv\n\rmap.m" - "ax_pairs\032euint(this.size()) > rules.max_" - "pairs \? \'map must be at most %d entries\'" - ".format([rules.max_pairs]) : \'\'\022&\n\004keys\030" - "\004 \001(\0132\030.buf.validate.FieldRules\022(\n\006value" - "s\030\005 \001(\0132\030.buf.validate.FieldRules*\t\010\350\007\020\200" - "\200\200\200\002\"&\n\010AnyRules\022\n\n\002in\030\002 \003(\t\022\016\n\006not_in\030\003" - " \003(\t\"\277\026\n\rDurationRules\022\233\001\n\005const\030\002 \001(\0132\031" - ".google.protobuf.DurationBq\302Hn\nl\n\016durati" - "on.const\032Zthis != getField(rules, \'const" - "\') \? \'must equal %s\'.format([getField(ru" - "les, \'const\')]) : \'\'\022\242\001\n\002lt\030\003 \001(\0132\031.goog" - "le.protobuf.DurationBy\302Hv\nt\n\013duration.lt" - "\032e!has(rules.gte) && !has(rules.gt) && t" - "his >= rules.lt\? \'must be less than %s\'." - "format([rules.lt]) : \'\'H\000\022\264\001\n\003lte\030\004 \001(\0132" - "\031.google.protobuf.DurationB\211\001\302H\205\001\n\202\001\n\014du" - "ration.lte\032r!has(rules.gte) && !has(rule" - "s.gt) && this > rules.lte\? \'must be less" - " than or equal to %s\'.format([rules.lte]" - ") : \'\'H\000\022\243\007\n\002gt\030\005 \001(\0132\031.google.protobuf." - "DurationB\371\006\302H\365\006\nw\n\013duration.gt\032h!has(rul" - "es.lt) && !has(rules.lte) && this <= rul" - "es.gt\? \'must be greater than %s\'.format(" - "[rules.gt]) : \'\'\n\260\001\n\016duration.gt_lt\032\235\001ha" - "s(rules.lt) && rules.lt >= rules.gt && (" - "this >= rules.lt || this <= rules.gt)\? \'" - "must be greater than %s and less than %s" - "\'.format([rules.gt, rules.lt]) : \'\'\n\270\001\n\030" - "duration.gt_lt_exclusive\032\233\001has(rules.lt)" - " && rules.lt < rules.gt && (rules.lt <= " - "this && this <= rules.gt)\? \'must be grea" - "ter than %s or less than %s\'.format([rul" - "es.gt, rules.lt]) : \'\'\n\300\001\n\017duration.gt_l" - "te\032\254\001has(rules.lte) && rules.lte >= rule" - "s.gt && (this > rules.lte || this <= rul" - "es.gt)\? \'must be greater than %s and les" - "s than or equal to %s\'.format([rules.gt," - " rules.lte]) : \'\'\n\310\001\n\031duration.gt_lte_ex" - "clusive\032\252\001has(rules.lte) && rules.lte < " - "rules.gt && (rules.lte < this && this <=" - " rules.gt)\? \'must be greater than %s or " - "less than or equal to %s\'.format([rules." - "gt, rules.lte]) : \'\'H\001\022\357\007\n\003gte\030\006 \001(\0132\031.g" - "oogle.protobuf.DurationB\304\007\302H\300\007\n\205\001\n\014durat" - "ion.gte\032u!has(rules.lt) && !has(rules.lt" - "e) && this < rules.gte\? \'must be greater" - " than or equal to %s\'.format([rules.gte]" - ") : \'\'\n\277\001\n\017duration.gte_lt\032\253\001has(rules.l" - "t) && rules.lt >= rules.gte && (this >= " - "rules.lt || this < rules.gte)\? \'must be " - "greater than or equal to %s and less tha" - "n %s\'.format([rules.gte, rules.lt]) : \'\'" - "\n\307\001\n\031duration.gte_lt_exclusive\032\251\001has(rul" - "es.lt) && rules.lt < rules.gte && (rules" - ".lt <= this && this < rules.gte)\? \'must " - "be greater than or equal to %s or less t" - "han %s\'.format([rules.gte, rules.lt]) : " - "\'\'\n\317\001\n\020duration.gte_lte\032\272\001has(rules.lte)" - " && rules.lte >= rules.gte && (this > ru" - "les.lte || this < rules.gte)\? \'must be g" - "reater than or equal to %s and less than" - " or equal to %s\'.format([rules.gte, rule" - "s.lte]) : \'\'\n\327\001\n\032duration.gte_lte_exclus" - "ive\032\270\001has(rules.lte) && rules.lte < rule" - "s.gte && (rules.lte < this && this < rul" - "es.gte)\? \'must be greater than or equal " - "to %s or less than or equal to %s\'.forma" - "t([rules.gte, rules.lte]) : \'\'H\001\022\227\001\n\002in\030" - "\007 \003(\0132\031.google.protobuf.DurationBp\302Hm\nk\n" - "\013duration.in\032\\!(this in getField(rules, " - "\'in\')) \? \'must be in list %s\'.format([ge" - "tField(rules, \'in\')]) : \'\'\022\216\001\n\006not_in\030\010 " - "\003(\0132\031.google.protobuf.DurationBc\302H`\n^\n\017d" - "uration.not_in\032Kthis in rules.not_in \? \'" - "must not be in list %s\'.format([rules.no" - "t_in]) : \'\'\022I\n\007example\030\t \003(\0132\031.google.pr" - "otobuf.DurationB\035\302H\032\n\030\n\020duration.example" - "\032\004true*\t\010\350\007\020\200\200\200\200\002B\013\n\tless_thanB\016\n\014greate" - "r_than\"\353\005\n\016FieldMaskRules\022\271\001\n\005const\030\001 \001(" - "\0132\032.google.protobuf.FieldMaskB\215\001\302H\211\001\n\206\001\n" - "\020field_mask.const\032rthis.paths != getFiel" - "d(rules, \'const\').paths \? \'must equal pa" - "ths %s\'.format([getField(rules, \'const\')" - ".paths]) : \'\'\022\323\001\n\002in\030\002 \003(\tB\306\001\302H\302\001\n\277\001\n\rfi" - "eld_mask.in\032\255\001!this.paths.all(p, p in ge" - "tField(rules, \'in\') || getField(rules, \'" - "in\').exists(f, p.startsWith(f+\'.\'))) \? \'" - "must only contain paths in %s\'.format([g" - "etField(rules, \'in\')]) : \'\'\022\355\001\n\006not_in\030\003" - " \003(\tB\334\001\302H\330\001\n\325\001\n\021field_mask.not_in\032\277\001!thi" - "s.paths.all(p, !(p in getField(rules, \'n" - "ot_in\') || getField(rules, \'not_in\').exi" - "sts(f, p.startsWith(f+\'.\')))) \? \'must no" - "t contain any paths in %s\'.format([getFi" - "eld(rules, \'not_in\')]) : \'\'\022L\n\007example\030\004" - " \003(\0132\032.google.protobuf.FieldMaskB\037\302H\034\n\032\n" - "\022field_mask.example\032\004true*\t\010\350\007\020\200\200\200\200\002\"\260\027\n" - "\016TimestampRules\022\235\001\n\005const\030\002 \001(\0132\032.google" - ".protobuf.TimestampBr\302Ho\nm\n\017timestamp.co" - "nst\032Zthis != getField(rules, \'const\') \? " - "\'must equal %s\'.format([getField(rules, " - "\'const\')]) : \'\'\022\244\001\n\002lt\030\003 \001(\0132\032.google.pr" - "otobuf.TimestampBz\302Hw\nu\n\014timestamp.lt\032e!" - "has(rules.gte) && !has(rules.gt) && this" - " >= rules.lt\? \'must be less than %s\'.for" - "mat([rules.lt]) : \'\'H\000\022\266\001\n\003lte\030\004 \001(\0132\032.g" - "oogle.protobuf.TimestampB\212\001\302H\206\001\n\203\001\n\rtime" - "stamp.lte\032r!has(rules.gte) && !has(rules" - ".gt) && this > rules.lte\? \'must be less " - "than or equal to %s\'.format([rules.lte])" - " : \'\'H\000\022f\n\006lt_now\030\007 \001(\010BT\302HQ\nO\n\020timestam" - "p.lt_now\032;(rules.lt_now && this > now) \?" - " \'must be less than now\' : \'\'H\000\022\251\007\n\002gt\030\005" - " \001(\0132\032.google.protobuf.TimestampB\376\006\302H\372\006\n" - "x\n\014timestamp.gt\032h!has(rules.lt) && !has(" - "rules.lte) && this <= rules.gt\? \'must be" - " greater than %s\'.format([rules.gt]) : \'" - "\'\n\261\001\n\017timestamp.gt_lt\032\235\001has(rules.lt) &&" - " rules.lt >= rules.gt && (this >= rules." - "lt || this <= rules.gt)\? \'must be greate" - "r than %s and less than %s\'.format([rule" - "s.gt, rules.lt]) : \'\'\n\271\001\n\031timestamp.gt_l" - "t_exclusive\032\233\001has(rules.lt) && rules.lt " - "< rules.gt && (rules.lt <= this && this " - "<= rules.gt)\? \'must be greater than %s o" - "r less than %s\'.format([rules.gt, rules." - "lt]) : \'\'\n\301\001\n\020timestamp.gt_lte\032\254\001has(rul" - "es.lte) && rules.lte >= rules.gt && (thi" - "s > rules.lte || this <= rules.gt)\? \'mus" - "t be greater than %s and less than or eq" - "ual to %s\'.format([rules.gt, rules.lte])" - " : \'\'\n\311\001\n\032timestamp.gt_lte_exclusive\032\252\001h" - "as(rules.lte) && rules.lte < rules.gt &&" - " (rules.lte < this && this <= rules.gt)\?" - " \'must be greater than %s or less than o" - "r equal to %s\'.format([rules.gt, rules.l" - "te]) : \'\'H\001\022\365\007\n\003gte\030\006 \001(\0132\032.google.proto" - "buf.TimestampB\311\007\302H\305\007\n\206\001\n\rtimestamp.gte\032u" - "!has(rules.lt) && !has(rules.lte) && thi" - "s < rules.gte\? \'must be greater than or " - "equal to %s\'.format([rules.gte]) : \'\'\n\300\001" - "\n\020timestamp.gte_lt\032\253\001has(rules.lt) && ru" - "les.lt >= rules.gte && (this >= rules.lt" - " || this < rules.gte)\? \'must be greater " - "than or equal to %s and less than %s\'.fo" - "rmat([rules.gte, rules.lt]) : \'\'\n\310\001\n\032tim" - "estamp.gte_lt_exclusive\032\251\001has(rules.lt) " - "&& rules.lt < rules.gte && (rules.lt <= " - "this && this < rules.gte)\? \'must be grea" - "ter than or equal to %s or less than %s\'" - ".format([rules.gte, rules.lt]) : \'\'\n\320\001\n\021" - "timestamp.gte_lte\032\272\001has(rules.lte) && ru" - "les.lte >= rules.gte && (this > rules.lt" - "e || this < rules.gte)\? \'must be greater" - " than or equal to %s and less than or eq" - "ual to %s\'.format([rules.gte, rules.lte]" - ") : \'\'\n\330\001\n\033timestamp.gte_lte_exclusive\032\270" - "\001has(rules.lte) && rules.lte < rules.gte" - " && (rules.lte < this && this < rules.gt" - "e)\? \'must be greater than or equal to %s" - " or less than or equal to %s\'.format([ru" - "les.gte, rules.lte]) : \'\'H\001\022i\n\006gt_now\030\010 " - "\001(\010BW\302HT\nR\n\020timestamp.gt_now\032>(rules.gt_" - "now && this < now) \? \'must be greater th" - "an now\' : \'\'H\001\022\261\001\n\006within\030\t \001(\0132\031.google" - ".protobuf.DurationB\205\001\302H\201\001\n\177\n\020timestamp.w" - "ithin\032kthis < now-rules.within || this >" - " now+rules.within \? \'must be within %s o" - "f now\'.format([rules.within]) : \'\'\022K\n\007ex" - "ample\030\n \003(\0132\032.google.protobuf.TimestampB" - "\036\302H\033\n\031\n\021timestamp.example\032\004true*\t\010\350\007\020\200\200\200" - "\200\002B\013\n\tless_thanB\016\n\014greater_than\"9\n\nViola" - "tions\022+\n\nviolations\030\001 \003(\0132\027.buf.validate" - ".Violation\"\237\001\n\tViolation\022&\n\005field\030\005 \001(\0132" - "\027.buf.validate.FieldPath\022%\n\004rule\030\006 \001(\0132\027" - ".buf.validate.FieldPath\022\017\n\007rule_id\030\002 \001(\t" - "\022\017\n\007message\030\003 \001(\t\022\017\n\007for_key\030\004 \001(\010J\004\010\001\020\002" - "R\nfield_path\"=\n\tFieldPath\0220\n\010elements\030\001 " - "\003(\0132\036.buf.validate.FieldPathElement\"\351\002\n\020" - "FieldPathElement\022\024\n\014field_number\030\001 \001(\005\022\022" - "\n\nfield_name\030\002 \001(\t\022>\n\nfield_type\030\003 \001(\0162*" - ".google.protobuf.FieldDescriptorProto.Ty" - "pe\022<\n\010key_type\030\004 \001(\0162*.google.protobuf.F" - "ieldDescriptorProto.Type\022>\n\nvalue_type\030\005" - " \001(\0162*.google.protobuf.FieldDescriptorPr" - "oto.Type\022\017\n\005index\030\006 \001(\004H\000\022\022\n\010bool_key\030\007 " - "\001(\010H\000\022\021\n\007int_key\030\010 \001(\003H\000\022\022\n\010uint_key\030\t \001" - "(\004H\000\022\024\n\nstring_key\030\n \001(\tH\000B\013\n\tsubscript*" - "\241\001\n\006Ignore\022\026\n\022IGNORE_UNSPECIFIED\020\000\022\030\n\024IG" - "NORE_IF_ZERO_VALUE\020\001\022\021\n\rIGNORE_ALWAYS\020\003\"" - "\004\010\002\020\002*\014IGNORE_EMPTY*\016IGNORE_DEFAULT*\027IGN" - "ORE_IF_DEFAULT_VALUE*\025IGNORE_IF_UNPOPULA" - "TED*n\n\nKnownRegex\022\033\n\027KNOWN_REGEX_UNSPECI" - "FIED\020\000\022 \n\034KNOWN_REGEX_HTTP_HEADER_NAME\020\001" - "\022!\n\035KNOWN_REGEX_HTTP_HEADER_VALUE\020\002:M\n\007m" - "essage\022\037.google.protobuf.MessageOptions\030" - "\207\t \001(\0132\032.buf.validate.MessageRules:G\n\005on" - "eof\022\035.google.protobuf.OneofOptions\030\207\t \001(" - "\0132\030.buf.validate.OneofRules:G\n\005field\022\035.g" - "oogle.protobuf.FieldOptions\030\207\t \001(\0132\030.buf" - ".validate.FieldRules:Q\n\npredefined\022\035.goo" - "gle.protobuf.FieldOptions\030\210\t \001(\0132\035.buf.v" - "alidate.PredefinedRulesBn\n\022build.buf.val" - "idateB\rValidateProtoP\001ZGbuf.build/gen/go" - "/bufbuild/protovalidate/protocolbuffers/" - "go/buf/validate" -}; -static const ::_pbi::DescriptorTable* PROTOBUF_NONNULL const - descriptor_table_buf_2fvalidate_2fvalidate_2eproto_deps[4] = { - &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto, - &::descriptor_table_google_2fprotobuf_2fduration_2eproto, - &::descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto, - &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto, -}; -static ::absl::once_flag descriptor_table_buf_2fvalidate_2fvalidate_2eproto_once; -PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_buf_2fvalidate_2fvalidate_2eproto = { - false, - false, - 53575, - descriptor_table_protodef_buf_2fvalidate_2fvalidate_2eproto, - "buf/validate/validate.proto", - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto_once, - descriptor_table_buf_2fvalidate_2fvalidate_2eproto_deps, - 4, - 32, - schemas, - file_default_instances, - TableStruct_buf_2fvalidate_2fvalidate_2eproto::offsets, - file_level_enum_descriptors_buf_2fvalidate_2fvalidate_2eproto, - file_level_service_descriptors_buf_2fvalidate_2fvalidate_2eproto, -}; -namespace buf { -namespace validate { -const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Ignore_descriptor() { - ::google::protobuf::internal::AssignDescriptors(&descriptor_table_buf_2fvalidate_2fvalidate_2eproto); - return file_level_enum_descriptors_buf_2fvalidate_2fvalidate_2eproto[0]; -} -PROTOBUF_CONSTINIT const uint32_t Ignore_internal_data_[] = { - 131072u, 32u, 2u, }; -const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL KnownRegex_descriptor() { - ::google::protobuf::internal::AssignDescriptors(&descriptor_table_buf_2fvalidate_2fvalidate_2eproto); - return file_level_enum_descriptors_buf_2fvalidate_2fvalidate_2eproto[1]; -} -PROTOBUF_CONSTINIT const uint32_t KnownRegex_internal_data_[] = { - 196608u, 0u, }; -// =================================================================== - -class Rule::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Rule, _impl_._has_bits_); -}; - -Rule::Rule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Rule_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Rule) -} -PROTOBUF_NDEBUG_INLINE Rule::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Rule& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - id_(arena, from.id_), - message_(arena, from.message_), - expression_(arena, from.expression_) {} - -Rule::Rule( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Rule& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Rule_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Rule* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.Rule) -} -PROTOBUF_NDEBUG_INLINE Rule::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - id_(arena), - message_(arena), - expression_(arena) {} - -inline void Rule::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -Rule::~Rule() { - // @@protoc_insertion_point(destructor:buf.validate.Rule) - SharedDtor(*this); -} -inline void Rule::SharedDtor(MessageLite& self) { - Rule& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.id_.Destroy(); - this_._impl_.message_.Destroy(); - this_._impl_.expression_.Destroy(); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL Rule::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Rule(arena); -} -constexpr auto Rule::InternalNewImpl_() { - return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Rule), - alignof(Rule)); -} -constexpr auto Rule::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Rule_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Rule::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Rule::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Rule::ByteSizeLong, - &Rule::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Rule, _impl_._cached_size_), - false, - }, - &Rule::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Rule_class_data_ = - Rule::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Rule::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Rule_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Rule_class_data_.tc_table); - return Rule_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 0, 0, 2> -Rule::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Rule, _impl_._has_bits_), - 0, // no _extensions_ - 3, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967288, // skipmap - offsetof(decltype(_table_), field_entries), - 3, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - Rule_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Rule>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional string id = 1; - {::_pbi::TcParser::FastBS1, - {10, 0, 0, - PROTOBUF_FIELD_OFFSET(Rule, _impl_.id_)}}, - // optional string message = 2; - {::_pbi::TcParser::FastBS1, - {18, 1, 0, - PROTOBUF_FIELD_OFFSET(Rule, _impl_.message_)}}, - // optional string expression = 3; - {::_pbi::TcParser::FastBS1, - {26, 2, 0, - PROTOBUF_FIELD_OFFSET(Rule, _impl_.expression_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional string id = 1; - {PROTOBUF_FIELD_OFFSET(Rule, _impl_.id_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string message = 2; - {PROTOBUF_FIELD_OFFSET(Rule, _impl_.message_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string expression = 3; - {PROTOBUF_FIELD_OFFSET(Rule, _impl_.expression_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void Rule::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Rule) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _impl_.id_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _impl_.message_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _impl_.expression_.ClearNonDefaultToEmpty(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Rule::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Rule& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Rule::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Rule& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Rule) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string id = 1; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - const ::std::string& _s = this_._internal_id(); - target = stream->WriteStringMaybeAliased(1, _s, target); - } - - // optional string message = 2; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - const ::std::string& _s = this_._internal_message(); - target = stream->WriteStringMaybeAliased(2, _s, target); - } - - // optional string expression = 3; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - const ::std::string& _s = this_._internal_expression(); - target = stream->WriteStringMaybeAliased(3, _s, target); - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Rule) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Rule::ByteSizeLong(const MessageLite& base) { - const Rule& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Rule::ByteSizeLong() const { - const Rule& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Rule) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // optional string id = 1; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_id()); - } - // optional string message = 2; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_message()); - } - // optional string expression = 3; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_expression()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Rule::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Rule) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _this->_internal_set_id(from._internal_id()); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_internal_set_message(from._internal_message()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_internal_set_expression(from._internal_expression()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Rule::CopyFrom(const Rule& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Rule) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void Rule::InternalSwap(Rule* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.id_, &other->_impl_.id_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.message_, &other->_impl_.message_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.expression_, &other->_impl_.expression_, arena); -} - -::google::protobuf::Metadata Rule::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class MessageRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(MessageRules, _impl_._has_bits_); -}; - -MessageRules::MessageRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MessageRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.MessageRules) -} -PROTOBUF_NDEBUG_INLINE MessageRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::MessageRules& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - cel_{visibility, arena, from.cel_}, - oneof_{visibility, arena, from.oneof_}, - cel_expression_{visibility, arena, from.cel_expression_} {} - -MessageRules::MessageRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const MessageRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MessageRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - MessageRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.MessageRules) -} -PROTOBUF_NDEBUG_INLINE MessageRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - cel_{visibility, arena}, - oneof_{visibility, arena}, - cel_expression_{visibility, arena} {} - -inline void MessageRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -MessageRules::~MessageRules() { - // @@protoc_insertion_point(destructor:buf.validate.MessageRules) - SharedDtor(*this); -} -inline void MessageRules::SharedDtor(MessageLite& self) { - MessageRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL MessageRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) MessageRules(arena); -} -constexpr auto MessageRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_expression_) + - decltype(MessageRules::_impl_.cel_expression_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_) + - decltype(MessageRules::_impl_.cel_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.oneof_) + - decltype(MessageRules::_impl_.oneof_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(MessageRules), alignof(MessageRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&MessageRules::PlacementNew_, - sizeof(MessageRules), - alignof(MessageRules)); - } -} -constexpr auto MessageRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_MessageRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &MessageRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &MessageRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &MessageRules::ByteSizeLong, - &MessageRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_._cached_size_), - false, - }, - &MessageRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull MessageRules_class_data_ = - MessageRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -MessageRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&MessageRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(MessageRules_class_data_.tc_table); - return MessageRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 3, 2, 0, 2> -MessageRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_._has_bits_), - 0, // no _extensions_ - 5, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967267, // skipmap - offsetof(decltype(_table_), field_entries), - 3, // num_field_entries - 2, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - MessageRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::MessageRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .buf.validate.MessageOneofRule oneof = 4; - {::_pbi::TcParser::FastMtR1, - {34, 1, 1, - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.oneof_)}}, - // repeated string cel_expression = 5; - {::_pbi::TcParser::FastBR1, - {42, 2, 0, - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_expression_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated .buf.validate.Rule cel = 3; - {::_pbi::TcParser::FastMtR1, - {26, 0, 0, - PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated .buf.validate.Rule cel = 3; - {PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .buf.validate.MessageOneofRule oneof = 4; - {PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.oneof_), _Internal::kHasBitsOffset + 1, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated string cel_expression = 5; - {PROTOBUF_FIELD_OFFSET(MessageRules, _impl_.cel_expression_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::Rule>()}, - {::_pbi::TcParser::GetTable<::buf::validate::MessageOneofRule>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void MessageRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.MessageRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.cel_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.oneof_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.cel_expression_.Clear(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL MessageRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const MessageRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL MessageRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const MessageRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.MessageRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated .buf.validate.Rule cel = 3; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_cel_size()); - i < n; i++) { - const auto& repfield = this_._internal_cel().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // repeated .buf.validate.MessageOneofRule oneof = 4; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_oneof_size()); - i < n; i++) { - const auto& repfield = this_._internal_oneof().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // repeated string cel_expression = 5; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_cel_expression_size(); i < n; ++i) { - const auto& s = this_._internal_cel_expression().Get(i); - target = stream->WriteString(5, s, target); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.MessageRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t MessageRules::ByteSizeLong(const MessageLite& base) { - const MessageRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t MessageRules::ByteSizeLong() const { - const MessageRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.MessageRules) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // repeated .buf.validate.Rule cel = 3; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_cel_size(); - for (const auto& msg : this_._internal_cel()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .buf.validate.MessageOneofRule oneof = 4; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_oneof_size(); - for (const auto& msg : this_._internal_oneof()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated string cel_expression = 5; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_cel_expression().size()); - for (int i = 0, n = this_._internal_cel_expression().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_cel_expression().Get(i)); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void MessageRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.MessageRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_cel()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_cel()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_oneof()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_oneof()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_cel_expression()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_cel_expression()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void MessageRules::CopyFrom(const MessageRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.MessageRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void MessageRules::InternalSwap(MessageRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.cel_.InternalSwap(&other->_impl_.cel_); - _impl_.oneof_.InternalSwap(&other->_impl_.oneof_); - _impl_.cel_expression_.InternalSwap(&other->_impl_.cel_expression_); -} - -::google::protobuf::Metadata MessageRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class MessageOneofRule::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_._has_bits_); -}; - -MessageOneofRule::MessageOneofRule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MessageOneofRule_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.MessageOneofRule) -} -PROTOBUF_NDEBUG_INLINE MessageOneofRule::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::MessageOneofRule& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - fields_{visibility, arena, from.fields_} {} - -MessageOneofRule::MessageOneofRule( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const MessageOneofRule& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MessageOneofRule_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - MessageOneofRule* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_.required_ = from._impl_.required_; - - // @@protoc_insertion_point(copy_constructor:buf.validate.MessageOneofRule) -} -PROTOBUF_NDEBUG_INLINE MessageOneofRule::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - fields_{visibility, arena} {} - -inline void MessageOneofRule::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.required_ = {}; -} -MessageOneofRule::~MessageOneofRule() { - // @@protoc_insertion_point(destructor:buf.validate.MessageOneofRule) - SharedDtor(*this); -} -inline void MessageOneofRule::SharedDtor(MessageLite& self) { - MessageOneofRule& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL MessageOneofRule::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) MessageOneofRule(arena); -} -constexpr auto MessageOneofRule::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_.fields_) + - decltype(MessageOneofRule::_impl_.fields_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(MessageOneofRule), alignof(MessageOneofRule), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&MessageOneofRule::PlacementNew_, - sizeof(MessageOneofRule), - alignof(MessageOneofRule)); - } -} -constexpr auto MessageOneofRule::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_MessageOneofRule_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &MessageOneofRule::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &MessageOneofRule::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &MessageOneofRule::ByteSizeLong, - &MessageOneofRule::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_._cached_size_), - false, - }, - &MessageOneofRule::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull MessageOneofRule_class_data_ = - MessageOneofRule::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -MessageOneofRule::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&MessageOneofRule_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(MessageOneofRule_class_data_.tc_table); - return MessageOneofRule_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> -MessageOneofRule::_table_ = { - { - PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_._has_bits_), - 0, // no _extensions_ - 2, 8, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap - offsetof(decltype(_table_), field_entries), - 2, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - MessageOneofRule_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::MessageOneofRule>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // optional bool required = 2; - {::_pbi::TcParser::SingularVarintNoZag1(), - {16, 1, 0, - PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_.required_)}}, - // repeated string fields = 1; - {::_pbi::TcParser::FastBR1, - {10, 0, 0, - PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_.fields_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated string fields = 1; - {PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_.fields_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // optional bool required = 2; - {PROTOBUF_FIELD_OFFSET(MessageOneofRule, _impl_.required_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void MessageOneofRule::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.MessageOneofRule) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.fields_.Clear(); - } - _impl_.required_ = false; - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL MessageOneofRule::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const MessageOneofRule& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL MessageOneofRule::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const MessageOneofRule& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.MessageOneofRule) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated string fields = 1; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_fields_size(); i < n; ++i) { - const auto& s = this_._internal_fields().Get(i); - target = stream->WriteString(1, s, target); - } - } - - // optional bool required = 2; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_required(), target); - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.MessageOneofRule) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t MessageOneofRule::ByteSizeLong(const MessageLite& base) { - const MessageOneofRule& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t MessageOneofRule::ByteSizeLong() const { - const MessageOneofRule& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.MessageOneofRule) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000002U & cached_has_bits) * 2; - { - // repeated string fields = 1; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_fields().size()); - for (int i = 0, n = this_._internal_fields().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_fields().Get(i)); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void MessageOneofRule::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.MessageOneofRule) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_fields()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_fields()); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_impl_.required_ = from._impl_.required_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void MessageOneofRule::CopyFrom(const MessageOneofRule& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.MessageOneofRule) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void MessageOneofRule::InternalSwap(MessageOneofRule* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.fields_.InternalSwap(&other->_impl_.fields_); - swap(_impl_.required_, other->_impl_.required_); -} - -::google::protobuf::Metadata MessageOneofRule::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class OneofRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(OneofRules, _impl_._has_bits_); -}; - -OneofRules::OneofRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, OneofRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.OneofRules) -} -OneofRules::OneofRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, OneofRules_class_data_.base()), -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena), -#endif // PROTOBUF_CUSTOM_VTABLE - _impl_(from._impl_) { - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} -PROTOBUF_NDEBUG_INLINE OneofRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0} {} - -inline void OneofRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.required_ = {}; -} -OneofRules::~OneofRules() { - // @@protoc_insertion_point(destructor:buf.validate.OneofRules) - SharedDtor(*this); -} -inline void OneofRules::SharedDtor(MessageLite& self) { - OneofRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL OneofRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) OneofRules(arena); -} -constexpr auto OneofRules::InternalNewImpl_() { - return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(OneofRules), - alignof(OneofRules)); -} -constexpr auto OneofRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_OneofRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &OneofRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &OneofRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &OneofRules::ByteSizeLong, - &OneofRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(OneofRules, _impl_._cached_size_), - false, - }, - &OneofRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull OneofRules_class_data_ = - OneofRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -OneofRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&OneofRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(OneofRules_class_data_.tc_table); - return OneofRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 0, 0, 2> -OneofRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(OneofRules, _impl_._has_bits_), - 0, // no _extensions_ - 1, 0, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967294, // skipmap - offsetof(decltype(_table_), field_entries), - 1, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - OneofRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::OneofRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // optional bool required = 1; - {::_pbi::TcParser::SingularVarintNoZag1(), - {8, 0, 0, - PROTOBUF_FIELD_OFFSET(OneofRules, _impl_.required_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional bool required = 1; - {PROTOBUF_FIELD_OFFSET(OneofRules, _impl_.required_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void OneofRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.OneofRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_.required_ = false; - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL OneofRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const OneofRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL OneofRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const OneofRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.OneofRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool required = 1; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_required(), target); - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.OneofRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t OneofRules::ByteSizeLong(const MessageLite& base) { - const OneofRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t OneofRules::ByteSizeLong() const { - const OneofRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.OneofRules) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000001U & cached_has_bits) * 2; - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void OneofRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.OneofRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _this->_impl_.required_ = from._impl_.required_; - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void OneofRules::CopyFrom(const OneofRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.OneofRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void OneofRules::InternalSwap(OneofRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - swap(_impl_.required_, other->_impl_.required_); -} - -::google::protobuf::Metadata OneofRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class FieldRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(FieldRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldRules, _impl_._oneof_case_); -}; - -void FieldRules::set_allocated_float_(::buf::validate::FloatRules* PROTOBUF_NULLABLE float_) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (float_) { - ::google::protobuf::Arena* submessage_arena = float_->GetArena(); - if (message_arena != submessage_arena) { - float_ = ::google::protobuf::internal::GetOwnedMessage(message_arena, float_, submessage_arena); - } - set_has_float_(); - _impl_.type_.float__ = float_; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.float) -} -void FieldRules::set_allocated_double_(::buf::validate::DoubleRules* PROTOBUF_NULLABLE double_) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (double_) { - ::google::protobuf::Arena* submessage_arena = double_->GetArena(); - if (message_arena != submessage_arena) { - double_ = ::google::protobuf::internal::GetOwnedMessage(message_arena, double_, submessage_arena); - } - set_has_double_(); - _impl_.type_.double__ = double_; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.double) -} -void FieldRules::set_allocated_int32(::buf::validate::Int32Rules* PROTOBUF_NULLABLE int32) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (int32) { - ::google::protobuf::Arena* submessage_arena = int32->GetArena(); - if (message_arena != submessage_arena) { - int32 = ::google::protobuf::internal::GetOwnedMessage(message_arena, int32, submessage_arena); - } - set_has_int32(); - _impl_.type_.int32_ = int32; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.int32) -} -void FieldRules::set_allocated_int64(::buf::validate::Int64Rules* PROTOBUF_NULLABLE int64) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (int64) { - ::google::protobuf::Arena* submessage_arena = int64->GetArena(); - if (message_arena != submessage_arena) { - int64 = ::google::protobuf::internal::GetOwnedMessage(message_arena, int64, submessage_arena); - } - set_has_int64(); - _impl_.type_.int64_ = int64; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.int64) -} -void FieldRules::set_allocated_uint32(::buf::validate::UInt32Rules* PROTOBUF_NULLABLE uint32) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (uint32) { - ::google::protobuf::Arena* submessage_arena = uint32->GetArena(); - if (message_arena != submessage_arena) { - uint32 = ::google::protobuf::internal::GetOwnedMessage(message_arena, uint32, submessage_arena); - } - set_has_uint32(); - _impl_.type_.uint32_ = uint32; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.uint32) -} -void FieldRules::set_allocated_uint64(::buf::validate::UInt64Rules* PROTOBUF_NULLABLE uint64) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (uint64) { - ::google::protobuf::Arena* submessage_arena = uint64->GetArena(); - if (message_arena != submessage_arena) { - uint64 = ::google::protobuf::internal::GetOwnedMessage(message_arena, uint64, submessage_arena); - } - set_has_uint64(); - _impl_.type_.uint64_ = uint64; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.uint64) -} -void FieldRules::set_allocated_sint32(::buf::validate::SInt32Rules* PROTOBUF_NULLABLE sint32) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (sint32) { - ::google::protobuf::Arena* submessage_arena = sint32->GetArena(); - if (message_arena != submessage_arena) { - sint32 = ::google::protobuf::internal::GetOwnedMessage(message_arena, sint32, submessage_arena); - } - set_has_sint32(); - _impl_.type_.sint32_ = sint32; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.sint32) -} -void FieldRules::set_allocated_sint64(::buf::validate::SInt64Rules* PROTOBUF_NULLABLE sint64) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (sint64) { - ::google::protobuf::Arena* submessage_arena = sint64->GetArena(); - if (message_arena != submessage_arena) { - sint64 = ::google::protobuf::internal::GetOwnedMessage(message_arena, sint64, submessage_arena); - } - set_has_sint64(); - _impl_.type_.sint64_ = sint64; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.sint64) -} -void FieldRules::set_allocated_fixed32(::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE fixed32) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (fixed32) { - ::google::protobuf::Arena* submessage_arena = fixed32->GetArena(); - if (message_arena != submessage_arena) { - fixed32 = ::google::protobuf::internal::GetOwnedMessage(message_arena, fixed32, submessage_arena); - } - set_has_fixed32(); - _impl_.type_.fixed32_ = fixed32; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.fixed32) -} -void FieldRules::set_allocated_fixed64(::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE fixed64) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (fixed64) { - ::google::protobuf::Arena* submessage_arena = fixed64->GetArena(); - if (message_arena != submessage_arena) { - fixed64 = ::google::protobuf::internal::GetOwnedMessage(message_arena, fixed64, submessage_arena); - } - set_has_fixed64(); - _impl_.type_.fixed64_ = fixed64; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.fixed64) -} -void FieldRules::set_allocated_sfixed32(::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE sfixed32) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (sfixed32) { - ::google::protobuf::Arena* submessage_arena = sfixed32->GetArena(); - if (message_arena != submessage_arena) { - sfixed32 = ::google::protobuf::internal::GetOwnedMessage(message_arena, sfixed32, submessage_arena); - } - set_has_sfixed32(); - _impl_.type_.sfixed32_ = sfixed32; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.sfixed32) -} -void FieldRules::set_allocated_sfixed64(::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE sfixed64) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (sfixed64) { - ::google::protobuf::Arena* submessage_arena = sfixed64->GetArena(); - if (message_arena != submessage_arena) { - sfixed64 = ::google::protobuf::internal::GetOwnedMessage(message_arena, sfixed64, submessage_arena); - } - set_has_sfixed64(); - _impl_.type_.sfixed64_ = sfixed64; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.sfixed64) -} -void FieldRules::set_allocated_bool_(::buf::validate::BoolRules* PROTOBUF_NULLABLE bool_) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (bool_) { - ::google::protobuf::Arena* submessage_arena = bool_->GetArena(); - if (message_arena != submessage_arena) { - bool_ = ::google::protobuf::internal::GetOwnedMessage(message_arena, bool_, submessage_arena); - } - set_has_bool_(); - _impl_.type_.bool__ = bool_; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.bool) -} -void FieldRules::set_allocated_string(::buf::validate::StringRules* PROTOBUF_NULLABLE string) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (string) { - ::google::protobuf::Arena* submessage_arena = string->GetArena(); - if (message_arena != submessage_arena) { - string = ::google::protobuf::internal::GetOwnedMessage(message_arena, string, submessage_arena); - } - set_has_string(); - _impl_.type_.string_ = string; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.string) -} -void FieldRules::set_allocated_bytes(::buf::validate::BytesRules* PROTOBUF_NULLABLE bytes) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (bytes) { - ::google::protobuf::Arena* submessage_arena = bytes->GetArena(); - if (message_arena != submessage_arena) { - bytes = ::google::protobuf::internal::GetOwnedMessage(message_arena, bytes, submessage_arena); - } - set_has_bytes(); - _impl_.type_.bytes_ = bytes; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.bytes) -} -void FieldRules::set_allocated_enum_(::buf::validate::EnumRules* PROTOBUF_NULLABLE enum_) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (enum_) { - ::google::protobuf::Arena* submessage_arena = enum_->GetArena(); - if (message_arena != submessage_arena) { - enum_ = ::google::protobuf::internal::GetOwnedMessage(message_arena, enum_, submessage_arena); - } - set_has_enum_(); - _impl_.type_.enum__ = enum_; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.enum) -} -void FieldRules::set_allocated_repeated(::buf::validate::RepeatedRules* PROTOBUF_NULLABLE repeated) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (repeated) { - ::google::protobuf::Arena* submessage_arena = repeated->GetArena(); - if (message_arena != submessage_arena) { - repeated = ::google::protobuf::internal::GetOwnedMessage(message_arena, repeated, submessage_arena); - } - set_has_repeated(); - _impl_.type_.repeated_ = repeated; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.repeated) -} -void FieldRules::set_allocated_map(::buf::validate::MapRules* PROTOBUF_NULLABLE map) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (map) { - ::google::protobuf::Arena* submessage_arena = map->GetArena(); - if (message_arena != submessage_arena) { - map = ::google::protobuf::internal::GetOwnedMessage(message_arena, map, submessage_arena); - } - set_has_map(); - _impl_.type_.map_ = map; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.map) -} -void FieldRules::set_allocated_any(::buf::validate::AnyRules* PROTOBUF_NULLABLE any) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (any) { - ::google::protobuf::Arena* submessage_arena = any->GetArena(); - if (message_arena != submessage_arena) { - any = ::google::protobuf::internal::GetOwnedMessage(message_arena, any, submessage_arena); - } - set_has_any(); - _impl_.type_.any_ = any; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.any) -} -void FieldRules::set_allocated_duration(::buf::validate::DurationRules* PROTOBUF_NULLABLE duration) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (duration) { - ::google::protobuf::Arena* submessage_arena = duration->GetArena(); - if (message_arena != submessage_arena) { - duration = ::google::protobuf::internal::GetOwnedMessage(message_arena, duration, submessage_arena); - } - set_has_duration(); - _impl_.type_.duration_ = duration; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.duration) -} -void FieldRules::set_allocated_field_mask(::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE field_mask) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (field_mask) { - ::google::protobuf::Arena* submessage_arena = field_mask->GetArena(); - if (message_arena != submessage_arena) { - field_mask = ::google::protobuf::internal::GetOwnedMessage(message_arena, field_mask, submessage_arena); - } - set_has_field_mask(); - _impl_.type_.field_mask_ = field_mask; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.field_mask) -} -void FieldRules::set_allocated_timestamp(::buf::validate::TimestampRules* PROTOBUF_NULLABLE timestamp) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_type(); - if (timestamp) { - ::google::protobuf::Arena* submessage_arena = timestamp->GetArena(); - if (message_arena != submessage_arena) { - timestamp = ::google::protobuf::internal::GetOwnedMessage(message_arena, timestamp, submessage_arena); - } - set_has_timestamp(); - _impl_.type_.timestamp_ = timestamp; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldRules.timestamp) -} -FieldRules::FieldRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.FieldRules) -} -PROTOBUF_NDEBUG_INLINE FieldRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::FieldRules& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - cel_{visibility, arena, from.cel_}, - cel_expression_{visibility, arena, from.cel_expression_}, - type_{}, - _oneof_case_{from._oneof_case_[0]} {} - -FieldRules::FieldRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const FieldRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - FieldRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, required_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, required_), - offsetof(Impl_, ignore_) - - offsetof(Impl_, required_) + - sizeof(Impl_::ignore_)); - switch (type_case()) { - case TYPE_NOT_SET: - break; - case kFloat: - _impl_.type_.float__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.float__); - break; - case kDouble: - _impl_.type_.double__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.double__); - break; - case kInt32: - _impl_.type_.int32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.int32_); - break; - case kInt64: - _impl_.type_.int64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.int64_); - break; - case kUint32: - _impl_.type_.uint32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.uint32_); - break; - case kUint64: - _impl_.type_.uint64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.uint64_); - break; - case kSint32: - _impl_.type_.sint32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sint32_); - break; - case kSint64: - _impl_.type_.sint64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sint64_); - break; - case kFixed32: - _impl_.type_.fixed32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.fixed32_); - break; - case kFixed64: - _impl_.type_.fixed64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.fixed64_); - break; - case kSfixed32: - _impl_.type_.sfixed32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sfixed32_); - break; - case kSfixed64: - _impl_.type_.sfixed64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sfixed64_); - break; - case kBool: - _impl_.type_.bool__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.bool__); - break; - case kString: - _impl_.type_.string_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.string_); - break; - case kBytes: - _impl_.type_.bytes_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.bytes_); - break; - case kEnum: - _impl_.type_.enum__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.enum__); - break; - case kRepeated: - _impl_.type_.repeated_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.repeated_); - break; - case kMap: - _impl_.type_.map_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.map_); - break; - case kAny: - _impl_.type_.any_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.any_); - break; - case kDuration: - _impl_.type_.duration_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.duration_); - break; - case kFieldMask: - _impl_.type_.field_mask_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.field_mask_); - break; - case kTimestamp: - _impl_.type_.timestamp_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.timestamp_); - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.FieldRules) -} -PROTOBUF_NDEBUG_INLINE FieldRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - cel_{visibility, arena}, - cel_expression_{visibility, arena}, - type_{}, - _oneof_case_{} {} - -inline void FieldRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, required_), - 0, - offsetof(Impl_, ignore_) - - offsetof(Impl_, required_) + - sizeof(Impl_::ignore_)); -} -FieldRules::~FieldRules() { - // @@protoc_insertion_point(destructor:buf.validate.FieldRules) - SharedDtor(*this); -} -inline void FieldRules::SharedDtor(MessageLite& self) { - FieldRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_type()) { - this_.clear_type(); - } - this_._impl_.~Impl_(); -} - -void FieldRules::clear_type() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.FieldRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (type_case()) { - case kFloat: { - if (GetArena() == nullptr) { - delete _impl_.type_.float__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.float__); - } - break; - } - case kDouble: { - if (GetArena() == nullptr) { - delete _impl_.type_.double__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.double__); - } - break; - } - case kInt32: { - if (GetArena() == nullptr) { - delete _impl_.type_.int32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.int32_); - } - break; - } - case kInt64: { - if (GetArena() == nullptr) { - delete _impl_.type_.int64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.int64_); - } - break; - } - case kUint32: { - if (GetArena() == nullptr) { - delete _impl_.type_.uint32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.uint32_); - } - break; - } - case kUint64: { - if (GetArena() == nullptr) { - delete _impl_.type_.uint64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.uint64_); - } - break; - } - case kSint32: { - if (GetArena() == nullptr) { - delete _impl_.type_.sint32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sint32_); - } - break; - } - case kSint64: { - if (GetArena() == nullptr) { - delete _impl_.type_.sint64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sint64_); - } - break; - } - case kFixed32: { - if (GetArena() == nullptr) { - delete _impl_.type_.fixed32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.fixed32_); - } - break; - } - case kFixed64: { - if (GetArena() == nullptr) { - delete _impl_.type_.fixed64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.fixed64_); - } - break; - } - case kSfixed32: { - if (GetArena() == nullptr) { - delete _impl_.type_.sfixed32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sfixed32_); - } - break; - } - case kSfixed64: { - if (GetArena() == nullptr) { - delete _impl_.type_.sfixed64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sfixed64_); - } - break; - } - case kBool: { - if (GetArena() == nullptr) { - delete _impl_.type_.bool__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.bool__); - } - break; - } - case kString: { - if (GetArena() == nullptr) { - delete _impl_.type_.string_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.string_); - } - break; - } - case kBytes: { - if (GetArena() == nullptr) { - delete _impl_.type_.bytes_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.bytes_); - } - break; - } - case kEnum: { - if (GetArena() == nullptr) { - delete _impl_.type_.enum__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.enum__); - } - break; - } - case kRepeated: { - if (GetArena() == nullptr) { - delete _impl_.type_.repeated_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.repeated_); - } - break; - } - case kMap: { - if (GetArena() == nullptr) { - delete _impl_.type_.map_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.map_); - } - break; - } - case kAny: { - if (GetArena() == nullptr) { - delete _impl_.type_.any_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.any_); - } - break; - } - case kDuration: { - if (GetArena() == nullptr) { - delete _impl_.type_.duration_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.duration_); - } - break; - } - case kFieldMask: { - if (GetArena() == nullptr) { - delete _impl_.type_.field_mask_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.field_mask_); - } - break; - } - case kTimestamp: { - if (GetArena() == nullptr) { - delete _impl_.type_.timestamp_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.timestamp_); - } - break; - } - case TYPE_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = TYPE_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL FieldRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) FieldRules(arena); -} -constexpr auto FieldRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_expression_) + - decltype(FieldRules::_impl_.cel_expression_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_) + - decltype(FieldRules::_impl_.cel_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(FieldRules), alignof(FieldRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&FieldRules::PlacementNew_, - sizeof(FieldRules), - alignof(FieldRules)); - } -} -constexpr auto FieldRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_FieldRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FieldRules::IsInitializedImpl, - &FieldRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &FieldRules::ByteSizeLong, - &FieldRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_._cached_size_), - false, - }, - &FieldRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull FieldRules_class_data_ = - FieldRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -FieldRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&FieldRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(FieldRules_class_data_.tc_table); - return FieldRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 26, 24, 0, 2> -FieldRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_._has_bits_), - 0, // no _extensions_ - 29, 56, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 3800104960, // skipmap - offsetof(decltype(_table_), field_entries), - 26, // num_field_entries - 24, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - FieldRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::FieldRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional bool required = 25; - {::_pbi::TcParser::FastV8S2, - {456, 2, 0, - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.required_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional .buf.validate.Ignore ignore = 27; - {::_pbi::TcParser::FastEvS2, - {472, 3, 23, - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.ignore_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated string cel_expression = 29; - {::_pbi::TcParser::FastBR2, - {490, 1, 0, - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_expression_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated .buf.validate.Rule cel = 23; - {::_pbi::TcParser::FastMtR2, - {442, 0, 21, - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // .buf.validate.FloatRules float = 1; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.float__), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.DoubleRules double = 2; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.double__), _Internal::kOneofCaseOffset + 0, 1, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.Int32Rules int32 = 3; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.int32_), _Internal::kOneofCaseOffset + 0, 2, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.Int64Rules int64 = 4; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.int64_), _Internal::kOneofCaseOffset + 0, 3, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.UInt32Rules uint32 = 5; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.uint32_), _Internal::kOneofCaseOffset + 0, 4, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.UInt64Rules uint64 = 6; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.uint64_), _Internal::kOneofCaseOffset + 0, 5, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.SInt32Rules sint32 = 7; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.sint32_), _Internal::kOneofCaseOffset + 0, 6, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.SInt64Rules sint64 = 8; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.sint64_), _Internal::kOneofCaseOffset + 0, 7, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.Fixed32Rules fixed32 = 9; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.fixed32_), _Internal::kOneofCaseOffset + 0, 8, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.Fixed64Rules fixed64 = 10; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.fixed64_), _Internal::kOneofCaseOffset + 0, 9, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.SFixed32Rules sfixed32 = 11; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.sfixed32_), _Internal::kOneofCaseOffset + 0, 10, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.SFixed64Rules sfixed64 = 12; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.sfixed64_), _Internal::kOneofCaseOffset + 0, 11, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.BoolRules bool = 13; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.bool__), _Internal::kOneofCaseOffset + 0, 12, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.StringRules string = 14; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.string_), _Internal::kOneofCaseOffset + 0, 13, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.BytesRules bytes = 15; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.bytes_), _Internal::kOneofCaseOffset + 0, 14, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.EnumRules enum = 16; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.enum__), _Internal::kOneofCaseOffset + 0, 15, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.RepeatedRules repeated = 18; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.repeated_), _Internal::kOneofCaseOffset + 0, 16, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.MapRules map = 19; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.map_), _Internal::kOneofCaseOffset + 0, 17, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.AnyRules any = 20; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.any_), _Internal::kOneofCaseOffset + 0, 18, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.DurationRules duration = 21; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.duration_), _Internal::kOneofCaseOffset + 0, 19, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .buf.validate.TimestampRules timestamp = 22; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.timestamp_), _Internal::kOneofCaseOffset + 0, 20, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .buf.validate.Rule cel = 23; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_), _Internal::kHasBitsOffset + 0, 21, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // optional bool required = 25; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.required_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // optional .buf.validate.Ignore ignore = 27; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.ignore_), _Internal::kHasBitsOffset + 3, 23, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, - // .buf.validate.FieldMaskRules field_mask = 28; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.type_.field_mask_), _Internal::kOneofCaseOffset + 0, 22, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated string cel_expression = 29; - {PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.cel_expression_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::FloatRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::DoubleRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::Int32Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::Int64Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::UInt32Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::UInt64Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::SInt32Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::SInt64Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::Fixed32Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::Fixed64Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::SFixed32Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::SFixed64Rules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::BoolRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::StringRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::BytesRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::EnumRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::RepeatedRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::MapRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::AnyRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::DurationRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::TimestampRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::Rule>()}, - {::_pbi::TcParser::GetTable<::buf::validate::FieldMaskRules>()}, - {::_pbi::FieldAuxEnumData{}, ::buf::validate::Ignore_internal_data_}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void FieldRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.FieldRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.cel_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.cel_expression_.Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000000cU)) { - ::memset(&_impl_.required_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.ignore_) - - reinterpret_cast(&_impl_.required_)) + sizeof(_impl_.ignore_)); - } - clear_type(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL FieldRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const FieldRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL FieldRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const FieldRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.FieldRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - switch (this_.type_case()) { - case kFloat: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, *this_._impl_.type_.float__, this_._impl_.type_.float__->GetCachedSize(), target, - stream); - break; - } - case kDouble: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.type_.double__, this_._impl_.type_.double__->GetCachedSize(), target, - stream); - break; - } - case kInt32: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.type_.int32_, this_._impl_.type_.int32_->GetCachedSize(), target, - stream); - break; - } - case kInt64: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.type_.int64_, this_._impl_.type_.int64_->GetCachedSize(), target, - stream); - break; - } - case kUint32: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.type_.uint32_, this_._impl_.type_.uint32_->GetCachedSize(), target, - stream); - break; - } - case kUint64: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, *this_._impl_.type_.uint64_, this_._impl_.type_.uint64_->GetCachedSize(), target, - stream); - break; - } - case kSint32: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 7, *this_._impl_.type_.sint32_, this_._impl_.type_.sint32_->GetCachedSize(), target, - stream); - break; - } - case kSint64: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, *this_._impl_.type_.sint64_, this_._impl_.type_.sint64_->GetCachedSize(), target, - stream); - break; - } - case kFixed32: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, *this_._impl_.type_.fixed32_, this_._impl_.type_.fixed32_->GetCachedSize(), target, - stream); - break; - } - case kFixed64: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 10, *this_._impl_.type_.fixed64_, this_._impl_.type_.fixed64_->GetCachedSize(), target, - stream); - break; - } - case kSfixed32: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 11, *this_._impl_.type_.sfixed32_, this_._impl_.type_.sfixed32_->GetCachedSize(), target, - stream); - break; - } - case kSfixed64: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 12, *this_._impl_.type_.sfixed64_, this_._impl_.type_.sfixed64_->GetCachedSize(), target, - stream); - break; - } - case kBool: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 13, *this_._impl_.type_.bool__, this_._impl_.type_.bool__->GetCachedSize(), target, - stream); - break; - } - case kString: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 14, *this_._impl_.type_.string_, this_._impl_.type_.string_->GetCachedSize(), target, - stream); - break; - } - case kBytes: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 15, *this_._impl_.type_.bytes_, this_._impl_.type_.bytes_->GetCachedSize(), target, - stream); - break; - } - case kEnum: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 16, *this_._impl_.type_.enum__, this_._impl_.type_.enum__->GetCachedSize(), target, - stream); - break; - } - case kRepeated: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 18, *this_._impl_.type_.repeated_, this_._impl_.type_.repeated_->GetCachedSize(), target, - stream); - break; - } - case kMap: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 19, *this_._impl_.type_.map_, this_._impl_.type_.map_->GetCachedSize(), target, - stream); - break; - } - case kAny: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 20, *this_._impl_.type_.any_, this_._impl_.type_.any_->GetCachedSize(), target, - stream); - break; - } - case kDuration: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 21, *this_._impl_.type_.duration_, this_._impl_.type_.duration_->GetCachedSize(), target, - stream); - break; - } - case kTimestamp: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 22, *this_._impl_.type_.timestamp_, this_._impl_.type_.timestamp_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated .buf.validate.Rule cel = 23; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_cel_size()); - i < n; i++) { - const auto& repfield = this_._internal_cel().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 23, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // optional bool required = 25; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 25, this_._internal_required(), target); - } - - // optional .buf.validate.Ignore ignore = 27; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 27, this_._internal_ignore(), target); - } - - // .buf.validate.FieldMaskRules field_mask = 28; - if (this_.type_case() == kFieldMask) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 28, *this_._impl_.type_.field_mask_, this_._impl_.type_.field_mask_->GetCachedSize(), target, - stream); - } - - // repeated string cel_expression = 29; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_cel_expression_size(); i < n; ++i) { - const auto& s = this_._internal_cel_expression().Get(i); - target = stream->WriteString(29, s, target); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.FieldRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t FieldRules::ByteSizeLong(const MessageLite& base) { - const FieldRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t FieldRules::ByteSizeLong() const { - const FieldRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.FieldRules) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000004U & cached_has_bits) * 3; - if (BatchCheckHasBit(cached_has_bits, 0x0000000bU)) { - // repeated .buf.validate.Rule cel = 23; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 2UL * this_._internal_cel_size(); - for (const auto& msg : this_._internal_cel()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated string cel_expression = 29; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += - 2 * ::google::protobuf::internal::FromIntSize(this_._internal_cel_expression().size()); - for (int i = 0, n = this_._internal_cel_expression().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_cel_expression().Get(i)); - } - } - // optional .buf.validate.Ignore ignore = 27; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_ignore()); - } - } - switch (this_.type_case()) { - // .buf.validate.FloatRules float = 1; - case kFloat: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.float__); - break; - } - // .buf.validate.DoubleRules double = 2; - case kDouble: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.double__); - break; - } - // .buf.validate.Int32Rules int32 = 3; - case kInt32: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.int32_); - break; - } - // .buf.validate.Int64Rules int64 = 4; - case kInt64: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.int64_); - break; - } - // .buf.validate.UInt32Rules uint32 = 5; - case kUint32: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.uint32_); - break; - } - // .buf.validate.UInt64Rules uint64 = 6; - case kUint64: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.uint64_); - break; - } - // .buf.validate.SInt32Rules sint32 = 7; - case kSint32: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.sint32_); - break; - } - // .buf.validate.SInt64Rules sint64 = 8; - case kSint64: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.sint64_); - break; - } - // .buf.validate.Fixed32Rules fixed32 = 9; - case kFixed32: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.fixed32_); - break; - } - // .buf.validate.Fixed64Rules fixed64 = 10; - case kFixed64: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.fixed64_); - break; - } - // .buf.validate.SFixed32Rules sfixed32 = 11; - case kSfixed32: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.sfixed32_); - break; - } - // .buf.validate.SFixed64Rules sfixed64 = 12; - case kSfixed64: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.sfixed64_); - break; - } - // .buf.validate.BoolRules bool = 13; - case kBool: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.bool__); - break; - } - // .buf.validate.StringRules string = 14; - case kString: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.string_); - break; - } - // .buf.validate.BytesRules bytes = 15; - case kBytes: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.bytes_); - break; - } - // .buf.validate.EnumRules enum = 16; - case kEnum: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.enum__); - break; - } - // .buf.validate.RepeatedRules repeated = 18; - case kRepeated: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.repeated_); - break; - } - // .buf.validate.MapRules map = 19; - case kMap: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.map_); - break; - } - // .buf.validate.AnyRules any = 20; - case kAny: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.any_); - break; - } - // .buf.validate.DurationRules duration = 21; - case kDuration: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.duration_); - break; - } - // .buf.validate.FieldMaskRules field_mask = 28; - case kFieldMask: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.field_mask_); - break; - } - // .buf.validate.TimestampRules timestamp = 22; - case kTimestamp: { - total_size += 2 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.type_.timestamp_); - break; - } - case TYPE_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void FieldRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.FieldRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_cel()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_cel()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_cel_expression()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_cel_expression()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.required_ = from._impl_.required_; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.ignore_ = from._impl_.ignore_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_type(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kFloat: { - if (oneof_needs_init) { - _this->_impl_.type_.float__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.float__); - } else { - _this->_impl_.type_.float__->MergeFrom(*from._impl_.type_.float__); - } - break; - } - case kDouble: { - if (oneof_needs_init) { - _this->_impl_.type_.double__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.double__); - } else { - _this->_impl_.type_.double__->MergeFrom(*from._impl_.type_.double__); - } - break; - } - case kInt32: { - if (oneof_needs_init) { - _this->_impl_.type_.int32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.int32_); - } else { - _this->_impl_.type_.int32_->MergeFrom(*from._impl_.type_.int32_); - } - break; - } - case kInt64: { - if (oneof_needs_init) { - _this->_impl_.type_.int64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.int64_); - } else { - _this->_impl_.type_.int64_->MergeFrom(*from._impl_.type_.int64_); - } - break; - } - case kUint32: { - if (oneof_needs_init) { - _this->_impl_.type_.uint32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.uint32_); - } else { - _this->_impl_.type_.uint32_->MergeFrom(*from._impl_.type_.uint32_); - } - break; - } - case kUint64: { - if (oneof_needs_init) { - _this->_impl_.type_.uint64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.uint64_); - } else { - _this->_impl_.type_.uint64_->MergeFrom(*from._impl_.type_.uint64_); - } - break; - } - case kSint32: { - if (oneof_needs_init) { - _this->_impl_.type_.sint32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sint32_); - } else { - _this->_impl_.type_.sint32_->MergeFrom(*from._impl_.type_.sint32_); - } - break; - } - case kSint64: { - if (oneof_needs_init) { - _this->_impl_.type_.sint64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sint64_); - } else { - _this->_impl_.type_.sint64_->MergeFrom(*from._impl_.type_.sint64_); - } - break; - } - case kFixed32: { - if (oneof_needs_init) { - _this->_impl_.type_.fixed32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.fixed32_); - } else { - _this->_impl_.type_.fixed32_->MergeFrom(*from._impl_.type_.fixed32_); - } - break; - } - case kFixed64: { - if (oneof_needs_init) { - _this->_impl_.type_.fixed64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.fixed64_); - } else { - _this->_impl_.type_.fixed64_->MergeFrom(*from._impl_.type_.fixed64_); - } - break; - } - case kSfixed32: { - if (oneof_needs_init) { - _this->_impl_.type_.sfixed32_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sfixed32_); - } else { - _this->_impl_.type_.sfixed32_->MergeFrom(*from._impl_.type_.sfixed32_); - } - break; - } - case kSfixed64: { - if (oneof_needs_init) { - _this->_impl_.type_.sfixed64_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.sfixed64_); - } else { - _this->_impl_.type_.sfixed64_->MergeFrom(*from._impl_.type_.sfixed64_); - } - break; - } - case kBool: { - if (oneof_needs_init) { - _this->_impl_.type_.bool__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.bool__); - } else { - _this->_impl_.type_.bool__->MergeFrom(*from._impl_.type_.bool__); - } - break; - } - case kString: { - if (oneof_needs_init) { - _this->_impl_.type_.string_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.string_); - } else { - _this->_impl_.type_.string_->MergeFrom(*from._impl_.type_.string_); - } - break; - } - case kBytes: { - if (oneof_needs_init) { - _this->_impl_.type_.bytes_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.bytes_); - } else { - _this->_impl_.type_.bytes_->MergeFrom(*from._impl_.type_.bytes_); - } - break; - } - case kEnum: { - if (oneof_needs_init) { - _this->_impl_.type_.enum__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.enum__); - } else { - _this->_impl_.type_.enum__->MergeFrom(*from._impl_.type_.enum__); - } - break; - } - case kRepeated: { - if (oneof_needs_init) { - _this->_impl_.type_.repeated_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.repeated_); - } else { - _this->_impl_.type_.repeated_->MergeFrom(*from._impl_.type_.repeated_); - } - break; - } - case kMap: { - if (oneof_needs_init) { - _this->_impl_.type_.map_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.map_); - } else { - _this->_impl_.type_.map_->MergeFrom(*from._impl_.type_.map_); - } - break; - } - case kAny: { - if (oneof_needs_init) { - _this->_impl_.type_.any_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.any_); - } else { - _this->_impl_.type_.any_->MergeFrom(*from._impl_.type_.any_); - } - break; - } - case kDuration: { - if (oneof_needs_init) { - _this->_impl_.type_.duration_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.duration_); - } else { - _this->_impl_.type_.duration_->MergeFrom(*from._impl_.type_.duration_); - } - break; - } - case kFieldMask: { - if (oneof_needs_init) { - _this->_impl_.type_.field_mask_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.field_mask_); - } else { - _this->_impl_.type_.field_mask_->MergeFrom(*from._impl_.type_.field_mask_); - } - break; - } - case kTimestamp: { - if (oneof_needs_init) { - _this->_impl_.type_.timestamp_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.type_.timestamp_); - } else { - _this->_impl_.type_.timestamp_->MergeFrom(*from._impl_.type_.timestamp_); - } - break; - } - case TYPE_NOT_SET: - break; - } - } - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void FieldRules::CopyFrom(const FieldRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.FieldRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool FieldRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - switch (this_.type_case()) { - case kFloat: { - if (this_.type_case() == kFloat && !this_._impl_.type_.float__->IsInitialized()) - return false; - break; - } - case kDouble: { - if (this_.type_case() == kDouble && !this_._impl_.type_.double__->IsInitialized()) - return false; - break; - } - case kInt32: { - if (this_.type_case() == kInt32 && !this_._impl_.type_.int32_->IsInitialized()) - return false; - break; - } - case kInt64: { - if (this_.type_case() == kInt64 && !this_._impl_.type_.int64_->IsInitialized()) - return false; - break; - } - case kUint32: { - if (this_.type_case() == kUint32 && !this_._impl_.type_.uint32_->IsInitialized()) - return false; - break; - } - case kUint64: { - if (this_.type_case() == kUint64 && !this_._impl_.type_.uint64_->IsInitialized()) - return false; - break; - } - case kSint32: { - if (this_.type_case() == kSint32 && !this_._impl_.type_.sint32_->IsInitialized()) - return false; - break; - } - case kSint64: { - if (this_.type_case() == kSint64 && !this_._impl_.type_.sint64_->IsInitialized()) - return false; - break; - } - case kFixed32: { - if (this_.type_case() == kFixed32 && !this_._impl_.type_.fixed32_->IsInitialized()) - return false; - break; - } - case kFixed64: { - if (this_.type_case() == kFixed64 && !this_._impl_.type_.fixed64_->IsInitialized()) - return false; - break; - } - case kSfixed32: { - if (this_.type_case() == kSfixed32 && !this_._impl_.type_.sfixed32_->IsInitialized()) - return false; - break; - } - case kSfixed64: { - if (this_.type_case() == kSfixed64 && !this_._impl_.type_.sfixed64_->IsInitialized()) - return false; - break; - } - case kBool: { - if (this_.type_case() == kBool && !this_._impl_.type_.bool__->IsInitialized()) - return false; - break; - } - case kString: { - if (this_.type_case() == kString && !this_._impl_.type_.string_->IsInitialized()) - return false; - break; - } - case kBytes: { - if (this_.type_case() == kBytes && !this_._impl_.type_.bytes_->IsInitialized()) - return false; - break; - } - case kEnum: { - if (this_.type_case() == kEnum && !this_._impl_.type_.enum__->IsInitialized()) - return false; - break; - } - case kRepeated: { - if (this_.type_case() == kRepeated && !this_._impl_.type_.repeated_->IsInitialized()) - return false; - break; - } - case kMap: { - if (this_.type_case() == kMap && !this_._impl_.type_.map_->IsInitialized()) - return false; - break; - } - case kAny: { - break; - } - case kDuration: { - if (this_.type_case() == kDuration && !this_._impl_.type_.duration_->IsInitialized()) - return false; - break; - } - case kFieldMask: { - if (this_.type_case() == kFieldMask && !this_._impl_.type_.field_mask_->IsInitialized()) - return false; - break; - } - case kTimestamp: { - if (this_.type_case() == kTimestamp && !this_._impl_.type_.timestamp_->IsInitialized()) - return false; - break; - } - case TYPE_NOT_SET: { - break; - } - } - return true; -} - -void FieldRules::InternalSwap(FieldRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.cel_.InternalSwap(&other->_impl_.cel_); - _impl_.cel_expression_.InternalSwap(&other->_impl_.cel_expression_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.ignore_) - + sizeof(FieldRules::_impl_.ignore_) - - PROTOBUF_FIELD_OFFSET(FieldRules, _impl_.required_)>( - reinterpret_cast(&_impl_.required_), - reinterpret_cast(&other->_impl_.required_)); - swap(_impl_.type_, other->_impl_.type_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); -} - -::google::protobuf::Metadata FieldRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class PredefinedRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_._has_bits_); -}; - -PredefinedRules::PredefinedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, PredefinedRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.PredefinedRules) -} -PROTOBUF_NDEBUG_INLINE PredefinedRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::PredefinedRules& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - cel_{visibility, arena, from.cel_} {} - -PredefinedRules::PredefinedRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const PredefinedRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, PredefinedRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - PredefinedRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.PredefinedRules) -} -PROTOBUF_NDEBUG_INLINE PredefinedRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - cel_{visibility, arena} {} - -inline void PredefinedRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -PredefinedRules::~PredefinedRules() { - // @@protoc_insertion_point(destructor:buf.validate.PredefinedRules) - SharedDtor(*this); -} -inline void PredefinedRules::SharedDtor(MessageLite& self) { - PredefinedRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL PredefinedRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) PredefinedRules(arena); -} -constexpr auto PredefinedRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_.cel_) + - decltype(PredefinedRules::_impl_.cel_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(PredefinedRules), alignof(PredefinedRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&PredefinedRules::PlacementNew_, - sizeof(PredefinedRules), - alignof(PredefinedRules)); - } -} -constexpr auto PredefinedRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_PredefinedRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &PredefinedRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &PredefinedRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &PredefinedRules::ByteSizeLong, - &PredefinedRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_._cached_size_), - false, - }, - &PredefinedRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull PredefinedRules_class_data_ = - PredefinedRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -PredefinedRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&PredefinedRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(PredefinedRules_class_data_.tc_table); - return PredefinedRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 1, 0, 2> -PredefinedRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_._has_bits_), - 0, // no _extensions_ - 1, 0, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967294, // skipmap - offsetof(decltype(_table_), field_entries), - 1, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - PredefinedRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::PredefinedRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .buf.validate.Rule cel = 1; - {::_pbi::TcParser::FastMtR1, - {10, 0, 0, - PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_.cel_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated .buf.validate.Rule cel = 1; - {PROTOBUF_FIELD_OFFSET(PredefinedRules, _impl_.cel_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::Rule>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void PredefinedRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.PredefinedRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.cel_.Clear(); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL PredefinedRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const PredefinedRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL PredefinedRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const PredefinedRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.PredefinedRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated .buf.validate.Rule cel = 1; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_cel_size()); - i < n; i++) { - const auto& repfield = this_._internal_cel().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.PredefinedRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t PredefinedRules::ByteSizeLong(const MessageLite& base) { - const PredefinedRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t PredefinedRules::ByteSizeLong() const { - const PredefinedRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.PredefinedRules) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .buf.validate.Rule cel = 1; - cached_has_bits = this_._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_cel_size(); - for (const auto& msg : this_._internal_cel()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void PredefinedRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.PredefinedRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_cel()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_cel()); - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void PredefinedRules::CopyFrom(const PredefinedRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.PredefinedRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void PredefinedRules::InternalSwap(PredefinedRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.cel_.InternalSwap(&other->_impl_.cel_); -} - -::google::protobuf::Metadata PredefinedRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class FloatRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(FloatRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::FloatRules, _impl_._oneof_case_); -}; - -FloatRules::FloatRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FloatRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.FloatRules) -} -PROTOBUF_NDEBUG_INLINE FloatRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::FloatRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -FloatRules::FloatRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const FloatRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FloatRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - FloatRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, const__), - offsetof(Impl_, finite_) - - offsetof(Impl_, const__) + - sizeof(Impl_::finite_)); - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.FloatRules) -} -PROTOBUF_NDEBUG_INLINE FloatRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void FloatRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - 0, - offsetof(Impl_, finite_) - - offsetof(Impl_, const__) + - sizeof(Impl_::finite_)); -} -FloatRules::~FloatRules() { - // @@protoc_insertion_point(destructor:buf.validate.FloatRules) - SharedDtor(*this); -} -inline void FloatRules::SharedDtor(MessageLite& self) { - FloatRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void FloatRules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.FloatRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void FloatRules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.FloatRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL FloatRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) FloatRules(arena); -} -constexpr auto FloatRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_._extensions_) + - decltype(FloatRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.in_) + - decltype(FloatRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.not_in_) + - decltype(FloatRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.example_) + - decltype(FloatRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(FloatRules), alignof(FloatRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&FloatRules::PlacementNew_, - sizeof(FloatRules), - alignof(FloatRules)); - } -} -constexpr auto FloatRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_FloatRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FloatRules::IsInitializedImpl, - &FloatRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &FloatRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &FloatRules::ByteSizeLong, - &FloatRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_._cached_size_), - false, - }, - &FloatRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull FloatRules_class_data_ = - FloatRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -FloatRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&FloatRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(FloatRules_class_data_.tc_table); - return FloatRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 9, 0, 0, 2> -FloatRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_._extensions_), - 9, 120, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966784, // skipmap - offsetof(decltype(_table_), field_entries), - 9, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - FloatRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::FloatRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional float const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32S1, - {13, 2, 0, - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.const__)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated float in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {53, 0, 0, - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.in_)}}, - // repeated float not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {61, 1, 0, - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.not_in_)}}, - // optional bool finite = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1(), - {64, 3, 0, - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.finite_)}}, - // repeated float example = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {77, 4, 0, - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional float const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.const__), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kFloat)}, - // float lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFloat)}, - // float lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFloat)}, - // float gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFloat)}, - // float gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFloat)}, - // repeated float in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFloat)}, - // repeated float not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFloat)}, - // optional bool finite = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.finite_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // repeated float example = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.example_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFloat)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void FloatRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.FloatRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000001cU)) { - ::memset(&_impl_.const__, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.finite_) - - reinterpret_cast(&_impl_.const__)) + sizeof(_impl_.finite_)); - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _impl_.example_.Clear(); - } - } - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL FloatRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const FloatRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL FloatRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const FloatRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.FloatRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional float const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated float in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated float not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // optional bool finite = 8 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this_._internal_finite(), target); - } - - // repeated float example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFloatToArray( - 9, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.FloatRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t FloatRules::ByteSizeLong(const MessageLite& base) { - const FloatRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t FloatRules::ByteSizeLong() const { - const FloatRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.FloatRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000004U & cached_has_bits) * 5; - total_size += static_cast(0x00000008U & cached_has_bits) * 2; - if (BatchCheckHasBit(cached_has_bits, 0x00000013U)) { - // repeated float in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated float not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated float example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // float lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 5; - break; - } - // float lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 5; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // float gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 5; - break; - } - // float gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 5; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void FloatRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.FloatRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.const__ = from._impl_.const__; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.finite_ = from._impl_.finite_; - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void FloatRules::CopyFrom(const FloatRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.FloatRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool FloatRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void FloatRules::InternalSwap(FloatRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.finite_) - + sizeof(FloatRules::_impl_.finite_) - - PROTOBUF_FIELD_OFFSET(FloatRules, _impl_.const__)>( - reinterpret_cast(&_impl_.const__), - reinterpret_cast(&other->_impl_.const__)); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata FloatRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class DoubleRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::DoubleRules, _impl_._oneof_case_); -}; - -DoubleRules::DoubleRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, DoubleRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.DoubleRules) -} -PROTOBUF_NDEBUG_INLINE DoubleRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::DoubleRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -DoubleRules::DoubleRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const DoubleRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, DoubleRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - DoubleRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, const__), - offsetof(Impl_, finite_) - - offsetof(Impl_, const__) + - sizeof(Impl_::finite_)); - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.DoubleRules) -} -PROTOBUF_NDEBUG_INLINE DoubleRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void DoubleRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - 0, - offsetof(Impl_, finite_) - - offsetof(Impl_, const__) + - sizeof(Impl_::finite_)); -} -DoubleRules::~DoubleRules() { - // @@protoc_insertion_point(destructor:buf.validate.DoubleRules) - SharedDtor(*this); -} -inline void DoubleRules::SharedDtor(MessageLite& self) { - DoubleRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void DoubleRules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.DoubleRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void DoubleRules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.DoubleRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL DoubleRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) DoubleRules(arena); -} -constexpr auto DoubleRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_._extensions_) + - decltype(DoubleRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.in_) + - decltype(DoubleRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.not_in_) + - decltype(DoubleRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.example_) + - decltype(DoubleRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(DoubleRules), alignof(DoubleRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&DoubleRules::PlacementNew_, - sizeof(DoubleRules), - alignof(DoubleRules)); - } -} -constexpr auto DoubleRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_DoubleRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - DoubleRules::IsInitializedImpl, - &DoubleRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &DoubleRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &DoubleRules::ByteSizeLong, - &DoubleRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_._cached_size_), - false, - }, - &DoubleRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull DoubleRules_class_data_ = - DoubleRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -DoubleRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&DoubleRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(DoubleRules_class_data_.tc_table); - return DoubleRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 9, 0, 0, 2> -DoubleRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_._extensions_), - 9, 120, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966784, // skipmap - offsetof(decltype(_table_), field_entries), - 9, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - DoubleRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::DoubleRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional double const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64S1, - {9, 2, 0, - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.const__)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated double in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {49, 0, 0, - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.in_)}}, - // repeated double not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {57, 1, 0, - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.not_in_)}}, - // optional bool finite = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1(), - {64, 3, 0, - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.finite_)}}, - // repeated double example = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {73, 4, 0, - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional double const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.const__), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kDouble)}, - // double lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kDouble)}, - // double lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kDouble)}, - // double gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kDouble)}, - // double gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kDouble)}, - // repeated double in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kDouble)}, - // repeated double not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kDouble)}, - // optional bool finite = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.finite_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // repeated double example = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.example_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcRepeated | ::_fl::kDouble)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void DoubleRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.DoubleRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000001cU)) { - ::memset(&_impl_.const__, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.finite_) - - reinterpret_cast(&_impl_.const__)) + sizeof(_impl_.finite_)); - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _impl_.example_.Clear(); - } - } - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL DoubleRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const DoubleRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL DoubleRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const DoubleRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.DoubleRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional double const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated double in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated double not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // optional bool finite = 8 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this_._internal_finite(), target); - } - - // repeated double example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteDoubleToArray( - 9, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.DoubleRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t DoubleRules::ByteSizeLong(const MessageLite& base) { - const DoubleRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t DoubleRules::ByteSizeLong() const { - const DoubleRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.DoubleRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000004U & cached_has_bits) * 9; - total_size += static_cast(0x00000008U & cached_has_bits) * 2; - if (BatchCheckHasBit(cached_has_bits, 0x00000013U)) { - // repeated double in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated double not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated double example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // double lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 9; - break; - } - // double lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 9; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // double gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 9; - break; - } - // double gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 9; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void DoubleRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.DoubleRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.const__ = from._impl_.const__; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.finite_ = from._impl_.finite_; - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000010U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void DoubleRules::CopyFrom(const DoubleRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.DoubleRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool DoubleRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void DoubleRules::InternalSwap(DoubleRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.finite_) - + sizeof(DoubleRules::_impl_.finite_) - - PROTOBUF_FIELD_OFFSET(DoubleRules, _impl_.const__)>( - reinterpret_cast(&_impl_.const__), - reinterpret_cast(&other->_impl_.const__)); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata DoubleRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Int32Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::Int32Rules, _impl_._oneof_case_); -}; - -Int32Rules::Int32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Int32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Int32Rules) -} -PROTOBUF_NDEBUG_INLINE Int32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Int32Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -Int32Rules::Int32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Int32Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Int32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Int32Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.Int32Rules) -} -PROTOBUF_NDEBUG_INLINE Int32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void Int32Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -Int32Rules::~Int32Rules() { - // @@protoc_insertion_point(destructor:buf.validate.Int32Rules) - SharedDtor(*this); -} -inline void Int32Rules::SharedDtor(MessageLite& self) { - Int32Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void Int32Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Int32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void Int32Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Int32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL Int32Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Int32Rules(arena); -} -constexpr auto Int32Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_._extensions_) + - decltype(Int32Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.in_) + - decltype(Int32Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.not_in_) + - decltype(Int32Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.example_) + - decltype(Int32Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(Int32Rules), alignof(Int32Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&Int32Rules::PlacementNew_, - sizeof(Int32Rules), - alignof(Int32Rules)); - } -} -constexpr auto Int32Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Int32Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - Int32Rules::IsInitializedImpl, - &Int32Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Int32Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Int32Rules::ByteSizeLong, - &Int32Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_._cached_size_), - false, - }, - &Int32Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Int32Rules_class_data_ = - Int32Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Int32Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Int32Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Int32Rules_class_data_.tc_table); - return Int32Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -Int32Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - Int32Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Int32Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated int32 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {64, 2, 0, - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.example_)}}, - // optional int32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(Int32Rules, _impl_.const__), 3>(), - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.const__)}}, - // repeated int32 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.in_)}}, - // repeated int32 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional int32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, - // int32 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt32)}, - // int32 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt32)}, - // int32 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt32)}, - // int32 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt32)}, - // repeated int32 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - // repeated int32 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - // repeated int32 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int32Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void Int32Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Int32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = 0; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Int32Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Int32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Int32Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Int32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Int32Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( - stream, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<2>( - stream, this_._internal_lt(), target); - break; - } - case kLte: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<3>( - stream, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<4>( - stream, this_._internal_gt(), target); - break; - } - case kGte: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<5>( - stream, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated int32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated int32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated int32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Int32Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Int32Rules::ByteSizeLong(const MessageLite& base) { - const Int32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Int32Rules::ByteSizeLong() const { - const Int32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Int32Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated int32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated int32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated int32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional int32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_const_()); - } - } - switch (this_.less_than_case()) { - // int32 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_lt()); - break; - } - // int32 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // int32 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_gt()); - break; - } - // int32 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Int32Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Int32Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Int32Rules::CopyFrom(const Int32Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Int32Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool Int32Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void Int32Rules::InternalSwap(Int32Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata Int32Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Int64Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::Int64Rules, _impl_._oneof_case_); -}; - -Int64Rules::Int64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Int64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Int64Rules) -} -PROTOBUF_NDEBUG_INLINE Int64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Int64Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -Int64Rules::Int64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Int64Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Int64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Int64Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.Int64Rules) -} -PROTOBUF_NDEBUG_INLINE Int64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void Int64Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -Int64Rules::~Int64Rules() { - // @@protoc_insertion_point(destructor:buf.validate.Int64Rules) - SharedDtor(*this); -} -inline void Int64Rules::SharedDtor(MessageLite& self) { - Int64Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void Int64Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Int64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void Int64Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Int64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL Int64Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Int64Rules(arena); -} -constexpr auto Int64Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_._extensions_) + - decltype(Int64Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.in_) + - decltype(Int64Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.not_in_) + - decltype(Int64Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.example_) + - decltype(Int64Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(Int64Rules), alignof(Int64Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&Int64Rules::PlacementNew_, - sizeof(Int64Rules), - alignof(Int64Rules)); - } -} -constexpr auto Int64Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Int64Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - Int64Rules::IsInitializedImpl, - &Int64Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Int64Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Int64Rules::ByteSizeLong, - &Int64Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_._cached_size_), - false, - }, - &Int64Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Int64Rules_class_data_ = - Int64Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Int64Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Int64Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Int64Rules_class_data_.tc_table); - return Int64Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 8, 0, 0, 2> -Int64Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_._extensions_), - 9, 120, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966912, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - Int64Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Int64Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional int64 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(Int64Rules, _impl_.const__), 2>(), - {8, 2, 0, - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.const__)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated int64 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.in_)}}, - // repeated int64 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.not_in_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated int64 example = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {72, 3, 0, - PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional int64 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.const__), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt64)}, - // int64 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt64)}, - // int64 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt64)}, - // int64 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt64)}, - // int64 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt64)}, - // repeated int64 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt64)}, - // repeated int64 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt64)}, - // repeated int64 example = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Int64Rules, _impl_.example_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt64)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void Int64Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Int64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000000cU)) { - _impl_.const__ = ::int64_t{0}; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - _impl_.example_.Clear(); - } - } - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Int64Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Int64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Int64Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Int64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Int64Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<1>( - stream, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<2>( - stream, this_._internal_lt(), target); - break; - } - case kLte: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<3>( - stream, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<4>( - stream, this_._internal_gt(), target); - break; - } - case kGte: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<5>( - stream, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated int64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt64ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated int64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt64ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated int64 example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt64ToArray( - 9, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Int64Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Int64Rules::ByteSizeLong(const MessageLite& base) { - const Int64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Int64Rules::ByteSizeLong() const { - const Int64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Int64Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated int64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int64Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated int64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int64Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // optional int64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_const_()); - } - // repeated int64 example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int64Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // int64 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_lt()); - break; - } - // int64 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // int64 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_gt()); - break; - } - // int64 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Int64Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Int64Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.const__ = from._impl_.const__; - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000008U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Int64Rules::CopyFrom(const Int64Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Int64Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool Int64Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void Int64Rules::InternalSwap(Int64Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - swap(_impl_.const__, other->_impl_.const__); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata Int64Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class UInt32Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt32Rules, _impl_._oneof_case_); -}; - -UInt32Rules::UInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, UInt32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.UInt32Rules) -} -PROTOBUF_NDEBUG_INLINE UInt32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::UInt32Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -UInt32Rules::UInt32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const UInt32Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, UInt32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - UInt32Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.UInt32Rules) -} -PROTOBUF_NDEBUG_INLINE UInt32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void UInt32Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -UInt32Rules::~UInt32Rules() { - // @@protoc_insertion_point(destructor:buf.validate.UInt32Rules) - SharedDtor(*this); -} -inline void UInt32Rules::SharedDtor(MessageLite& self) { - UInt32Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void UInt32Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.UInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void UInt32Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.UInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL UInt32Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) UInt32Rules(arena); -} -constexpr auto UInt32Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_._extensions_) + - decltype(UInt32Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.in_) + - decltype(UInt32Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.not_in_) + - decltype(UInt32Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.example_) + - decltype(UInt32Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(UInt32Rules), alignof(UInt32Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&UInt32Rules::PlacementNew_, - sizeof(UInt32Rules), - alignof(UInt32Rules)); - } -} -constexpr auto UInt32Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_UInt32Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - UInt32Rules::IsInitializedImpl, - &UInt32Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &UInt32Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &UInt32Rules::ByteSizeLong, - &UInt32Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_._cached_size_), - false, - }, - &UInt32Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull UInt32Rules_class_data_ = - UInt32Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -UInt32Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&UInt32Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(UInt32Rules_class_data_.tc_table); - return UInt32Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -UInt32Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - UInt32Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::UInt32Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated uint32 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {64, 2, 0, - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.example_)}}, - // optional uint32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(UInt32Rules, _impl_.const__), 3>(), - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.const__)}}, - // repeated uint32 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.in_)}}, - // repeated uint32 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional uint32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt32)}, - // uint32 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt32)}, - // uint32 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt32)}, - // uint32 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt32)}, - // uint32 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt32)}, - // repeated uint32 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt32)}, - // repeated uint32 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt32)}, - // repeated uint32 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt32Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void UInt32Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.UInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = 0u; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL UInt32Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const UInt32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL UInt32Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const UInt32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.UInt32Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional uint32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated uint32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated uint32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated uint32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.UInt32Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t UInt32Rules::ByteSizeLong(const MessageLite& base) { - const UInt32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t UInt32Rules::ByteSizeLong() const { - const UInt32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.UInt32Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated uint32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt32Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated uint32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt32Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated uint32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt32Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional uint32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_const_()); - } - } - switch (this_.less_than_case()) { - // uint32 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_lt()); - break; - } - // uint32 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // uint32 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_gt()); - break; - } - // uint32 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void UInt32Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.UInt32Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void UInt32Rules::CopyFrom(const UInt32Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.UInt32Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool UInt32Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void UInt32Rules::InternalSwap(UInt32Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata UInt32Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class UInt64Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::UInt64Rules, _impl_._oneof_case_); -}; - -UInt64Rules::UInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, UInt64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.UInt64Rules) -} -PROTOBUF_NDEBUG_INLINE UInt64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::UInt64Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -UInt64Rules::UInt64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const UInt64Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, UInt64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - UInt64Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.UInt64Rules) -} -PROTOBUF_NDEBUG_INLINE UInt64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void UInt64Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -UInt64Rules::~UInt64Rules() { - // @@protoc_insertion_point(destructor:buf.validate.UInt64Rules) - SharedDtor(*this); -} -inline void UInt64Rules::SharedDtor(MessageLite& self) { - UInt64Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void UInt64Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.UInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void UInt64Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.UInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL UInt64Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) UInt64Rules(arena); -} -constexpr auto UInt64Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_._extensions_) + - decltype(UInt64Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.in_) + - decltype(UInt64Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.not_in_) + - decltype(UInt64Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.example_) + - decltype(UInt64Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(UInt64Rules), alignof(UInt64Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&UInt64Rules::PlacementNew_, - sizeof(UInt64Rules), - alignof(UInt64Rules)); - } -} -constexpr auto UInt64Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_UInt64Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - UInt64Rules::IsInitializedImpl, - &UInt64Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &UInt64Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &UInt64Rules::ByteSizeLong, - &UInt64Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_._cached_size_), - false, - }, - &UInt64Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull UInt64Rules_class_data_ = - UInt64Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -UInt64Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&UInt64Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(UInt64Rules_class_data_.tc_table); - return UInt64Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -UInt64Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - UInt64Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::UInt64Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated uint64 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {64, 2, 0, - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.example_)}}, - // optional uint64 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(UInt64Rules, _impl_.const__), 3>(), - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.const__)}}, - // repeated uint64 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.in_)}}, - // repeated uint64 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional uint64 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // uint64 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // uint64 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // uint64 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // uint64 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // repeated uint64 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt64)}, - // repeated uint64 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt64)}, - // repeated uint64 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(UInt64Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kUInt64)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void UInt64Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.UInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = ::uint64_t{0u}; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL UInt64Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const UInt64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL UInt64Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const UInt64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.UInt64Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional uint64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated uint64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated uint64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated uint64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.UInt64Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t UInt64Rules::ByteSizeLong(const MessageLite& base) { - const UInt64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t UInt64Rules::ByteSizeLong() const { - const UInt64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.UInt64Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated uint64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt64Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated uint64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt64Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated uint64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::UInt64Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional uint64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_const_()); - } - } - switch (this_.less_than_case()) { - // uint64 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_lt()); - break; - } - // uint64 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // uint64 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_gt()); - break; - } - // uint64 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void UInt64Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.UInt64Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void UInt64Rules::CopyFrom(const UInt64Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.UInt64Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool UInt64Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void UInt64Rules::InternalSwap(UInt64Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata UInt64Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class SInt32Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt32Rules, _impl_._oneof_case_); -}; - -SInt32Rules::SInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SInt32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.SInt32Rules) -} -PROTOBUF_NDEBUG_INLINE SInt32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::SInt32Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -SInt32Rules::SInt32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const SInt32Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SInt32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SInt32Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.SInt32Rules) -} -PROTOBUF_NDEBUG_INLINE SInt32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void SInt32Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -SInt32Rules::~SInt32Rules() { - // @@protoc_insertion_point(destructor:buf.validate.SInt32Rules) - SharedDtor(*this); -} -inline void SInt32Rules::SharedDtor(MessageLite& self) { - SInt32Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void SInt32Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void SInt32Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL SInt32Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) SInt32Rules(arena); -} -constexpr auto SInt32Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_._extensions_) + - decltype(SInt32Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.in_) + - decltype(SInt32Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.not_in_) + - decltype(SInt32Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.example_) + - decltype(SInt32Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(SInt32Rules), alignof(SInt32Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&SInt32Rules::PlacementNew_, - sizeof(SInt32Rules), - alignof(SInt32Rules)); - } -} -constexpr auto SInt32Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_SInt32Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - SInt32Rules::IsInitializedImpl, - &SInt32Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &SInt32Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &SInt32Rules::ByteSizeLong, - &SInt32Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_._cached_size_), - false, - }, - &SInt32Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull SInt32Rules_class_data_ = - SInt32Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -SInt32Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&SInt32Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(SInt32Rules_class_data_.tc_table); - return SInt32Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -SInt32Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - SInt32Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::SInt32Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated sint32 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ32R1, - {64, 2, 0, - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.example_)}}, - // optional sint32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ32S1, - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.const__)}}, - // repeated sint32 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ32R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.in_)}}, - // repeated sint32 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ32R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional sint32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kSInt32)}, - // sint32 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt32)}, - // sint32 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt32)}, - // sint32 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt32)}, - // sint32 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt32)}, - // repeated sint32 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt32)}, - // repeated sint32 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt32)}, - // repeated sint32 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt32Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void SInt32Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.SInt32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = 0; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL SInt32Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const SInt32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL SInt32Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const SInt32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.SInt32Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional sint32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated sint32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated sint32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated sint32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt32ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.SInt32Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t SInt32Rules::ByteSizeLong(const MessageLite& base) { - const SInt32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t SInt32Rules::ByteSizeLong() const { - const SInt32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.SInt32Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated sint32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt32Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated sint32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt32Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated sint32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt32Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional sint32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne( - this_._internal_const_()); - } - } - switch (this_.less_than_case()) { - // sint32 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne( - this_._internal_lt()); - break; - } - // sint32 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // sint32 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne( - this_._internal_gt()); - break; - } - // sint32 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::SInt32SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void SInt32Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.SInt32Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void SInt32Rules::CopyFrom(const SInt32Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.SInt32Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool SInt32Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void SInt32Rules::InternalSwap(SInt32Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata SInt32Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class SInt64Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::SInt64Rules, _impl_._oneof_case_); -}; - -SInt64Rules::SInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SInt64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.SInt64Rules) -} -PROTOBUF_NDEBUG_INLINE SInt64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::SInt64Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -SInt64Rules::SInt64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const SInt64Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SInt64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SInt64Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.SInt64Rules) -} -PROTOBUF_NDEBUG_INLINE SInt64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void SInt64Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -SInt64Rules::~SInt64Rules() { - // @@protoc_insertion_point(destructor:buf.validate.SInt64Rules) - SharedDtor(*this); -} -inline void SInt64Rules::SharedDtor(MessageLite& self) { - SInt64Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void SInt64Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void SInt64Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL SInt64Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) SInt64Rules(arena); -} -constexpr auto SInt64Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_._extensions_) + - decltype(SInt64Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.in_) + - decltype(SInt64Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.not_in_) + - decltype(SInt64Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.example_) + - decltype(SInt64Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(SInt64Rules), alignof(SInt64Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&SInt64Rules::PlacementNew_, - sizeof(SInt64Rules), - alignof(SInt64Rules)); - } -} -constexpr auto SInt64Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_SInt64Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - SInt64Rules::IsInitializedImpl, - &SInt64Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &SInt64Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &SInt64Rules::ByteSizeLong, - &SInt64Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_._cached_size_), - false, - }, - &SInt64Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull SInt64Rules_class_data_ = - SInt64Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -SInt64Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&SInt64Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(SInt64Rules_class_data_.tc_table); - return SInt64Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -SInt64Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - SInt64Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::SInt64Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated sint64 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ64R1, - {64, 2, 0, - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.example_)}}, - // optional sint64 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ64S1, - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.const__)}}, - // repeated sint64 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ64R1, - {48, 0, 0, - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.in_)}}, - // repeated sint64 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastZ64R1, - {56, 1, 0, - PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional sint64 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kSInt64)}, - // sint64 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt64)}, - // sint64 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt64)}, - // sint64 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt64)}, - // sint64 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSInt64)}, - // repeated sint64 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt64)}, - // repeated sint64 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt64)}, - // repeated sint64 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SInt64Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSInt64)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void SInt64Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.SInt64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = ::int64_t{0}; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL SInt64Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const SInt64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL SInt64Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const SInt64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.SInt64Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional sint64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated sint64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated sint64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated sint64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSInt64ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.SInt64Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t SInt64Rules::ByteSizeLong(const MessageLite& base) { - const SInt64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t SInt64Rules::ByteSizeLong() const { - const SInt64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.SInt64Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated sint64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt64Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated sint64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt64Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated sint64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::SInt64Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional sint64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne( - this_._internal_const_()); - } - } - switch (this_.less_than_case()) { - // sint64 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne( - this_._internal_lt()); - break; - } - // sint64 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne( - this_._internal_lte()); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // sint64 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne( - this_._internal_gt()); - break; - } - // sint64 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += ::_pbi::WireFormatLite::SInt64SizePlusOne( - this_._internal_gte()); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void SInt64Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.SInt64Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void SInt64Rules::CopyFrom(const SInt64Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.SInt64Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool SInt64Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void SInt64Rules::InternalSwap(SInt64Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata SInt64Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Fixed32Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed32Rules, _impl_._oneof_case_); -}; - -Fixed32Rules::Fixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Fixed32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Fixed32Rules) -} -PROTOBUF_NDEBUG_INLINE Fixed32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Fixed32Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -Fixed32Rules::Fixed32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Fixed32Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Fixed32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Fixed32Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.Fixed32Rules) -} -PROTOBUF_NDEBUG_INLINE Fixed32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void Fixed32Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -Fixed32Rules::~Fixed32Rules() { - // @@protoc_insertion_point(destructor:buf.validate.Fixed32Rules) - SharedDtor(*this); -} -inline void Fixed32Rules::SharedDtor(MessageLite& self) { - Fixed32Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void Fixed32Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Fixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void Fixed32Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Fixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL Fixed32Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Fixed32Rules(arena); -} -constexpr auto Fixed32Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_._extensions_) + - decltype(Fixed32Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.in_) + - decltype(Fixed32Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.not_in_) + - decltype(Fixed32Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.example_) + - decltype(Fixed32Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(Fixed32Rules), alignof(Fixed32Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&Fixed32Rules::PlacementNew_, - sizeof(Fixed32Rules), - alignof(Fixed32Rules)); - } -} -constexpr auto Fixed32Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Fixed32Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - Fixed32Rules::IsInitializedImpl, - &Fixed32Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Fixed32Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Fixed32Rules::ByteSizeLong, - &Fixed32Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_._cached_size_), - false, - }, - &Fixed32Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Fixed32Rules_class_data_ = - Fixed32Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Fixed32Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Fixed32Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Fixed32Rules_class_data_.tc_table); - return Fixed32Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -Fixed32Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - Fixed32Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Fixed32Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated fixed32 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {69, 2, 0, - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.example_)}}, - // optional fixed32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32S1, - {13, 3, 0, - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.const__)}}, - // repeated fixed32 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {53, 0, 0, - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.in_)}}, - // repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {61, 1, 0, - PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional fixed32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kFixed32)}, - // fixed32 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed32)}, - // fixed32 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed32)}, - // fixed32 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed32)}, - // fixed32 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed32)}, - // repeated fixed32 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed32)}, - // repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed32)}, - // repeated fixed32 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed32Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void Fixed32Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Fixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = 0u; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Fixed32Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Fixed32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Fixed32Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Fixed32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Fixed32Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional fixed32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated fixed32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated fixed32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed32ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Fixed32Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Fixed32Rules::ByteSizeLong(const MessageLite& base) { - const Fixed32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Fixed32Rules::ByteSizeLong() const { - const Fixed32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Fixed32Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000008U & cached_has_bits) * 5; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // repeated fixed32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated fixed32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // fixed32 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 5; - break; - } - // fixed32 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 5; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // fixed32 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 5; - break; - } - // fixed32 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 5; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Fixed32Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Fixed32Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Fixed32Rules::CopyFrom(const Fixed32Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Fixed32Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool Fixed32Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void Fixed32Rules::InternalSwap(Fixed32Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata Fixed32Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Fixed64Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::Fixed64Rules, _impl_._oneof_case_); -}; - -Fixed64Rules::Fixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Fixed64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Fixed64Rules) -} -PROTOBUF_NDEBUG_INLINE Fixed64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Fixed64Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -Fixed64Rules::Fixed64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Fixed64Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Fixed64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Fixed64Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.Fixed64Rules) -} -PROTOBUF_NDEBUG_INLINE Fixed64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void Fixed64Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -Fixed64Rules::~Fixed64Rules() { - // @@protoc_insertion_point(destructor:buf.validate.Fixed64Rules) - SharedDtor(*this); -} -inline void Fixed64Rules::SharedDtor(MessageLite& self) { - Fixed64Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void Fixed64Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Fixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void Fixed64Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.Fixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL Fixed64Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Fixed64Rules(arena); -} -constexpr auto Fixed64Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_._extensions_) + - decltype(Fixed64Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.in_) + - decltype(Fixed64Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.not_in_) + - decltype(Fixed64Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.example_) + - decltype(Fixed64Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(Fixed64Rules), alignof(Fixed64Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&Fixed64Rules::PlacementNew_, - sizeof(Fixed64Rules), - alignof(Fixed64Rules)); - } -} -constexpr auto Fixed64Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Fixed64Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - Fixed64Rules::IsInitializedImpl, - &Fixed64Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Fixed64Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Fixed64Rules::ByteSizeLong, - &Fixed64Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_._cached_size_), - false, - }, - &Fixed64Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Fixed64Rules_class_data_ = - Fixed64Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Fixed64Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Fixed64Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Fixed64Rules_class_data_.tc_table); - return Fixed64Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -Fixed64Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - Fixed64Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Fixed64Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated fixed64 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {65, 2, 0, - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.example_)}}, - // optional fixed64 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64S1, - {9, 3, 0, - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.const__)}}, - // repeated fixed64 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {49, 0, 0, - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.in_)}}, - // repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {57, 1, 0, - PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional fixed64 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kFixed64)}, - // fixed64 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed64)}, - // fixed64 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed64)}, - // fixed64 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed64)}, - // fixed64 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kFixed64)}, - // repeated fixed64 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed64)}, - // repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed64)}, - // repeated fixed64 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(Fixed64Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kFixed64)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void Fixed64Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Fixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = ::uint64_t{0u}; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Fixed64Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Fixed64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Fixed64Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Fixed64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Fixed64Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional fixed64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated fixed64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated fixed64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteFixed64ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Fixed64Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Fixed64Rules::ByteSizeLong(const MessageLite& base) { - const Fixed64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Fixed64Rules::ByteSizeLong() const { - const Fixed64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Fixed64Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000008U & cached_has_bits) * 9; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // repeated fixed64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated fixed64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // fixed64 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 9; - break; - } - // fixed64 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 9; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // fixed64 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 9; - break; - } - // fixed64 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 9; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Fixed64Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Fixed64Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Fixed64Rules::CopyFrom(const Fixed64Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Fixed64Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool Fixed64Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void Fixed64Rules::InternalSwap(Fixed64Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata Fixed64Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class SFixed32Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed32Rules, _impl_._oneof_case_); -}; - -SFixed32Rules::SFixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SFixed32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.SFixed32Rules) -} -PROTOBUF_NDEBUG_INLINE SFixed32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::SFixed32Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -SFixed32Rules::SFixed32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const SFixed32Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SFixed32Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SFixed32Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.SFixed32Rules) -} -PROTOBUF_NDEBUG_INLINE SFixed32Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void SFixed32Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -SFixed32Rules::~SFixed32Rules() { - // @@protoc_insertion_point(destructor:buf.validate.SFixed32Rules) - SharedDtor(*this); -} -inline void SFixed32Rules::SharedDtor(MessageLite& self) { - SFixed32Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void SFixed32Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SFixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void SFixed32Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SFixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL SFixed32Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) SFixed32Rules(arena); -} -constexpr auto SFixed32Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_._extensions_) + - decltype(SFixed32Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.in_) + - decltype(SFixed32Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.not_in_) + - decltype(SFixed32Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.example_) + - decltype(SFixed32Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(SFixed32Rules), alignof(SFixed32Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&SFixed32Rules::PlacementNew_, - sizeof(SFixed32Rules), - alignof(SFixed32Rules)); - } -} -constexpr auto SFixed32Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_SFixed32Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - SFixed32Rules::IsInitializedImpl, - &SFixed32Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &SFixed32Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &SFixed32Rules::ByteSizeLong, - &SFixed32Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_._cached_size_), - false, - }, - &SFixed32Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull SFixed32Rules_class_data_ = - SFixed32Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -SFixed32Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&SFixed32Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(SFixed32Rules_class_data_.tc_table); - return SFixed32Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -SFixed32Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - SFixed32Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::SFixed32Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated sfixed32 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {69, 2, 0, - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.example_)}}, - // optional sfixed32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32S1, - {13, 3, 0, - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.const__)}}, - // repeated sfixed32 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {53, 0, 0, - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.in_)}}, - // repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF32R1, - {61, 1, 0, - PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional sfixed32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kSFixed32)}, - // sfixed32 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed32)}, - // sfixed32 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed32)}, - // sfixed32 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed32)}, - // sfixed32 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed32)}, - // repeated sfixed32 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed32)}, - // repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed32)}, - // repeated sfixed32 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed32Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void SFixed32Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.SFixed32Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = 0; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL SFixed32Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const SFixed32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL SFixed32Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const SFixed32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.SFixed32Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional sfixed32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated sfixed32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated sfixed32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed32ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.SFixed32Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t SFixed32Rules::ByteSizeLong(const MessageLite& base) { - const SFixed32Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t SFixed32Rules::ByteSizeLong() const { - const SFixed32Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.SFixed32Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000008U & cached_has_bits) * 5; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // repeated sfixed32 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated sfixed32 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::size_t{4} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // sfixed32 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 5; - break; - } - // sfixed32 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 5; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // sfixed32 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 5; - break; - } - // sfixed32 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 5; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void SFixed32Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.SFixed32Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void SFixed32Rules::CopyFrom(const SFixed32Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.SFixed32Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool SFixed32Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void SFixed32Rules::InternalSwap(SFixed32Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata SFixed32Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class SFixed64Rules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::SFixed64Rules, _impl_._oneof_case_); -}; - -SFixed64Rules::SFixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SFixed64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.SFixed64Rules) -} -PROTOBUF_NDEBUG_INLINE SFixed64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::SFixed64Rules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -SFixed64Rules::SFixed64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const SFixed64Rules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, SFixed64Rules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SFixed64Rules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - case kLte: - _impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - case kGte: - _impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.SFixed64Rules) -} -PROTOBUF_NDEBUG_INLINE SFixed64Rules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void SFixed64Rules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -SFixed64Rules::~SFixed64Rules() { - // @@protoc_insertion_point(destructor:buf.validate.SFixed64Rules) - SharedDtor(*this); -} -inline void SFixed64Rules::SharedDtor(MessageLite& self) { - SFixed64Rules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void SFixed64Rules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SFixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - // No need to clear - break; - } - case kLte: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void SFixed64Rules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.SFixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - // No need to clear - break; - } - case kGte: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL SFixed64Rules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) SFixed64Rules(arena); -} -constexpr auto SFixed64Rules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_._extensions_) + - decltype(SFixed64Rules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.in_) + - decltype(SFixed64Rules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.not_in_) + - decltype(SFixed64Rules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.example_) + - decltype(SFixed64Rules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(SFixed64Rules), alignof(SFixed64Rules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&SFixed64Rules::PlacementNew_, - sizeof(SFixed64Rules), - alignof(SFixed64Rules)); - } -} -constexpr auto SFixed64Rules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_SFixed64Rules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - SFixed64Rules::IsInitializedImpl, - &SFixed64Rules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &SFixed64Rules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &SFixed64Rules::ByteSizeLong, - &SFixed64Rules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_._cached_size_), - false, - }, - &SFixed64Rules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull SFixed64Rules_class_data_ = - SFixed64Rules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -SFixed64Rules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&SFixed64Rules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(SFixed64Rules_class_data_.tc_table); - return SFixed64Rules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 0, 0, 2> -SFixed64Rules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_._extensions_), - 8, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967040, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - SFixed64Rules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::SFixed64Rules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated sfixed64 example = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {65, 2, 0, - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.example_)}}, - // optional sfixed64 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64S1, - {9, 3, 0, - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.const__)}}, - // repeated sfixed64 in = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {49, 0, 0, - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.in_)}}, - // repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastF64R1, - {57, 1, 0, - PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional sfixed64 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kSFixed64)}, - // sfixed64 lt = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed64)}, - // sfixed64 lte = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed64)}, - // sfixed64 gt = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed64)}, - // sfixed64 gte = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kSFixed64)}, - // repeated sfixed64 in = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed64)}, - // repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed64)}, - // repeated sfixed64 example = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(SFixed64Rules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kSFixed64)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void SFixed64Rules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.SFixed64Rules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - _impl_.const__ = ::int64_t{0}; - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL SFixed64Rules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const SFixed64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL SFixed64Rules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const SFixed64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.SFixed64Rules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional sfixed64 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 1, this_._internal_const_(), target); - } - - switch (this_.less_than_case()) { - case kLt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 2, this_._internal_lt(), target); - break; - } - case kLte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 3, this_._internal_lte(), target); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 4, this_._internal_gt(), target); - break; - } - case kGte: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 5, this_._internal_gte(), target); - break; - } - default: - break; - } - // repeated sfixed64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 6, this_._internal_in().Get(i), target); - } - } - - // repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 7, this_._internal_not_in().Get(i), target); - } - } - - // repeated sfixed64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteSFixed64ToArray( - 8, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.SFixed64Rules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t SFixed64Rules::ByteSizeLong(const MessageLite& base) { - const SFixed64Rules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t SFixed64Rules::ByteSizeLong() const { - const SFixed64Rules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.SFixed64Rules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000008U & cached_has_bits) * 9; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // repeated sfixed64 in = 6 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated sfixed64 example = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::size_t{8} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - switch (this_.less_than_case()) { - // sfixed64 lt = 2 [(.buf.validate.predefined) = { - case kLt: { - total_size += 9; - break; - } - // sfixed64 lte = 3 [(.buf.validate.predefined) = { - case kLte: { - total_size += 9; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // sfixed64 gt = 4 [(.buf.validate.predefined) = { - case kGt: { - total_size += 9; - break; - } - // sfixed64 gte = 5 [(.buf.validate.predefined) = { - case kGte: { - total_size += 9; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void SFixed64Rules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.SFixed64Rules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - _this->_impl_.less_than_.lt_ = from._impl_.less_than_.lt_; - break; - } - case kLte: { - _this->_impl_.less_than_.lte_ = from._impl_.less_than_.lte_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - _this->_impl_.greater_than_.gt_ = from._impl_.greater_than_.gt_; - break; - } - case kGte: { - _this->_impl_.greater_than_.gte_ = from._impl_.greater_than_.gte_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void SFixed64Rules::CopyFrom(const SFixed64Rules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.SFixed64Rules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool SFixed64Rules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void SFixed64Rules::InternalSwap(SFixed64Rules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata SFixed64Rules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class BoolRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(BoolRules, _impl_._has_bits_); -}; - -BoolRules::BoolRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, BoolRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.BoolRules) -} -PROTOBUF_NDEBUG_INLINE BoolRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::BoolRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - example_{visibility, arena, from.example_} {} - -BoolRules::BoolRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const BoolRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, BoolRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - BoolRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - _impl_.const__ = from._impl_.const__; - - // @@protoc_insertion_point(copy_constructor:buf.validate.BoolRules) -} -PROTOBUF_NDEBUG_INLINE BoolRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - example_{visibility, arena} {} - -inline void BoolRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -BoolRules::~BoolRules() { - // @@protoc_insertion_point(destructor:buf.validate.BoolRules) - SharedDtor(*this); -} -inline void BoolRules::SharedDtor(MessageLite& self) { - BoolRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL BoolRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) BoolRules(arena); -} -constexpr auto BoolRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_._extensions_) + - decltype(BoolRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_.example_) + - decltype(BoolRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(BoolRules), alignof(BoolRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&BoolRules::PlacementNew_, - sizeof(BoolRules), - alignof(BoolRules)); - } -} -constexpr auto BoolRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_BoolRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - BoolRules::IsInitializedImpl, - &BoolRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &BoolRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &BoolRules::ByteSizeLong, - &BoolRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_._cached_size_), - false, - }, - &BoolRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull BoolRules_class_data_ = - BoolRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -BoolRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&BoolRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(BoolRules_class_data_.tc_table); - return BoolRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> -BoolRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_._extensions_), - 2, 8, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967292, // skipmap - offsetof(decltype(_table_), field_entries), - 2, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - BoolRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::BoolRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated bool example = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV8R1, - {16, 0, 0, - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_.example_)}}, - // optional bool const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1(), - {8, 1, 0, - PROTOBUF_FIELD_OFFSET(BoolRules, _impl_.const__)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional bool const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BoolRules, _impl_.const__), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // repeated bool example = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BoolRules, _impl_.example_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBool)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void BoolRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.BoolRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.example_.Clear(); - } - _impl_.const__ = false; - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL BoolRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const BoolRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL BoolRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const BoolRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.BoolRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bool const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 1, this_._internal_const_(), target); - } - - // repeated bool example = 2 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.BoolRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t BoolRules::ByteSizeLong(const MessageLite& base) { - const BoolRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t BoolRules::ByteSizeLong() const { - const BoolRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.BoolRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000002U & cached_has_bits) * 2; - { - // repeated bool example = 2 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void BoolRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.BoolRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_impl_.const__ = from._impl_.const__; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void BoolRules::CopyFrom(const BoolRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.BoolRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool BoolRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void BoolRules::InternalSwap(BoolRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); -} - -::google::protobuf::Metadata BoolRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class StringRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(StringRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::StringRules, _impl_._oneof_case_); -}; - -StringRules::StringRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, StringRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.StringRules) -} -PROTOBUF_NDEBUG_INLINE StringRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::StringRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - const__(arena, from.const__), - pattern_(arena, from.pattern_), - prefix_(arena, from.prefix_), - suffix_(arena, from.suffix_), - contains_(arena, from.contains_), - not_contains_(arena, from.not_contains_), - well_known_{}, - _oneof_case_{from._oneof_case_[0]} {} - -StringRules::StringRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const StringRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, StringRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - StringRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_len_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, min_len_), - offsetof(Impl_, strict_) - - offsetof(Impl_, min_len_) + - sizeof(Impl_::strict_)); - switch (well_known_case()) { - case WELL_KNOWN_NOT_SET: - break; - case kEmail: - _impl_.well_known_.email_ = from._impl_.well_known_.email_; - break; - case kHostname: - _impl_.well_known_.hostname_ = from._impl_.well_known_.hostname_; - break; - case kIp: - _impl_.well_known_.ip_ = from._impl_.well_known_.ip_; - break; - case kIpv4: - _impl_.well_known_.ipv4_ = from._impl_.well_known_.ipv4_; - break; - case kIpv6: - _impl_.well_known_.ipv6_ = from._impl_.well_known_.ipv6_; - break; - case kUri: - _impl_.well_known_.uri_ = from._impl_.well_known_.uri_; - break; - case kUriRef: - _impl_.well_known_.uri_ref_ = from._impl_.well_known_.uri_ref_; - break; - case kAddress: - _impl_.well_known_.address_ = from._impl_.well_known_.address_; - break; - case kUuid: - _impl_.well_known_.uuid_ = from._impl_.well_known_.uuid_; - break; - case kTuuid: - _impl_.well_known_.tuuid_ = from._impl_.well_known_.tuuid_; - break; - case kIpWithPrefixlen: - _impl_.well_known_.ip_with_prefixlen_ = from._impl_.well_known_.ip_with_prefixlen_; - break; - case kIpv4WithPrefixlen: - _impl_.well_known_.ipv4_with_prefixlen_ = from._impl_.well_known_.ipv4_with_prefixlen_; - break; - case kIpv6WithPrefixlen: - _impl_.well_known_.ipv6_with_prefixlen_ = from._impl_.well_known_.ipv6_with_prefixlen_; - break; - case kIpPrefix: - _impl_.well_known_.ip_prefix_ = from._impl_.well_known_.ip_prefix_; - break; - case kIpv4Prefix: - _impl_.well_known_.ipv4_prefix_ = from._impl_.well_known_.ipv4_prefix_; - break; - case kIpv6Prefix: - _impl_.well_known_.ipv6_prefix_ = from._impl_.well_known_.ipv6_prefix_; - break; - case kHostAndPort: - _impl_.well_known_.host_and_port_ = from._impl_.well_known_.host_and_port_; - break; - case kUlid: - _impl_.well_known_.ulid_ = from._impl_.well_known_.ulid_; - break; - case kProtobufFqn: - _impl_.well_known_.protobuf_fqn_ = from._impl_.well_known_.protobuf_fqn_; - break; - case kProtobufDotFqn: - _impl_.well_known_.protobuf_dot_fqn_ = from._impl_.well_known_.protobuf_dot_fqn_; - break; - case kWellKnownRegex: - _impl_.well_known_.well_known_regex_ = from._impl_.well_known_.well_known_regex_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.StringRules) -} -PROTOBUF_NDEBUG_INLINE StringRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - const__(arena), - pattern_(arena), - prefix_(arena), - suffix_(arena), - contains_(arena), - not_contains_(arena), - well_known_{}, - _oneof_case_{} {} - -inline void StringRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_len_), - 0, - offsetof(Impl_, strict_) - - offsetof(Impl_, min_len_) + - sizeof(Impl_::strict_)); -} -StringRules::~StringRules() { - // @@protoc_insertion_point(destructor:buf.validate.StringRules) - SharedDtor(*this); -} -inline void StringRules::SharedDtor(MessageLite& self) { - StringRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.const__.Destroy(); - this_._impl_.pattern_.Destroy(); - this_._impl_.prefix_.Destroy(); - this_._impl_.suffix_.Destroy(); - this_._impl_.contains_.Destroy(); - this_._impl_.not_contains_.Destroy(); - if (this_.has_well_known()) { - this_.clear_well_known(); - } - this_._impl_.~Impl_(); -} - -void StringRules::clear_well_known() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.StringRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (well_known_case()) { - case kEmail: { - // No need to clear - break; - } - case kHostname: { - // No need to clear - break; - } - case kIp: { - // No need to clear - break; - } - case kIpv4: { - // No need to clear - break; - } - case kIpv6: { - // No need to clear - break; - } - case kUri: { - // No need to clear - break; - } - case kUriRef: { - // No need to clear - break; - } - case kAddress: { - // No need to clear - break; - } - case kUuid: { - // No need to clear - break; - } - case kTuuid: { - // No need to clear - break; - } - case kIpWithPrefixlen: { - // No need to clear - break; - } - case kIpv4WithPrefixlen: { - // No need to clear - break; - } - case kIpv6WithPrefixlen: { - // No need to clear - break; - } - case kIpPrefix: { - // No need to clear - break; - } - case kIpv4Prefix: { - // No need to clear - break; - } - case kIpv6Prefix: { - // No need to clear - break; - } - case kHostAndPort: { - // No need to clear - break; - } - case kUlid: { - // No need to clear - break; - } - case kProtobufFqn: { - // No need to clear - break; - } - case kProtobufDotFqn: { - // No need to clear - break; - } - case kWellKnownRegex: { - // No need to clear - break; - } - case WELL_KNOWN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = WELL_KNOWN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL StringRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) StringRules(arena); -} -constexpr auto StringRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(StringRules, _impl_._extensions_) + - decltype(StringRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.in_) + - decltype(StringRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.not_in_) + - decltype(StringRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.example_) + - decltype(StringRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::CopyInit( - sizeof(StringRules), alignof(StringRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&StringRules::PlacementNew_, - sizeof(StringRules), - alignof(StringRules)); - } -} -constexpr auto StringRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_StringRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - StringRules::IsInitializedImpl, - &StringRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &StringRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &StringRules::ByteSizeLong, - &StringRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(StringRules, _impl_._cached_size_), - false, - }, - &StringRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull StringRules_class_data_ = - StringRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -StringRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&StringRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(StringRules_class_data_.tc_table); - return StringRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<5, 37, 1, 0, 7> -StringRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(StringRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(StringRules, _impl_._extensions_), - 38, 248, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 0, // skipmap - offsetof(decltype(_table_), field_entries), - 37, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - StringRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::StringRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional string const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {10, 3, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.const__)}}, - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(StringRules, _impl_.min_len_), 9>(), - {16, 9, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.min_len_)}}, - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(StringRules, _impl_.max_len_), 10>(), - {24, 10, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.max_len_)}}, - // optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(StringRules, _impl_.min_bytes_), 11>(), - {32, 11, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.min_bytes_)}}, - // optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(StringRules, _impl_.max_bytes_), 12>(), - {40, 12, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.max_bytes_)}}, - // optional string pattern = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {50, 4, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.pattern_)}}, - // optional string prefix = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {58, 5, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.prefix_)}}, - // optional string suffix = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {66, 6, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.suffix_)}}, - // optional string contains = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {74, 7, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.contains_)}}, - // repeated string in = 10 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {82, 0, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.in_)}}, - // repeated string not_in = 11 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {90, 1, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.not_in_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // repeated string example = 34 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR2, - {658, 2, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.example_)}}, - // optional uint64 len = 19 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64S2, - {408, 13, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.len_)}}, - // optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV64S2, - {416, 14, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.len_bytes_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional string not_contains = 23 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS2, - {442, 8, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.not_contains_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional bool strict = 25; - {::_pbi::TcParser::FastV8S2, - {456, 15, 0, - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.strict_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 33, 0, 1, - 65480, 32, - 65535, 65535 - }}, {{ - // optional string const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.min_len_), _Internal::kHasBitsOffset + 9, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.max_len_), _Internal::kHasBitsOffset + 10, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.min_bytes_), _Internal::kHasBitsOffset + 11, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.max_bytes_), _Internal::kHasBitsOffset + 12, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional string pattern = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.pattern_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string prefix = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.prefix_), _Internal::kHasBitsOffset + 5, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string suffix = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.suffix_), _Internal::kHasBitsOffset + 6, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string contains = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.contains_), _Internal::kHasBitsOffset + 7, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // repeated string in = 10 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // repeated string not_in = 11 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // bool email = 12 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.email_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool hostname = 13 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.hostname_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ip = 14 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ip_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv4 = 15 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv4_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv6 = 16 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv6_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool uri = 17 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.uri_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool uri_ref = 18 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.uri_ref_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // optional uint64 len = 19 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.len_), _Internal::kHasBitsOffset + 13, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.len_bytes_), _Internal::kHasBitsOffset + 14, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // bool address = 21 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.address_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool uuid = 22 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.uuid_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // optional string not_contains = 23 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.not_contains_), _Internal::kHasBitsOffset + 8, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // .buf.validate.KnownRegex well_known_regex = 24 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.well_known_regex_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kEnumRange)}, - // optional bool strict = 25; - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.strict_), _Internal::kHasBitsOffset + 15, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // bool ip_with_prefixlen = 26 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ip_with_prefixlen_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv4_with_prefixlen = 27 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv4_with_prefixlen_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv6_with_prefixlen = 28 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv6_with_prefixlen_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ip_prefix = 29 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ip_prefix_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv4_prefix = 30 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv4_prefix_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv6_prefix = 31 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ipv6_prefix_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool host_and_port = 32 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.host_and_port_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool tuuid = 33 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.tuuid_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // repeated string example = 34 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // bool ulid = 35 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.ulid_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool protobuf_fqn = 37 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.protobuf_fqn_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool protobuf_dot_fqn = 38 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(StringRules, _impl_.well_known_.protobuf_dot_fqn_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - }}, - {{ - {0, 2}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void StringRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.StringRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _impl_.const__.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _impl_.pattern_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - _impl_.prefix_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - _impl_.suffix_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - _impl_.contains_.ClearNonDefaultToEmpty(); - } - } - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - _impl_.not_contains_.ClearNonDefaultToEmpty(); - } - if (BatchCheckHasBit(cached_has_bits, 0x0000fe00U)) { - ::memset(&_impl_.min_len_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.strict_) - - reinterpret_cast(&_impl_.min_len_)) + sizeof(_impl_.strict_)); - } - clear_well_known(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL StringRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const StringRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL StringRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const StringRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.StringRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - const ::std::string& _s = this_._internal_const_(); - target = stream->WriteStringMaybeAliased(1, _s, target); - } - - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_min_len(), target); - } - - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 3, this_._internal_max_len(), target); - } - - // optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000800U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 4, this_._internal_min_bytes(), target); - } - - // optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00001000U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 5, this_._internal_max_bytes(), target); - } - - // optional string pattern = 6 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - const ::std::string& _s = this_._internal_pattern(); - target = stream->WriteStringMaybeAliased(6, _s, target); - } - - // optional string prefix = 7 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - const ::std::string& _s = this_._internal_prefix(); - target = stream->WriteStringMaybeAliased(7, _s, target); - } - - // optional string suffix = 8 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - const ::std::string& _s = this_._internal_suffix(); - target = stream->WriteStringMaybeAliased(8, _s, target); - } - - // optional string contains = 9 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - const ::std::string& _s = this_._internal_contains(); - target = stream->WriteStringMaybeAliased(9, _s, target); - } - - // repeated string in = 10 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - const auto& s = this_._internal_in().Get(i); - target = stream->WriteString(10, s, target); - } - } - - // repeated string not_in = 11 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - const auto& s = this_._internal_not_in().Get(i); - target = stream->WriteString(11, s, target); - } - } - - switch (this_.well_known_case()) { - case kEmail: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 12, this_._internal_email(), target); - break; - } - case kHostname: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 13, this_._internal_hostname(), target); - break; - } - case kIp: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 14, this_._internal_ip(), target); - break; - } - case kIpv4: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 15, this_._internal_ipv4(), target); - break; - } - case kIpv6: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 16, this_._internal_ipv6(), target); - break; - } - case kUri: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 17, this_._internal_uri(), target); - break; - } - case kUriRef: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 18, this_._internal_uri_ref(), target); - break; - } - default: - break; - } - // optional uint64 len = 19 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00002000U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 19, this_._internal_len(), target); - } - - // optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00004000U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 20, this_._internal_len_bytes(), target); - } - - switch (this_.well_known_case()) { - case kAddress: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 21, this_._internal_address(), target); - break; - } - case kUuid: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 22, this_._internal_uuid(), target); - break; - } - default: - break; - } - // optional string not_contains = 23 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - const ::std::string& _s = this_._internal_not_contains(); - target = stream->WriteStringMaybeAliased(23, _s, target); - } - - // .buf.validate.KnownRegex well_known_regex = 24 [(.buf.validate.predefined) = { - if (this_.well_known_case() == kWellKnownRegex) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 24, this_._internal_well_known_regex(), target); - } - - // optional bool strict = 25; - if (CheckHasBit(cached_has_bits, 0x00008000U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 25, this_._internal_strict(), target); - } - - switch (this_.well_known_case()) { - case kIpWithPrefixlen: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 26, this_._internal_ip_with_prefixlen(), target); - break; - } - case kIpv4WithPrefixlen: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 27, this_._internal_ipv4_with_prefixlen(), target); - break; - } - case kIpv6WithPrefixlen: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 28, this_._internal_ipv6_with_prefixlen(), target); - break; - } - case kIpPrefix: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 29, this_._internal_ip_prefix(), target); - break; - } - case kIpv4Prefix: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 30, this_._internal_ipv4_prefix(), target); - break; - } - case kIpv6Prefix: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 31, this_._internal_ipv6_prefix(), target); - break; - } - case kHostAndPort: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 32, this_._internal_host_and_port(), target); - break; - } - case kTuuid: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 33, this_._internal_tuuid(), target); - break; - } - default: - break; - } - // repeated string example = 34 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - const auto& s = this_._internal_example().Get(i); - target = stream->WriteString(34, s, target); - } - } - - switch (this_.well_known_case()) { - case kUlid: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 35, this_._internal_ulid(), target); - break; - } - case kProtobufFqn: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 37, this_._internal_protobuf_fqn(), target); - break; - } - case kProtobufDotFqn: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 38, this_._internal_protobuf_dot_fqn(), target); - break; - } - default: - break; - } - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.StringRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t StringRules::ByteSizeLong(const MessageLite& base) { - const StringRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t StringRules::ByteSizeLong() const { - const StringRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.StringRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00008000U & cached_has_bits) * 3; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - // repeated string in = 10 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_in().size()); - for (int i = 0, n = this_._internal_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_in().Get(i)); - } - } - // repeated string not_in = 11 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_not_in().size()); - for (int i = 0, n = this_._internal_not_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_not_in().Get(i)); - } - } - // repeated string example = 34 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += - 2 * ::google::protobuf::internal::FromIntSize(this_._internal_example().size()); - for (int i = 0, n = this_._internal_example().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_example().Get(i)); - } - } - // optional string const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_const_()); - } - // optional string pattern = 6 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_pattern()); - } - // optional string prefix = 7 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_prefix()); - } - // optional string suffix = 8 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_suffix()); - } - // optional string contains = 9 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_contains()); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x00007f00U)) { - // optional string not_contains = 23 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - total_size += 2 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_not_contains()); - } - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_min_len()); - } - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_max_len()); - } - // optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000800U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_min_bytes()); - } - // optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00001000U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_max_bytes()); - } - // optional uint64 len = 19 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00002000U)) { - total_size += 2 + ::_pbi::WireFormatLite::UInt64Size( - this_._internal_len()); - } - // optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00004000U)) { - total_size += 2 + ::_pbi::WireFormatLite::UInt64Size( - this_._internal_len_bytes()); - } - } - switch (this_.well_known_case()) { - // bool email = 12 [(.buf.validate.predefined) = { - case kEmail: { - total_size += 2; - break; - } - // bool hostname = 13 [(.buf.validate.predefined) = { - case kHostname: { - total_size += 2; - break; - } - // bool ip = 14 [(.buf.validate.predefined) = { - case kIp: { - total_size += 2; - break; - } - // bool ipv4 = 15 [(.buf.validate.predefined) = { - case kIpv4: { - total_size += 2; - break; - } - // bool ipv6 = 16 [(.buf.validate.predefined) = { - case kIpv6: { - total_size += 3; - break; - } - // bool uri = 17 [(.buf.validate.predefined) = { - case kUri: { - total_size += 3; - break; - } - // bool uri_ref = 18 [(.buf.validate.predefined) = { - case kUriRef: { - total_size += 3; - break; - } - // bool address = 21 [(.buf.validate.predefined) = { - case kAddress: { - total_size += 3; - break; - } - // bool uuid = 22 [(.buf.validate.predefined) = { - case kUuid: { - total_size += 3; - break; - } - // bool tuuid = 33 [(.buf.validate.predefined) = { - case kTuuid: { - total_size += 3; - break; - } - // bool ip_with_prefixlen = 26 [(.buf.validate.predefined) = { - case kIpWithPrefixlen: { - total_size += 3; - break; - } - // bool ipv4_with_prefixlen = 27 [(.buf.validate.predefined) = { - case kIpv4WithPrefixlen: { - total_size += 3; - break; - } - // bool ipv6_with_prefixlen = 28 [(.buf.validate.predefined) = { - case kIpv6WithPrefixlen: { - total_size += 3; - break; - } - // bool ip_prefix = 29 [(.buf.validate.predefined) = { - case kIpPrefix: { - total_size += 3; - break; - } - // bool ipv4_prefix = 30 [(.buf.validate.predefined) = { - case kIpv4Prefix: { - total_size += 3; - break; - } - // bool ipv6_prefix = 31 [(.buf.validate.predefined) = { - case kIpv6Prefix: { - total_size += 3; - break; - } - // bool host_and_port = 32 [(.buf.validate.predefined) = { - case kHostAndPort: { - total_size += 3; - break; - } - // bool ulid = 35 [(.buf.validate.predefined) = { - case kUlid: { - total_size += 3; - break; - } - // bool protobuf_fqn = 37 [(.buf.validate.predefined) = { - case kProtobufFqn: { - total_size += 3; - break; - } - // bool protobuf_dot_fqn = 38 [(.buf.validate.predefined) = { - case kProtobufDotFqn: { - total_size += 3; - break; - } - // .buf.validate.KnownRegex well_known_regex = 24 [(.buf.validate.predefined) = { - case kWellKnownRegex: { - total_size += 2 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_well_known_regex()); - break; - } - case WELL_KNOWN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void StringRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.StringRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_internal_set_const_(from._internal_const_()); - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _this->_internal_set_pattern(from._internal_pattern()); - } - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - _this->_internal_set_prefix(from._internal_prefix()); - } - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - _this->_internal_set_suffix(from._internal_suffix()); - } - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - _this->_internal_set_contains(from._internal_contains()); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000ff00U)) { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - _this->_internal_set_not_contains(from._internal_not_contains()); - } - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - _this->_impl_.min_len_ = from._impl_.min_len_; - } - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - _this->_impl_.max_len_ = from._impl_.max_len_; - } - if (CheckHasBit(cached_has_bits, 0x00000800U)) { - _this->_impl_.min_bytes_ = from._impl_.min_bytes_; - } - if (CheckHasBit(cached_has_bits, 0x00001000U)) { - _this->_impl_.max_bytes_ = from._impl_.max_bytes_; - } - if (CheckHasBit(cached_has_bits, 0x00002000U)) { - _this->_impl_.len_ = from._impl_.len_; - } - if (CheckHasBit(cached_has_bits, 0x00004000U)) { - _this->_impl_.len_bytes_ = from._impl_.len_bytes_; - } - if (CheckHasBit(cached_has_bits, 0x00008000U)) { - _this->_impl_.strict_ = from._impl_.strict_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_well_known(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kEmail: { - _this->_impl_.well_known_.email_ = from._impl_.well_known_.email_; - break; - } - case kHostname: { - _this->_impl_.well_known_.hostname_ = from._impl_.well_known_.hostname_; - break; - } - case kIp: { - _this->_impl_.well_known_.ip_ = from._impl_.well_known_.ip_; - break; - } - case kIpv4: { - _this->_impl_.well_known_.ipv4_ = from._impl_.well_known_.ipv4_; - break; - } - case kIpv6: { - _this->_impl_.well_known_.ipv6_ = from._impl_.well_known_.ipv6_; - break; - } - case kUri: { - _this->_impl_.well_known_.uri_ = from._impl_.well_known_.uri_; - break; - } - case kUriRef: { - _this->_impl_.well_known_.uri_ref_ = from._impl_.well_known_.uri_ref_; - break; - } - case kAddress: { - _this->_impl_.well_known_.address_ = from._impl_.well_known_.address_; - break; - } - case kUuid: { - _this->_impl_.well_known_.uuid_ = from._impl_.well_known_.uuid_; - break; - } - case kTuuid: { - _this->_impl_.well_known_.tuuid_ = from._impl_.well_known_.tuuid_; - break; - } - case kIpWithPrefixlen: { - _this->_impl_.well_known_.ip_with_prefixlen_ = from._impl_.well_known_.ip_with_prefixlen_; - break; - } - case kIpv4WithPrefixlen: { - _this->_impl_.well_known_.ipv4_with_prefixlen_ = from._impl_.well_known_.ipv4_with_prefixlen_; - break; - } - case kIpv6WithPrefixlen: { - _this->_impl_.well_known_.ipv6_with_prefixlen_ = from._impl_.well_known_.ipv6_with_prefixlen_; - break; - } - case kIpPrefix: { - _this->_impl_.well_known_.ip_prefix_ = from._impl_.well_known_.ip_prefix_; - break; - } - case kIpv4Prefix: { - _this->_impl_.well_known_.ipv4_prefix_ = from._impl_.well_known_.ipv4_prefix_; - break; - } - case kIpv6Prefix: { - _this->_impl_.well_known_.ipv6_prefix_ = from._impl_.well_known_.ipv6_prefix_; - break; - } - case kHostAndPort: { - _this->_impl_.well_known_.host_and_port_ = from._impl_.well_known_.host_and_port_; - break; - } - case kUlid: { - _this->_impl_.well_known_.ulid_ = from._impl_.well_known_.ulid_; - break; - } - case kProtobufFqn: { - _this->_impl_.well_known_.protobuf_fqn_ = from._impl_.well_known_.protobuf_fqn_; - break; - } - case kProtobufDotFqn: { - _this->_impl_.well_known_.protobuf_dot_fqn_ = from._impl_.well_known_.protobuf_dot_fqn_; - break; - } - case kWellKnownRegex: { - _this->_impl_.well_known_.well_known_regex_ = from._impl_.well_known_.well_known_regex_; - break; - } - case WELL_KNOWN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void StringRules::CopyFrom(const StringRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.StringRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool StringRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void StringRules::InternalSwap(StringRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.const__, &other->_impl_.const__, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.pattern_, &other->_impl_.pattern_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.prefix_, &other->_impl_.prefix_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.suffix_, &other->_impl_.suffix_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.contains_, &other->_impl_.contains_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.not_contains_, &other->_impl_.not_contains_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.strict_) - + sizeof(StringRules::_impl_.strict_) - - PROTOBUF_FIELD_OFFSET(StringRules, _impl_.min_len_)>( - reinterpret_cast(&_impl_.min_len_), - reinterpret_cast(&other->_impl_.min_len_)); - swap(_impl_.well_known_, other->_impl_.well_known_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); -} - -::google::protobuf::Metadata StringRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class BytesRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(BytesRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::BytesRules, _impl_._oneof_case_); -}; - -BytesRules::BytesRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, BytesRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.BytesRules) -} -PROTOBUF_NDEBUG_INLINE BytesRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::BytesRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - const__(arena, from.const__), - pattern_(arena, from.pattern_), - prefix_(arena, from.prefix_), - suffix_(arena, from.suffix_), - contains_(arena, from.contains_), - well_known_{}, - _oneof_case_{from._oneof_case_[0]} {} - -BytesRules::BytesRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const BytesRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, BytesRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - BytesRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_len_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, min_len_), - offsetof(Impl_, len_) - - offsetof(Impl_, min_len_) + - sizeof(Impl_::len_)); - switch (well_known_case()) { - case WELL_KNOWN_NOT_SET: - break; - case kIp: - _impl_.well_known_.ip_ = from._impl_.well_known_.ip_; - break; - case kIpv4: - _impl_.well_known_.ipv4_ = from._impl_.well_known_.ipv4_; - break; - case kIpv6: - _impl_.well_known_.ipv6_ = from._impl_.well_known_.ipv6_; - break; - case kUuid: - _impl_.well_known_.uuid_ = from._impl_.well_known_.uuid_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.BytesRules) -} -PROTOBUF_NDEBUG_INLINE BytesRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - const__(arena), - pattern_(arena), - prefix_(arena), - suffix_(arena), - contains_(arena), - well_known_{}, - _oneof_case_{} {} - -inline void BytesRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_len_), - 0, - offsetof(Impl_, len_) - - offsetof(Impl_, min_len_) + - sizeof(Impl_::len_)); -} -BytesRules::~BytesRules() { - // @@protoc_insertion_point(destructor:buf.validate.BytesRules) - SharedDtor(*this); -} -inline void BytesRules::SharedDtor(MessageLite& self) { - BytesRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.const__.Destroy(); - this_._impl_.pattern_.Destroy(); - this_._impl_.prefix_.Destroy(); - this_._impl_.suffix_.Destroy(); - this_._impl_.contains_.Destroy(); - if (this_.has_well_known()) { - this_.clear_well_known(); - } - this_._impl_.~Impl_(); -} - -void BytesRules::clear_well_known() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.BytesRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (well_known_case()) { - case kIp: { - // No need to clear - break; - } - case kIpv4: { - // No need to clear - break; - } - case kIpv6: { - // No need to clear - break; - } - case kUuid: { - // No need to clear - break; - } - case WELL_KNOWN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = WELL_KNOWN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL BytesRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) BytesRules(arena); -} -constexpr auto BytesRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_._extensions_) + - decltype(BytesRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.in_) + - decltype(BytesRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.not_in_) + - decltype(BytesRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.example_) + - decltype(BytesRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::CopyInit( - sizeof(BytesRules), alignof(BytesRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&BytesRules::PlacementNew_, - sizeof(BytesRules), - alignof(BytesRules)); - } -} -constexpr auto BytesRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_BytesRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - BytesRules::IsInitializedImpl, - &BytesRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &BytesRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &BytesRules::ByteSizeLong, - &BytesRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_._cached_size_), - false, - }, - &BytesRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull BytesRules_class_data_ = - BytesRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -BytesRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&BytesRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(BytesRules_class_data_.tc_table); - return BytesRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 15, 0, 0, 2> -BytesRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_._extensions_), - 15, 120, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294934528, // skipmap - offsetof(decltype(_table_), field_entries), - 15, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - BytesRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::BytesRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional bytes const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {10, 3, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.const__)}}, - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(BytesRules, _impl_.min_len_), 8>(), - {16, 8, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.min_len_)}}, - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(BytesRules, _impl_.max_len_), 9>(), - {24, 9, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.max_len_)}}, - // optional string pattern = 4 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {34, 4, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.pattern_)}}, - // optional bytes prefix = 5 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {42, 5, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.prefix_)}}, - // optional bytes suffix = 6 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {50, 6, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.suffix_)}}, - // optional bytes contains = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBS1, - {58, 7, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.contains_)}}, - // repeated bytes in = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {66, 0, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.in_)}}, - // repeated bytes not_in = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {74, 1, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.not_in_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional uint64 len = 13 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(BytesRules, _impl_.len_), 10>(), - {104, 10, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.len_)}}, - // repeated bytes example = 14 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {114, 2, 0, - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional bytes const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.min_len_), _Internal::kHasBitsOffset + 8, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.max_len_), _Internal::kHasBitsOffset + 9, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional string pattern = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.pattern_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional bytes prefix = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.prefix_), _Internal::kHasBitsOffset + 5, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional bytes suffix = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.suffix_), _Internal::kHasBitsOffset + 6, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional bytes contains = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.contains_), _Internal::kHasBitsOffset + 7, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // repeated bytes in = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // repeated bytes not_in = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // bool ip = 10 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.well_known_.ip_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv4 = 11 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.well_known_.ipv4_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool ipv6 = 12 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.well_known_.ipv6_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // optional uint64 len = 13 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.len_), _Internal::kHasBitsOffset + 10, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // repeated bytes example = 14 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // bool uuid = 15 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.well_known_.uuid_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void BytesRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.BytesRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _impl_.const__.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _impl_.pattern_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - _impl_.prefix_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - _impl_.suffix_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - _impl_.contains_.ClearNonDefaultToEmpty(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x00000700U)) { - ::memset(&_impl_.min_len_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.len_) - - reinterpret_cast(&_impl_.min_len_)) + sizeof(_impl_.len_)); - } - clear_well_known(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL BytesRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const BytesRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL BytesRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const BytesRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.BytesRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional bytes const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - const ::std::string& _s = this_._internal_const_(); - target = stream->WriteBytesMaybeAliased(1, _s, target); - } - - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_min_len(), target); - } - - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 3, this_._internal_max_len(), target); - } - - // optional string pattern = 4 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - const ::std::string& _s = this_._internal_pattern(); - target = stream->WriteStringMaybeAliased(4, _s, target); - } - - // optional bytes prefix = 5 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - const ::std::string& _s = this_._internal_prefix(); - target = stream->WriteBytesMaybeAliased(5, _s, target); - } - - // optional bytes suffix = 6 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - const ::std::string& _s = this_._internal_suffix(); - target = stream->WriteBytesMaybeAliased(6, _s, target); - } - - // optional bytes contains = 7 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - const ::std::string& _s = this_._internal_contains(); - target = stream->WriteBytesMaybeAliased(7, _s, target); - } - - // repeated bytes in = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - const auto& s = this_._internal_in().Get(i); - target = stream->WriteBytes(8, s, target); - } - } - - // repeated bytes not_in = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - const auto& s = this_._internal_not_in().Get(i); - target = stream->WriteBytes(9, s, target); - } - } - - switch (this_.well_known_case()) { - case kIp: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 10, this_._internal_ip(), target); - break; - } - case kIpv4: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 11, this_._internal_ipv4(), target); - break; - } - case kIpv6: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 12, this_._internal_ipv6(), target); - break; - } - default: - break; - } - // optional uint64 len = 13 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 13, this_._internal_len(), target); - } - - // repeated bytes example = 14 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - const auto& s = this_._internal_example().Get(i); - target = stream->WriteBytes(14, s, target); - } - } - - // bool uuid = 15 [(.buf.validate.predefined) = { - if (this_.well_known_case() == kUuid) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 15, this_._internal_uuid(), target); - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.BytesRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t BytesRules::ByteSizeLong(const MessageLite& base) { - const BytesRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t BytesRules::ByteSizeLong() const { - const BytesRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.BytesRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - // repeated bytes in = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_in().size()); - for (int i = 0, n = this_._internal_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_in().Get(i)); - } - } - // repeated bytes not_in = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_not_in().size()); - for (int i = 0, n = this_._internal_not_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_not_in().Get(i)); - } - } - // repeated bytes example = 14 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_example().size()); - for (int i = 0, n = this_._internal_example().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_example().Get(i)); - } - } - // optional bytes const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_const_()); - } - // optional string pattern = 4 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_pattern()); - } - // optional bytes prefix = 5 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_prefix()); - } - // optional bytes suffix = 6 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_suffix()); - } - // optional bytes contains = 7 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this_._internal_contains()); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x00000700U)) { - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_min_len()); - } - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_max_len()); - } - // optional uint64 len = 13 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_len()); - } - } - switch (this_.well_known_case()) { - // bool ip = 10 [(.buf.validate.predefined) = { - case kIp: { - total_size += 2; - break; - } - // bool ipv4 = 11 [(.buf.validate.predefined) = { - case kIpv4: { - total_size += 2; - break; - } - // bool ipv6 = 12 [(.buf.validate.predefined) = { - case kIpv6: { - total_size += 2; - break; - } - // bool uuid = 15 [(.buf.validate.predefined) = { - case kUuid: { - total_size += 2; - break; - } - case WELL_KNOWN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void BytesRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.BytesRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x000000ffU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_internal_set_const_(from._internal_const_()); - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _this->_internal_set_pattern(from._internal_pattern()); - } - if (CheckHasBit(cached_has_bits, 0x00000020U)) { - _this->_internal_set_prefix(from._internal_prefix()); - } - if (CheckHasBit(cached_has_bits, 0x00000040U)) { - _this->_internal_set_suffix(from._internal_suffix()); - } - if (CheckHasBit(cached_has_bits, 0x00000080U)) { - _this->_internal_set_contains(from._internal_contains()); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x00000700U)) { - if (CheckHasBit(cached_has_bits, 0x00000100U)) { - _this->_impl_.min_len_ = from._impl_.min_len_; - } - if (CheckHasBit(cached_has_bits, 0x00000200U)) { - _this->_impl_.max_len_ = from._impl_.max_len_; - } - if (CheckHasBit(cached_has_bits, 0x00000400U)) { - _this->_impl_.len_ = from._impl_.len_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_well_known(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kIp: { - _this->_impl_.well_known_.ip_ = from._impl_.well_known_.ip_; - break; - } - case kIpv4: { - _this->_impl_.well_known_.ipv4_ = from._impl_.well_known_.ipv4_; - break; - } - case kIpv6: { - _this->_impl_.well_known_.ipv6_ = from._impl_.well_known_.ipv6_; - break; - } - case kUuid: { - _this->_impl_.well_known_.uuid_ = from._impl_.well_known_.uuid_; - break; - } - case WELL_KNOWN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void BytesRules::CopyFrom(const BytesRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.BytesRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool BytesRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void BytesRules::InternalSwap(BytesRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.const__, &other->_impl_.const__, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.pattern_, &other->_impl_.pattern_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.prefix_, &other->_impl_.prefix_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.suffix_, &other->_impl_.suffix_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.contains_, &other->_impl_.contains_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.len_) - + sizeof(BytesRules::_impl_.len_) - - PROTOBUF_FIELD_OFFSET(BytesRules, _impl_.min_len_)>( - reinterpret_cast(&_impl_.min_len_), - reinterpret_cast(&other->_impl_.min_len_)); - swap(_impl_.well_known_, other->_impl_.well_known_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); -} - -::google::protobuf::Metadata BytesRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class EnumRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(EnumRules, _impl_._has_bits_); -}; - -EnumRules::EnumRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, EnumRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.EnumRules) -} -PROTOBUF_NDEBUG_INLINE EnumRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::EnumRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_} {} - -EnumRules::EnumRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const EnumRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, EnumRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - EnumRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, const__), - offsetof(Impl_, defined_only_) - - offsetof(Impl_, const__) + - sizeof(Impl_::defined_only_)); - - // @@protoc_insertion_point(copy_constructor:buf.validate.EnumRules) -} -PROTOBUF_NDEBUG_INLINE EnumRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena} {} - -inline void EnumRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - 0, - offsetof(Impl_, defined_only_) - - offsetof(Impl_, const__) + - sizeof(Impl_::defined_only_)); -} -EnumRules::~EnumRules() { - // @@protoc_insertion_point(destructor:buf.validate.EnumRules) - SharedDtor(*this); -} -inline void EnumRules::SharedDtor(MessageLite& self) { - EnumRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL EnumRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) EnumRules(arena); -} -constexpr auto EnumRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_._extensions_) + - decltype(EnumRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.in_) + - decltype(EnumRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.not_in_) + - decltype(EnumRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.example_) + - decltype(EnumRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(EnumRules), alignof(EnumRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&EnumRules::PlacementNew_, - sizeof(EnumRules), - alignof(EnumRules)); - } -} -constexpr auto EnumRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_EnumRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - EnumRules::IsInitializedImpl, - &EnumRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &EnumRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &EnumRules::ByteSizeLong, - &EnumRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_._cached_size_), - false, - }, - &EnumRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull EnumRules_class_data_ = - EnumRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -EnumRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&EnumRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(EnumRules_class_data_.tc_table); - return EnumRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 5, 0, 0, 2> -EnumRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_._extensions_), - 5, 56, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967264, // skipmap - offsetof(decltype(_table_), field_entries), - 5, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - EnumRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::EnumRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional int32 const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumRules, _impl_.const__), 3>(), - {8, 3, 0, - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.const__)}}, - // optional bool defined_only = 2; - {::_pbi::TcParser::SingularVarintNoZag1(), - {16, 4, 0, - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.defined_only_)}}, - // repeated int32 in = 3 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {24, 0, 0, - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.in_)}}, - // repeated int32 not_in = 4 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {32, 1, 0, - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.not_in_)}}, - // repeated int32 example = 5 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastV32R1, - {40, 2, 0, - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional int32 const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, - // optional bool defined_only = 2; - {PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.defined_only_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // repeated int32 in = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - // repeated int32 not_in = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - // repeated int32 example = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcRepeated | ::_fl::kInt32)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void EnumRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.EnumRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x00000018U)) { - ::memset(&_impl_.const__, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.defined_only_) - - reinterpret_cast(&_impl_.const__)) + sizeof(_impl_.defined_only_)); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL EnumRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const EnumRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL EnumRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const EnumRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.EnumRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( - stream, this_._internal_const_(), target); - } - - // optional bool defined_only = 2; - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 2, this_._internal_defined_only(), target); - } - - // repeated int32 in = 3 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 3, this_._internal_in().Get(i), target); - } - } - - // repeated int32 not_in = 4 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 4, this_._internal_not_in().Get(i), target); - } - } - - // repeated int32 example = 5 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (int i = 0, n = this_._internal_example_size(); i < n; ++i) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteInt32ToArray( - 5, this_._internal_example().Get(i), target); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.EnumRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t EnumRules::ByteSizeLong(const MessageLite& base) { - const EnumRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t EnumRules::ByteSizeLong() const { - const EnumRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.EnumRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000010U & cached_has_bits) * 2; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated int32 in = 3 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_in_size()); - total_size += tag_size + data_size; - } - // repeated int32 not_in = 4 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_not_in()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_not_in_size()); - total_size += tag_size + data_size; - } - // repeated int32 example = 5 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - ::size_t data_size = ::_pbi::WireFormatLite::Int32Size( - this_._internal_example()); - ::size_t tag_size = ::size_t{1} * - ::_pbi::FromIntSize(this_._internal_example_size()); - total_size += tag_size + data_size; - } - // optional int32 const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_const_()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void EnumRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.EnumRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->MergeFrom(from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->MergeFrom(from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->MergeFrom(from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.const__ = from._impl_.const__; - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _this->_impl_.defined_only_ = from._impl_.defined_only_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void EnumRules::CopyFrom(const EnumRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.EnumRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool EnumRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void EnumRules::InternalSwap(EnumRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.defined_only_) - + sizeof(EnumRules::_impl_.defined_only_) - - PROTOBUF_FIELD_OFFSET(EnumRules, _impl_.const__)>( - reinterpret_cast(&_impl_.const__), - reinterpret_cast(&other->_impl_.const__)); -} - -::google::protobuf::Metadata EnumRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class RepeatedRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_._has_bits_); -}; - -RepeatedRules::RepeatedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, RepeatedRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.RepeatedRules) -} -PROTOBUF_NDEBUG_INLINE RepeatedRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::RepeatedRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0} {} - -RepeatedRules::RepeatedRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const RepeatedRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, RepeatedRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - RepeatedRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.items_ = (CheckHasBit(cached_has_bits, 0x00000001U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.items_) - : nullptr; - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_items_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, min_items_), - offsetof(Impl_, unique_) - - offsetof(Impl_, min_items_) + - sizeof(Impl_::unique_)); - - // @@protoc_insertion_point(copy_constructor:buf.validate.RepeatedRules) -} -PROTOBUF_NDEBUG_INLINE RepeatedRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0} {} - -inline void RepeatedRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, items_), - 0, - offsetof(Impl_, unique_) - - offsetof(Impl_, items_) + - sizeof(Impl_::unique_)); -} -RepeatedRules::~RepeatedRules() { - // @@protoc_insertion_point(destructor:buf.validate.RepeatedRules) - SharedDtor(*this); -} -inline void RepeatedRules::SharedDtor(MessageLite& self) { - RepeatedRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - delete this_._impl_.items_; - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL RepeatedRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) RepeatedRules(arena); -} -constexpr auto RepeatedRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_._extensions_) + - decltype(RepeatedRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(RepeatedRules), alignof(RepeatedRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&RepeatedRules::PlacementNew_, - sizeof(RepeatedRules), - alignof(RepeatedRules)); - } -} -constexpr auto RepeatedRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_RepeatedRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - RepeatedRules::IsInitializedImpl, - &RepeatedRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &RepeatedRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &RepeatedRules::ByteSizeLong, - &RepeatedRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_._cached_size_), - false, - }, - &RepeatedRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull RepeatedRules_class_data_ = - RepeatedRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -RepeatedRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&RepeatedRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(RepeatedRules_class_data_.tc_table); - return RepeatedRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 4, 1, 0, 2> -RepeatedRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_._extensions_), - 4, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967280, // skipmap - offsetof(decltype(_table_), field_entries), - 4, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - RepeatedRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::RepeatedRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // optional .buf.validate.FieldRules items = 4; - {::_pbi::TcParser::FastMtS1, - {34, 0, 0, - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.items_)}}, - // optional uint64 min_items = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(RepeatedRules, _impl_.min_items_), 1>(), - {8, 1, 0, - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.min_items_)}}, - // optional uint64 max_items = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(RepeatedRules, _impl_.max_items_), 2>(), - {16, 2, 0, - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.max_items_)}}, - // optional bool unique = 3 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1(), - {24, 3, 0, - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.unique_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional uint64 min_items = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.min_items_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 max_items = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.max_items_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional bool unique = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.unique_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // optional .buf.validate.FieldRules items = 4; - {PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.items_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::FieldRules>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void RepeatedRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.RepeatedRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(_impl_.items_ != nullptr); - _impl_.items_->Clear(); - } - if (BatchCheckHasBit(cached_has_bits, 0x0000000eU)) { - ::memset(&_impl_.min_items_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.unique_) - - reinterpret_cast(&_impl_.min_items_)) + sizeof(_impl_.unique_)); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL RepeatedRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const RepeatedRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL RepeatedRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const RepeatedRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.RepeatedRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional uint64 min_items = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 1, this_._internal_min_items(), target); - } - - // optional uint64 max_items = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_max_items(), target); - } - - // optional bool unique = 3 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 3, this_._internal_unique(), target); - } - - // optional .buf.validate.FieldRules items = 4; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.items_, this_._impl_.items_->GetCachedSize(), target, - stream); - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.RepeatedRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t RepeatedRules::ByteSizeLong(const MessageLite& base) { - const RepeatedRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t RepeatedRules::ByteSizeLong() const { - const RepeatedRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.RepeatedRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000008U & cached_has_bits) * 2; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // optional .buf.validate.FieldRules items = 4; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.items_); - } - // optional uint64 min_items = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_min_items()); - } - // optional uint64 max_items = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_max_items()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void RepeatedRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.RepeatedRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(from._impl_.items_ != nullptr); - if (_this->_impl_.items_ == nullptr) { - _this->_impl_.items_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.items_); - } else { - _this->_impl_.items_->MergeFrom(*from._impl_.items_); - } - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_impl_.min_items_ = from._impl_.min_items_; - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.max_items_ = from._impl_.max_items_; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.unique_ = from._impl_.unique_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void RepeatedRules::CopyFrom(const RepeatedRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.RepeatedRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool RepeatedRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - if (CheckHasBit(this_._impl_._has_bits_[0], 0x00000001U)) { - if (!this_._impl_.items_->IsInitialized()) return false; - } - return true; -} - -void RepeatedRules::InternalSwap(RepeatedRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.unique_) - + sizeof(RepeatedRules::_impl_.unique_) - - PROTOBUF_FIELD_OFFSET(RepeatedRules, _impl_.items_)>( - reinterpret_cast(&_impl_.items_), - reinterpret_cast(&other->_impl_.items_)); -} - -::google::protobuf::Metadata RepeatedRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class MapRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(MapRules, _impl_._has_bits_); -}; - -MapRules::MapRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MapRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.MapRules) -} -PROTOBUF_NDEBUG_INLINE MapRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::MapRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0} {} - -MapRules::MapRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const MapRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, MapRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - MapRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.keys_ = (CheckHasBit(cached_has_bits, 0x00000001U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.keys_) - : nullptr; - _impl_.values_ = (CheckHasBit(cached_has_bits, 0x00000002U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.values_) - : nullptr; - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, min_pairs_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, min_pairs_), - offsetof(Impl_, max_pairs_) - - offsetof(Impl_, min_pairs_) + - sizeof(Impl_::max_pairs_)); - - // @@protoc_insertion_point(copy_constructor:buf.validate.MapRules) -} -PROTOBUF_NDEBUG_INLINE MapRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0} {} - -inline void MapRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, keys_), - 0, - offsetof(Impl_, max_pairs_) - - offsetof(Impl_, keys_) + - sizeof(Impl_::max_pairs_)); -} -MapRules::~MapRules() { - // @@protoc_insertion_point(destructor:buf.validate.MapRules) - SharedDtor(*this); -} -inline void MapRules::SharedDtor(MessageLite& self) { - MapRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - delete this_._impl_.keys_; - delete this_._impl_.values_; - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL MapRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) MapRules(arena); -} -constexpr auto MapRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(MapRules, _impl_._extensions_) + - decltype(MapRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(MapRules), alignof(MapRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&MapRules::PlacementNew_, - sizeof(MapRules), - alignof(MapRules)); - } -} -constexpr auto MapRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_MapRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - MapRules::IsInitializedImpl, - &MapRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &MapRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &MapRules::ByteSizeLong, - &MapRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(MapRules, _impl_._cached_size_), - false, - }, - &MapRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull MapRules_class_data_ = - MapRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -MapRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&MapRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(MapRules_class_data_.tc_table); - return MapRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 4, 2, 0, 2> -MapRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(MapRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(MapRules, _impl_._extensions_), - 5, 56, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967268, // skipmap - offsetof(decltype(_table_), field_entries), - 4, // num_field_entries - 2, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - MapRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::MapRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(MapRules, _impl_.min_pairs_), 2>(), - {8, 2, 0, - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.min_pairs_)}}, - // optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::SingularVarintNoZag1<::uint64_t, offsetof(MapRules, _impl_.max_pairs_), 3>(), - {16, 3, 0, - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.max_pairs_)}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional .buf.validate.FieldRules keys = 4; - {::_pbi::TcParser::FastMtS1, - {34, 0, 0, - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.keys_)}}, - // optional .buf.validate.FieldRules values = 5; - {::_pbi::TcParser::FastMtS1, - {42, 1, 1, - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.values_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(MapRules, _impl_.min_pairs_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(MapRules, _impl_.max_pairs_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kUInt64)}, - // optional .buf.validate.FieldRules keys = 4; - {PROTOBUF_FIELD_OFFSET(MapRules, _impl_.keys_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // optional .buf.validate.FieldRules values = 5; - {PROTOBUF_FIELD_OFFSET(MapRules, _impl_.values_), _Internal::kHasBitsOffset + 1, 1, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::FieldRules>()}, - {::_pbi::TcParser::GetTable<::buf::validate::FieldRules>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void MapRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.MapRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(_impl_.keys_ != nullptr); - _impl_.keys_->Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - ABSL_DCHECK(_impl_.values_ != nullptr); - _impl_.values_->Clear(); - } - } - if (BatchCheckHasBit(cached_has_bits, 0x0000000cU)) { - ::memset(&_impl_.min_pairs_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.max_pairs_) - - reinterpret_cast(&_impl_.min_pairs_)) + sizeof(_impl_.max_pairs_)); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL MapRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const MapRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL MapRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const MapRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.MapRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 1, this_._internal_min_pairs(), target); - } - - // optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 2, this_._internal_max_pairs(), target); - } - - // optional .buf.validate.FieldRules keys = 4; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.keys_, this_._impl_.keys_->GetCachedSize(), target, - stream); - } - - // optional .buf.validate.FieldRules values = 5; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.values_, this_._impl_.values_->GetCachedSize(), target, - stream); - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.MapRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t MapRules::ByteSizeLong(const MessageLite& base) { - const MapRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t MapRules::ByteSizeLong() const { - const MapRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.MapRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // optional .buf.validate.FieldRules keys = 4; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.keys_); - } - // optional .buf.validate.FieldRules values = 5; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.values_); - } - // optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_min_pairs()); - } - // optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_max_pairs()); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void MapRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.MapRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(from._impl_.keys_ != nullptr); - if (_this->_impl_.keys_ == nullptr) { - _this->_impl_.keys_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.keys_); - } else { - _this->_impl_.keys_->MergeFrom(*from._impl_.keys_); - } - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - ABSL_DCHECK(from._impl_.values_ != nullptr); - if (_this->_impl_.values_ == nullptr) { - _this->_impl_.values_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.values_); - } else { - _this->_impl_.values_->MergeFrom(*from._impl_.values_); - } - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.min_pairs_ = from._impl_.min_pairs_; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.max_pairs_ = from._impl_.max_pairs_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void MapRules::CopyFrom(const MapRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.MapRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool MapRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - if (CheckHasBit(this_._impl_._has_bits_[0], 0x00000001U)) { - if (!this_._impl_.keys_->IsInitialized()) return false; - } - if (CheckHasBit(this_._impl_._has_bits_[0], 0x00000002U)) { - if (!this_._impl_.values_->IsInitialized()) return false; - } - return true; -} - -void MapRules::InternalSwap(MapRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.max_pairs_) - + sizeof(MapRules::_impl_.max_pairs_) - - PROTOBUF_FIELD_OFFSET(MapRules, _impl_.keys_)>( - reinterpret_cast(&_impl_.keys_), - reinterpret_cast(&other->_impl_.keys_)); -} - -::google::protobuf::Metadata MapRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class AnyRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(AnyRules, _impl_._has_bits_); -}; - -AnyRules::AnyRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, AnyRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.AnyRules) -} -PROTOBUF_NDEBUG_INLINE AnyRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::AnyRules& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_} {} - -AnyRules::AnyRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const AnyRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, AnyRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - AnyRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.AnyRules) -} -PROTOBUF_NDEBUG_INLINE AnyRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena} {} - -inline void AnyRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -AnyRules::~AnyRules() { - // @@protoc_insertion_point(destructor:buf.validate.AnyRules) - SharedDtor(*this); -} -inline void AnyRules::SharedDtor(MessageLite& self) { - AnyRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL AnyRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) AnyRules(arena); -} -constexpr auto AnyRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.in_) + - decltype(AnyRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.not_in_) + - decltype(AnyRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(AnyRules), alignof(AnyRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&AnyRules::PlacementNew_, - sizeof(AnyRules), - alignof(AnyRules)); - } -} -constexpr auto AnyRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_AnyRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &AnyRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &AnyRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &AnyRules::ByteSizeLong, - &AnyRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_._cached_size_), - false, - }, - &AnyRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull AnyRules_class_data_ = - AnyRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -AnyRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&AnyRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(AnyRules_class_data_.tc_table); - return AnyRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<1, 2, 0, 0, 2> -AnyRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_._has_bits_), - 0, // no _extensions_ - 3, 8, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967289, // skipmap - offsetof(decltype(_table_), field_entries), - 2, // num_field_entries - 0, // num_aux_entries - offsetof(decltype(_table_), field_names), // no aux_entries - AnyRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::AnyRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated string in = 2; - {::_pbi::TcParser::FastBR1, - {18, 0, 0, - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.in_)}}, - // repeated string not_in = 3; - {::_pbi::TcParser::FastBR1, - {26, 1, 0, - PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated string in = 2; - {PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // repeated string not_in = 3; - {PROTOBUF_FIELD_OFFSET(AnyRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - }}, - // no aux_entries - {{ - }}, -}; -PROTOBUF_NOINLINE void AnyRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.AnyRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL AnyRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const AnyRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL AnyRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const AnyRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.AnyRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated string in = 2; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - const auto& s = this_._internal_in().Get(i); - target = stream->WriteString(2, s, target); - } - } - - // repeated string not_in = 3; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - const auto& s = this_._internal_not_in().Get(i); - target = stream->WriteString(3, s, target); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.AnyRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t AnyRules::ByteSizeLong(const MessageLite& base) { - const AnyRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t AnyRules::ByteSizeLong() const { - const AnyRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.AnyRules) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - // repeated string in = 2; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_in().size()); - for (int i = 0, n = this_._internal_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_in().Get(i)); - } - } - // repeated string not_in = 3; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_not_in().size()); - for (int i = 0, n = this_._internal_not_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_not_in().Get(i)); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void AnyRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.AnyRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000003U)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_not_in()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void AnyRules::CopyFrom(const AnyRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.AnyRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void AnyRules::InternalSwap(AnyRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); -} - -::google::protobuf::Metadata AnyRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class DurationRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(DurationRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::DurationRules, _impl_._oneof_case_); -}; - -void DurationRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ != nullptr) _impl_.const__->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -void DurationRules::set_allocated_lt(::google::protobuf::Duration* PROTOBUF_NULLABLE lt) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_less_than(); - if (lt) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(lt)->GetArena(); - if (message_arena != submessage_arena) { - lt = ::google::protobuf::internal::GetOwnedMessage(message_arena, lt, submessage_arena); - } - set_has_lt(); - _impl_.less_than_.lt_ = lt; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.DurationRules.lt) -} -void DurationRules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lt_); - } - clear_has_less_than(); - } -} -void DurationRules::set_allocated_lte(::google::protobuf::Duration* PROTOBUF_NULLABLE lte) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_less_than(); - if (lte) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(lte)->GetArena(); - if (message_arena != submessage_arena) { - lte = ::google::protobuf::internal::GetOwnedMessage(message_arena, lte, submessage_arena); - } - set_has_lte(); - _impl_.less_than_.lte_ = lte; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.DurationRules.lte) -} -void DurationRules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lte_); - } - clear_has_less_than(); - } -} -void DurationRules::set_allocated_gt(::google::protobuf::Duration* PROTOBUF_NULLABLE gt) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_greater_than(); - if (gt) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(gt)->GetArena(); - if (message_arena != submessage_arena) { - gt = ::google::protobuf::internal::GetOwnedMessage(message_arena, gt, submessage_arena); - } - set_has_gt(); - _impl_.greater_than_.gt_ = gt; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.DurationRules.gt) -} -void DurationRules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gt_); - } - clear_has_greater_than(); - } -} -void DurationRules::set_allocated_gte(::google::protobuf::Duration* PROTOBUF_NULLABLE gte) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_greater_than(); - if (gte) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(gte)->GetArena(); - if (message_arena != submessage_arena) { - gte = ::google::protobuf::internal::GetOwnedMessage(message_arena, gte, submessage_arena); - } - set_has_gte(); - _impl_.greater_than_.gte_ = gte; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.DurationRules.gte) -} -void DurationRules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gte_); - } - clear_has_greater_than(); - } -} -void DurationRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -void DurationRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -void DurationRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -DurationRules::DurationRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, DurationRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.DurationRules) -} -PROTOBUF_NDEBUG_INLINE DurationRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::DurationRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -DurationRules::DurationRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const DurationRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, DurationRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - DurationRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.const__ = (CheckHasBit(cached_has_bits, 0x00000008U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__) - : nullptr; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lt_); - break; - case kLte: - _impl_.less_than_.lte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lte_); - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gt_); - break; - case kGte: - _impl_.greater_than_.gte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gte_); - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.DurationRules) -} -PROTOBUF_NDEBUG_INLINE DurationRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void DurationRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -DurationRules::~DurationRules() { - // @@protoc_insertion_point(destructor:buf.validate.DurationRules) - SharedDtor(*this); -} -inline void DurationRules::SharedDtor(MessageLite& self) { - DurationRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - delete this_._impl_.const__; - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void DurationRules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.DurationRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lt_); - } - break; - } - case kLte: { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lte_); - } - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void DurationRules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.DurationRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gt_); - } - break; - } - case kGte: { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gte_); - } - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL DurationRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) DurationRules(arena); -} -constexpr auto DurationRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_._extensions_) + - decltype(DurationRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.in_) + - decltype(DurationRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.not_in_) + - decltype(DurationRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.example_) + - decltype(DurationRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(DurationRules), alignof(DurationRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&DurationRules::PlacementNew_, - sizeof(DurationRules), - alignof(DurationRules)); - } -} -constexpr auto DurationRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_DurationRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - DurationRules::IsInitializedImpl, - &DurationRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &DurationRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &DurationRules::ByteSizeLong, - &DurationRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_._cached_size_), - false, - }, - &DurationRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull DurationRules_class_data_ = - DurationRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -DurationRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&DurationRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(DurationRules_class_data_.tc_table); - return DurationRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 8, 8, 0, 2> -DurationRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_._extensions_), - 9, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966785, // skipmap - offsetof(decltype(_table_), field_entries), - 8, // num_field_entries - 8, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - DurationRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::DurationRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtR1, - {66, 1, 6, - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.not_in_)}}, - // repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtR1, - {74, 2, 7, - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.example_)}}, - // optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtS1, - {18, 3, 0, - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.const__)}}, - // repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtR1, - {58, 0, 5, - PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Duration lt = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 1, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Duration lte = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 2, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Duration gt = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 3, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Duration gte = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 4, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 5, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 6, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(DurationRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 7, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void DurationRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.DurationRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(_impl_.const__ != nullptr); - _impl_.const__->Clear(); - } - } - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL DurationRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const DurationRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL DurationRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const DurationRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.DurationRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.const__, this_._impl_.const__->GetCachedSize(), target, - stream); - } - - switch (this_.less_than_case()) { - case kLt: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.less_than_.lt_, this_._impl_.less_than_.lt_->GetCachedSize(), target, - stream); - break; - } - case kLte: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.less_than_.lte_, this_._impl_.less_than_.lte_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.greater_than_.gt_, this_._impl_.greater_than_.gt_->GetCachedSize(), target, - stream); - break; - } - case kGte: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, *this_._impl_.greater_than_.gte_, this_._impl_.greater_than_.gte_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - // repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_in_size()); - i < n; i++) { - const auto& repfield = this_._internal_in().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 7, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_not_in_size()); - i < n; i++) { - const auto& repfield = this_._internal_not_in().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 8, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_example_size()); - i < n; i++) { - const auto& repfield = this_._internal_example().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.DurationRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t DurationRules::ByteSizeLong(const MessageLite& base) { - const DurationRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t DurationRules::ByteSizeLong() const { - const DurationRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.DurationRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_in_size(); - for (const auto& msg : this_._internal_in()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += 1UL * this_._internal_not_in_size(); - for (const auto& msg : this_._internal_not_in()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += 1UL * this_._internal_example_size(); - for (const auto& msg : this_._internal_example()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.const__); - } - } - switch (this_.less_than_case()) { - // .google.protobuf.Duration lt = 3 [(.buf.validate.predefined) = { - case kLt: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.less_than_.lt_); - break; - } - // .google.protobuf.Duration lte = 4 [(.buf.validate.predefined) = { - case kLte: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.less_than_.lte_); - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // .google.protobuf.Duration gt = 5 [(.buf.validate.predefined) = { - case kGt: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.greater_than_.gt_); - break; - } - // .google.protobuf.Duration gte = 6 [(.buf.validate.predefined) = { - case kGte: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.greater_than_.gte_); - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void DurationRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.DurationRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(from._impl_.const__ != nullptr); - if (_this->_impl_.const__ == nullptr) { - _this->_impl_.const__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__); - } else { - _this->_impl_.const__->MergeFrom(*from._impl_.const__); - } - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - if (oneof_needs_init) { - _this->_impl_.less_than_.lt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lt_); - } else { - _this->_impl_.less_than_.lt_->MergeFrom(*from._impl_.less_than_.lt_); - } - break; - } - case kLte: { - if (oneof_needs_init) { - _this->_impl_.less_than_.lte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lte_); - } else { - _this->_impl_.less_than_.lte_->MergeFrom(*from._impl_.less_than_.lte_); - } - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - if (oneof_needs_init) { - _this->_impl_.greater_than_.gt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gt_); - } else { - _this->_impl_.greater_than_.gt_->MergeFrom(*from._impl_.greater_than_.gt_); - } - break; - } - case kGte: { - if (oneof_needs_init) { - _this->_impl_.greater_than_.gte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gte_); - } else { - _this->_impl_.greater_than_.gte_->MergeFrom(*from._impl_.greater_than_.gte_); - } - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void DurationRules::CopyFrom(const DurationRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.DurationRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool DurationRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void DurationRules::InternalSwap(DurationRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata DurationRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class FieldMaskRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_._has_bits_); -}; - -void FieldMaskRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ != nullptr) _impl_.const__->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -void FieldMaskRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -FieldMaskRules::FieldMaskRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldMaskRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.FieldMaskRules) -} -PROTOBUF_NDEBUG_INLINE FieldMaskRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::FieldMaskRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - in_{visibility, arena, from.in_}, - not_in_{visibility, arena, from.not_in_}, - example_{visibility, arena, from.example_} {} - -FieldMaskRules::FieldMaskRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const FieldMaskRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldMaskRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - FieldMaskRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.const__ = (CheckHasBit(cached_has_bits, 0x00000008U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__) - : nullptr; - - // @@protoc_insertion_point(copy_constructor:buf.validate.FieldMaskRules) -} -PROTOBUF_NDEBUG_INLINE FieldMaskRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - in_{visibility, arena}, - not_in_{visibility, arena}, - example_{visibility, arena} {} - -inline void FieldMaskRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.const__ = {}; -} -FieldMaskRules::~FieldMaskRules() { - // @@protoc_insertion_point(destructor:buf.validate.FieldMaskRules) - SharedDtor(*this); -} -inline void FieldMaskRules::SharedDtor(MessageLite& self) { - FieldMaskRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - delete this_._impl_.const__; - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL FieldMaskRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) FieldMaskRules(arena); -} -constexpr auto FieldMaskRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_._extensions_) + - decltype(FieldMaskRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.in_) + - decltype(FieldMaskRules::_impl_.in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.not_in_) + - decltype(FieldMaskRules::_impl_.not_in_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.example_) + - decltype(FieldMaskRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(FieldMaskRules), alignof(FieldMaskRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&FieldMaskRules::PlacementNew_, - sizeof(FieldMaskRules), - alignof(FieldMaskRules)); - } -} -constexpr auto FieldMaskRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_FieldMaskRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - FieldMaskRules::IsInitializedImpl, - &FieldMaskRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldMaskRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &FieldMaskRules::ByteSizeLong, - &FieldMaskRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_._cached_size_), - false, - }, - &FieldMaskRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull FieldMaskRules_class_data_ = - FieldMaskRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -FieldMaskRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&FieldMaskRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(FieldMaskRules_class_data_.tc_table); - return FieldMaskRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<2, 4, 2, 0, 2> -FieldMaskRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_._extensions_), - 4, 24, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967280, // skipmap - offsetof(decltype(_table_), field_entries), - 4, // num_field_entries - 2, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - FieldMaskRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::FieldMaskRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtR1, - {34, 2, 1, - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.example_)}}, - // optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtS1, - {10, 3, 0, - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.const__)}}, - // repeated string in = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {18, 0, 0, - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.in_)}}, - // repeated string not_in = 3 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastBR1, - {26, 1, 0, - PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.not_in_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.const__), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated string in = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.in_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // repeated string not_in = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.not_in_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcRepeated | ::_fl::kBytes | ::_fl::kRepSString)}, - // repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(FieldMaskRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 1, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FieldMask>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::FieldMask>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void FieldMaskRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.FieldMaskRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _impl_.not_in_.Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(_impl_.const__ != nullptr); - _impl_.const__->Clear(); - } - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL FieldMaskRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const FieldMaskRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL FieldMaskRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const FieldMaskRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.FieldMaskRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, *this_._impl_.const__, this_._impl_.const__->GetCachedSize(), target, - stream); - } - - // repeated string in = 2 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (int i = 0, n = this_._internal_in_size(); i < n; ++i) { - const auto& s = this_._internal_in().Get(i); - target = stream->WriteString(2, s, target); - } - } - - // repeated string not_in = 3 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - for (int i = 0, n = this_._internal_not_in_size(); i < n; ++i) { - const auto& s = this_._internal_not_in().Get(i); - target = stream->WriteString(3, s, target); - } - } - - // repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_example_size()); - i < n; i++) { - const auto& repfield = this_._internal_example().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.FieldMaskRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t FieldMaskRules::ByteSizeLong(const MessageLite& base) { - const FieldMaskRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t FieldMaskRules::ByteSizeLong() const { - const FieldMaskRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.FieldMaskRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // repeated string in = 2 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_in().size()); - for (int i = 0, n = this_._internal_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_in().Get(i)); - } - } - // repeated string not_in = 3 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this_._internal_not_in().size()); - for (int i = 0, n = this_._internal_not_in().size(); i < n; ++i) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_not_in().Get(i)); - } - } - // repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += 1UL * this_._internal_example_size(); - for (const auto& msg : this_._internal_example()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - // optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.const__); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void FieldMaskRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.FieldMaskRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000002U)) { - _this->_internal_mutable_not_in()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_not_in()); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_example()); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(from._impl_.const__ != nullptr); - if (_this->_impl_.const__ == nullptr) { - _this->_impl_.const__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__); - } else { - _this->_impl_.const__->MergeFrom(*from._impl_.const__); - } - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void FieldMaskRules::CopyFrom(const FieldMaskRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.FieldMaskRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool FieldMaskRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void FieldMaskRules::InternalSwap(FieldMaskRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.in_.InternalSwap(&other->_impl_.in_); - _impl_.not_in_.InternalSwap(&other->_impl_.not_in_); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.const__, other->_impl_.const__); -} - -::google::protobuf::Metadata FieldMaskRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class TimestampRules::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::TimestampRules, _impl_._oneof_case_); -}; - -void TimestampRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ != nullptr) _impl_.const__->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -void TimestampRules::set_allocated_lt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE lt) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_less_than(); - if (lt) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(lt)->GetArena(); - if (message_arena != submessage_arena) { - lt = ::google::protobuf::internal::GetOwnedMessage(message_arena, lt, submessage_arena); - } - set_has_lt(); - _impl_.less_than_.lt_ = lt; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.lt) -} -void TimestampRules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lt_); - } - clear_has_less_than(); - } -} -void TimestampRules::set_allocated_lte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE lte) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_less_than(); - if (lte) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(lte)->GetArena(); - if (message_arena != submessage_arena) { - lte = ::google::protobuf::internal::GetOwnedMessage(message_arena, lte, submessage_arena); - } - set_has_lte(); - _impl_.less_than_.lte_ = lte; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.lte) -} -void TimestampRules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lte_); - } - clear_has_less_than(); - } -} -void TimestampRules::set_allocated_gt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE gt) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_greater_than(); - if (gt) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(gt)->GetArena(); - if (message_arena != submessage_arena) { - gt = ::google::protobuf::internal::GetOwnedMessage(message_arena, gt, submessage_arena); - } - set_has_gt(); - _impl_.greater_than_.gt_ = gt; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.gt) -} -void TimestampRules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gt_); - } - clear_has_greater_than(); - } -} -void TimestampRules::set_allocated_gte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE gte) { - ::google::protobuf::Arena* message_arena = GetArena(); - clear_greater_than(); - if (gte) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(gte)->GetArena(); - if (message_arena != submessage_arena) { - gte = ::google::protobuf::internal::GetOwnedMessage(message_arena, gte, submessage_arena); - } - set_has_gte(); - _impl_.greater_than_.gte_ = gte; - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.gte) -} -void TimestampRules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gte_); - } - clear_has_greater_than(); - } -} -void TimestampRules::clear_within() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.within_ != nullptr) _impl_.within_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -void TimestampRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -TimestampRules::TimestampRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, TimestampRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.TimestampRules) -} -PROTOBUF_NDEBUG_INLINE TimestampRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::TimestampRules& from_msg) - : _extensions_{visibility, arena}, - _has_bits_{from._has_bits_}, - _cached_size_{0}, - example_{visibility, arena, from.example_}, - less_than_{}, - greater_than_{}, - _oneof_case_{from._oneof_case_[0], from._oneof_case_[1]} {} - -TimestampRules::TimestampRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const TimestampRules& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, TimestampRules_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - TimestampRules* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - _impl_._extensions_.MergeFrom(this, from._impl_._extensions_); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.const__ = (CheckHasBit(cached_has_bits, 0x00000001U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__) - : nullptr; - _impl_.within_ = (CheckHasBit(cached_has_bits, 0x00000002U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.within_) - : nullptr; - switch (less_than_case()) { - case LESS_THAN_NOT_SET: - break; - case kLt: - _impl_.less_than_.lt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lt_); - break; - case kLte: - _impl_.less_than_.lte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lte_); - break; - case kLtNow: - _impl_.less_than_.lt_now_ = from._impl_.less_than_.lt_now_; - break; - } - switch (greater_than_case()) { - case GREATER_THAN_NOT_SET: - break; - case kGt: - _impl_.greater_than_.gt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gt_); - break; - case kGte: - _impl_.greater_than_.gte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gte_); - break; - case kGtNow: - _impl_.greater_than_.gt_now_ = from._impl_.greater_than_.gt_now_; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.TimestampRules) -} -PROTOBUF_NDEBUG_INLINE TimestampRules::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _extensions_{visibility, arena}, - _cached_size_{0}, - example_{visibility, arena}, - less_than_{}, - greater_than_{}, - _oneof_case_{} {} - -inline void TimestampRules::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, const__), - 0, - offsetof(Impl_, within_) - - offsetof(Impl_, const__) + - sizeof(Impl_::within_)); -} -TimestampRules::~TimestampRules() { - // @@protoc_insertion_point(destructor:buf.validate.TimestampRules) - SharedDtor(*this); -} -inline void TimestampRules::SharedDtor(MessageLite& self) { - TimestampRules& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - delete this_._impl_.const__; - delete this_._impl_.within_; - if (this_.has_less_than()) { - this_.clear_less_than(); - } - if (this_.has_greater_than()) { - this_.clear_greater_than(); - } - this_._impl_.~Impl_(); -} - -void TimestampRules::clear_less_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.TimestampRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (less_than_case()) { - case kLt: { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lt_); - } - break; - } - case kLte: { - if (GetArena() == nullptr) { - delete _impl_.less_than_.lte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.less_than_.lte_); - } - break; - } - case kLtNow: { - // No need to clear - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} - -void TimestampRules::clear_greater_than() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.TimestampRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (greater_than_case()) { - case kGt: { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gt_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gt_); - } - break; - } - case kGte: { - if (GetArena() == nullptr) { - delete _impl_.greater_than_.gte_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.greater_than_.gte_); - } - break; - } - case kGtNow: { - // No need to clear - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL TimestampRules::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) TimestampRules(arena); -} -constexpr auto TimestampRules::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_._extensions_) + - decltype(TimestampRules::_impl_._extensions_)::InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.example_) + - decltype(TimestampRules::_impl_.example_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(TimestampRules), alignof(TimestampRules), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&TimestampRules::PlacementNew_, - sizeof(TimestampRules), - alignof(TimestampRules)); - } -} -constexpr auto TimestampRules::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_TimestampRules_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - TimestampRules::IsInitializedImpl, - &TimestampRules::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &TimestampRules::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &TimestampRules::ByteSizeLong, - &TimestampRules::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_._cached_size_), - false, - }, - &TimestampRules::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull TimestampRules_class_data_ = - TimestampRules::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -TimestampRules::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&TimestampRules_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(TimestampRules_class_data_.tc_table); - return TimestampRules_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<4, 9, 7, 0, 2> -TimestampRules::_table_ = { - { - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_._has_bits_), - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_._extensions_), - 10, 120, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966273, // skipmap - offsetof(decltype(_table_), field_entries), - 9, // num_field_entries - 7, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - TimestampRules_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::TimestampRules>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtS1, - {18, 0, 0, - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.const__)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtS1, - {74, 1, 5, - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.within_)}}, - // repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { - {::_pbi::TcParser::FastMtR1, - {82, 2, 6, - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.example_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.const__), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Timestamp lt = 3 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.less_than_.lt_), _Internal::kOneofCaseOffset + 0, 1, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Timestamp lte = 4 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.less_than_.lte_), _Internal::kOneofCaseOffset + 0, 2, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Timestamp gt = 5 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.greater_than_.gt_), _Internal::kOneofCaseOffset + 4, 3, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // .google.protobuf.Timestamp gte = 6 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.greater_than_.gte_), _Internal::kOneofCaseOffset + 4, 4, (0 | ::_fl::kFcOneof | ::_fl::kMessage | ::_fl::kTvTable)}, - // bool lt_now = 7 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.less_than_.lt_now_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // bool gt_now = 8 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.greater_than_.gt_now_), _Internal::kOneofCaseOffset + 4, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.within_), _Internal::kHasBitsOffset + 1, 5, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { - {PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.example_), _Internal::kHasBitsOffset + 2, 6, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Duration>()}, - {::_pbi::TcParser::GetTable<::google::protobuf::Timestamp>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void TimestampRules::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.TimestampRules) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - _impl_._extensions_.Clear(); - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(_impl_.const__ != nullptr); - _impl_.const__->Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - ABSL_DCHECK(_impl_.within_ != nullptr); - _impl_.within_->Clear(); - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _impl_.example_.Clear(); - } - } - clear_less_than(); - clear_greater_than(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL TimestampRules::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const TimestampRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL TimestampRules::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const TimestampRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.TimestampRules) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *this_._impl_.const__, this_._impl_.const__->GetCachedSize(), target, - stream); - } - - switch (this_.less_than_case()) { - case kLt: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 3, *this_._impl_.less_than_.lt_, this_._impl_.less_than_.lt_->GetCachedSize(), target, - stream); - break; - } - case kLte: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 4, *this_._impl_.less_than_.lte_, this_._impl_.less_than_.lte_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - switch (this_.greater_than_case()) { - case kGt: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.greater_than_.gt_, this_._impl_.greater_than_.gt_->GetCachedSize(), target, - stream); - break; - } - case kGte: { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, *this_._impl_.greater_than_.gte_, this_._impl_.greater_than_.gte_->GetCachedSize(), target, - stream); - break; - } - default: - break; - } - // bool lt_now = 7 [(.buf.validate.predefined) = { - if (this_.less_than_case() == kLtNow) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 7, this_._internal_lt_now(), target); - } - - // bool gt_now = 8 [(.buf.validate.predefined) = { - if (this_.greater_than_case() == kGtNow) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 8, this_._internal_gt_now(), target); - } - - // optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 9, *this_._impl_.within_, this_._impl_.within_->GetCachedSize(), target, - stream); - } - - // repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_example_size()); - i < n; i++) { - const auto& repfield = this_._internal_example().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 10, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - // All extensions. - target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), - target, stream); - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.TimestampRules) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t TimestampRules::ByteSizeLong(const MessageLite& base) { - const TimestampRules& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t TimestampRules::ByteSizeLong() const { - const TimestampRules& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.TimestampRules) - ::size_t total_size = 0; - total_size += this_._impl_._extensions_.ByteSize(); - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - // optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.const__); - } - // optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.within_); - } - // repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - total_size += 1UL * this_._internal_example_size(); - for (const auto& msg : this_._internal_example()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - switch (this_.less_than_case()) { - // .google.protobuf.Timestamp lt = 3 [(.buf.validate.predefined) = { - case kLt: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.less_than_.lt_); - break; - } - // .google.protobuf.Timestamp lte = 4 [(.buf.validate.predefined) = { - case kLte: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.less_than_.lte_); - break; - } - // bool lt_now = 7 [(.buf.validate.predefined) = { - case kLtNow: { - total_size += 2; - break; - } - case LESS_THAN_NOT_SET: { - break; - } - } - switch (this_.greater_than_case()) { - // .google.protobuf.Timestamp gt = 5 [(.buf.validate.predefined) = { - case kGt: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.greater_than_.gt_); - break; - } - // .google.protobuf.Timestamp gte = 6 [(.buf.validate.predefined) = { - case kGte: { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.greater_than_.gte_); - break; - } - // bool gt_now = 8 [(.buf.validate.predefined) = { - case kGtNow: { - total_size += 2; - break; - } - case GREATER_THAN_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void TimestampRules::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.TimestampRules) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x00000007U)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - ABSL_DCHECK(from._impl_.const__ != nullptr); - if (_this->_impl_.const__ == nullptr) { - _this->_impl_.const__ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.const__); - } else { - _this->_impl_.const__->MergeFrom(*from._impl_.const__); - } - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - ABSL_DCHECK(from._impl_.within_ != nullptr); - if (_this->_impl_.within_ == nullptr) { - _this->_impl_.within_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.within_); - } else { - _this->_impl_.within_->MergeFrom(*from._impl_.within_); - } - } - if (CheckHasBitForRepeated(cached_has_bits, 0x00000004U)) { - _this->_internal_mutable_example()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_example()); - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_less_than(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kLt: { - if (oneof_needs_init) { - _this->_impl_.less_than_.lt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lt_); - } else { - _this->_impl_.less_than_.lt_->MergeFrom(*from._impl_.less_than_.lt_); - } - break; - } - case kLte: { - if (oneof_needs_init) { - _this->_impl_.less_than_.lte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.less_than_.lte_); - } else { - _this->_impl_.less_than_.lte_->MergeFrom(*from._impl_.less_than_.lte_); - } - break; - } - case kLtNow: { - _this->_impl_.less_than_.lt_now_ = from._impl_.less_than_.lt_now_; - break; - } - case LESS_THAN_NOT_SET: - break; - } - } - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[1]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[1]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_greater_than(); - } - _this->_impl_._oneof_case_[1] = oneof_from_case; - } - - switch (oneof_from_case) { - case kGt: { - if (oneof_needs_init) { - _this->_impl_.greater_than_.gt_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gt_); - } else { - _this->_impl_.greater_than_.gt_->MergeFrom(*from._impl_.greater_than_.gt_); - } - break; - } - case kGte: { - if (oneof_needs_init) { - _this->_impl_.greater_than_.gte_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.greater_than_.gte_); - } else { - _this->_impl_.greater_than_.gte_->MergeFrom(*from._impl_.greater_than_.gte_); - } - break; - } - case kGtNow: { - _this->_impl_.greater_than_.gt_now_ = from._impl_.greater_than_.gt_now_; - break; - } - case GREATER_THAN_NOT_SET: - break; - } - } - _this->_impl_._extensions_.MergeFrom(&default_instance(), - from._impl_._extensions_); - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void TimestampRules::CopyFrom(const TimestampRules& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.TimestampRules) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -PROTOBUF_NOINLINE bool TimestampRules::IsInitializedImpl( - const MessageLite& msg) { - auto& this_ = static_cast(msg); - if (!this_._impl_._extensions_.IsInitialized(&default_instance())) { - return false; - } - return true; -} - -void TimestampRules::InternalSwap(TimestampRules* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _impl_._extensions_.InternalSwap(&other->_impl_._extensions_); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.within_) - + sizeof(TimestampRules::_impl_.within_) - - PROTOBUF_FIELD_OFFSET(TimestampRules, _impl_.const__)>( - reinterpret_cast(&_impl_.const__), - reinterpret_cast(&other->_impl_.const__)); - _impl_.example_.InternalSwap(&other->_impl_.example_); - swap(_impl_.less_than_, other->_impl_.less_than_); - swap(_impl_.greater_than_, other->_impl_.greater_than_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); - swap(_impl_._oneof_case_[1], other->_impl_._oneof_case_[1]); -} - -::google::protobuf::Metadata TimestampRules::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Violations::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Violations, _impl_._has_bits_); -}; - -Violations::Violations(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Violations_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Violations) -} -PROTOBUF_NDEBUG_INLINE Violations::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Violations& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - violations_{visibility, arena, from.violations_} {} - -Violations::Violations( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Violations& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Violations_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Violations* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.Violations) -} -PROTOBUF_NDEBUG_INLINE Violations::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - violations_{visibility, arena} {} - -inline void Violations::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -Violations::~Violations() { - // @@protoc_insertion_point(destructor:buf.validate.Violations) - SharedDtor(*this); -} -inline void Violations::SharedDtor(MessageLite& self) { - Violations& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL Violations::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Violations(arena); -} -constexpr auto Violations::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(Violations, _impl_.violations_) + - decltype(Violations::_impl_.violations_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(Violations), alignof(Violations), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&Violations::PlacementNew_, - sizeof(Violations), - alignof(Violations)); - } -} -constexpr auto Violations::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Violations_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Violations::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Violations::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Violations::ByteSizeLong, - &Violations::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Violations, _impl_._cached_size_), - false, - }, - &Violations::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Violations_class_data_ = - Violations::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Violations::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Violations_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Violations_class_data_.tc_table); - return Violations_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 1, 0, 2> -Violations::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Violations, _impl_._has_bits_), - 0, // no _extensions_ - 1, 0, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967294, // skipmap - offsetof(decltype(_table_), field_entries), - 1, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - Violations_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Violations>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .buf.validate.Violation violations = 1; - {::_pbi::TcParser::FastMtR1, - {10, 0, 0, - PROTOBUF_FIELD_OFFSET(Violations, _impl_.violations_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated .buf.validate.Violation violations = 1; - {PROTOBUF_FIELD_OFFSET(Violations, _impl_.violations_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::Violation>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void Violations::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Violations) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.violations_.Clear(); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Violations::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Violations& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Violations::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Violations& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Violations) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated .buf.validate.Violation violations = 1; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_violations_size()); - i < n; i++) { - const auto& repfield = this_._internal_violations().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Violations) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Violations::ByteSizeLong(const MessageLite& base) { - const Violations& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Violations::ByteSizeLong() const { - const Violations& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Violations) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .buf.validate.Violation violations = 1; - cached_has_bits = this_._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_violations_size(); - for (const auto& msg : this_._internal_violations()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Violations::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Violations) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_violations()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_violations()); - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Violations::CopyFrom(const Violations& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Violations) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void Violations::InternalSwap(Violations* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.violations_.InternalSwap(&other->_impl_.violations_); -} - -::google::protobuf::Metadata Violations::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class Violation::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(Violation, _impl_._has_bits_); -}; - -Violation::Violation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Violation_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.Violation) -} -PROTOBUF_NDEBUG_INLINE Violation::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::Violation& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - rule_id_(arena, from.rule_id_), - message_(arena, from.message_) {} - -Violation::Violation( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const Violation& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, Violation_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - Violation* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.field_ = (CheckHasBit(cached_has_bits, 0x00000004U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.field_) - : nullptr; - _impl_.rule_ = (CheckHasBit(cached_has_bits, 0x00000008U)) - ? ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.rule_) - : nullptr; - _impl_.for_key_ = from._impl_.for_key_; - - // @@protoc_insertion_point(copy_constructor:buf.validate.Violation) -} -PROTOBUF_NDEBUG_INLINE Violation::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - rule_id_(arena), - message_(arena) {} - -inline void Violation::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, field_), - 0, - offsetof(Impl_, for_key_) - - offsetof(Impl_, field_) + - sizeof(Impl_::for_key_)); -} -Violation::~Violation() { - // @@protoc_insertion_point(destructor:buf.validate.Violation) - SharedDtor(*this); -} -inline void Violation::SharedDtor(MessageLite& self) { - Violation& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.rule_id_.Destroy(); - this_._impl_.message_.Destroy(); - delete this_._impl_.field_; - delete this_._impl_.rule_; - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL Violation::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) Violation(arena); -} -constexpr auto Violation::InternalNewImpl_() { - return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Violation), - alignof(Violation)); -} -constexpr auto Violation::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_Violation_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &Violation::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &Violation::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &Violation::ByteSizeLong, - &Violation::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(Violation, _impl_._cached_size_), - false, - }, - &Violation::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull Violation_class_data_ = - Violation::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -Violation::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&Violation_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(Violation_class_data_.tc_table); - return Violation_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 5, 2, 0, 2> -Violation::_table_ = { - { - PROTOBUF_FIELD_OFFSET(Violation, _impl_._has_bits_), - 0, // no _extensions_ - 6, 56, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967233, // skipmap - offsetof(decltype(_table_), field_entries), - 5, // num_field_entries - 2, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - Violation_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::Violation>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - // optional string rule_id = 2; - {::_pbi::TcParser::FastBS1, - {18, 0, 0, - PROTOBUF_FIELD_OFFSET(Violation, _impl_.rule_id_)}}, - // optional string message = 3; - {::_pbi::TcParser::FastBS1, - {26, 1, 0, - PROTOBUF_FIELD_OFFSET(Violation, _impl_.message_)}}, - // optional bool for_key = 4; - {::_pbi::TcParser::SingularVarintNoZag1(), - {32, 4, 0, - PROTOBUF_FIELD_OFFSET(Violation, _impl_.for_key_)}}, - // optional .buf.validate.FieldPath field = 5; - {::_pbi::TcParser::FastMtS1, - {42, 2, 0, - PROTOBUF_FIELD_OFFSET(Violation, _impl_.field_)}}, - // optional .buf.validate.FieldPath rule = 6; - {::_pbi::TcParser::FastMtS1, - {50, 3, 1, - PROTOBUF_FIELD_OFFSET(Violation, _impl_.rule_)}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional string rule_id = 2; - {PROTOBUF_FIELD_OFFSET(Violation, _impl_.rule_id_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional string message = 3; - {PROTOBUF_FIELD_OFFSET(Violation, _impl_.message_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional bool for_key = 4; - {PROTOBUF_FIELD_OFFSET(Violation, _impl_.for_key_), _Internal::kHasBitsOffset + 4, 0, (0 | ::_fl::kFcOptional | ::_fl::kBool)}, - // optional .buf.validate.FieldPath field = 5; - {PROTOBUF_FIELD_OFFSET(Violation, _impl_.field_), _Internal::kHasBitsOffset + 2, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - // optional .buf.validate.FieldPath rule = 6; - {PROTOBUF_FIELD_OFFSET(Violation, _impl_.rule_), _Internal::kHasBitsOffset + 3, 1, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::FieldPath>()}, - {::_pbi::TcParser::GetTable<::buf::validate::FieldPath>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void Violation::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.Violation) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _impl_.rule_id_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _impl_.message_.ClearNonDefaultToEmpty(); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - ABSL_DCHECK(_impl_.field_ != nullptr); - _impl_.field_->Clear(); - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(_impl_.rule_ != nullptr); - _impl_.rule_->Clear(); - } - } - _impl_.for_key_ = false; - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL Violation::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const Violation& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL Violation::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const Violation& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.Violation) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional string rule_id = 2; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - const ::std::string& _s = this_._internal_rule_id(); - target = stream->WriteStringMaybeAliased(2, _s, target); - } - - // optional string message = 3; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - const ::std::string& _s = this_._internal_message(); - target = stream->WriteStringMaybeAliased(3, _s, target); - } - - // optional bool for_key = 4; - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 4, this_._internal_for_key(), target); - } - - // optional .buf.validate.FieldPath field = 5; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 5, *this_._impl_.field_, this_._impl_.field_->GetCachedSize(), target, - stream); - } - - // optional .buf.validate.FieldPath rule = 6; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 6, *this_._impl_.rule_, this_._impl_.rule_->GetCachedSize(), target, - stream); - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.Violation) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t Violation::ByteSizeLong(const MessageLite& base) { - const Violation& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t Violation::ByteSizeLong() const { - const Violation& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.Violation) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - total_size += static_cast(0x00000010U & cached_has_bits) * 2; - if (BatchCheckHasBit(cached_has_bits, 0x0000000fU)) { - // optional string rule_id = 2; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_rule_id()); - } - // optional string message = 3; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_message()); - } - // optional .buf.validate.FieldPath field = 5; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.field_); - } - // optional .buf.validate.FieldPath rule = 6; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSize(*this_._impl_.rule_); - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void Violation::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.Violation) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _this->_internal_set_rule_id(from._internal_rule_id()); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_internal_set_message(from._internal_message()); - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - ABSL_DCHECK(from._impl_.field_ != nullptr); - if (_this->_impl_.field_ == nullptr) { - _this->_impl_.field_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.field_); - } else { - _this->_impl_.field_->MergeFrom(*from._impl_.field_); - } - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - ABSL_DCHECK(from._impl_.rule_ != nullptr); - if (_this->_impl_.rule_ == nullptr) { - _this->_impl_.rule_ = ::google::protobuf::Message::CopyConstruct(arena, *from._impl_.rule_); - } else { - _this->_impl_.rule_->MergeFrom(*from._impl_.rule_); - } - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _this->_impl_.for_key_ = from._impl_.for_key_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void Violation::CopyFrom(const Violation& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.Violation) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void Violation::InternalSwap(Violation* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.rule_id_, &other->_impl_.rule_id_, arena); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.message_, &other->_impl_.message_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(Violation, _impl_.for_key_) - + sizeof(Violation::_impl_.for_key_) - - PROTOBUF_FIELD_OFFSET(Violation, _impl_.field_)>( - reinterpret_cast(&_impl_.field_), - reinterpret_cast(&other->_impl_.field_)); -} - -::google::protobuf::Metadata Violation::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class FieldPath::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(FieldPath, _impl_._has_bits_); -}; - -FieldPath::FieldPath(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldPath_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.FieldPath) -} -PROTOBUF_NDEBUG_INLINE FieldPath::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::FieldPath& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - elements_{visibility, arena, from.elements_} {} - -FieldPath::FieldPath( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const FieldPath& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldPath_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - FieldPath* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - - // @@protoc_insertion_point(copy_constructor:buf.validate.FieldPath) -} -PROTOBUF_NDEBUG_INLINE FieldPath::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - elements_{visibility, arena} {} - -inline void FieldPath::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); -} -FieldPath::~FieldPath() { - // @@protoc_insertion_point(destructor:buf.validate.FieldPath) - SharedDtor(*this); -} -inline void FieldPath::SharedDtor(MessageLite& self) { - FieldPath& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.~Impl_(); -} - -inline void* PROTOBUF_NONNULL FieldPath::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) FieldPath(arena); -} -constexpr auto FieldPath::InternalNewImpl_() { - constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ - PROTOBUF_FIELD_OFFSET(FieldPath, _impl_.elements_) + - decltype(FieldPath::_impl_.elements_):: - InternalGetArenaOffset( - ::google::protobuf::Message::internal_visibility()), - }); - if (arena_bits.has_value()) { - return ::google::protobuf::internal::MessageCreator::ZeroInit( - sizeof(FieldPath), alignof(FieldPath), *arena_bits); - } else { - return ::google::protobuf::internal::MessageCreator(&FieldPath::PlacementNew_, - sizeof(FieldPath), - alignof(FieldPath)); - } -} -constexpr auto FieldPath::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_FieldPath_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FieldPath::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldPath::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &FieldPath::ByteSizeLong, - &FieldPath::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldPath, _impl_._cached_size_), - false, - }, - &FieldPath::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull FieldPath_class_data_ = - FieldPath::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -FieldPath::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&FieldPath_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(FieldPath_class_data_.tc_table); - return FieldPath_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<0, 1, 1, 0, 2> -FieldPath::_table_ = { - { - PROTOBUF_FIELD_OFFSET(FieldPath, _impl_._has_bits_), - 0, // no _extensions_ - 1, 0, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294967294, // skipmap - offsetof(decltype(_table_), field_entries), - 1, // num_field_entries - 1, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - FieldPath_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::FieldPath>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - // repeated .buf.validate.FieldPathElement elements = 1; - {::_pbi::TcParser::FastMtR1, - {10, 0, 0, - PROTOBUF_FIELD_OFFSET(FieldPath, _impl_.elements_)}}, - }}, {{ - 65535, 65535 - }}, {{ - // repeated .buf.validate.FieldPathElement elements = 1; - {PROTOBUF_FIELD_OFFSET(FieldPath, _impl_.elements_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcRepeated | ::_fl::kMessage | ::_fl::kTvTable)}, - }}, - {{ - {::_pbi::TcParser::GetTable<::buf::validate::FieldPathElement>()}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void FieldPath::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.FieldPath) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _impl_.elements_.Clear(); - } - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL FieldPath::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const FieldPath& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL FieldPath::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const FieldPath& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.FieldPath) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // repeated .buf.validate.FieldPathElement elements = 1; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - for (unsigned i = 0, n = static_cast( - this_._internal_elements_size()); - i < n; i++) { - const auto& repfield = this_._internal_elements().Get(i); - target = - ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 1, repfield, repfield.GetCachedSize(), - target, stream); - } - } - - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.FieldPath) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t FieldPath::ByteSizeLong(const MessageLite& base) { - const FieldPath& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t FieldPath::ByteSizeLong() const { - const FieldPath& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.FieldPath) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - { - // repeated .buf.validate.FieldPathElement elements = 1; - cached_has_bits = this_._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - total_size += 1UL * this_._internal_elements_size(); - for (const auto& msg : this_._internal_elements()) { - total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); - } - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void FieldPath::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.FieldPath) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (CheckHasBitForRepeated(cached_has_bits, 0x00000001U)) { - _this->_internal_mutable_elements()->InternalMergeFromWithArena( - ::google::protobuf::MessageLite::internal_visibility(), arena, - from._internal_elements()); - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void FieldPath::CopyFrom(const FieldPath& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.FieldPath) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void FieldPath::InternalSwap(FieldPath* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - _impl_.elements_.InternalSwap(&other->_impl_.elements_); -} - -::google::protobuf::Metadata FieldPath::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -// =================================================================== - -class FieldPathElement::_Internal { - public: - using HasBits = - decltype(::std::declval()._impl_._has_bits_); - static constexpr ::int32_t kHasBitsOffset = - 8 * PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_._has_bits_); - static constexpr ::int32_t kOneofCaseOffset = - PROTOBUF_FIELD_OFFSET(::buf::validate::FieldPathElement, _impl_._oneof_case_); -}; - -FieldPathElement::FieldPathElement(::google::protobuf::Arena* PROTOBUF_NULLABLE arena) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldPathElement_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - SharedCtor(arena); - // @@protoc_insertion_point(arena_constructor:buf.validate.FieldPathElement) -} -PROTOBUF_NDEBUG_INLINE FieldPathElement::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - [[maybe_unused]] const ::buf::validate::FieldPathElement& from_msg) - : _has_bits_{from._has_bits_}, - _cached_size_{0}, - field_name_(arena, from.field_name_), - subscript_{}, - _oneof_case_{from._oneof_case_[0]} {} - -FieldPathElement::FieldPathElement( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, - const FieldPathElement& from) -#if defined(PROTOBUF_CUSTOM_VTABLE) - : ::google::protobuf::Message(arena, FieldPathElement_class_data_.base()) { -#else // PROTOBUF_CUSTOM_VTABLE - : ::google::protobuf::Message(arena) { -#endif // PROTOBUF_CUSTOM_VTABLE - FieldPathElement* const _this = this; - (void)_this; - _internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); - new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); - ::memcpy(reinterpret_cast(&_impl_) + - offsetof(Impl_, field_number_), - reinterpret_cast(&from._impl_) + - offsetof(Impl_, field_number_), - offsetof(Impl_, key_type_) - - offsetof(Impl_, field_number_) + - sizeof(Impl_::key_type_)); - switch (subscript_case()) { - case SUBSCRIPT_NOT_SET: - break; - case kIndex: - _impl_.subscript_.index_ = from._impl_.subscript_.index_; - break; - case kBoolKey: - _impl_.subscript_.bool_key_ = from._impl_.subscript_.bool_key_; - break; - case kIntKey: - _impl_.subscript_.int_key_ = from._impl_.subscript_.int_key_; - break; - case kUintKey: - _impl_.subscript_.uint_key_ = from._impl_.subscript_.uint_key_; - break; - case kStringKey: - new (&_impl_.subscript_.string_key_) decltype(_impl_.subscript_.string_key_){arena, from._impl_.subscript_.string_key_}; - break; - } - - // @@protoc_insertion_point(copy_constructor:buf.validate.FieldPathElement) -} -PROTOBUF_NDEBUG_INLINE FieldPathElement::Impl_::Impl_( - [[maybe_unused]] ::google::protobuf::internal::InternalVisibility visibility, - [[maybe_unused]] ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) - : _cached_size_{0}, - field_name_(arena), - value_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - field_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - key_type_{static_cast< ::google::protobuf::FieldDescriptorProto_Type >(1)}, - subscript_{}, - _oneof_case_{} {} - -inline void FieldPathElement::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { - new (&_impl_) Impl_(internal_visibility(), arena); - _impl_.field_number_ = {}; -} -FieldPathElement::~FieldPathElement() { - // @@protoc_insertion_point(destructor:buf.validate.FieldPathElement) - SharedDtor(*this); -} -inline void FieldPathElement::SharedDtor(MessageLite& self) { - FieldPathElement& this_ = static_cast(self); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - this_._internal_metadata_.Delete<::google::protobuf::UnknownFieldSet>(); - ABSL_DCHECK(this_.GetArena() == nullptr); - this_._impl_.field_name_.Destroy(); - if (this_.has_subscript()) { - this_.clear_subscript(); - } - this_._impl_.~Impl_(); -} - -void FieldPathElement::clear_subscript() { -// @@protoc_insertion_point(one_of_clear_start:buf.validate.FieldPathElement) - ::google::protobuf::internal::TSanWrite(&_impl_); - switch (subscript_case()) { - case kIndex: { - // No need to clear - break; - } - case kBoolKey: { - // No need to clear - break; - } - case kIntKey: { - // No need to clear - break; - } - case kUintKey: { - // No need to clear - break; - } - case kStringKey: { - _impl_.subscript_.string_key_.Destroy(); - break; - } - case SUBSCRIPT_NOT_SET: { - break; - } - } - _impl_._oneof_case_[0] = SUBSCRIPT_NOT_SET; -} - - -inline void* PROTOBUF_NONNULL FieldPathElement::PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena) { - return ::new (mem) FieldPathElement(arena); -} -constexpr auto FieldPathElement::InternalNewImpl_() { - return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldPathElement), - alignof(FieldPathElement)); -} -constexpr auto FieldPathElement::InternalGenerateClassData_() { - return ::google::protobuf::internal::ClassDataFull{ - ::google::protobuf::internal::ClassData{ - &_FieldPathElement_default_instance_._instance, - &_table_.header, - nullptr, // OnDemandRegisterArenaDtor - nullptr, // IsInitialized - &FieldPathElement::MergeImpl, - ::google::protobuf::Message::GetNewImpl(), -#if defined(PROTOBUF_CUSTOM_VTABLE) - &FieldPathElement::SharedDtor, - ::google::protobuf::Message::GetClearImpl(), &FieldPathElement::ByteSizeLong, - &FieldPathElement::_InternalSerialize, -#endif // PROTOBUF_CUSTOM_VTABLE - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_._cached_size_), - false, - }, - &FieldPathElement::kDescriptorMethods, - &descriptor_table_buf_2fvalidate_2fvalidate_2eproto, - nullptr, // tracker - }; -} - -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const - ::google::protobuf::internal::ClassDataFull FieldPathElement_class_data_ = - FieldPathElement::InternalGenerateClassData_(); - -PROTOBUF_ATTRIBUTE_WEAK const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL -FieldPathElement::GetClassData() const { - ::google::protobuf::internal::PrefetchToLocalCache(&FieldPathElement_class_data_); - ::google::protobuf::internal::PrefetchToLocalCache(FieldPathElement_class_data_.tc_table); - return FieldPathElement_class_data_.base(); -} -PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 -const ::_pbi::TcParseTable<3, 10, 3, 0, 2> -FieldPathElement::_table_ = { - { - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_._has_bits_), - 0, // no _extensions_ - 10, 56, // max_field_number, fast_idx_mask - offsetof(decltype(_table_), field_lookup_table), - 4294966272, // skipmap - offsetof(decltype(_table_), field_entries), - 10, // num_field_entries - 3, // num_aux_entries - offsetof(decltype(_table_), aux_entries), - FieldPathElement_class_data_.base(), - nullptr, // post_loop_handler - ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::buf::validate::FieldPathElement>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE - }, {{ - {::_pbi::TcParser::MiniParse, {}}, - // optional int32 field_number = 1; - {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(FieldPathElement, _impl_.field_number_), 1>(), - {8, 1, 0, - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_number_)}}, - // optional string field_name = 2; - {::_pbi::TcParser::FastBS1, - {18, 0, 0, - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_name_)}}, - // optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; - {::_pbi::TcParser::FastEr1S1, - {24, 3, 18, - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_type_)}}, - // optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; - {::_pbi::TcParser::FastEr1S1, - {32, 4, 18, - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.key_type_)}}, - // optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; - {::_pbi::TcParser::FastEr1S1, - {40, 2, 18, - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.value_type_)}}, - {::_pbi::TcParser::MiniParse, {}}, - {::_pbi::TcParser::MiniParse, {}}, - }}, {{ - 65535, 65535 - }}, {{ - // optional int32 field_number = 1; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_number_), _Internal::kHasBitsOffset + 1, 0, (0 | ::_fl::kFcOptional | ::_fl::kInt32)}, - // optional string field_name = 2; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_name_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kBytes | ::_fl::kRepAString)}, - // optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_type_), _Internal::kHasBitsOffset + 3, 0, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - // optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.key_type_), _Internal::kHasBitsOffset + 4, 1, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - // optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.value_type_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, - // uint64 index = 6; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.subscript_.index_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // bool bool_key = 7; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.subscript_.bool_key_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBool)}, - // int64 int_key = 8; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.subscript_.int_key_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kInt64)}, - // uint64 uint_key = 9; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.subscript_.uint_key_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kUInt64)}, - // string string_key = 10; - {PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.subscript_.string_key_), _Internal::kOneofCaseOffset + 0, 0, (0 | ::_fl::kFcOneof | ::_fl::kBytes | ::_fl::kRepAString)}, - }}, - {{ - {1, 18}, - {1, 18}, - {1, 18}, - }}, - {{ - }}, -}; -PROTOBUF_NOINLINE void FieldPathElement::Clear() { -// @@protoc_insertion_point(message_clear_start:buf.validate.FieldPathElement) - ::google::protobuf::internal::TSanWrite(&_impl_); - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void) cached_has_bits; - - cached_has_bits = _impl_._has_bits_[0]; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _impl_.field_name_.ClearNonDefaultToEmpty(); - } - if (BatchCheckHasBit(cached_has_bits, 0x0000001eU)) { - _impl_.field_number_ = 0; - _impl_.value_type_ = 1; - _impl_.field_type_ = 1; - _impl_.key_type_ = 1; - } - clear_subscript(); - _impl_._has_bits_.Clear(); - _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::uint8_t* PROTOBUF_NONNULL FieldPathElement::_InternalSerialize( - const ::google::protobuf::MessageLite& base, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) { - const FieldPathElement& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::uint8_t* PROTOBUF_NONNULL FieldPathElement::_InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - const FieldPathElement& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - this_.CheckHasBitConsistency(); - } - // @@protoc_insertion_point(serialize_to_array_start:buf.validate.FieldPathElement) - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = this_._impl_._has_bits_[0]; - // optional int32 field_number = 1; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt32ToArrayWithField<1>( - stream, this_._internal_field_number(), target); - } - - // optional string field_name = 2; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - const ::std::string& _s = this_._internal_field_name(); - target = stream->WriteStringMaybeAliased(2, _s, target); - } - - // optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 3, this_._internal_field_type(), target); - } - - // optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 4, this_._internal_key_type(), target); - } - - // optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteEnumToArray( - 5, this_._internal_value_type(), target); - } - - switch (this_.subscript_case()) { - case kIndex: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 6, this_._internal_index(), target); - break; - } - case kBoolKey: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteBoolToArray( - 7, this_._internal_bool_key(), target); - break; - } - case kIntKey: { - target = - ::google::protobuf::internal::WireFormatLite::WriteInt64ToArrayWithField<8>( - stream, this_._internal_int_key(), target); - break; - } - case kUintKey: { - target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt64ToArray( - 9, this_._internal_uint_key(), target); - break; - } - case kStringKey: { - const ::std::string& _s = this_._internal_string_key(); - target = stream->WriteStringMaybeAliased(10, _s, target); - break; - } - default: - break; - } - if (ABSL_PREDICT_FALSE(this_._internal_metadata_.have_unknown_fields())) { - target = - ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( - this_._internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance), target, stream); - } - // @@protoc_insertion_point(serialize_to_array_end:buf.validate.FieldPathElement) - return target; -} - -#if defined(PROTOBUF_CUSTOM_VTABLE) -::size_t FieldPathElement::ByteSizeLong(const MessageLite& base) { - const FieldPathElement& this_ = static_cast(base); -#else // PROTOBUF_CUSTOM_VTABLE -::size_t FieldPathElement::ByteSizeLong() const { - const FieldPathElement& this_ = *this; -#endif // PROTOBUF_CUSTOM_VTABLE - // @@protoc_insertion_point(message_byte_size_start:buf.validate.FieldPathElement) - ::size_t total_size = 0; - - ::uint32_t cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ::_pbi::Prefetch5LinesFrom7Lines(&this_); - cached_has_bits = this_._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - // optional string field_name = 2; - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_field_name()); - } - // optional int32 field_number = 1; - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - total_size += ::_pbi::WireFormatLite::Int32SizePlusOne( - this_._internal_field_number()); - } - // optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_value_type()); - } - // optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_field_type()); - } - // optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - total_size += 1 + - ::_pbi::WireFormatLite::EnumSize(this_._internal_key_type()); - } - } - switch (this_.subscript_case()) { - // uint64 index = 6; - case kIndex: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_index()); - break; - } - // bool bool_key = 7; - case kBoolKey: { - total_size += 2; - break; - } - // int64 int_key = 8; - case kIntKey: { - total_size += ::_pbi::WireFormatLite::Int64SizePlusOne( - this_._internal_int_key()); - break; - } - // uint64 uint_key = 9; - case kUintKey: { - total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne( - this_._internal_uint_key()); - break; - } - // string string_key = 10; - case kStringKey: { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this_._internal_string_key()); - break; - } - case SUBSCRIPT_NOT_SET: { - break; - } - } - return this_.MaybeComputeUnknownFieldsSize(total_size, - &this_._impl_._cached_size_); -} - -void FieldPathElement::MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg) { - auto* const _this = - static_cast(&to_msg); - auto& from = static_cast(from_msg); - if constexpr (::_pbi::DebugHardenCheckHasBitConsistency()) { - from.CheckHasBitConsistency(); - } - ::google::protobuf::Arena* arena = _this->GetArena(); - // @@protoc_insertion_point(class_specific_merge_from_start:buf.validate.FieldPathElement) - ABSL_DCHECK_NE(&from, _this); - ::uint32_t cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._impl_._has_bits_[0]; - if (BatchCheckHasBit(cached_has_bits, 0x0000001fU)) { - if (CheckHasBit(cached_has_bits, 0x00000001U)) { - _this->_internal_set_field_name(from._internal_field_name()); - } - if (CheckHasBit(cached_has_bits, 0x00000002U)) { - _this->_impl_.field_number_ = from._impl_.field_number_; - } - if (CheckHasBit(cached_has_bits, 0x00000004U)) { - _this->_impl_.value_type_ = from._impl_.value_type_; - } - if (CheckHasBit(cached_has_bits, 0x00000008U)) { - _this->_impl_.field_type_ = from._impl_.field_type_; - } - if (CheckHasBit(cached_has_bits, 0x00000010U)) { - _this->_impl_.key_type_ = from._impl_.key_type_; - } - } - _this->_impl_._has_bits_[0] |= cached_has_bits; - if (const uint32_t oneof_from_case = - from._impl_._oneof_case_[0]) { - const uint32_t oneof_to_case = _this->_impl_._oneof_case_[0]; - const bool oneof_needs_init = oneof_to_case != oneof_from_case; - if (oneof_needs_init) { - if (oneof_to_case != 0) { - _this->clear_subscript(); - } - _this->_impl_._oneof_case_[0] = oneof_from_case; - } - - switch (oneof_from_case) { - case kIndex: { - _this->_impl_.subscript_.index_ = from._impl_.subscript_.index_; - break; - } - case kBoolKey: { - _this->_impl_.subscript_.bool_key_ = from._impl_.subscript_.bool_key_; - break; - } - case kIntKey: { - _this->_impl_.subscript_.int_key_ = from._impl_.subscript_.int_key_; - break; - } - case kUintKey: { - _this->_impl_.subscript_.uint_key_ = from._impl_.subscript_.uint_key_; - break; - } - case kStringKey: { - if (oneof_needs_init) { - _this->_impl_.subscript_.string_key_.InitDefault(); - } - _this->_impl_.subscript_.string_key_.Set(from._internal_string_key(), arena); - break; - } - case SUBSCRIPT_NOT_SET: - break; - } - } - _this->_internal_metadata_.MergeFrom<::google::protobuf::UnknownFieldSet>( - from._internal_metadata_); -} - -void FieldPathElement::CopyFrom(const FieldPathElement& from) { - // @@protoc_insertion_point(class_specific_copy_from_start:buf.validate.FieldPathElement) - if (&from == this) return; - Clear(); - MergeFrom(from); -} - - -void FieldPathElement::InternalSwap(FieldPathElement* PROTOBUF_RESTRICT PROTOBUF_NONNULL other) { - using ::std::swap; - auto* arena = GetArena(); - ABSL_DCHECK_EQ(arena, other->GetArena()); - _internal_metadata_.InternalSwap(&other->_internal_metadata_); - swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); - ::_pbi::ArenaStringPtr::InternalSwap(&_impl_.field_name_, &other->_impl_.field_name_, arena); - ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.key_type_) - + sizeof(FieldPathElement::_impl_.key_type_) - - PROTOBUF_FIELD_OFFSET(FieldPathElement, _impl_.field_number_)>( - reinterpret_cast(&_impl_.field_number_), - reinterpret_cast(&other->_impl_.field_number_)); - swap(_impl_.subscript_, other->_impl_.subscript_); - swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); -} - -::google::protobuf::Metadata FieldPathElement::GetMetadata() const { - return ::google::protobuf::Message::GetMetadataImpl(GetClassData()->full()); -} -PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< - ::google::protobuf::MessageOptions, ::_pbi::MessageTypeTraits< ::buf::validate::MessageRules >, 11, false> - message(kMessageFieldNumber, &::buf::validate::_MessageRules_default_instance_); -PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< - ::google::protobuf::OneofOptions, ::_pbi::MessageTypeTraits< ::buf::validate::OneofRules >, 11, false> - oneof(kOneofFieldNumber, &::buf::validate::_OneofRules_default_instance_); -PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< - ::google::protobuf::FieldOptions, ::_pbi::MessageTypeTraits< ::buf::validate::FieldRules >, 11, false> - field(kFieldFieldNumber, &::buf::validate::_FieldRules_default_instance_); -PROTOBUF_CONSTINIT - PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 ::_pbi::ExtensionIdentifier< - ::google::protobuf::FieldOptions, ::_pbi::MessageTypeTraits< ::buf::validate::PredefinedRules >, 11, false> - predefined(kPredefinedFieldNumber, &::buf::validate::_PredefinedRules_default_instance_); -// @@protoc_insertion_point(namespace_scope) -} // namespace validate -} // namespace buf -namespace google { -namespace protobuf { -} // namespace protobuf -} // namespace google -// @@protoc_insertion_point(global_scope) -PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::std::false_type - _static_init2_ [[maybe_unused]] = - (::_pbi::AddDescriptors(&descriptor_table_buf_2fvalidate_2fvalidate_2eproto), - ::_pbi::ExtensionSet::RegisterMessageExtension( - &::google::protobuf::MessageOptions::default_instance(), 1159, 11, - false, false, &::buf::validate::MessageRules::default_instance(), - nullptr, ::_pbi::LazyAnnotation::kUndefined), - ::_pbi::ExtensionSet::RegisterMessageExtension( - &::google::protobuf::OneofOptions::default_instance(), 1159, 11, - false, false, &::buf::validate::OneofRules::default_instance(), - nullptr, ::_pbi::LazyAnnotation::kUndefined), - ::_pbi::ExtensionSet::RegisterMessageExtension( - &::google::protobuf::FieldOptions::default_instance(), 1159, 11, - false, false, &::buf::validate::FieldRules::default_instance(), - nullptr, ::_pbi::LazyAnnotation::kUndefined), - ::_pbi::ExtensionSet::RegisterMessageExtension( - &::google::protobuf::FieldOptions::default_instance(), 1160, 11, - false, false, &::buf::validate::PredefinedRules::default_instance(), - nullptr, ::_pbi::LazyAnnotation::kUndefined), - ::std::false_type{}); -#include "google/protobuf/port_undef.inc" diff --git a/crates/protovalidate-rs/gen/buf/validate/validate.pb.h b/crates/protovalidate-rs/gen/buf/validate/validate.pb.h deleted file mode 100644 index b33a3bc5..00000000 --- a/crates/protovalidate-rs/gen/buf/validate/validate.pb.h +++ /dev/null @@ -1,26870 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// NO CHECKED-IN PROTOBUF GENCODE -// source: buf/validate/validate.proto -// Protobuf C++ Version: 6.33.4 - -#ifndef buf_2fvalidate_2fvalidate_2eproto_2epb_2eh -#define buf_2fvalidate_2fvalidate_2eproto_2epb_2eh - -#include -#include -#include -#include - -#include "google/protobuf/runtime_version.h" -#if PROTOBUF_VERSION != 6033004 -#error "Protobuf C++ gencode is built with an incompatible version of" -#error "Protobuf C++ headers/runtime. See" -#error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" -#endif -#include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/arena.h" -#include "google/protobuf/arenastring.h" -#include "google/protobuf/generated_message_tctable_decl.h" -#include "google/protobuf/generated_message_util.h" -#include "google/protobuf/metadata_lite.h" -#include "google/protobuf/generated_message_reflection.h" -#include "google/protobuf/message.h" -#include "google/protobuf/message_lite.h" -#include "google/protobuf/repeated_field.h" // IWYU pragma: export -#include "google/protobuf/extension_set.h" // IWYU pragma: export -#include "google/protobuf/generated_enum_reflection.h" -#include "google/protobuf/unknown_field_set.h" -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/duration.pb.h" -#include "google/protobuf/field_mask.pb.h" -#include "google/protobuf/timestamp.pb.h" -// @@protoc_insertion_point(includes) - -// Must be included last. -#include "google/protobuf/port_def.inc" - -#define PROTOBUF_INTERNAL_EXPORT_buf_2fvalidate_2fvalidate_2eproto - -namespace google { -namespace protobuf { -namespace internal { -template -::absl::string_view GetAnyMessageName(); -} // namespace internal -} // namespace protobuf -} // namespace google - -// Internal implementation detail -- do not use these members. -struct TableStruct_buf_2fvalidate_2fvalidate_2eproto { - static const ::uint32_t offsets[]; -}; -extern "C" { -extern const ::google::protobuf::internal::DescriptorTable descriptor_table_buf_2fvalidate_2fvalidate_2eproto; -} // extern "C" -namespace buf { -namespace validate { -enum Ignore : int; -extern const uint32_t Ignore_internal_data_[]; -enum KnownRegex : int; -extern const uint32_t KnownRegex_internal_data_[]; -class AnyRules; -struct AnyRulesDefaultTypeInternal; -extern AnyRulesDefaultTypeInternal _AnyRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull AnyRules_class_data_; -class BoolRules; -struct BoolRulesDefaultTypeInternal; -extern BoolRulesDefaultTypeInternal _BoolRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull BoolRules_class_data_; -class BytesRules; -struct BytesRulesDefaultTypeInternal; -extern BytesRulesDefaultTypeInternal _BytesRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull BytesRules_class_data_; -class DoubleRules; -struct DoubleRulesDefaultTypeInternal; -extern DoubleRulesDefaultTypeInternal _DoubleRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull DoubleRules_class_data_; -class DurationRules; -struct DurationRulesDefaultTypeInternal; -extern DurationRulesDefaultTypeInternal _DurationRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull DurationRules_class_data_; -class EnumRules; -struct EnumRulesDefaultTypeInternal; -extern EnumRulesDefaultTypeInternal _EnumRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull EnumRules_class_data_; -class FieldMaskRules; -struct FieldMaskRulesDefaultTypeInternal; -extern FieldMaskRulesDefaultTypeInternal _FieldMaskRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull FieldMaskRules_class_data_; -class FieldPath; -struct FieldPathDefaultTypeInternal; -extern FieldPathDefaultTypeInternal _FieldPath_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull FieldPath_class_data_; -class FieldPathElement; -struct FieldPathElementDefaultTypeInternal; -extern FieldPathElementDefaultTypeInternal _FieldPathElement_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull FieldPathElement_class_data_; -class FieldRules; -struct FieldRulesDefaultTypeInternal; -extern FieldRulesDefaultTypeInternal _FieldRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull FieldRules_class_data_; -class Fixed32Rules; -struct Fixed32RulesDefaultTypeInternal; -extern Fixed32RulesDefaultTypeInternal _Fixed32Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Fixed32Rules_class_data_; -class Fixed64Rules; -struct Fixed64RulesDefaultTypeInternal; -extern Fixed64RulesDefaultTypeInternal _Fixed64Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Fixed64Rules_class_data_; -class FloatRules; -struct FloatRulesDefaultTypeInternal; -extern FloatRulesDefaultTypeInternal _FloatRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull FloatRules_class_data_; -class Int32Rules; -struct Int32RulesDefaultTypeInternal; -extern Int32RulesDefaultTypeInternal _Int32Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Int32Rules_class_data_; -class Int64Rules; -struct Int64RulesDefaultTypeInternal; -extern Int64RulesDefaultTypeInternal _Int64Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Int64Rules_class_data_; -class MapRules; -struct MapRulesDefaultTypeInternal; -extern MapRulesDefaultTypeInternal _MapRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull MapRules_class_data_; -class MessageOneofRule; -struct MessageOneofRuleDefaultTypeInternal; -extern MessageOneofRuleDefaultTypeInternal _MessageOneofRule_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull MessageOneofRule_class_data_; -class MessageRules; -struct MessageRulesDefaultTypeInternal; -extern MessageRulesDefaultTypeInternal _MessageRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull MessageRules_class_data_; -class OneofRules; -struct OneofRulesDefaultTypeInternal; -extern OneofRulesDefaultTypeInternal _OneofRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull OneofRules_class_data_; -class PredefinedRules; -struct PredefinedRulesDefaultTypeInternal; -extern PredefinedRulesDefaultTypeInternal _PredefinedRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull PredefinedRules_class_data_; -class RepeatedRules; -struct RepeatedRulesDefaultTypeInternal; -extern RepeatedRulesDefaultTypeInternal _RepeatedRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull RepeatedRules_class_data_; -class Rule; -struct RuleDefaultTypeInternal; -extern RuleDefaultTypeInternal _Rule_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Rule_class_data_; -class SFixed32Rules; -struct SFixed32RulesDefaultTypeInternal; -extern SFixed32RulesDefaultTypeInternal _SFixed32Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull SFixed32Rules_class_data_; -class SFixed64Rules; -struct SFixed64RulesDefaultTypeInternal; -extern SFixed64RulesDefaultTypeInternal _SFixed64Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull SFixed64Rules_class_data_; -class SInt32Rules; -struct SInt32RulesDefaultTypeInternal; -extern SInt32RulesDefaultTypeInternal _SInt32Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull SInt32Rules_class_data_; -class SInt64Rules; -struct SInt64RulesDefaultTypeInternal; -extern SInt64RulesDefaultTypeInternal _SInt64Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull SInt64Rules_class_data_; -class StringRules; -struct StringRulesDefaultTypeInternal; -extern StringRulesDefaultTypeInternal _StringRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull StringRules_class_data_; -class TimestampRules; -struct TimestampRulesDefaultTypeInternal; -extern TimestampRulesDefaultTypeInternal _TimestampRules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull TimestampRules_class_data_; -class UInt32Rules; -struct UInt32RulesDefaultTypeInternal; -extern UInt32RulesDefaultTypeInternal _UInt32Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull UInt32Rules_class_data_; -class UInt64Rules; -struct UInt64RulesDefaultTypeInternal; -extern UInt64RulesDefaultTypeInternal _UInt64Rules_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull UInt64Rules_class_data_; -class Violation; -struct ViolationDefaultTypeInternal; -extern ViolationDefaultTypeInternal _Violation_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Violation_class_data_; -class Violations; -struct ViolationsDefaultTypeInternal; -extern ViolationsDefaultTypeInternal _Violations_default_instance_; -extern const ::google::protobuf::internal::ClassDataFull Violations_class_data_; -} // namespace validate -} // namespace buf -namespace google { -namespace protobuf { -template <> -internal::EnumTraitsT<::buf::validate::Ignore_internal_data_> - internal::EnumTraitsImpl::value<::buf::validate::Ignore>; -template <> -internal::EnumTraitsT<::buf::validate::KnownRegex_internal_data_> - internal::EnumTraitsImpl::value<::buf::validate::KnownRegex>; -} // namespace protobuf -} // namespace google - -namespace buf { -namespace validate { -enum Ignore : int { - IGNORE_UNSPECIFIED = 0, - IGNORE_IF_ZERO_VALUE = 1, - IGNORE_ALWAYS = 3, -}; - -extern const uint32_t Ignore_internal_data_[]; -inline constexpr Ignore Ignore_MIN = - static_cast(0); -inline constexpr Ignore Ignore_MAX = - static_cast(3); -inline bool Ignore_IsValid(int value) { - return 0 <= value && value <= 3 && ((11u >> value) & 1) != 0; -} -inline constexpr int Ignore_ARRAYSIZE = 3 + 1; -const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Ignore_descriptor(); -template -const ::std::string& Ignore_Name(T value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to Ignore_Name()."); - return Ignore_Name(static_cast(value)); -} -template <> -inline const ::std::string& Ignore_Name(Ignore value) { - return ::google::protobuf::internal::NameOfDenseEnum( - static_cast(value)); -} -inline bool Ignore_Parse( - ::absl::string_view name, Ignore* PROTOBUF_NONNULL value) { - return ::google::protobuf::internal::ParseNamedEnum(Ignore_descriptor(), name, - value); -} -enum KnownRegex : int { - KNOWN_REGEX_UNSPECIFIED = 0, - KNOWN_REGEX_HTTP_HEADER_NAME = 1, - KNOWN_REGEX_HTTP_HEADER_VALUE = 2, -}; - -extern const uint32_t KnownRegex_internal_data_[]; -inline constexpr KnownRegex KnownRegex_MIN = - static_cast(0); -inline constexpr KnownRegex KnownRegex_MAX = - static_cast(2); -inline bool KnownRegex_IsValid(int value) { - return 0 <= value && value <= 2; -} -inline constexpr int KnownRegex_ARRAYSIZE = 2 + 1; -const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL KnownRegex_descriptor(); -template -const ::std::string& KnownRegex_Name(T value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to KnownRegex_Name()."); - return KnownRegex_Name(static_cast(value)); -} -template <> -inline const ::std::string& KnownRegex_Name(KnownRegex value) { - return ::google::protobuf::internal::NameOfDenseEnum( - static_cast(value)); -} -inline bool KnownRegex_Parse( - ::absl::string_view name, KnownRegex* PROTOBUF_NONNULL value) { - return ::google::protobuf::internal::ParseNamedEnum(KnownRegex_descriptor(), name, - value); -} - -// =================================================================== - - -// ------------------------------------------------------------------- - -class UInt64Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.UInt64Rules) */ { - public: - inline UInt64Rules() : UInt64Rules(nullptr) {} - ~UInt64Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UInt64Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(UInt64Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR UInt64Rules(::google::protobuf::internal::ConstantInitialized); - - inline UInt64Rules(const UInt64Rules& from) : UInt64Rules(nullptr, from) {} - inline UInt64Rules(UInt64Rules&& from) noexcept - : UInt64Rules(nullptr, ::std::move(from)) {} - inline UInt64Rules& operator=(const UInt64Rules& from) { - CopyFrom(from); - return *this; - } - inline UInt64Rules& operator=(UInt64Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const UInt64Rules& default_instance() { - return *reinterpret_cast( - &_UInt64Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 11; - friend void swap(UInt64Rules& a, UInt64Rules& b) { a.Swap(&b); } - inline void Swap(UInt64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(UInt64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - UInt64Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const UInt64Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const UInt64Rules& from) { UInt64Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(UInt64Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.UInt64Rules"; } - - explicit UInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - UInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt64Rules& from); - UInt64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UInt64Rules&& from) noexcept - : UInt64Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated uint64 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::uint64_t in(int index) const; - void set_in(int index, ::uint64_t value); - void add_in(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated uint64 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::uint64_t not_in(int index) const; - void set_not_in(int index, ::uint64_t value); - void add_not_in(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& not_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated uint64 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::uint64_t example(int index) const; - void set_example(int index, ::uint64_t value); - void add_example(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& example() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional uint64 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::uint64_t const_() const; - void set_const_(::uint64_t value); - - private: - ::uint64_t _internal_const_() const; - void _internal_set_const_(::uint64_t value); - - public: - // uint64 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::uint64_t lt() const; - void set_lt(::uint64_t value); - - private: - ::uint64_t _internal_lt() const; - void _internal_set_lt(::uint64_t value); - - public: - // uint64 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::uint64_t lte() const; - void set_lte(::uint64_t value); - - private: - ::uint64_t _internal_lte() const; - void _internal_set_lte(::uint64_t value); - - public: - // uint64 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::uint64_t gt() const; - void set_gt(::uint64_t value); - - private: - ::uint64_t _internal_gt() const; - void _internal_set_gt(::uint64_t value); - - public: - // uint64 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::uint64_t gte() const; - void set_gte(::uint64_t value); - - private: - ::uint64_t _internal_gte() const; - void _internal_set_gte(::uint64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.UInt64Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const UInt64Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::uint64_t> in_; - ::google::protobuf::RepeatedField<::uint64_t> not_in_; - ::google::protobuf::RepeatedField<::uint64_t> example_; - ::uint64_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint64_t lt_; - ::uint64_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint64_t gt_; - ::uint64_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull UInt64Rules_class_data_; -// ------------------------------------------------------------------- - -class UInt32Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.UInt32Rules) */ { - public: - inline UInt32Rules() : UInt32Rules(nullptr) {} - ~UInt32Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(UInt32Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(UInt32Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR UInt32Rules(::google::protobuf::internal::ConstantInitialized); - - inline UInt32Rules(const UInt32Rules& from) : UInt32Rules(nullptr, from) {} - inline UInt32Rules(UInt32Rules&& from) noexcept - : UInt32Rules(nullptr, ::std::move(from)) {} - inline UInt32Rules& operator=(const UInt32Rules& from) { - CopyFrom(from); - return *this; - } - inline UInt32Rules& operator=(UInt32Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const UInt32Rules& default_instance() { - return *reinterpret_cast( - &_UInt32Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 10; - friend void swap(UInt32Rules& a, UInt32Rules& b) { a.Swap(&b); } - inline void Swap(UInt32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(UInt32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - UInt32Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const UInt32Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const UInt32Rules& from) { UInt32Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(UInt32Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.UInt32Rules"; } - - explicit UInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - UInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const UInt32Rules& from); - UInt32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, UInt32Rules&& from) noexcept - : UInt32Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated uint32 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::uint32_t in(int index) const; - void set_in(int index, ::uint32_t value); - void add_in(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated uint32 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::uint32_t not_in(int index) const; - void set_not_in(int index, ::uint32_t value); - void add_not_in(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& not_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated uint32 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::uint32_t example(int index) const; - void set_example(int index, ::uint32_t value); - void add_example(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& example() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional uint32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::uint32_t const_() const; - void set_const_(::uint32_t value); - - private: - ::uint32_t _internal_const_() const; - void _internal_set_const_(::uint32_t value); - - public: - // uint32 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::uint32_t lt() const; - void set_lt(::uint32_t value); - - private: - ::uint32_t _internal_lt() const; - void _internal_set_lt(::uint32_t value); - - public: - // uint32 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::uint32_t lte() const; - void set_lte(::uint32_t value); - - private: - ::uint32_t _internal_lte() const; - void _internal_set_lte(::uint32_t value); - - public: - // uint32 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::uint32_t gt() const; - void set_gt(::uint32_t value); - - private: - ::uint32_t _internal_gt() const; - void _internal_set_gt(::uint32_t value); - - public: - // uint32 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::uint32_t gte() const; - void set_gte(::uint32_t value); - - private: - ::uint32_t _internal_gte() const; - void _internal_set_gte(::uint32_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - UInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.UInt32Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const UInt32Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::uint32_t> in_; - ::google::protobuf::RepeatedField<::uint32_t> not_in_; - ::google::protobuf::RepeatedField<::uint32_t> example_; - ::uint32_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint32_t lt_; - ::uint32_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint32_t gt_; - ::uint32_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull UInt32Rules_class_data_; -// ------------------------------------------------------------------- - -class StringRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.StringRules) */ { - public: - inline StringRules() : StringRules(nullptr) {} - ~StringRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(StringRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(StringRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR StringRules(::google::protobuf::internal::ConstantInitialized); - - inline StringRules(const StringRules& from) : StringRules(nullptr, from) {} - inline StringRules(StringRules&& from) noexcept - : StringRules(nullptr, ::std::move(from)) {} - inline StringRules& operator=(const StringRules& from) { - CopyFrom(from); - return *this; - } - inline StringRules& operator=(StringRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const StringRules& default_instance() { - return *reinterpret_cast( - &_StringRules_default_instance_); - } - enum WellKnownCase { - kEmail = 12, - kHostname = 13, - kIp = 14, - kIpv4 = 15, - kIpv6 = 16, - kUri = 17, - kUriRef = 18, - kAddress = 21, - kUuid = 22, - kTuuid = 33, - kIpWithPrefixlen = 26, - kIpv4WithPrefixlen = 27, - kIpv6WithPrefixlen = 28, - kIpPrefix = 29, - kIpv4Prefix = 30, - kIpv6Prefix = 31, - kHostAndPort = 32, - kUlid = 35, - kProtobufFqn = 37, - kProtobufDotFqn = 38, - kWellKnownRegex = 24, - WELL_KNOWN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 19; - friend void swap(StringRules& a, StringRules& b) { a.Swap(&b); } - inline void Swap(StringRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(StringRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - StringRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const StringRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const StringRules& from) { StringRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(StringRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.StringRules"; } - - explicit StringRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - StringRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const StringRules& from); - StringRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, StringRules&& from) noexcept - : StringRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 10, - kNotInFieldNumber = 11, - kExampleFieldNumber = 34, - kConstFieldNumber = 1, - kPatternFieldNumber = 6, - kPrefixFieldNumber = 7, - kSuffixFieldNumber = 8, - kContainsFieldNumber = 9, - kNotContainsFieldNumber = 23, - kMinLenFieldNumber = 2, - kMaxLenFieldNumber = 3, - kMinBytesFieldNumber = 4, - kMaxBytesFieldNumber = 5, - kLenFieldNumber = 19, - kLenBytesFieldNumber = 20, - kStrictFieldNumber = 25, - kEmailFieldNumber = 12, - kHostnameFieldNumber = 13, - kIpFieldNumber = 14, - kIpv4FieldNumber = 15, - kIpv6FieldNumber = 16, - kUriFieldNumber = 17, - kUriRefFieldNumber = 18, - kAddressFieldNumber = 21, - kUuidFieldNumber = 22, - kTuuidFieldNumber = 33, - kIpWithPrefixlenFieldNumber = 26, - kIpv4WithPrefixlenFieldNumber = 27, - kIpv6WithPrefixlenFieldNumber = 28, - kIpPrefixFieldNumber = 29, - kIpv4PrefixFieldNumber = 30, - kIpv6PrefixFieldNumber = 31, - kHostAndPortFieldNumber = 32, - kUlidFieldNumber = 35, - kProtobufFqnFieldNumber = 37, - kProtobufDotFqnFieldNumber = 38, - kWellKnownRegexFieldNumber = 24, - }; - // repeated string in = 10 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - const ::std::string& in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_in(int index); - template - void set_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_in(); - template - void add_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated string not_in = 11 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - const ::std::string& not_in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_not_in(int index); - template - void set_not_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_not_in(); - template - void add_not_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated string example = 34 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - const ::std::string& example(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_example(int index); - template - void set_example(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_example(); - template - void add_example(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& example() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_example() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional string const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - const ::std::string& const_() const; - template - void set_const_(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_const_(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_const_(); - void set_allocated_const_(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_const_() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_const_(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_const_(); - - public: - // optional string pattern = 6 [(.buf.validate.predefined) = { - bool has_pattern() const; - void clear_pattern() ; - const ::std::string& pattern() const; - template - void set_pattern(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_pattern(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_pattern(); - void set_allocated_pattern(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_pattern() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_pattern(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_pattern(); - - public: - // optional string prefix = 7 [(.buf.validate.predefined) = { - bool has_prefix() const; - void clear_prefix() ; - const ::std::string& prefix() const; - template - void set_prefix(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_prefix(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_prefix(); - void set_allocated_prefix(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_prefix() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_prefix(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_prefix(); - - public: - // optional string suffix = 8 [(.buf.validate.predefined) = { - bool has_suffix() const; - void clear_suffix() ; - const ::std::string& suffix() const; - template - void set_suffix(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_suffix(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_suffix(); - void set_allocated_suffix(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_suffix() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_suffix(); - - public: - // optional string contains = 9 [(.buf.validate.predefined) = { - bool has_contains() const; - void clear_contains() ; - const ::std::string& contains() const; - template - void set_contains(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_contains(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_contains(); - void set_allocated_contains(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_contains() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_contains(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_contains(); - - public: - // optional string not_contains = 23 [(.buf.validate.predefined) = { - bool has_not_contains() const; - void clear_not_contains() ; - const ::std::string& not_contains() const; - template - void set_not_contains(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_not_contains(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_not_contains(); - void set_allocated_not_contains(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_not_contains() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_not_contains(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_not_contains(); - - public: - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - bool has_min_len() const; - void clear_min_len() ; - ::uint64_t min_len() const; - void set_min_len(::uint64_t value); - - private: - ::uint64_t _internal_min_len() const; - void _internal_set_min_len(::uint64_t value); - - public: - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - bool has_max_len() const; - void clear_max_len() ; - ::uint64_t max_len() const; - void set_max_len(::uint64_t value); - - private: - ::uint64_t _internal_max_len() const; - void _internal_set_max_len(::uint64_t value); - - public: - // optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { - bool has_min_bytes() const; - void clear_min_bytes() ; - ::uint64_t min_bytes() const; - void set_min_bytes(::uint64_t value); - - private: - ::uint64_t _internal_min_bytes() const; - void _internal_set_min_bytes(::uint64_t value); - - public: - // optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { - bool has_max_bytes() const; - void clear_max_bytes() ; - ::uint64_t max_bytes() const; - void set_max_bytes(::uint64_t value); - - private: - ::uint64_t _internal_max_bytes() const; - void _internal_set_max_bytes(::uint64_t value); - - public: - // optional uint64 len = 19 [(.buf.validate.predefined) = { - bool has_len() const; - void clear_len() ; - ::uint64_t len() const; - void set_len(::uint64_t value); - - private: - ::uint64_t _internal_len() const; - void _internal_set_len(::uint64_t value); - - public: - // optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { - bool has_len_bytes() const; - void clear_len_bytes() ; - ::uint64_t len_bytes() const; - void set_len_bytes(::uint64_t value); - - private: - ::uint64_t _internal_len_bytes() const; - void _internal_set_len_bytes(::uint64_t value); - - public: - // optional bool strict = 25; - bool has_strict() const; - void clear_strict() ; - bool strict() const; - void set_strict(bool value); - - private: - bool _internal_strict() const; - void _internal_set_strict(bool value); - - public: - // bool email = 12 [(.buf.validate.predefined) = { - bool has_email() const; - void clear_email() ; - bool email() const; - void set_email(bool value); - - private: - bool _internal_email() const; - void _internal_set_email(bool value); - - public: - // bool hostname = 13 [(.buf.validate.predefined) = { - bool has_hostname() const; - void clear_hostname() ; - bool hostname() const; - void set_hostname(bool value); - - private: - bool _internal_hostname() const; - void _internal_set_hostname(bool value); - - public: - // bool ip = 14 [(.buf.validate.predefined) = { - bool has_ip() const; - void clear_ip() ; - bool ip() const; - void set_ip(bool value); - - private: - bool _internal_ip() const; - void _internal_set_ip(bool value); - - public: - // bool ipv4 = 15 [(.buf.validate.predefined) = { - bool has_ipv4() const; - void clear_ipv4() ; - bool ipv4() const; - void set_ipv4(bool value); - - private: - bool _internal_ipv4() const; - void _internal_set_ipv4(bool value); - - public: - // bool ipv6 = 16 [(.buf.validate.predefined) = { - bool has_ipv6() const; - void clear_ipv6() ; - bool ipv6() const; - void set_ipv6(bool value); - - private: - bool _internal_ipv6() const; - void _internal_set_ipv6(bool value); - - public: - // bool uri = 17 [(.buf.validate.predefined) = { - bool has_uri() const; - void clear_uri() ; - bool uri() const; - void set_uri(bool value); - - private: - bool _internal_uri() const; - void _internal_set_uri(bool value); - - public: - // bool uri_ref = 18 [(.buf.validate.predefined) = { - bool has_uri_ref() const; - void clear_uri_ref() ; - bool uri_ref() const; - void set_uri_ref(bool value); - - private: - bool _internal_uri_ref() const; - void _internal_set_uri_ref(bool value); - - public: - // bool address = 21 [(.buf.validate.predefined) = { - bool has_address() const; - void clear_address() ; - bool address() const; - void set_address(bool value); - - private: - bool _internal_address() const; - void _internal_set_address(bool value); - - public: - // bool uuid = 22 [(.buf.validate.predefined) = { - bool has_uuid() const; - void clear_uuid() ; - bool uuid() const; - void set_uuid(bool value); - - private: - bool _internal_uuid() const; - void _internal_set_uuid(bool value); - - public: - // bool tuuid = 33 [(.buf.validate.predefined) = { - bool has_tuuid() const; - void clear_tuuid() ; - bool tuuid() const; - void set_tuuid(bool value); - - private: - bool _internal_tuuid() const; - void _internal_set_tuuid(bool value); - - public: - // bool ip_with_prefixlen = 26 [(.buf.validate.predefined) = { - bool has_ip_with_prefixlen() const; - void clear_ip_with_prefixlen() ; - bool ip_with_prefixlen() const; - void set_ip_with_prefixlen(bool value); - - private: - bool _internal_ip_with_prefixlen() const; - void _internal_set_ip_with_prefixlen(bool value); - - public: - // bool ipv4_with_prefixlen = 27 [(.buf.validate.predefined) = { - bool has_ipv4_with_prefixlen() const; - void clear_ipv4_with_prefixlen() ; - bool ipv4_with_prefixlen() const; - void set_ipv4_with_prefixlen(bool value); - - private: - bool _internal_ipv4_with_prefixlen() const; - void _internal_set_ipv4_with_prefixlen(bool value); - - public: - // bool ipv6_with_prefixlen = 28 [(.buf.validate.predefined) = { - bool has_ipv6_with_prefixlen() const; - void clear_ipv6_with_prefixlen() ; - bool ipv6_with_prefixlen() const; - void set_ipv6_with_prefixlen(bool value); - - private: - bool _internal_ipv6_with_prefixlen() const; - void _internal_set_ipv6_with_prefixlen(bool value); - - public: - // bool ip_prefix = 29 [(.buf.validate.predefined) = { - bool has_ip_prefix() const; - void clear_ip_prefix() ; - bool ip_prefix() const; - void set_ip_prefix(bool value); - - private: - bool _internal_ip_prefix() const; - void _internal_set_ip_prefix(bool value); - - public: - // bool ipv4_prefix = 30 [(.buf.validate.predefined) = { - bool has_ipv4_prefix() const; - void clear_ipv4_prefix() ; - bool ipv4_prefix() const; - void set_ipv4_prefix(bool value); - - private: - bool _internal_ipv4_prefix() const; - void _internal_set_ipv4_prefix(bool value); - - public: - // bool ipv6_prefix = 31 [(.buf.validate.predefined) = { - bool has_ipv6_prefix() const; - void clear_ipv6_prefix() ; - bool ipv6_prefix() const; - void set_ipv6_prefix(bool value); - - private: - bool _internal_ipv6_prefix() const; - void _internal_set_ipv6_prefix(bool value); - - public: - // bool host_and_port = 32 [(.buf.validate.predefined) = { - bool has_host_and_port() const; - void clear_host_and_port() ; - bool host_and_port() const; - void set_host_and_port(bool value); - - private: - bool _internal_host_and_port() const; - void _internal_set_host_and_port(bool value); - - public: - // bool ulid = 35 [(.buf.validate.predefined) = { - bool has_ulid() const; - void clear_ulid() ; - bool ulid() const; - void set_ulid(bool value); - - private: - bool _internal_ulid() const; - void _internal_set_ulid(bool value); - - public: - // bool protobuf_fqn = 37 [(.buf.validate.predefined) = { - bool has_protobuf_fqn() const; - void clear_protobuf_fqn() ; - bool protobuf_fqn() const; - void set_protobuf_fqn(bool value); - - private: - bool _internal_protobuf_fqn() const; - void _internal_set_protobuf_fqn(bool value); - - public: - // bool protobuf_dot_fqn = 38 [(.buf.validate.predefined) = { - bool has_protobuf_dot_fqn() const; - void clear_protobuf_dot_fqn() ; - bool protobuf_dot_fqn() const; - void set_protobuf_dot_fqn(bool value); - - private: - bool _internal_protobuf_dot_fqn() const; - void _internal_set_protobuf_dot_fqn(bool value); - - public: - // .buf.validate.KnownRegex well_known_regex = 24 [(.buf.validate.predefined) = { - bool has_well_known_regex() const; - void clear_well_known_regex() ; - ::buf::validate::KnownRegex well_known_regex() const; - void set_well_known_regex(::buf::validate::KnownRegex value); - - private: - ::buf::validate::KnownRegex _internal_well_known_regex() const; - void _internal_set_well_known_regex(::buf::validate::KnownRegex value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - StringRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - StringRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - StringRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_well_known(); - WellKnownCase well_known_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.StringRules) - private: - class _Internal; - void set_has_email(); - void set_has_hostname(); - void set_has_ip(); - void set_has_ipv4(); - void set_has_ipv6(); - void set_has_uri(); - void set_has_uri_ref(); - void set_has_address(); - void set_has_uuid(); - void set_has_tuuid(); - void set_has_ip_with_prefixlen(); - void set_has_ipv4_with_prefixlen(); - void set_has_ipv6_with_prefixlen(); - void set_has_ip_prefix(); - void set_has_ipv4_prefix(); - void set_has_ipv6_prefix(); - void set_has_host_and_port(); - void set_has_ulid(); - void set_has_protobuf_fqn(); - void set_has_protobuf_dot_fqn(); - void set_has_well_known_regex(); - inline bool has_well_known() const; - inline void clear_has_well_known(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<5, 37, - 1, 0, - 7> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const StringRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> in_; - ::google::protobuf::RepeatedPtrField<::std::string> not_in_; - ::google::protobuf::RepeatedPtrField<::std::string> example_; - ::google::protobuf::internal::ArenaStringPtr const__; - ::google::protobuf::internal::ArenaStringPtr pattern_; - ::google::protobuf::internal::ArenaStringPtr prefix_; - ::google::protobuf::internal::ArenaStringPtr suffix_; - ::google::protobuf::internal::ArenaStringPtr contains_; - ::google::protobuf::internal::ArenaStringPtr not_contains_; - ::uint64_t min_len_; - ::uint64_t max_len_; - ::uint64_t min_bytes_; - ::uint64_t max_bytes_; - ::uint64_t len_; - ::uint64_t len_bytes_; - bool strict_; - union WellKnownUnion { - constexpr WellKnownUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - bool email_; - bool hostname_; - bool ip_; - bool ipv4_; - bool ipv6_; - bool uri_; - bool uri_ref_; - bool address_; - bool uuid_; - bool tuuid_; - bool ip_with_prefixlen_; - bool ipv4_with_prefixlen_; - bool ipv6_with_prefixlen_; - bool ip_prefix_; - bool ipv4_prefix_; - bool ipv6_prefix_; - bool host_and_port_; - bool ulid_; - bool protobuf_fqn_; - bool protobuf_dot_fqn_; - int well_known_regex_; - } well_known_; - ::uint32_t _oneof_case_[1]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull StringRules_class_data_; -// ------------------------------------------------------------------- - -class SInt64Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.SInt64Rules) */ { - public: - inline SInt64Rules() : SInt64Rules(nullptr) {} - ~SInt64Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SInt64Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(SInt64Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR SInt64Rules(::google::protobuf::internal::ConstantInitialized); - - inline SInt64Rules(const SInt64Rules& from) : SInt64Rules(nullptr, from) {} - inline SInt64Rules(SInt64Rules&& from) noexcept - : SInt64Rules(nullptr, ::std::move(from)) {} - inline SInt64Rules& operator=(const SInt64Rules& from) { - CopyFrom(from); - return *this; - } - inline SInt64Rules& operator=(SInt64Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SInt64Rules& default_instance() { - return *reinterpret_cast( - &_SInt64Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 13; - friend void swap(SInt64Rules& a, SInt64Rules& b) { a.Swap(&b); } - inline void Swap(SInt64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SInt64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SInt64Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const SInt64Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const SInt64Rules& from) { SInt64Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(SInt64Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.SInt64Rules"; } - - explicit SInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - SInt64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SInt64Rules& from); - SInt64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SInt64Rules&& from) noexcept - : SInt64Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated sint64 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int64_t in(int index) const; - void set_in(int index, ::int64_t value); - void add_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated sint64 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int64_t not_in(int index) const; - void set_not_in(int index, ::int64_t value); - void add_not_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated sint64 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int64_t example(int index) const; - void set_example(int index, ::int64_t value); - void add_example(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional sint64 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int64_t const_() const; - void set_const_(::int64_t value); - - private: - ::int64_t _internal_const_() const; - void _internal_set_const_(::int64_t value); - - public: - // sint64 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int64_t lt() const; - void set_lt(::int64_t value); - - private: - ::int64_t _internal_lt() const; - void _internal_set_lt(::int64_t value); - - public: - // sint64 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int64_t lte() const; - void set_lte(::int64_t value); - - private: - ::int64_t _internal_lte() const; - void _internal_set_lte(::int64_t value); - - public: - // sint64 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int64_t gt() const; - void set_gt(::int64_t value); - - private: - ::int64_t _internal_gt() const; - void _internal_set_gt(::int64_t value); - - public: - // sint64 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int64_t gte() const; - void set_gte(::int64_t value); - - private: - ::int64_t _internal_gte() const; - void _internal_set_gte(::int64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.SInt64Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const SInt64Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int64_t> in_; - ::google::protobuf::RepeatedField<::int64_t> not_in_; - ::google::protobuf::RepeatedField<::int64_t> example_; - ::int64_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t lt_; - ::int64_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t gt_; - ::int64_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull SInt64Rules_class_data_; -// ------------------------------------------------------------------- - -class SInt32Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.SInt32Rules) */ { - public: - inline SInt32Rules() : SInt32Rules(nullptr) {} - ~SInt32Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SInt32Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(SInt32Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR SInt32Rules(::google::protobuf::internal::ConstantInitialized); - - inline SInt32Rules(const SInt32Rules& from) : SInt32Rules(nullptr, from) {} - inline SInt32Rules(SInt32Rules&& from) noexcept - : SInt32Rules(nullptr, ::std::move(from)) {} - inline SInt32Rules& operator=(const SInt32Rules& from) { - CopyFrom(from); - return *this; - } - inline SInt32Rules& operator=(SInt32Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SInt32Rules& default_instance() { - return *reinterpret_cast( - &_SInt32Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 12; - friend void swap(SInt32Rules& a, SInt32Rules& b) { a.Swap(&b); } - inline void Swap(SInt32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SInt32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SInt32Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const SInt32Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const SInt32Rules& from) { SInt32Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(SInt32Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.SInt32Rules"; } - - explicit SInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - SInt32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SInt32Rules& from); - SInt32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SInt32Rules&& from) noexcept - : SInt32Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated sint32 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int32_t in(int index) const; - void set_in(int index, ::int32_t value); - void add_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated sint32 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int32_t not_in(int index) const; - void set_not_in(int index, ::int32_t value); - void add_not_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated sint32 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int32_t example(int index) const; - void set_example(int index, ::int32_t value); - void add_example(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional sint32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int32_t const_() const; - void set_const_(::int32_t value); - - private: - ::int32_t _internal_const_() const; - void _internal_set_const_(::int32_t value); - - public: - // sint32 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int32_t lt() const; - void set_lt(::int32_t value); - - private: - ::int32_t _internal_lt() const; - void _internal_set_lt(::int32_t value); - - public: - // sint32 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int32_t lte() const; - void set_lte(::int32_t value); - - private: - ::int32_t _internal_lte() const; - void _internal_set_lte(::int32_t value); - - public: - // sint32 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int32_t gt() const; - void set_gt(::int32_t value); - - private: - ::int32_t _internal_gt() const; - void _internal_set_gt(::int32_t value); - - public: - // sint32 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int32_t gte() const; - void set_gte(::int32_t value); - - private: - ::int32_t _internal_gte() const; - void _internal_set_gte(::int32_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SInt32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.SInt32Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const SInt32Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int32_t> in_; - ::google::protobuf::RepeatedField<::int32_t> not_in_; - ::google::protobuf::RepeatedField<::int32_t> example_; - ::int32_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t lt_; - ::int32_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t gt_; - ::int32_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull SInt32Rules_class_data_; -// ------------------------------------------------------------------- - -class SFixed64Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.SFixed64Rules) */ { - public: - inline SFixed64Rules() : SFixed64Rules(nullptr) {} - ~SFixed64Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SFixed64Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(SFixed64Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR SFixed64Rules(::google::protobuf::internal::ConstantInitialized); - - inline SFixed64Rules(const SFixed64Rules& from) : SFixed64Rules(nullptr, from) {} - inline SFixed64Rules(SFixed64Rules&& from) noexcept - : SFixed64Rules(nullptr, ::std::move(from)) {} - inline SFixed64Rules& operator=(const SFixed64Rules& from) { - CopyFrom(from); - return *this; - } - inline SFixed64Rules& operator=(SFixed64Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SFixed64Rules& default_instance() { - return *reinterpret_cast( - &_SFixed64Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 17; - friend void swap(SFixed64Rules& a, SFixed64Rules& b) { a.Swap(&b); } - inline void Swap(SFixed64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SFixed64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SFixed64Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const SFixed64Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const SFixed64Rules& from) { SFixed64Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(SFixed64Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.SFixed64Rules"; } - - explicit SFixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - SFixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SFixed64Rules& from); - SFixed64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SFixed64Rules&& from) noexcept - : SFixed64Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated sfixed64 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int64_t in(int index) const; - void set_in(int index, ::int64_t value); - void add_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int64_t not_in(int index) const; - void set_not_in(int index, ::int64_t value); - void add_not_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated sfixed64 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int64_t example(int index) const; - void set_example(int index, ::int64_t value); - void add_example(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional sfixed64 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int64_t const_() const; - void set_const_(::int64_t value); - - private: - ::int64_t _internal_const_() const; - void _internal_set_const_(::int64_t value); - - public: - // sfixed64 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int64_t lt() const; - void set_lt(::int64_t value); - - private: - ::int64_t _internal_lt() const; - void _internal_set_lt(::int64_t value); - - public: - // sfixed64 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int64_t lte() const; - void set_lte(::int64_t value); - - private: - ::int64_t _internal_lte() const; - void _internal_set_lte(::int64_t value); - - public: - // sfixed64 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int64_t gt() const; - void set_gt(::int64_t value); - - private: - ::int64_t _internal_gt() const; - void _internal_set_gt(::int64_t value); - - public: - // sfixed64 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int64_t gte() const; - void set_gte(::int64_t value); - - private: - ::int64_t _internal_gte() const; - void _internal_set_gte(::int64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.SFixed64Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const SFixed64Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int64_t> in_; - ::google::protobuf::RepeatedField<::int64_t> not_in_; - ::google::protobuf::RepeatedField<::int64_t> example_; - ::int64_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t lt_; - ::int64_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t gt_; - ::int64_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull SFixed64Rules_class_data_; -// ------------------------------------------------------------------- - -class SFixed32Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.SFixed32Rules) */ { - public: - inline SFixed32Rules() : SFixed32Rules(nullptr) {} - ~SFixed32Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(SFixed32Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(SFixed32Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR SFixed32Rules(::google::protobuf::internal::ConstantInitialized); - - inline SFixed32Rules(const SFixed32Rules& from) : SFixed32Rules(nullptr, from) {} - inline SFixed32Rules(SFixed32Rules&& from) noexcept - : SFixed32Rules(nullptr, ::std::move(from)) {} - inline SFixed32Rules& operator=(const SFixed32Rules& from) { - CopyFrom(from); - return *this; - } - inline SFixed32Rules& operator=(SFixed32Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SFixed32Rules& default_instance() { - return *reinterpret_cast( - &_SFixed32Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 16; - friend void swap(SFixed32Rules& a, SFixed32Rules& b) { a.Swap(&b); } - inline void Swap(SFixed32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SFixed32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SFixed32Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const SFixed32Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const SFixed32Rules& from) { SFixed32Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(SFixed32Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.SFixed32Rules"; } - - explicit SFixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - SFixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const SFixed32Rules& from); - SFixed32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, SFixed32Rules&& from) noexcept - : SFixed32Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated sfixed32 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int32_t in(int index) const; - void set_in(int index, ::int32_t value); - void add_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int32_t not_in(int index) const; - void set_not_in(int index, ::int32_t value); - void add_not_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated sfixed32 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int32_t example(int index) const; - void set_example(int index, ::int32_t value); - void add_example(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional sfixed32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int32_t const_() const; - void set_const_(::int32_t value); - - private: - ::int32_t _internal_const_() const; - void _internal_set_const_(::int32_t value); - - public: - // sfixed32 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int32_t lt() const; - void set_lt(::int32_t value); - - private: - ::int32_t _internal_lt() const; - void _internal_set_lt(::int32_t value); - - public: - // sfixed32 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int32_t lte() const; - void set_lte(::int32_t value); - - private: - ::int32_t _internal_lte() const; - void _internal_set_lte(::int32_t value); - - public: - // sfixed32 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int32_t gt() const; - void set_gt(::int32_t value); - - private: - ::int32_t _internal_gt() const; - void _internal_set_gt(::int32_t value); - - public: - // sfixed32 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int32_t gte() const; - void set_gte(::int32_t value); - - private: - ::int32_t _internal_gte() const; - void _internal_set_gte(::int32_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - SFixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.SFixed32Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const SFixed32Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int32_t> in_; - ::google::protobuf::RepeatedField<::int32_t> not_in_; - ::google::protobuf::RepeatedField<::int32_t> example_; - ::int32_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t lt_; - ::int32_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t gt_; - ::int32_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull SFixed32Rules_class_data_; -// ------------------------------------------------------------------- - -class Rule final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Rule) */ { - public: - inline Rule() : Rule(nullptr) {} - ~Rule() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Rule* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Rule)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Rule(::google::protobuf::internal::ConstantInitialized); - - inline Rule(const Rule& from) : Rule(nullptr, from) {} - inline Rule(Rule&& from) noexcept - : Rule(nullptr, ::std::move(from)) {} - inline Rule& operator=(const Rule& from) { - CopyFrom(from); - return *this; - } - inline Rule& operator=(Rule&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Rule& default_instance() { - return *reinterpret_cast( - &_Rule_default_instance_); - } - static constexpr int kIndexInFileMessages = 0; - friend void swap(Rule& a, Rule& b) { a.Swap(&b); } - inline void Swap(Rule* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Rule* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Rule* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Rule& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Rule& from) { Rule::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Rule* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Rule"; } - - explicit Rule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Rule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Rule& from); - Rule( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Rule&& from) noexcept - : Rule(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kIdFieldNumber = 1, - kMessageFieldNumber = 2, - kExpressionFieldNumber = 3, - }; - // optional string id = 1; - bool has_id() const; - void clear_id() ; - const ::std::string& id() const; - template - void set_id(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_id(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_id(); - void set_allocated_id(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_id() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_id(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_id(); - - public: - // optional string message = 2; - bool has_message() const; - void clear_message() ; - const ::std::string& message() const; - template - void set_message(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_message(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_message(); - void set_allocated_message(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_message() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_message(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_message(); - - public: - // optional string expression = 3; - bool has_expression() const; - void clear_expression() ; - const ::std::string& expression() const; - template - void set_expression(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_expression(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_expression(); - void set_allocated_expression(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_expression() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_expression(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_expression(); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.Rule) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 3, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Rule& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::internal::ArenaStringPtr id_; - ::google::protobuf::internal::ArenaStringPtr message_; - ::google::protobuf::internal::ArenaStringPtr expression_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Rule_class_data_; -// ------------------------------------------------------------------- - -class OneofRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.OneofRules) */ { - public: - inline OneofRules() : OneofRules(nullptr) {} - ~OneofRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(OneofRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(OneofRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR OneofRules(::google::protobuf::internal::ConstantInitialized); - - inline OneofRules(const OneofRules& from) : OneofRules(nullptr, from) {} - inline OneofRules(OneofRules&& from) noexcept - : OneofRules(nullptr, ::std::move(from)) {} - inline OneofRules& operator=(const OneofRules& from) { - CopyFrom(from); - return *this; - } - inline OneofRules& operator=(OneofRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const OneofRules& default_instance() { - return *reinterpret_cast( - &_OneofRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 3; - friend void swap(OneofRules& a, OneofRules& b) { a.Swap(&b); } - inline void Swap(OneofRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(OneofRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - OneofRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const OneofRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const OneofRules& from) { OneofRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(OneofRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.OneofRules"; } - - explicit OneofRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - OneofRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const OneofRules& from); - OneofRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, OneofRules&& from) noexcept - : OneofRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kRequiredFieldNumber = 1, - }; - // optional bool required = 1; - bool has_required() const; - void clear_required() ; - bool required() const; - void set_required(bool value); - - private: - bool _internal_required() const; - void _internal_set_required(bool value); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.OneofRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<0, 1, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const OneofRules& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - bool required_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull OneofRules_class_data_; -// ------------------------------------------------------------------- - -class MessageOneofRule final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.MessageOneofRule) */ { - public: - inline MessageOneofRule() : MessageOneofRule(nullptr) {} - ~MessageOneofRule() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MessageOneofRule* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(MessageOneofRule)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR MessageOneofRule(::google::protobuf::internal::ConstantInitialized); - - inline MessageOneofRule(const MessageOneofRule& from) : MessageOneofRule(nullptr, from) {} - inline MessageOneofRule(MessageOneofRule&& from) noexcept - : MessageOneofRule(nullptr, ::std::move(from)) {} - inline MessageOneofRule& operator=(const MessageOneofRule& from) { - CopyFrom(from); - return *this; - } - inline MessageOneofRule& operator=(MessageOneofRule&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const MessageOneofRule& default_instance() { - return *reinterpret_cast( - &_MessageOneofRule_default_instance_); - } - static constexpr int kIndexInFileMessages = 2; - friend void swap(MessageOneofRule& a, MessageOneofRule& b) { a.Swap(&b); } - inline void Swap(MessageOneofRule* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(MessageOneofRule* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - MessageOneofRule* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const MessageOneofRule& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const MessageOneofRule& from) { MessageOneofRule::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(MessageOneofRule* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.MessageOneofRule"; } - - explicit MessageOneofRule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - MessageOneofRule(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MessageOneofRule& from); - MessageOneofRule( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MessageOneofRule&& from) noexcept - : MessageOneofRule(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kFieldsFieldNumber = 1, - kRequiredFieldNumber = 2, - }; - // repeated string fields = 1; - int fields_size() const; - private: - int _internal_fields_size() const; - - public: - void clear_fields() ; - const ::std::string& fields(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_fields(int index); - template - void set_fields(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_fields(); - template - void add_fields(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& fields() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_fields(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_fields() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_fields(); - - public: - // optional bool required = 2; - bool has_required() const; - void clear_required() ; - bool required() const; - void set_required(bool value); - - private: - bool _internal_required() const; - void _internal_set_required(bool value); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.MessageOneofRule) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<1, 2, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const MessageOneofRule& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> fields_; - bool required_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull MessageOneofRule_class_data_; -// ------------------------------------------------------------------- - -class Int64Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Int64Rules) */ { - public: - inline Int64Rules() : Int64Rules(nullptr) {} - ~Int64Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Int64Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Int64Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Int64Rules(::google::protobuf::internal::ConstantInitialized); - - inline Int64Rules(const Int64Rules& from) : Int64Rules(nullptr, from) {} - inline Int64Rules(Int64Rules&& from) noexcept - : Int64Rules(nullptr, ::std::move(from)) {} - inline Int64Rules& operator=(const Int64Rules& from) { - CopyFrom(from); - return *this; - } - inline Int64Rules& operator=(Int64Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Int64Rules& default_instance() { - return *reinterpret_cast( - &_Int64Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 9; - friend void swap(Int64Rules& a, Int64Rules& b) { a.Swap(&b); } - inline void Swap(Int64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Int64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Int64Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Int64Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Int64Rules& from) { Int64Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Int64Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Int64Rules"; } - - explicit Int64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Int64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int64Rules& from); - Int64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Int64Rules&& from) noexcept - : Int64Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kConstFieldNumber = 1, - kExampleFieldNumber = 9, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated int64 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int64_t in(int index) const; - void set_in(int index, ::int64_t value); - void add_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated int64 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int64_t not_in(int index) const; - void set_not_in(int index, ::int64_t value); - void add_not_in(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // optional int64 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int64_t const_() const; - void set_const_(::int64_t value); - - private: - ::int64_t _internal_const_() const; - void _internal_set_const_(::int64_t value); - - public: - // repeated int64 example = 9 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int64_t example(int index) const; - void set_example(int index, ::int64_t value); - void add_example(::int64_t value); - const ::google::protobuf::RepeatedField<::int64_t>& example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int64_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // int64 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int64_t lt() const; - void set_lt(::int64_t value); - - private: - ::int64_t _internal_lt() const; - void _internal_set_lt(::int64_t value); - - public: - // int64 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int64_t lte() const; - void set_lte(::int64_t value); - - private: - ::int64_t _internal_lte() const; - void _internal_set_lte(::int64_t value); - - public: - // int64 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int64_t gt() const; - void set_gt(::int64_t value); - - private: - ::int64_t _internal_gt() const; - void _internal_set_gt(::int64_t value); - - public: - // int64 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int64_t gte() const; - void set_gte(::int64_t value); - - private: - ::int64_t _internal_gte() const; - void _internal_set_gte(::int64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.Int64Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<4, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Int64Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int64_t> in_; - ::google::protobuf::RepeatedField<::int64_t> not_in_; - ::int64_t const__; - ::google::protobuf::RepeatedField<::int64_t> example_; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t lt_; - ::int64_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int64_t gt_; - ::int64_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Int64Rules_class_data_; -// ------------------------------------------------------------------- - -class Int32Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Int32Rules) */ { - public: - inline Int32Rules() : Int32Rules(nullptr) {} - ~Int32Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Int32Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Int32Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Int32Rules(::google::protobuf::internal::ConstantInitialized); - - inline Int32Rules(const Int32Rules& from) : Int32Rules(nullptr, from) {} - inline Int32Rules(Int32Rules&& from) noexcept - : Int32Rules(nullptr, ::std::move(from)) {} - inline Int32Rules& operator=(const Int32Rules& from) { - CopyFrom(from); - return *this; - } - inline Int32Rules& operator=(Int32Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Int32Rules& default_instance() { - return *reinterpret_cast( - &_Int32Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 8; - friend void swap(Int32Rules& a, Int32Rules& b) { a.Swap(&b); } - inline void Swap(Int32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Int32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Int32Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Int32Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Int32Rules& from) { Int32Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Int32Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Int32Rules"; } - - explicit Int32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Int32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Int32Rules& from); - Int32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Int32Rules&& from) noexcept - : Int32Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated int32 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int32_t in(int index) const; - void set_in(int index, ::int32_t value); - void add_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated int32 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int32_t not_in(int index) const; - void set_not_in(int index, ::int32_t value); - void add_not_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated int32 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int32_t example(int index) const; - void set_example(int index, ::int32_t value); - void add_example(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional int32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int32_t const_() const; - void set_const_(::int32_t value); - - private: - ::int32_t _internal_const_() const; - void _internal_set_const_(::int32_t value); - - public: - // int32 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::int32_t lt() const; - void set_lt(::int32_t value); - - private: - ::int32_t _internal_lt() const; - void _internal_set_lt(::int32_t value); - - public: - // int32 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::int32_t lte() const; - void set_lte(::int32_t value); - - private: - ::int32_t _internal_lte() const; - void _internal_set_lte(::int32_t value); - - public: - // int32 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::int32_t gt() const; - void set_gt(::int32_t value); - - private: - ::int32_t _internal_gt() const; - void _internal_set_gt(::int32_t value); - - public: - // int32 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::int32_t gte() const; - void set_gte(::int32_t value); - - private: - ::int32_t _internal_gte() const; - void _internal_set_gte(::int32_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Int32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.Int32Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Int32Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int32_t> in_; - ::google::protobuf::RepeatedField<::int32_t> not_in_; - ::google::protobuf::RepeatedField<::int32_t> example_; - ::int32_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t lt_; - ::int32_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::int32_t gt_; - ::int32_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Int32Rules_class_data_; -// ------------------------------------------------------------------- - -class FloatRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.FloatRules) */ { - public: - inline FloatRules() : FloatRules(nullptr) {} - ~FloatRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FloatRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(FloatRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR FloatRules(::google::protobuf::internal::ConstantInitialized); - - inline FloatRules(const FloatRules& from) : FloatRules(nullptr, from) {} - inline FloatRules(FloatRules&& from) noexcept - : FloatRules(nullptr, ::std::move(from)) {} - inline FloatRules& operator=(const FloatRules& from) { - CopyFrom(from); - return *this; - } - inline FloatRules& operator=(FloatRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FloatRules& default_instance() { - return *reinterpret_cast( - &_FloatRules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 6; - friend void swap(FloatRules& a, FloatRules& b) { a.Swap(&b); } - inline void Swap(FloatRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FloatRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FloatRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const FloatRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const FloatRules& from) { FloatRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(FloatRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.FloatRules"; } - - explicit FloatRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - FloatRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FloatRules& from); - FloatRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FloatRules&& from) noexcept - : FloatRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kConstFieldNumber = 1, - kFiniteFieldNumber = 8, - kExampleFieldNumber = 9, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated float in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - float in(int index) const; - void set_in(int index, float value); - void add_in(float value); - const ::google::protobuf::RepeatedField& in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField& _internal_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated float not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - float not_in(int index) const; - void set_not_in(int index, float value); - void add_not_in(float value); - const ::google::protobuf::RepeatedField& not_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField& _internal_not_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // optional float const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - float const_() const; - void set_const_(float value); - - private: - float _internal_const_() const; - void _internal_set_const_(float value); - - public: - // optional bool finite = 8 [(.buf.validate.predefined) = { - bool has_finite() const; - void clear_finite() ; - bool finite() const; - void set_finite(bool value); - - private: - bool _internal_finite() const; - void _internal_set_finite(bool value); - - public: - // repeated float example = 9 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - float example(int index) const; - void set_example(int index, float value); - void add_example(float value); - const ::google::protobuf::RepeatedField& example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField& _internal_example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // float lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - float lt() const; - void set_lt(float value); - - private: - float _internal_lt() const; - void _internal_set_lt(float value); - - public: - // float lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - float lte() const; - void set_lte(float value); - - private: - float _internal_lte() const; - void _internal_set_lte(float value); - - public: - // float gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - float gt() const; - void set_gt(float value); - - private: - float _internal_gt() const; - void _internal_set_gt(float value); - - public: - // float gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - float gte() const; - void set_gte(float value); - - private: - float _internal_gte() const; - void _internal_set_gte(float value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FloatRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FloatRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FloatRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.FloatRules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<4, 9, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const FloatRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField in_; - ::google::protobuf::RepeatedField not_in_; - float const__; - bool finite_; - ::google::protobuf::RepeatedField example_; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - float lt_; - float lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - float gt_; - float gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull FloatRules_class_data_; -// ------------------------------------------------------------------- - -class Fixed64Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Fixed64Rules) */ { - public: - inline Fixed64Rules() : Fixed64Rules(nullptr) {} - ~Fixed64Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Fixed64Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Fixed64Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Fixed64Rules(::google::protobuf::internal::ConstantInitialized); - - inline Fixed64Rules(const Fixed64Rules& from) : Fixed64Rules(nullptr, from) {} - inline Fixed64Rules(Fixed64Rules&& from) noexcept - : Fixed64Rules(nullptr, ::std::move(from)) {} - inline Fixed64Rules& operator=(const Fixed64Rules& from) { - CopyFrom(from); - return *this; - } - inline Fixed64Rules& operator=(Fixed64Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Fixed64Rules& default_instance() { - return *reinterpret_cast( - &_Fixed64Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 15; - friend void swap(Fixed64Rules& a, Fixed64Rules& b) { a.Swap(&b); } - inline void Swap(Fixed64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Fixed64Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Fixed64Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Fixed64Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Fixed64Rules& from) { Fixed64Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Fixed64Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Fixed64Rules"; } - - explicit Fixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Fixed64Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Fixed64Rules& from); - Fixed64Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Fixed64Rules&& from) noexcept - : Fixed64Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated fixed64 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::uint64_t in(int index) const; - void set_in(int index, ::uint64_t value); - void add_in(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::uint64_t not_in(int index) const; - void set_not_in(int index, ::uint64_t value); - void add_not_in(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& not_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated fixed64 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::uint64_t example(int index) const; - void set_example(int index, ::uint64_t value); - void add_example(::uint64_t value); - const ::google::protobuf::RepeatedField<::uint64_t>& example() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::uint64_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional fixed64 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::uint64_t const_() const; - void set_const_(::uint64_t value); - - private: - ::uint64_t _internal_const_() const; - void _internal_set_const_(::uint64_t value); - - public: - // fixed64 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::uint64_t lt() const; - void set_lt(::uint64_t value); - - private: - ::uint64_t _internal_lt() const; - void _internal_set_lt(::uint64_t value); - - public: - // fixed64 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::uint64_t lte() const; - void set_lte(::uint64_t value); - - private: - ::uint64_t _internal_lte() const; - void _internal_set_lte(::uint64_t value); - - public: - // fixed64 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::uint64_t gt() const; - void set_gt(::uint64_t value); - - private: - ::uint64_t _internal_gt() const; - void _internal_set_gt(::uint64_t value); - - public: - // fixed64 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::uint64_t gte() const; - void set_gte(::uint64_t value); - - private: - ::uint64_t _internal_gte() const; - void _internal_set_gte(::uint64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed64Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.Fixed64Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Fixed64Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::uint64_t> in_; - ::google::protobuf::RepeatedField<::uint64_t> not_in_; - ::google::protobuf::RepeatedField<::uint64_t> example_; - ::uint64_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint64_t lt_; - ::uint64_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint64_t gt_; - ::uint64_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Fixed64Rules_class_data_; -// ------------------------------------------------------------------- - -class Fixed32Rules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Fixed32Rules) */ { - public: - inline Fixed32Rules() : Fixed32Rules(nullptr) {} - ~Fixed32Rules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Fixed32Rules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Fixed32Rules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Fixed32Rules(::google::protobuf::internal::ConstantInitialized); - - inline Fixed32Rules(const Fixed32Rules& from) : Fixed32Rules(nullptr, from) {} - inline Fixed32Rules(Fixed32Rules&& from) noexcept - : Fixed32Rules(nullptr, ::std::move(from)) {} - inline Fixed32Rules& operator=(const Fixed32Rules& from) { - CopyFrom(from); - return *this; - } - inline Fixed32Rules& operator=(Fixed32Rules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Fixed32Rules& default_instance() { - return *reinterpret_cast( - &_Fixed32Rules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 14; - friend void swap(Fixed32Rules& a, Fixed32Rules& b) { a.Swap(&b); } - inline void Swap(Fixed32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Fixed32Rules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Fixed32Rules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Fixed32Rules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Fixed32Rules& from) { Fixed32Rules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Fixed32Rules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Fixed32Rules"; } - - explicit Fixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Fixed32Rules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Fixed32Rules& from); - Fixed32Rules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Fixed32Rules&& from) noexcept - : Fixed32Rules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kExampleFieldNumber = 8, - kConstFieldNumber = 1, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated fixed32 in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::uint32_t in(int index) const; - void set_in(int index, ::uint32_t value); - void add_in(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::uint32_t not_in(int index) const; - void set_not_in(int index, ::uint32_t value); - void add_not_in(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& not_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated fixed32 example = 8 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::uint32_t example(int index) const; - void set_example(int index, ::uint32_t value); - void add_example(::uint32_t value); - const ::google::protobuf::RepeatedField<::uint32_t>& example() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::uint32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional fixed32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::uint32_t const_() const; - void set_const_(::uint32_t value); - - private: - ::uint32_t _internal_const_() const; - void _internal_set_const_(::uint32_t value); - - public: - // fixed32 lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - ::uint32_t lt() const; - void set_lt(::uint32_t value); - - private: - ::uint32_t _internal_lt() const; - void _internal_set_lt(::uint32_t value); - - public: - // fixed32 lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - ::uint32_t lte() const; - void set_lte(::uint32_t value); - - private: - ::uint32_t _internal_lte() const; - void _internal_set_lte(::uint32_t value); - - public: - // fixed32 gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - ::uint32_t gt() const; - void set_gt(::uint32_t value); - - private: - ::uint32_t _internal_gt() const; - void _internal_set_gt(::uint32_t value); - - public: - // fixed32 gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - ::uint32_t gte() const; - void set_gte(::uint32_t value); - - private: - ::uint32_t _internal_gte() const; - void _internal_set_gte(::uint32_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - Fixed32Rules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.Fixed32Rules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Fixed32Rules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::uint32_t> in_; - ::google::protobuf::RepeatedField<::uint32_t> not_in_; - ::google::protobuf::RepeatedField<::uint32_t> example_; - ::uint32_t const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint32_t lt_; - ::uint32_t lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint32_t gt_; - ::uint32_t gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Fixed32Rules_class_data_; -// ------------------------------------------------------------------- - -class FieldPathElement final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.FieldPathElement) */ { - public: - inline FieldPathElement() : FieldPathElement(nullptr) {} - ~FieldPathElement() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldPathElement* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldPathElement)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR FieldPathElement(::google::protobuf::internal::ConstantInitialized); - - inline FieldPathElement(const FieldPathElement& from) : FieldPathElement(nullptr, from) {} - inline FieldPathElement(FieldPathElement&& from) noexcept - : FieldPathElement(nullptr, ::std::move(from)) {} - inline FieldPathElement& operator=(const FieldPathElement& from) { - CopyFrom(from); - return *this; - } - inline FieldPathElement& operator=(FieldPathElement&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FieldPathElement& default_instance() { - return *reinterpret_cast( - &_FieldPathElement_default_instance_); - } - enum SubscriptCase { - kIndex = 6, - kBoolKey = 7, - kIntKey = 8, - kUintKey = 9, - kStringKey = 10, - SUBSCRIPT_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 31; - friend void swap(FieldPathElement& a, FieldPathElement& b) { a.Swap(&b); } - inline void Swap(FieldPathElement* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FieldPathElement* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FieldPathElement* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const FieldPathElement& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const FieldPathElement& from) { FieldPathElement::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(FieldPathElement* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.FieldPathElement"; } - - explicit FieldPathElement(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - FieldPathElement(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldPathElement& from); - FieldPathElement( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldPathElement&& from) noexcept - : FieldPathElement(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kFieldNameFieldNumber = 2, - kFieldNumberFieldNumber = 1, - kValueTypeFieldNumber = 5, - kFieldTypeFieldNumber = 3, - kKeyTypeFieldNumber = 4, - kIndexFieldNumber = 6, - kBoolKeyFieldNumber = 7, - kIntKeyFieldNumber = 8, - kUintKeyFieldNumber = 9, - kStringKeyFieldNumber = 10, - }; - // optional string field_name = 2; - bool has_field_name() const; - void clear_field_name() ; - const ::std::string& field_name() const; - template - void set_field_name(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_field_name(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_field_name(); - void set_allocated_field_name(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_field_name() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_field_name(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_field_name(); - - public: - // optional int32 field_number = 1; - bool has_field_number() const; - void clear_field_number() ; - ::int32_t field_number() const; - void set_field_number(::int32_t value); - - private: - ::int32_t _internal_field_number() const; - void _internal_set_field_number(::int32_t value); - - public: - // optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; - bool has_value_type() const; - void clear_value_type() ; - ::google::protobuf::FieldDescriptorProto_Type value_type() const; - void set_value_type(::google::protobuf::FieldDescriptorProto_Type value); - - private: - ::google::protobuf::FieldDescriptorProto_Type _internal_value_type() const; - void _internal_set_value_type(::google::protobuf::FieldDescriptorProto_Type value); - - public: - // optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; - bool has_field_type() const; - void clear_field_type() ; - ::google::protobuf::FieldDescriptorProto_Type field_type() const; - void set_field_type(::google::protobuf::FieldDescriptorProto_Type value); - - private: - ::google::protobuf::FieldDescriptorProto_Type _internal_field_type() const; - void _internal_set_field_type(::google::protobuf::FieldDescriptorProto_Type value); - - public: - // optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; - bool has_key_type() const; - void clear_key_type() ; - ::google::protobuf::FieldDescriptorProto_Type key_type() const; - void set_key_type(::google::protobuf::FieldDescriptorProto_Type value); - - private: - ::google::protobuf::FieldDescriptorProto_Type _internal_key_type() const; - void _internal_set_key_type(::google::protobuf::FieldDescriptorProto_Type value); - - public: - // uint64 index = 6; - bool has_index() const; - void clear_index() ; - ::uint64_t index() const; - void set_index(::uint64_t value); - - private: - ::uint64_t _internal_index() const; - void _internal_set_index(::uint64_t value); - - public: - // bool bool_key = 7; - bool has_bool_key() const; - void clear_bool_key() ; - bool bool_key() const; - void set_bool_key(bool value); - - private: - bool _internal_bool_key() const; - void _internal_set_bool_key(bool value); - - public: - // int64 int_key = 8; - bool has_int_key() const; - void clear_int_key() ; - ::int64_t int_key() const; - void set_int_key(::int64_t value); - - private: - ::int64_t _internal_int_key() const; - void _internal_set_int_key(::int64_t value); - - public: - // uint64 uint_key = 9; - bool has_uint_key() const; - void clear_uint_key() ; - ::uint64_t uint_key() const; - void set_uint_key(::uint64_t value); - - private: - ::uint64_t _internal_uint_key() const; - void _internal_set_uint_key(::uint64_t value); - - public: - // string string_key = 10; - bool has_string_key() const; - void clear_string_key() ; - const ::std::string& string_key() const; - template - void set_string_key(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_string_key(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_string_key(); - void set_allocated_string_key(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_string_key() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_string_key(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_string_key(); - - public: - void clear_subscript(); - SubscriptCase subscript_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.FieldPathElement) - private: - class _Internal; - void set_has_index(); - void set_has_bool_key(); - void set_has_int_key(); - void set_has_uint_key(); - void set_has_string_key(); - inline bool has_subscript() const; - inline void clear_has_subscript(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 10, - 3, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const FieldPathElement& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::internal::ArenaStringPtr field_name_; - ::int32_t field_number_; - int value_type_; - int field_type_; - int key_type_; - union SubscriptUnion { - constexpr SubscriptUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::uint64_t index_; - bool bool_key_; - ::int64_t int_key_; - ::uint64_t uint_key_; - ::google::protobuf::internal::ArenaStringPtr string_key_; - } subscript_; - ::uint32_t _oneof_case_[1]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull FieldPathElement_class_data_; -// ------------------------------------------------------------------- - -class EnumRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.EnumRules) */ { - public: - inline EnumRules() : EnumRules(nullptr) {} - ~EnumRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(EnumRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(EnumRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR EnumRules(::google::protobuf::internal::ConstantInitialized); - - inline EnumRules(const EnumRules& from) : EnumRules(nullptr, from) {} - inline EnumRules(EnumRules&& from) noexcept - : EnumRules(nullptr, ::std::move(from)) {} - inline EnumRules& operator=(const EnumRules& from) { - CopyFrom(from); - return *this; - } - inline EnumRules& operator=(EnumRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const EnumRules& default_instance() { - return *reinterpret_cast( - &_EnumRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 21; - friend void swap(EnumRules& a, EnumRules& b) { a.Swap(&b); } - inline void Swap(EnumRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(EnumRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - EnumRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const EnumRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const EnumRules& from) { EnumRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(EnumRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.EnumRules"; } - - explicit EnumRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - EnumRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EnumRules& from); - EnumRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EnumRules&& from) noexcept - : EnumRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 3, - kNotInFieldNumber = 4, - kExampleFieldNumber = 5, - kConstFieldNumber = 1, - kDefinedOnlyFieldNumber = 2, - }; - // repeated int32 in = 3 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::int32_t in(int index) const; - void set_in(int index, ::int32_t value); - void add_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated int32 not_in = 4 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::int32_t not_in(int index) const; - void set_not_in(int index, ::int32_t value); - void add_not_in(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_not_in() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated int32 example = 5 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::int32_t example(int index) const; - void set_example(int index, ::int32_t value); - void add_example(::int32_t value); - const ::google::protobuf::RepeatedField<::int32_t>& example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField<::int32_t>& _internal_example() const; - ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional int32 const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - ::int32_t const_() const; - void set_const_(::int32_t value); - - private: - ::int32_t _internal_const_() const; - void _internal_set_const_(::int32_t value); - - public: - // optional bool defined_only = 2; - bool has_defined_only() const; - void clear_defined_only() ; - bool defined_only() const; - void set_defined_only(bool value); - - private: - bool _internal_defined_only() const; - void _internal_set_defined_only(bool value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - EnumRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - EnumRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - EnumRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - // @@protoc_insertion_point(class_scope:buf.validate.EnumRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 5, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const EnumRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField<::int32_t> in_; - ::google::protobuf::RepeatedField<::int32_t> not_in_; - ::google::protobuf::RepeatedField<::int32_t> example_; - ::int32_t const__; - bool defined_only_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull EnumRules_class_data_; -// ------------------------------------------------------------------- - -class DoubleRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.DoubleRules) */ { - public: - inline DoubleRules() : DoubleRules(nullptr) {} - ~DoubleRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DoubleRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(DoubleRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR DoubleRules(::google::protobuf::internal::ConstantInitialized); - - inline DoubleRules(const DoubleRules& from) : DoubleRules(nullptr, from) {} - inline DoubleRules(DoubleRules&& from) noexcept - : DoubleRules(nullptr, ::std::move(from)) {} - inline DoubleRules& operator=(const DoubleRules& from) { - CopyFrom(from); - return *this; - } - inline DoubleRules& operator=(DoubleRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const DoubleRules& default_instance() { - return *reinterpret_cast( - &_DoubleRules_default_instance_); - } - enum LessThanCase { - kLt = 2, - kLte = 3, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 4, - kGte = 5, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 7; - friend void swap(DoubleRules& a, DoubleRules& b) { a.Swap(&b); } - inline void Swap(DoubleRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(DoubleRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - DoubleRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const DoubleRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const DoubleRules& from) { DoubleRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(DoubleRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.DoubleRules"; } - - explicit DoubleRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - DoubleRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DoubleRules& from); - DoubleRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DoubleRules&& from) noexcept - : DoubleRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 6, - kNotInFieldNumber = 7, - kConstFieldNumber = 1, - kFiniteFieldNumber = 8, - kExampleFieldNumber = 9, - kLtFieldNumber = 2, - kLteFieldNumber = 3, - kGtFieldNumber = 4, - kGteFieldNumber = 5, - }; - // repeated double in = 6 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - double in(int index) const; - void set_in(int index, double value); - void add_in(double value); - const ::google::protobuf::RepeatedField& in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedField& _internal_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated double not_in = 7 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - double not_in(int index) const; - void set_not_in(int index, double value); - void add_not_in(double value); - const ::google::protobuf::RepeatedField& not_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedField& _internal_not_in() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // optional double const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - double const_() const; - void set_const_(double value); - - private: - double _internal_const_() const; - void _internal_set_const_(double value); - - public: - // optional bool finite = 8 [(.buf.validate.predefined) = { - bool has_finite() const; - void clear_finite() ; - bool finite() const; - void set_finite(bool value); - - private: - bool _internal_finite() const; - void _internal_set_finite(bool value); - - public: - // repeated double example = 9 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - double example(int index) const; - void set_example(int index, double value); - void add_example(double value); - const ::google::protobuf::RepeatedField& example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField& _internal_example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // double lt = 2 [(.buf.validate.predefined) = { - bool has_lt() const; - void clear_lt() ; - double lt() const; - void set_lt(double value); - - private: - double _internal_lt() const; - void _internal_set_lt(double value); - - public: - // double lte = 3 [(.buf.validate.predefined) = { - bool has_lte() const; - void clear_lte() ; - double lte() const; - void set_lte(double value); - - private: - double _internal_lte() const; - void _internal_set_lte(double value); - - public: - // double gt = 4 [(.buf.validate.predefined) = { - bool has_gt() const; - void clear_gt() ; - double gt() const; - void set_gt(double value); - - private: - double _internal_gt() const; - void _internal_set_gt(double value); - - public: - // double gte = 5 [(.buf.validate.predefined) = { - bool has_gte() const; - void clear_gte() ; - double gte() const; - void set_gte(double value); - - private: - double _internal_gte() const; - void _internal_set_gte(double value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DoubleRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DoubleRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DoubleRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.DoubleRules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<4, 9, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const DoubleRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField in_; - ::google::protobuf::RepeatedField not_in_; - double const__; - bool finite_; - ::google::protobuf::RepeatedField example_; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - double lt_; - double lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - double gt_; - double gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull DoubleRules_class_data_; -// ------------------------------------------------------------------- - -class BytesRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.BytesRules) */ { - public: - inline BytesRules() : BytesRules(nullptr) {} - ~BytesRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(BytesRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(BytesRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR BytesRules(::google::protobuf::internal::ConstantInitialized); - - inline BytesRules(const BytesRules& from) : BytesRules(nullptr, from) {} - inline BytesRules(BytesRules&& from) noexcept - : BytesRules(nullptr, ::std::move(from)) {} - inline BytesRules& operator=(const BytesRules& from) { - CopyFrom(from); - return *this; - } - inline BytesRules& operator=(BytesRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const BytesRules& default_instance() { - return *reinterpret_cast( - &_BytesRules_default_instance_); - } - enum WellKnownCase { - kIp = 10, - kIpv4 = 11, - kIpv6 = 12, - kUuid = 15, - WELL_KNOWN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 20; - friend void swap(BytesRules& a, BytesRules& b) { a.Swap(&b); } - inline void Swap(BytesRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(BytesRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - BytesRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const BytesRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const BytesRules& from) { BytesRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(BytesRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.BytesRules"; } - - explicit BytesRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - BytesRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BytesRules& from); - BytesRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, BytesRules&& from) noexcept - : BytesRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 8, - kNotInFieldNumber = 9, - kExampleFieldNumber = 14, - kConstFieldNumber = 1, - kPatternFieldNumber = 4, - kPrefixFieldNumber = 5, - kSuffixFieldNumber = 6, - kContainsFieldNumber = 7, - kMinLenFieldNumber = 2, - kMaxLenFieldNumber = 3, - kLenFieldNumber = 13, - kIpFieldNumber = 10, - kIpv4FieldNumber = 11, - kIpv6FieldNumber = 12, - kUuidFieldNumber = 15, - }; - // repeated bytes in = 8 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - const ::std::string& in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_in(int index); - template - void set_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_in(); - template - void add_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated bytes not_in = 9 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - const ::std::string& not_in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_not_in(int index); - template - void set_not_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_not_in(); - template - void add_not_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated bytes example = 14 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - const ::std::string& example(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_example(int index); - template - void set_example(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_example(); - template - void add_example(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& example() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_example() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional bytes const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - const ::std::string& const_() const; - template - void set_const_(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_const_(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_const_(); - void set_allocated_const_(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_const_() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_const_(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_const_(); - - public: - // optional string pattern = 4 [(.buf.validate.predefined) = { - bool has_pattern() const; - void clear_pattern() ; - const ::std::string& pattern() const; - template - void set_pattern(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_pattern(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_pattern(); - void set_allocated_pattern(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_pattern() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_pattern(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_pattern(); - - public: - // optional bytes prefix = 5 [(.buf.validate.predefined) = { - bool has_prefix() const; - void clear_prefix() ; - const ::std::string& prefix() const; - template - void set_prefix(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_prefix(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_prefix(); - void set_allocated_prefix(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_prefix() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_prefix(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_prefix(); - - public: - // optional bytes suffix = 6 [(.buf.validate.predefined) = { - bool has_suffix() const; - void clear_suffix() ; - const ::std::string& suffix() const; - template - void set_suffix(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_suffix(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_suffix(); - void set_allocated_suffix(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_suffix() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_suffix(); - - public: - // optional bytes contains = 7 [(.buf.validate.predefined) = { - bool has_contains() const; - void clear_contains() ; - const ::std::string& contains() const; - template - void set_contains(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_contains(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_contains(); - void set_allocated_contains(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_contains() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_contains(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_contains(); - - public: - // optional uint64 min_len = 2 [(.buf.validate.predefined) = { - bool has_min_len() const; - void clear_min_len() ; - ::uint64_t min_len() const; - void set_min_len(::uint64_t value); - - private: - ::uint64_t _internal_min_len() const; - void _internal_set_min_len(::uint64_t value); - - public: - // optional uint64 max_len = 3 [(.buf.validate.predefined) = { - bool has_max_len() const; - void clear_max_len() ; - ::uint64_t max_len() const; - void set_max_len(::uint64_t value); - - private: - ::uint64_t _internal_max_len() const; - void _internal_set_max_len(::uint64_t value); - - public: - // optional uint64 len = 13 [(.buf.validate.predefined) = { - bool has_len() const; - void clear_len() ; - ::uint64_t len() const; - void set_len(::uint64_t value); - - private: - ::uint64_t _internal_len() const; - void _internal_set_len(::uint64_t value); - - public: - // bool ip = 10 [(.buf.validate.predefined) = { - bool has_ip() const; - void clear_ip() ; - bool ip() const; - void set_ip(bool value); - - private: - bool _internal_ip() const; - void _internal_set_ip(bool value); - - public: - // bool ipv4 = 11 [(.buf.validate.predefined) = { - bool has_ipv4() const; - void clear_ipv4() ; - bool ipv4() const; - void set_ipv4(bool value); - - private: - bool _internal_ipv4() const; - void _internal_set_ipv4(bool value); - - public: - // bool ipv6 = 12 [(.buf.validate.predefined) = { - bool has_ipv6() const; - void clear_ipv6() ; - bool ipv6() const; - void set_ipv6(bool value); - - private: - bool _internal_ipv6() const; - void _internal_set_ipv6(bool value); - - public: - // bool uuid = 15 [(.buf.validate.predefined) = { - bool has_uuid() const; - void clear_uuid() ; - bool uuid() const; - void set_uuid(bool value); - - private: - bool _internal_uuid() const; - void _internal_set_uuid(bool value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BytesRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BytesRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BytesRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_well_known(); - WellKnownCase well_known_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.BytesRules) - private: - class _Internal; - void set_has_ip(); - void set_has_ipv4(); - void set_has_ipv6(); - void set_has_uuid(); - inline bool has_well_known() const; - inline void clear_has_well_known(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<4, 15, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const BytesRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> in_; - ::google::protobuf::RepeatedPtrField<::std::string> not_in_; - ::google::protobuf::RepeatedPtrField<::std::string> example_; - ::google::protobuf::internal::ArenaStringPtr const__; - ::google::protobuf::internal::ArenaStringPtr pattern_; - ::google::protobuf::internal::ArenaStringPtr prefix_; - ::google::protobuf::internal::ArenaStringPtr suffix_; - ::google::protobuf::internal::ArenaStringPtr contains_; - ::uint64_t min_len_; - ::uint64_t max_len_; - ::uint64_t len_; - union WellKnownUnion { - constexpr WellKnownUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - bool ip_; - bool ipv4_; - bool ipv6_; - bool uuid_; - } well_known_; - ::uint32_t _oneof_case_[1]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull BytesRules_class_data_; -// ------------------------------------------------------------------- - -class BoolRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.BoolRules) */ { - public: - inline BoolRules() : BoolRules(nullptr) {} - ~BoolRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(BoolRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(BoolRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR BoolRules(::google::protobuf::internal::ConstantInitialized); - - inline BoolRules(const BoolRules& from) : BoolRules(nullptr, from) {} - inline BoolRules(BoolRules&& from) noexcept - : BoolRules(nullptr, ::std::move(from)) {} - inline BoolRules& operator=(const BoolRules& from) { - CopyFrom(from); - return *this; - } - inline BoolRules& operator=(BoolRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const BoolRules& default_instance() { - return *reinterpret_cast( - &_BoolRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 18; - friend void swap(BoolRules& a, BoolRules& b) { a.Swap(&b); } - inline void Swap(BoolRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(BoolRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - BoolRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const BoolRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const BoolRules& from) { BoolRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(BoolRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.BoolRules"; } - - explicit BoolRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - BoolRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const BoolRules& from); - BoolRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, BoolRules&& from) noexcept - : BoolRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kExampleFieldNumber = 2, - kConstFieldNumber = 1, - }; - // repeated bool example = 2 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - bool example(int index) const; - void set_example(int index, bool value); - void add_example(bool value); - const ::google::protobuf::RepeatedField& example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedField& _internal_example() const; - ::google::protobuf::RepeatedField* PROTOBUF_NONNULL _internal_mutable_example(); - - public: - // optional bool const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - bool const_() const; - void set_const_(bool value); - - private: - bool _internal_const_() const; - void _internal_set_const_(bool value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BoolRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BoolRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - BoolRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - // @@protoc_insertion_point(class_scope:buf.validate.BoolRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<1, 2, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const BoolRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedField example_; - bool const__; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull BoolRules_class_data_; -// ------------------------------------------------------------------- - -class AnyRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.AnyRules) */ { - public: - inline AnyRules() : AnyRules(nullptr) {} - ~AnyRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(AnyRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(AnyRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR AnyRules(::google::protobuf::internal::ConstantInitialized); - - inline AnyRules(const AnyRules& from) : AnyRules(nullptr, from) {} - inline AnyRules(AnyRules&& from) noexcept - : AnyRules(nullptr, ::std::move(from)) {} - inline AnyRules& operator=(const AnyRules& from) { - CopyFrom(from); - return *this; - } - inline AnyRules& operator=(AnyRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AnyRules& default_instance() { - return *reinterpret_cast( - &_AnyRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 24; - friend void swap(AnyRules& a, AnyRules& b) { a.Swap(&b); } - inline void Swap(AnyRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AnyRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AnyRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const AnyRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const AnyRules& from) { AnyRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(AnyRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.AnyRules"; } - - explicit AnyRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - AnyRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const AnyRules& from); - AnyRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, AnyRules&& from) noexcept - : AnyRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 2, - kNotInFieldNumber = 3, - }; - // repeated string in = 2; - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - const ::std::string& in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_in(int index); - template - void set_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_in(); - template - void add_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated string not_in = 3; - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - const ::std::string& not_in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_not_in(int index); - template - void set_not_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_not_in(); - template - void add_not_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.AnyRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<1, 2, - 0, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const AnyRules& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> in_; - ::google::protobuf::RepeatedPtrField<::std::string> not_in_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull AnyRules_class_data_; -// ------------------------------------------------------------------- - -class TimestampRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.TimestampRules) */ { - public: - inline TimestampRules() : TimestampRules(nullptr) {} - ~TimestampRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(TimestampRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(TimestampRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR TimestampRules(::google::protobuf::internal::ConstantInitialized); - - inline TimestampRules(const TimestampRules& from) : TimestampRules(nullptr, from) {} - inline TimestampRules(TimestampRules&& from) noexcept - : TimestampRules(nullptr, ::std::move(from)) {} - inline TimestampRules& operator=(const TimestampRules& from) { - CopyFrom(from); - return *this; - } - inline TimestampRules& operator=(TimestampRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const TimestampRules& default_instance() { - return *reinterpret_cast( - &_TimestampRules_default_instance_); - } - enum LessThanCase { - kLt = 3, - kLte = 4, - kLtNow = 7, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 5, - kGte = 6, - kGtNow = 8, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 27; - friend void swap(TimestampRules& a, TimestampRules& b) { a.Swap(&b); } - inline void Swap(TimestampRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(TimestampRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - TimestampRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const TimestampRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const TimestampRules& from) { TimestampRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(TimestampRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.TimestampRules"; } - - explicit TimestampRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - TimestampRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const TimestampRules& from); - TimestampRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, TimestampRules&& from) noexcept - : TimestampRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kConstFieldNumber = 2, - kWithinFieldNumber = 9, - kExampleFieldNumber = 10, - kLtFieldNumber = 3, - kLteFieldNumber = 4, - kLtNowFieldNumber = 7, - kGtFieldNumber = 5, - kGteFieldNumber = 6, - kGtNowFieldNumber = 8, - }; - // optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - const ::google::protobuf::Timestamp& const_() const; - [[nodiscard]] ::google::protobuf::Timestamp* PROTOBUF_NULLABLE release_const_(); - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_const_(); - void set_allocated_const_(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_const_(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE unsafe_arena_release_const_(); - - private: - const ::google::protobuf::Timestamp& _internal_const_() const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL _internal_mutable_const_(); - - public: - // optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { - bool has_within() const; - void clear_within() ; - const ::google::protobuf::Duration& within() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_within(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_within(); - void set_allocated_within(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_within(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_within(); - - private: - const ::google::protobuf::Duration& _internal_within() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_within(); - - public: - // repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_example(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>& _internal_example() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>* PROTOBUF_NONNULL _internal_mutable_example(); - public: - const ::google::protobuf::Timestamp& example(int index) const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL add_example(); - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>& example() const; - // .google.protobuf.Timestamp lt = 3 [(.buf.validate.predefined) = { - bool has_lt() const; - private: - bool _internal_has_lt() const; - - public: - void clear_lt() ; - const ::google::protobuf::Timestamp& lt() const; - [[nodiscard]] ::google::protobuf::Timestamp* PROTOBUF_NULLABLE release_lt(); - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_lt(); - void set_allocated_lt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_lt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE unsafe_arena_release_lt(); - - private: - const ::google::protobuf::Timestamp& _internal_lt() const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL _internal_mutable_lt(); - - public: - // .google.protobuf.Timestamp lte = 4 [(.buf.validate.predefined) = { - bool has_lte() const; - private: - bool _internal_has_lte() const; - - public: - void clear_lte() ; - const ::google::protobuf::Timestamp& lte() const; - [[nodiscard]] ::google::protobuf::Timestamp* PROTOBUF_NULLABLE release_lte(); - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_lte(); - void set_allocated_lte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_lte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE unsafe_arena_release_lte(); - - private: - const ::google::protobuf::Timestamp& _internal_lte() const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL _internal_mutable_lte(); - - public: - // bool lt_now = 7 [(.buf.validate.predefined) = { - bool has_lt_now() const; - void clear_lt_now() ; - bool lt_now() const; - void set_lt_now(bool value); - - private: - bool _internal_lt_now() const; - void _internal_set_lt_now(bool value); - - public: - // .google.protobuf.Timestamp gt = 5 [(.buf.validate.predefined) = { - bool has_gt() const; - private: - bool _internal_has_gt() const; - - public: - void clear_gt() ; - const ::google::protobuf::Timestamp& gt() const; - [[nodiscard]] ::google::protobuf::Timestamp* PROTOBUF_NULLABLE release_gt(); - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_gt(); - void set_allocated_gt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_gt(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE unsafe_arena_release_gt(); - - private: - const ::google::protobuf::Timestamp& _internal_gt() const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL _internal_mutable_gt(); - - public: - // .google.protobuf.Timestamp gte = 6 [(.buf.validate.predefined) = { - bool has_gte() const; - private: - bool _internal_has_gte() const; - - public: - void clear_gte() ; - const ::google::protobuf::Timestamp& gte() const; - [[nodiscard]] ::google::protobuf::Timestamp* PROTOBUF_NULLABLE release_gte(); - ::google::protobuf::Timestamp* PROTOBUF_NONNULL mutable_gte(); - void set_allocated_gte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_gte(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value); - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE unsafe_arena_release_gte(); - - private: - const ::google::protobuf::Timestamp& _internal_gte() const; - ::google::protobuf::Timestamp* PROTOBUF_NONNULL _internal_mutable_gte(); - - public: - // bool gt_now = 8 [(.buf.validate.predefined) = { - bool has_gt_now() const; - void clear_gt_now() ; - bool gt_now() const; - void set_gt_now(bool value); - - private: - bool _internal_gt_now() const; - void _internal_set_gt_now(bool value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - TimestampRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - TimestampRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - TimestampRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.TimestampRules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_lt_now(); - void set_has_gt(); - void set_has_gte(); - void set_has_gt_now(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<4, 9, - 7, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const TimestampRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE const__; - ::google::protobuf::Duration* PROTOBUF_NULLABLE within_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::Timestamp > example_; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE lt_; - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE lte_; - bool lt_now_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE gt_; - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE gte_; - bool gt_now_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull TimestampRules_class_data_; -// ------------------------------------------------------------------- - -class PredefinedRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.PredefinedRules) */ { - public: - inline PredefinedRules() : PredefinedRules(nullptr) {} - ~PredefinedRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(PredefinedRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(PredefinedRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR PredefinedRules(::google::protobuf::internal::ConstantInitialized); - - inline PredefinedRules(const PredefinedRules& from) : PredefinedRules(nullptr, from) {} - inline PredefinedRules(PredefinedRules&& from) noexcept - : PredefinedRules(nullptr, ::std::move(from)) {} - inline PredefinedRules& operator=(const PredefinedRules& from) { - CopyFrom(from); - return *this; - } - inline PredefinedRules& operator=(PredefinedRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const PredefinedRules& default_instance() { - return *reinterpret_cast( - &_PredefinedRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 5; - friend void swap(PredefinedRules& a, PredefinedRules& b) { a.Swap(&b); } - inline void Swap(PredefinedRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(PredefinedRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - PredefinedRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const PredefinedRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const PredefinedRules& from) { PredefinedRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(PredefinedRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.PredefinedRules"; } - - explicit PredefinedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - PredefinedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const PredefinedRules& from); - PredefinedRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, PredefinedRules&& from) noexcept - : PredefinedRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kCelFieldNumber = 1, - }; - // repeated .buf.validate.Rule cel = 1; - int cel_size() const; - private: - int _internal_cel_size() const; - - public: - void clear_cel() ; - ::buf::validate::Rule* PROTOBUF_NONNULL mutable_cel(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL mutable_cel(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& _internal_cel() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL _internal_mutable_cel(); - public: - const ::buf::validate::Rule& cel(int index) const; - ::buf::validate::Rule* PROTOBUF_NONNULL add_cel(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& cel() const; - // @@protoc_insertion_point(class_scope:buf.validate.PredefinedRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<0, 1, - 1, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const PredefinedRules& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::Rule > cel_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull PredefinedRules_class_data_; -// ------------------------------------------------------------------- - -class MessageRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.MessageRules) */ { - public: - inline MessageRules() : MessageRules(nullptr) {} - ~MessageRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MessageRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(MessageRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR MessageRules(::google::protobuf::internal::ConstantInitialized); - - inline MessageRules(const MessageRules& from) : MessageRules(nullptr, from) {} - inline MessageRules(MessageRules&& from) noexcept - : MessageRules(nullptr, ::std::move(from)) {} - inline MessageRules& operator=(const MessageRules& from) { - CopyFrom(from); - return *this; - } - inline MessageRules& operator=(MessageRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const MessageRules& default_instance() { - return *reinterpret_cast( - &_MessageRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 1; - friend void swap(MessageRules& a, MessageRules& b) { a.Swap(&b); } - inline void Swap(MessageRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(MessageRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - MessageRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const MessageRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const MessageRules& from) { MessageRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(MessageRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.MessageRules"; } - - explicit MessageRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - MessageRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MessageRules& from); - MessageRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MessageRules&& from) noexcept - : MessageRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kCelFieldNumber = 3, - kOneofFieldNumber = 4, - kCelExpressionFieldNumber = 5, - }; - // repeated .buf.validate.Rule cel = 3; - int cel_size() const; - private: - int _internal_cel_size() const; - - public: - void clear_cel() ; - ::buf::validate::Rule* PROTOBUF_NONNULL mutable_cel(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL mutable_cel(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& _internal_cel() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL _internal_mutable_cel(); - public: - const ::buf::validate::Rule& cel(int index) const; - ::buf::validate::Rule* PROTOBUF_NONNULL add_cel(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& cel() const; - // repeated .buf.validate.MessageOneofRule oneof = 4; - int oneof_size() const; - private: - int _internal_oneof_size() const; - - public: - void clear_oneof() ; - ::buf::validate::MessageOneofRule* PROTOBUF_NONNULL mutable_oneof(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>* PROTOBUF_NONNULL mutable_oneof(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>& _internal_oneof() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>* PROTOBUF_NONNULL _internal_mutable_oneof(); - public: - const ::buf::validate::MessageOneofRule& oneof(int index) const; - ::buf::validate::MessageOneofRule* PROTOBUF_NONNULL add_oneof(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>& oneof() const; - // repeated string cel_expression = 5; - int cel_expression_size() const; - private: - int _internal_cel_expression_size() const; - - public: - void clear_cel_expression() ; - const ::std::string& cel_expression(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_cel_expression(int index); - template - void set_cel_expression(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_cel_expression(); - template - void add_cel_expression(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& cel_expression() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_cel_expression(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_cel_expression() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_cel_expression(); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.MessageRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 3, - 2, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const MessageRules& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::Rule > cel_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::MessageOneofRule > oneof_; - ::google::protobuf::RepeatedPtrField<::std::string> cel_expression_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull MessageRules_class_data_; -// ------------------------------------------------------------------- - -class FieldPath final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.FieldPath) */ { - public: - inline FieldPath() : FieldPath(nullptr) {} - ~FieldPath() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldPath* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldPath)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR FieldPath(::google::protobuf::internal::ConstantInitialized); - - inline FieldPath(const FieldPath& from) : FieldPath(nullptr, from) {} - inline FieldPath(FieldPath&& from) noexcept - : FieldPath(nullptr, ::std::move(from)) {} - inline FieldPath& operator=(const FieldPath& from) { - CopyFrom(from); - return *this; - } - inline FieldPath& operator=(FieldPath&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FieldPath& default_instance() { - return *reinterpret_cast( - &_FieldPath_default_instance_); - } - static constexpr int kIndexInFileMessages = 30; - friend void swap(FieldPath& a, FieldPath& b) { a.Swap(&b); } - inline void Swap(FieldPath* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FieldPath* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FieldPath* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const FieldPath& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const FieldPath& from) { FieldPath::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(FieldPath* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.FieldPath"; } - - explicit FieldPath(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - FieldPath(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldPath& from); - FieldPath( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldPath&& from) noexcept - : FieldPath(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kElementsFieldNumber = 1, - }; - // repeated .buf.validate.FieldPathElement elements = 1; - int elements_size() const; - private: - int _internal_elements_size() const; - - public: - void clear_elements() ; - ::buf::validate::FieldPathElement* PROTOBUF_NONNULL mutable_elements(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>* PROTOBUF_NONNULL mutable_elements(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>& _internal_elements() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>* PROTOBUF_NONNULL _internal_mutable_elements(); - public: - const ::buf::validate::FieldPathElement& elements(int index) const; - ::buf::validate::FieldPathElement* PROTOBUF_NONNULL add_elements(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>& elements() const; - // @@protoc_insertion_point(class_scope:buf.validate.FieldPath) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<0, 1, - 1, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const FieldPath& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::FieldPathElement > elements_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull FieldPath_class_data_; -// ------------------------------------------------------------------- - -class FieldMaskRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.FieldMaskRules) */ { - public: - inline FieldMaskRules() : FieldMaskRules(nullptr) {} - ~FieldMaskRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldMaskRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldMaskRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR FieldMaskRules(::google::protobuf::internal::ConstantInitialized); - - inline FieldMaskRules(const FieldMaskRules& from) : FieldMaskRules(nullptr, from) {} - inline FieldMaskRules(FieldMaskRules&& from) noexcept - : FieldMaskRules(nullptr, ::std::move(from)) {} - inline FieldMaskRules& operator=(const FieldMaskRules& from) { - CopyFrom(from); - return *this; - } - inline FieldMaskRules& operator=(FieldMaskRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FieldMaskRules& default_instance() { - return *reinterpret_cast( - &_FieldMaskRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 26; - friend void swap(FieldMaskRules& a, FieldMaskRules& b) { a.Swap(&b); } - inline void Swap(FieldMaskRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FieldMaskRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FieldMaskRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const FieldMaskRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const FieldMaskRules& from) { FieldMaskRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(FieldMaskRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.FieldMaskRules"; } - - explicit FieldMaskRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - FieldMaskRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldMaskRules& from); - FieldMaskRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldMaskRules&& from) noexcept - : FieldMaskRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 2, - kNotInFieldNumber = 3, - kExampleFieldNumber = 4, - kConstFieldNumber = 1, - }; - // repeated string in = 2 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - const ::std::string& in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_in(int index); - template - void set_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_in(); - template - void add_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_in(); - - public: - // repeated string not_in = 3 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - const ::std::string& not_in(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_not_in(int index); - template - void set_not_in(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_not_in(); - template - void add_not_in(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_not_in() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_not_in(); - - public: - // repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::google::protobuf::FieldMask* PROTOBUF_NONNULL mutable_example(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>& _internal_example() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>* PROTOBUF_NONNULL _internal_mutable_example(); - public: - const ::google::protobuf::FieldMask& example(int index) const; - ::google::protobuf::FieldMask* PROTOBUF_NONNULL add_example(); - const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>& example() const; - // optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - const ::google::protobuf::FieldMask& const_() const; - [[nodiscard]] ::google::protobuf::FieldMask* PROTOBUF_NULLABLE release_const_(); - ::google::protobuf::FieldMask* PROTOBUF_NONNULL mutable_const_(); - void set_allocated_const_(::google::protobuf::FieldMask* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_const_(::google::protobuf::FieldMask* PROTOBUF_NULLABLE value); - ::google::protobuf::FieldMask* PROTOBUF_NULLABLE unsafe_arena_release_const_(); - - private: - const ::google::protobuf::FieldMask& _internal_const_() const; - ::google::protobuf::FieldMask* PROTOBUF_NONNULL _internal_mutable_const_(); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FieldMaskRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FieldMaskRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - FieldMaskRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - // @@protoc_insertion_point(class_scope:buf.validate.FieldMaskRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 4, - 2, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const FieldMaskRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> in_; - ::google::protobuf::RepeatedPtrField<::std::string> not_in_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldMask > example_; - ::google::protobuf::FieldMask* PROTOBUF_NULLABLE const__; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull FieldMaskRules_class_data_; -// ------------------------------------------------------------------- - -class DurationRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.DurationRules) */ { - public: - inline DurationRules() : DurationRules(nullptr) {} - ~DurationRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(DurationRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(DurationRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR DurationRules(::google::protobuf::internal::ConstantInitialized); - - inline DurationRules(const DurationRules& from) : DurationRules(nullptr, from) {} - inline DurationRules(DurationRules&& from) noexcept - : DurationRules(nullptr, ::std::move(from)) {} - inline DurationRules& operator=(const DurationRules& from) { - CopyFrom(from); - return *this; - } - inline DurationRules& operator=(DurationRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const DurationRules& default_instance() { - return *reinterpret_cast( - &_DurationRules_default_instance_); - } - enum LessThanCase { - kLt = 3, - kLte = 4, - LESS_THAN_NOT_SET = 0, - }; - enum GreaterThanCase { - kGt = 5, - kGte = 6, - GREATER_THAN_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 25; - friend void swap(DurationRules& a, DurationRules& b) { a.Swap(&b); } - inline void Swap(DurationRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(DurationRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - DurationRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const DurationRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const DurationRules& from) { DurationRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(DurationRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.DurationRules"; } - - explicit DurationRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - DurationRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const DurationRules& from); - DurationRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, DurationRules&& from) noexcept - : DurationRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kInFieldNumber = 7, - kNotInFieldNumber = 8, - kExampleFieldNumber = 9, - kConstFieldNumber = 2, - kLtFieldNumber = 3, - kLteFieldNumber = 4, - kGtFieldNumber = 5, - kGteFieldNumber = 6, - }; - // repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { - int in_size() const; - private: - int _internal_in_size() const; - - public: - void clear_in() ; - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_in(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL mutable_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& _internal_in() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL _internal_mutable_in(); - public: - const ::google::protobuf::Duration& in(int index) const; - ::google::protobuf::Duration* PROTOBUF_NONNULL add_in(); - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& in() const; - // repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { - int not_in_size() const; - private: - int _internal_not_in_size() const; - - public: - void clear_not_in() ; - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_not_in(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL mutable_not_in(); - - private: - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& _internal_not_in() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL _internal_mutable_not_in(); - public: - const ::google::protobuf::Duration& not_in(int index) const; - ::google::protobuf::Duration* PROTOBUF_NONNULL add_not_in(); - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& not_in() const; - // repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { - int example_size() const; - private: - int _internal_example_size() const; - - public: - void clear_example() ; - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_example(int index); - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL mutable_example(); - - private: - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& _internal_example() const; - ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL _internal_mutable_example(); - public: - const ::google::protobuf::Duration& example(int index) const; - ::google::protobuf::Duration* PROTOBUF_NONNULL add_example(); - const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& example() const; - // optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { - bool has_const_() const; - void clear_const_() ; - const ::google::protobuf::Duration& const_() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_const_(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_const_(); - void set_allocated_const_(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_const_(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_const_(); - - private: - const ::google::protobuf::Duration& _internal_const_() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_const_(); - - public: - // .google.protobuf.Duration lt = 3 [(.buf.validate.predefined) = { - bool has_lt() const; - private: - bool _internal_has_lt() const; - - public: - void clear_lt() ; - const ::google::protobuf::Duration& lt() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_lt(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_lt(); - void set_allocated_lt(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_lt(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_lt(); - - private: - const ::google::protobuf::Duration& _internal_lt() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_lt(); - - public: - // .google.protobuf.Duration lte = 4 [(.buf.validate.predefined) = { - bool has_lte() const; - private: - bool _internal_has_lte() const; - - public: - void clear_lte() ; - const ::google::protobuf::Duration& lte() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_lte(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_lte(); - void set_allocated_lte(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_lte(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_lte(); - - private: - const ::google::protobuf::Duration& _internal_lte() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_lte(); - - public: - // .google.protobuf.Duration gt = 5 [(.buf.validate.predefined) = { - bool has_gt() const; - private: - bool _internal_has_gt() const; - - public: - void clear_gt() ; - const ::google::protobuf::Duration& gt() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_gt(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_gt(); - void set_allocated_gt(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_gt(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_gt(); - - private: - const ::google::protobuf::Duration& _internal_gt() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_gt(); - - public: - // .google.protobuf.Duration gte = 6 [(.buf.validate.predefined) = { - bool has_gte() const; - private: - bool _internal_has_gte() const; - - public: - void clear_gte() ; - const ::google::protobuf::Duration& gte() const; - [[nodiscard]] ::google::protobuf::Duration* PROTOBUF_NULLABLE release_gte(); - ::google::protobuf::Duration* PROTOBUF_NONNULL mutable_gte(); - void set_allocated_gte(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_gte(::google::protobuf::Duration* PROTOBUF_NULLABLE value); - ::google::protobuf::Duration* PROTOBUF_NULLABLE unsafe_arena_release_gte(); - - private: - const ::google::protobuf::Duration& _internal_gte() const; - ::google::protobuf::Duration* PROTOBUF_NONNULL _internal_mutable_gte(); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DurationRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DurationRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - DurationRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - void clear_less_than(); - LessThanCase less_than_case() const; - void clear_greater_than(); - GreaterThanCase greater_than_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.DurationRules) - private: - class _Internal; - void set_has_lt(); - void set_has_lte(); - void set_has_gt(); - void set_has_gte(); - inline bool has_less_than() const; - inline void clear_has_less_than(); - inline bool has_greater_than() const; - inline void clear_has_greater_than(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 8, - 8, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const DurationRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::Duration > in_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::Duration > not_in_; - ::google::protobuf::RepeatedPtrField< ::google::protobuf::Duration > example_; - ::google::protobuf::Duration* PROTOBUF_NULLABLE const__; - union LessThanUnion { - constexpr LessThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::google::protobuf::Duration* PROTOBUF_NULLABLE lt_; - ::google::protobuf::Duration* PROTOBUF_NULLABLE lte_; - } less_than_; - union GreaterThanUnion { - constexpr GreaterThanUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::google::protobuf::Duration* PROTOBUF_NULLABLE gt_; - ::google::protobuf::Duration* PROTOBUF_NULLABLE gte_; - } greater_than_; - ::uint32_t _oneof_case_[2]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull DurationRules_class_data_; -// ------------------------------------------------------------------- - -class Violation final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Violation) */ { - public: - inline Violation() : Violation(nullptr) {} - ~Violation() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Violation* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Violation)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Violation(::google::protobuf::internal::ConstantInitialized); - - inline Violation(const Violation& from) : Violation(nullptr, from) {} - inline Violation(Violation&& from) noexcept - : Violation(nullptr, ::std::move(from)) {} - inline Violation& operator=(const Violation& from) { - CopyFrom(from); - return *this; - } - inline Violation& operator=(Violation&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Violation& default_instance() { - return *reinterpret_cast( - &_Violation_default_instance_); - } - static constexpr int kIndexInFileMessages = 29; - friend void swap(Violation& a, Violation& b) { a.Swap(&b); } - inline void Swap(Violation* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Violation* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Violation* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Violation& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Violation& from) { Violation::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Violation* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Violation"; } - - explicit Violation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Violation(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Violation& from); - Violation( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Violation&& from) noexcept - : Violation(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kRuleIdFieldNumber = 2, - kMessageFieldNumber = 3, - kFieldFieldNumber = 5, - kRuleFieldNumber = 6, - kForKeyFieldNumber = 4, - }; - // optional string rule_id = 2; - bool has_rule_id() const; - void clear_rule_id() ; - const ::std::string& rule_id() const; - template - void set_rule_id(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_rule_id(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_rule_id(); - void set_allocated_rule_id(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_rule_id() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_rule_id(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_rule_id(); - - public: - // optional string message = 3; - bool has_message() const; - void clear_message() ; - const ::std::string& message() const; - template - void set_message(Arg_&& arg, Args_... args); - ::std::string* PROTOBUF_NONNULL mutable_message(); - [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_message(); - void set_allocated_message(::std::string* PROTOBUF_NULLABLE value); - - private: - const ::std::string& _internal_message() const; - PROTOBUF_ALWAYS_INLINE void _internal_set_message(const ::std::string& value); - ::std::string* PROTOBUF_NONNULL _internal_mutable_message(); - - public: - // optional .buf.validate.FieldPath field = 5; - bool has_field() const; - void clear_field() ; - const ::buf::validate::FieldPath& field() const; - [[nodiscard]] ::buf::validate::FieldPath* PROTOBUF_NULLABLE release_field(); - ::buf::validate::FieldPath* PROTOBUF_NONNULL mutable_field(); - void set_allocated_field(::buf::validate::FieldPath* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_field(::buf::validate::FieldPath* PROTOBUF_NULLABLE value); - ::buf::validate::FieldPath* PROTOBUF_NULLABLE unsafe_arena_release_field(); - - private: - const ::buf::validate::FieldPath& _internal_field() const; - ::buf::validate::FieldPath* PROTOBUF_NONNULL _internal_mutable_field(); - - public: - // optional .buf.validate.FieldPath rule = 6; - bool has_rule() const; - void clear_rule() ; - const ::buf::validate::FieldPath& rule() const; - [[nodiscard]] ::buf::validate::FieldPath* PROTOBUF_NULLABLE release_rule(); - ::buf::validate::FieldPath* PROTOBUF_NONNULL mutable_rule(); - void set_allocated_rule(::buf::validate::FieldPath* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_rule(::buf::validate::FieldPath* PROTOBUF_NULLABLE value); - ::buf::validate::FieldPath* PROTOBUF_NULLABLE unsafe_arena_release_rule(); - - private: - const ::buf::validate::FieldPath& _internal_rule() const; - ::buf::validate::FieldPath* PROTOBUF_NONNULL _internal_mutable_rule(); - - public: - // optional bool for_key = 4; - bool has_for_key() const; - void clear_for_key() ; - bool for_key() const; - void set_for_key(bool value); - - private: - bool _internal_for_key() const; - void _internal_set_for_key(bool value); - - public: - // @@protoc_insertion_point(class_scope:buf.validate.Violation) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 5, - 2, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Violation& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::internal::ArenaStringPtr rule_id_; - ::google::protobuf::internal::ArenaStringPtr message_; - ::buf::validate::FieldPath* PROTOBUF_NULLABLE field_; - ::buf::validate::FieldPath* PROTOBUF_NULLABLE rule_; - bool for_key_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Violation_class_data_; -// ------------------------------------------------------------------- - -class FieldRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.FieldRules) */ { - public: - inline FieldRules() : FieldRules(nullptr) {} - ~FieldRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(FieldRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(FieldRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR FieldRules(::google::protobuf::internal::ConstantInitialized); - - inline FieldRules(const FieldRules& from) : FieldRules(nullptr, from) {} - inline FieldRules(FieldRules&& from) noexcept - : FieldRules(nullptr, ::std::move(from)) {} - inline FieldRules& operator=(const FieldRules& from) { - CopyFrom(from); - return *this; - } - inline FieldRules& operator=(FieldRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FieldRules& default_instance() { - return *reinterpret_cast( - &_FieldRules_default_instance_); - } - enum TypeCase { - kFloat = 1, - kDouble = 2, - kInt32 = 3, - kInt64 = 4, - kUint32 = 5, - kUint64 = 6, - kSint32 = 7, - kSint64 = 8, - kFixed32 = 9, - kFixed64 = 10, - kSfixed32 = 11, - kSfixed64 = 12, - kBool = 13, - kString = 14, - kBytes = 15, - kEnum = 16, - kRepeated = 18, - kMap = 19, - kAny = 20, - kDuration = 21, - kFieldMask = 28, - kTimestamp = 22, - TYPE_NOT_SET = 0, - }; - static constexpr int kIndexInFileMessages = 4; - friend void swap(FieldRules& a, FieldRules& b) { a.Swap(&b); } - inline void Swap(FieldRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FieldRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FieldRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const FieldRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const FieldRules& from) { FieldRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(FieldRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.FieldRules"; } - - explicit FieldRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - FieldRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const FieldRules& from); - FieldRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, FieldRules&& from) noexcept - : FieldRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kCelFieldNumber = 23, - kCelExpressionFieldNumber = 29, - kRequiredFieldNumber = 25, - kIgnoreFieldNumber = 27, - kFloatFieldNumber = 1, - kDoubleFieldNumber = 2, - kInt32FieldNumber = 3, - kInt64FieldNumber = 4, - kUint32FieldNumber = 5, - kUint64FieldNumber = 6, - kSint32FieldNumber = 7, - kSint64FieldNumber = 8, - kFixed32FieldNumber = 9, - kFixed64FieldNumber = 10, - kSfixed32FieldNumber = 11, - kSfixed64FieldNumber = 12, - kBoolFieldNumber = 13, - kStringFieldNumber = 14, - kBytesFieldNumber = 15, - kEnumFieldNumber = 16, - kRepeatedFieldNumber = 18, - kMapFieldNumber = 19, - kAnyFieldNumber = 20, - kDurationFieldNumber = 21, - kFieldMaskFieldNumber = 28, - kTimestampFieldNumber = 22, - }; - // repeated .buf.validate.Rule cel = 23; - int cel_size() const; - private: - int _internal_cel_size() const; - - public: - void clear_cel() ; - ::buf::validate::Rule* PROTOBUF_NONNULL mutable_cel(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL mutable_cel(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& _internal_cel() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL _internal_mutable_cel(); - public: - const ::buf::validate::Rule& cel(int index) const; - ::buf::validate::Rule* PROTOBUF_NONNULL add_cel(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& cel() const; - // repeated string cel_expression = 29; - int cel_expression_size() const; - private: - int _internal_cel_expression_size() const; - - public: - void clear_cel_expression() ; - const ::std::string& cel_expression(int index) const; - ::std::string* PROTOBUF_NONNULL mutable_cel_expression(int index); - template - void set_cel_expression(int index, Arg_&& value, Args_... args); - ::std::string* PROTOBUF_NONNULL add_cel_expression(); - template - void add_cel_expression(Arg_&& value, Args_... args); - const ::google::protobuf::RepeatedPtrField<::std::string>& cel_expression() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL mutable_cel_expression(); - - private: - const ::google::protobuf::RepeatedPtrField<::std::string>& _internal_cel_expression() const; - ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL _internal_mutable_cel_expression(); - - public: - // optional bool required = 25; - bool has_required() const; - void clear_required() ; - bool required() const; - void set_required(bool value); - - private: - bool _internal_required() const; - void _internal_set_required(bool value); - - public: - // optional .buf.validate.Ignore ignore = 27; - bool has_ignore() const; - void clear_ignore() ; - ::buf::validate::Ignore ignore() const; - void set_ignore(::buf::validate::Ignore value); - - private: - ::buf::validate::Ignore _internal_ignore() const; - void _internal_set_ignore(::buf::validate::Ignore value); - - public: - // .buf.validate.FloatRules float = 1; - bool has_float_() const; - private: - bool _internal_has_float_() const; - - public: - void clear_float_() ; - const ::buf::validate::FloatRules& float_() const; - [[nodiscard]] ::buf::validate::FloatRules* PROTOBUF_NULLABLE release_float_(); - ::buf::validate::FloatRules* PROTOBUF_NONNULL mutable_float_(); - void set_allocated_float_(::buf::validate::FloatRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_float_(::buf::validate::FloatRules* PROTOBUF_NULLABLE value); - ::buf::validate::FloatRules* PROTOBUF_NULLABLE unsafe_arena_release_float_(); - - private: - const ::buf::validate::FloatRules& _internal_float_() const; - ::buf::validate::FloatRules* PROTOBUF_NONNULL _internal_mutable_float_(); - - public: - // .buf.validate.DoubleRules double = 2; - bool has_double_() const; - private: - bool _internal_has_double_() const; - - public: - void clear_double_() ; - const ::buf::validate::DoubleRules& double_() const; - [[nodiscard]] ::buf::validate::DoubleRules* PROTOBUF_NULLABLE release_double_(); - ::buf::validate::DoubleRules* PROTOBUF_NONNULL mutable_double_(); - void set_allocated_double_(::buf::validate::DoubleRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_double_(::buf::validate::DoubleRules* PROTOBUF_NULLABLE value); - ::buf::validate::DoubleRules* PROTOBUF_NULLABLE unsafe_arena_release_double_(); - - private: - const ::buf::validate::DoubleRules& _internal_double_() const; - ::buf::validate::DoubleRules* PROTOBUF_NONNULL _internal_mutable_double_(); - - public: - // .buf.validate.Int32Rules int32 = 3; - bool has_int32() const; - private: - bool _internal_has_int32() const; - - public: - void clear_int32() ; - const ::buf::validate::Int32Rules& int32() const; - [[nodiscard]] ::buf::validate::Int32Rules* PROTOBUF_NULLABLE release_int32(); - ::buf::validate::Int32Rules* PROTOBUF_NONNULL mutable_int32(); - void set_allocated_int32(::buf::validate::Int32Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_int32(::buf::validate::Int32Rules* PROTOBUF_NULLABLE value); - ::buf::validate::Int32Rules* PROTOBUF_NULLABLE unsafe_arena_release_int32(); - - private: - const ::buf::validate::Int32Rules& _internal_int32() const; - ::buf::validate::Int32Rules* PROTOBUF_NONNULL _internal_mutable_int32(); - - public: - // .buf.validate.Int64Rules int64 = 4; - bool has_int64() const; - private: - bool _internal_has_int64() const; - - public: - void clear_int64() ; - const ::buf::validate::Int64Rules& int64() const; - [[nodiscard]] ::buf::validate::Int64Rules* PROTOBUF_NULLABLE release_int64(); - ::buf::validate::Int64Rules* PROTOBUF_NONNULL mutable_int64(); - void set_allocated_int64(::buf::validate::Int64Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_int64(::buf::validate::Int64Rules* PROTOBUF_NULLABLE value); - ::buf::validate::Int64Rules* PROTOBUF_NULLABLE unsafe_arena_release_int64(); - - private: - const ::buf::validate::Int64Rules& _internal_int64() const; - ::buf::validate::Int64Rules* PROTOBUF_NONNULL _internal_mutable_int64(); - - public: - // .buf.validate.UInt32Rules uint32 = 5; - bool has_uint32() const; - private: - bool _internal_has_uint32() const; - - public: - void clear_uint32() ; - const ::buf::validate::UInt32Rules& uint32() const; - [[nodiscard]] ::buf::validate::UInt32Rules* PROTOBUF_NULLABLE release_uint32(); - ::buf::validate::UInt32Rules* PROTOBUF_NONNULL mutable_uint32(); - void set_allocated_uint32(::buf::validate::UInt32Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_uint32(::buf::validate::UInt32Rules* PROTOBUF_NULLABLE value); - ::buf::validate::UInt32Rules* PROTOBUF_NULLABLE unsafe_arena_release_uint32(); - - private: - const ::buf::validate::UInt32Rules& _internal_uint32() const; - ::buf::validate::UInt32Rules* PROTOBUF_NONNULL _internal_mutable_uint32(); - - public: - // .buf.validate.UInt64Rules uint64 = 6; - bool has_uint64() const; - private: - bool _internal_has_uint64() const; - - public: - void clear_uint64() ; - const ::buf::validate::UInt64Rules& uint64() const; - [[nodiscard]] ::buf::validate::UInt64Rules* PROTOBUF_NULLABLE release_uint64(); - ::buf::validate::UInt64Rules* PROTOBUF_NONNULL mutable_uint64(); - void set_allocated_uint64(::buf::validate::UInt64Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_uint64(::buf::validate::UInt64Rules* PROTOBUF_NULLABLE value); - ::buf::validate::UInt64Rules* PROTOBUF_NULLABLE unsafe_arena_release_uint64(); - - private: - const ::buf::validate::UInt64Rules& _internal_uint64() const; - ::buf::validate::UInt64Rules* PROTOBUF_NONNULL _internal_mutable_uint64(); - - public: - // .buf.validate.SInt32Rules sint32 = 7; - bool has_sint32() const; - private: - bool _internal_has_sint32() const; - - public: - void clear_sint32() ; - const ::buf::validate::SInt32Rules& sint32() const; - [[nodiscard]] ::buf::validate::SInt32Rules* PROTOBUF_NULLABLE release_sint32(); - ::buf::validate::SInt32Rules* PROTOBUF_NONNULL mutable_sint32(); - void set_allocated_sint32(::buf::validate::SInt32Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_sint32(::buf::validate::SInt32Rules* PROTOBUF_NULLABLE value); - ::buf::validate::SInt32Rules* PROTOBUF_NULLABLE unsafe_arena_release_sint32(); - - private: - const ::buf::validate::SInt32Rules& _internal_sint32() const; - ::buf::validate::SInt32Rules* PROTOBUF_NONNULL _internal_mutable_sint32(); - - public: - // .buf.validate.SInt64Rules sint64 = 8; - bool has_sint64() const; - private: - bool _internal_has_sint64() const; - - public: - void clear_sint64() ; - const ::buf::validate::SInt64Rules& sint64() const; - [[nodiscard]] ::buf::validate::SInt64Rules* PROTOBUF_NULLABLE release_sint64(); - ::buf::validate::SInt64Rules* PROTOBUF_NONNULL mutable_sint64(); - void set_allocated_sint64(::buf::validate::SInt64Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_sint64(::buf::validate::SInt64Rules* PROTOBUF_NULLABLE value); - ::buf::validate::SInt64Rules* PROTOBUF_NULLABLE unsafe_arena_release_sint64(); - - private: - const ::buf::validate::SInt64Rules& _internal_sint64() const; - ::buf::validate::SInt64Rules* PROTOBUF_NONNULL _internal_mutable_sint64(); - - public: - // .buf.validate.Fixed32Rules fixed32 = 9; - bool has_fixed32() const; - private: - bool _internal_has_fixed32() const; - - public: - void clear_fixed32() ; - const ::buf::validate::Fixed32Rules& fixed32() const; - [[nodiscard]] ::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE release_fixed32(); - ::buf::validate::Fixed32Rules* PROTOBUF_NONNULL mutable_fixed32(); - void set_allocated_fixed32(::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_fixed32(::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE value); - ::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE unsafe_arena_release_fixed32(); - - private: - const ::buf::validate::Fixed32Rules& _internal_fixed32() const; - ::buf::validate::Fixed32Rules* PROTOBUF_NONNULL _internal_mutable_fixed32(); - - public: - // .buf.validate.Fixed64Rules fixed64 = 10; - bool has_fixed64() const; - private: - bool _internal_has_fixed64() const; - - public: - void clear_fixed64() ; - const ::buf::validate::Fixed64Rules& fixed64() const; - [[nodiscard]] ::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE release_fixed64(); - ::buf::validate::Fixed64Rules* PROTOBUF_NONNULL mutable_fixed64(); - void set_allocated_fixed64(::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_fixed64(::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE value); - ::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE unsafe_arena_release_fixed64(); - - private: - const ::buf::validate::Fixed64Rules& _internal_fixed64() const; - ::buf::validate::Fixed64Rules* PROTOBUF_NONNULL _internal_mutable_fixed64(); - - public: - // .buf.validate.SFixed32Rules sfixed32 = 11; - bool has_sfixed32() const; - private: - bool _internal_has_sfixed32() const; - - public: - void clear_sfixed32() ; - const ::buf::validate::SFixed32Rules& sfixed32() const; - [[nodiscard]] ::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE release_sfixed32(); - ::buf::validate::SFixed32Rules* PROTOBUF_NONNULL mutable_sfixed32(); - void set_allocated_sfixed32(::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_sfixed32(::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE value); - ::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE unsafe_arena_release_sfixed32(); - - private: - const ::buf::validate::SFixed32Rules& _internal_sfixed32() const; - ::buf::validate::SFixed32Rules* PROTOBUF_NONNULL _internal_mutable_sfixed32(); - - public: - // .buf.validate.SFixed64Rules sfixed64 = 12; - bool has_sfixed64() const; - private: - bool _internal_has_sfixed64() const; - - public: - void clear_sfixed64() ; - const ::buf::validate::SFixed64Rules& sfixed64() const; - [[nodiscard]] ::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE release_sfixed64(); - ::buf::validate::SFixed64Rules* PROTOBUF_NONNULL mutable_sfixed64(); - void set_allocated_sfixed64(::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_sfixed64(::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE value); - ::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE unsafe_arena_release_sfixed64(); - - private: - const ::buf::validate::SFixed64Rules& _internal_sfixed64() const; - ::buf::validate::SFixed64Rules* PROTOBUF_NONNULL _internal_mutable_sfixed64(); - - public: - // .buf.validate.BoolRules bool = 13; - bool has_bool_() const; - private: - bool _internal_has_bool_() const; - - public: - void clear_bool_() ; - const ::buf::validate::BoolRules& bool_() const; - [[nodiscard]] ::buf::validate::BoolRules* PROTOBUF_NULLABLE release_bool_(); - ::buf::validate::BoolRules* PROTOBUF_NONNULL mutable_bool_(); - void set_allocated_bool_(::buf::validate::BoolRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_bool_(::buf::validate::BoolRules* PROTOBUF_NULLABLE value); - ::buf::validate::BoolRules* PROTOBUF_NULLABLE unsafe_arena_release_bool_(); - - private: - const ::buf::validate::BoolRules& _internal_bool_() const; - ::buf::validate::BoolRules* PROTOBUF_NONNULL _internal_mutable_bool_(); - - public: - // .buf.validate.StringRules string = 14; - bool has_string() const; - private: - bool _internal_has_string() const; - - public: - void clear_string() ; - const ::buf::validate::StringRules& string() const; - [[nodiscard]] ::buf::validate::StringRules* PROTOBUF_NULLABLE release_string(); - ::buf::validate::StringRules* PROTOBUF_NONNULL mutable_string(); - void set_allocated_string(::buf::validate::StringRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_string(::buf::validate::StringRules* PROTOBUF_NULLABLE value); - ::buf::validate::StringRules* PROTOBUF_NULLABLE unsafe_arena_release_string(); - - private: - const ::buf::validate::StringRules& _internal_string() const; - ::buf::validate::StringRules* PROTOBUF_NONNULL _internal_mutable_string(); - - public: - // .buf.validate.BytesRules bytes = 15; - bool has_bytes() const; - private: - bool _internal_has_bytes() const; - - public: - void clear_bytes() ; - const ::buf::validate::BytesRules& bytes() const; - [[nodiscard]] ::buf::validate::BytesRules* PROTOBUF_NULLABLE release_bytes(); - ::buf::validate::BytesRules* PROTOBUF_NONNULL mutable_bytes(); - void set_allocated_bytes(::buf::validate::BytesRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_bytes(::buf::validate::BytesRules* PROTOBUF_NULLABLE value); - ::buf::validate::BytesRules* PROTOBUF_NULLABLE unsafe_arena_release_bytes(); - - private: - const ::buf::validate::BytesRules& _internal_bytes() const; - ::buf::validate::BytesRules* PROTOBUF_NONNULL _internal_mutable_bytes(); - - public: - // .buf.validate.EnumRules enum = 16; - bool has_enum_() const; - private: - bool _internal_has_enum_() const; - - public: - void clear_enum_() ; - const ::buf::validate::EnumRules& enum_() const; - [[nodiscard]] ::buf::validate::EnumRules* PROTOBUF_NULLABLE release_enum_(); - ::buf::validate::EnumRules* PROTOBUF_NONNULL mutable_enum_(); - void set_allocated_enum_(::buf::validate::EnumRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_enum_(::buf::validate::EnumRules* PROTOBUF_NULLABLE value); - ::buf::validate::EnumRules* PROTOBUF_NULLABLE unsafe_arena_release_enum_(); - - private: - const ::buf::validate::EnumRules& _internal_enum_() const; - ::buf::validate::EnumRules* PROTOBUF_NONNULL _internal_mutable_enum_(); - - public: - // .buf.validate.RepeatedRules repeated = 18; - bool has_repeated() const; - private: - bool _internal_has_repeated() const; - - public: - void clear_repeated() ; - const ::buf::validate::RepeatedRules& repeated() const; - [[nodiscard]] ::buf::validate::RepeatedRules* PROTOBUF_NULLABLE release_repeated(); - ::buf::validate::RepeatedRules* PROTOBUF_NONNULL mutable_repeated(); - void set_allocated_repeated(::buf::validate::RepeatedRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_repeated(::buf::validate::RepeatedRules* PROTOBUF_NULLABLE value); - ::buf::validate::RepeatedRules* PROTOBUF_NULLABLE unsafe_arena_release_repeated(); - - private: - const ::buf::validate::RepeatedRules& _internal_repeated() const; - ::buf::validate::RepeatedRules* PROTOBUF_NONNULL _internal_mutable_repeated(); - - public: - // .buf.validate.MapRules map = 19; - bool has_map() const; - private: - bool _internal_has_map() const; - - public: - void clear_map() ; - const ::buf::validate::MapRules& map() const; - [[nodiscard]] ::buf::validate::MapRules* PROTOBUF_NULLABLE release_map(); - ::buf::validate::MapRules* PROTOBUF_NONNULL mutable_map(); - void set_allocated_map(::buf::validate::MapRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_map(::buf::validate::MapRules* PROTOBUF_NULLABLE value); - ::buf::validate::MapRules* PROTOBUF_NULLABLE unsafe_arena_release_map(); - - private: - const ::buf::validate::MapRules& _internal_map() const; - ::buf::validate::MapRules* PROTOBUF_NONNULL _internal_mutable_map(); - - public: - // .buf.validate.AnyRules any = 20; - bool has_any() const; - private: - bool _internal_has_any() const; - - public: - void clear_any() ; - const ::buf::validate::AnyRules& any() const; - [[nodiscard]] ::buf::validate::AnyRules* PROTOBUF_NULLABLE release_any(); - ::buf::validate::AnyRules* PROTOBUF_NONNULL mutable_any(); - void set_allocated_any(::buf::validate::AnyRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_any(::buf::validate::AnyRules* PROTOBUF_NULLABLE value); - ::buf::validate::AnyRules* PROTOBUF_NULLABLE unsafe_arena_release_any(); - - private: - const ::buf::validate::AnyRules& _internal_any() const; - ::buf::validate::AnyRules* PROTOBUF_NONNULL _internal_mutable_any(); - - public: - // .buf.validate.DurationRules duration = 21; - bool has_duration() const; - private: - bool _internal_has_duration() const; - - public: - void clear_duration() ; - const ::buf::validate::DurationRules& duration() const; - [[nodiscard]] ::buf::validate::DurationRules* PROTOBUF_NULLABLE release_duration(); - ::buf::validate::DurationRules* PROTOBUF_NONNULL mutable_duration(); - void set_allocated_duration(::buf::validate::DurationRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_duration(::buf::validate::DurationRules* PROTOBUF_NULLABLE value); - ::buf::validate::DurationRules* PROTOBUF_NULLABLE unsafe_arena_release_duration(); - - private: - const ::buf::validate::DurationRules& _internal_duration() const; - ::buf::validate::DurationRules* PROTOBUF_NONNULL _internal_mutable_duration(); - - public: - // .buf.validate.FieldMaskRules field_mask = 28; - bool has_field_mask() const; - private: - bool _internal_has_field_mask() const; - - public: - void clear_field_mask() ; - const ::buf::validate::FieldMaskRules& field_mask() const; - [[nodiscard]] ::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE release_field_mask(); - ::buf::validate::FieldMaskRules* PROTOBUF_NONNULL mutable_field_mask(); - void set_allocated_field_mask(::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_field_mask(::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE value); - ::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE unsafe_arena_release_field_mask(); - - private: - const ::buf::validate::FieldMaskRules& _internal_field_mask() const; - ::buf::validate::FieldMaskRules* PROTOBUF_NONNULL _internal_mutable_field_mask(); - - public: - // .buf.validate.TimestampRules timestamp = 22; - bool has_timestamp() const; - private: - bool _internal_has_timestamp() const; - - public: - void clear_timestamp() ; - const ::buf::validate::TimestampRules& timestamp() const; - [[nodiscard]] ::buf::validate::TimestampRules* PROTOBUF_NULLABLE release_timestamp(); - ::buf::validate::TimestampRules* PROTOBUF_NONNULL mutable_timestamp(); - void set_allocated_timestamp(::buf::validate::TimestampRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_timestamp(::buf::validate::TimestampRules* PROTOBUF_NULLABLE value); - ::buf::validate::TimestampRules* PROTOBUF_NULLABLE unsafe_arena_release_timestamp(); - - private: - const ::buf::validate::TimestampRules& _internal_timestamp() const; - ::buf::validate::TimestampRules* PROTOBUF_NONNULL _internal_mutable_timestamp(); - - public: - void clear_type(); - TypeCase type_case() const; - // @@protoc_insertion_point(class_scope:buf.validate.FieldRules) - private: - class _Internal; - void set_has_float_(); - void set_has_double_(); - void set_has_int32(); - void set_has_int64(); - void set_has_uint32(); - void set_has_uint64(); - void set_has_sint32(); - void set_has_sint64(); - void set_has_fixed32(); - void set_has_fixed64(); - void set_has_sfixed32(); - void set_has_sfixed64(); - void set_has_bool_(); - void set_has_string(); - void set_has_bytes(); - void set_has_enum_(); - void set_has_repeated(); - void set_has_map(); - void set_has_any(); - void set_has_duration(); - void set_has_field_mask(); - void set_has_timestamp(); - inline bool has_type() const; - inline void clear_has_type(); - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 26, - 24, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const FieldRules& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::Rule > cel_; - ::google::protobuf::RepeatedPtrField<::std::string> cel_expression_; - bool required_; - int ignore_; - union TypeUnion { - constexpr TypeUnion() : _constinit_{} {} - ::google::protobuf::internal::ConstantInitialized _constinit_; - ::google::protobuf::Message* PROTOBUF_NULLABLE float__; - ::google::protobuf::Message* PROTOBUF_NULLABLE double__; - ::google::protobuf::Message* PROTOBUF_NULLABLE int32_; - ::google::protobuf::Message* PROTOBUF_NULLABLE int64_; - ::google::protobuf::Message* PROTOBUF_NULLABLE uint32_; - ::google::protobuf::Message* PROTOBUF_NULLABLE uint64_; - ::google::protobuf::Message* PROTOBUF_NULLABLE sint32_; - ::google::protobuf::Message* PROTOBUF_NULLABLE sint64_; - ::google::protobuf::Message* PROTOBUF_NULLABLE fixed32_; - ::google::protobuf::Message* PROTOBUF_NULLABLE fixed64_; - ::google::protobuf::Message* PROTOBUF_NULLABLE sfixed32_; - ::google::protobuf::Message* PROTOBUF_NULLABLE sfixed64_; - ::google::protobuf::Message* PROTOBUF_NULLABLE bool__; - ::google::protobuf::Message* PROTOBUF_NULLABLE string_; - ::google::protobuf::Message* PROTOBUF_NULLABLE bytes_; - ::google::protobuf::Message* PROTOBUF_NULLABLE enum__; - ::google::protobuf::Message* PROTOBUF_NULLABLE repeated_; - ::google::protobuf::Message* PROTOBUF_NULLABLE map_; - ::google::protobuf::Message* PROTOBUF_NULLABLE any_; - ::google::protobuf::Message* PROTOBUF_NULLABLE duration_; - ::google::protobuf::Message* PROTOBUF_NULLABLE field_mask_; - ::google::protobuf::Message* PROTOBUF_NULLABLE timestamp_; - } type_; - ::uint32_t _oneof_case_[1]; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull FieldRules_class_data_; -// ------------------------------------------------------------------- - -class MapRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.MapRules) */ { - public: - inline MapRules() : MapRules(nullptr) {} - ~MapRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(MapRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(MapRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR MapRules(::google::protobuf::internal::ConstantInitialized); - - inline MapRules(const MapRules& from) : MapRules(nullptr, from) {} - inline MapRules(MapRules&& from) noexcept - : MapRules(nullptr, ::std::move(from)) {} - inline MapRules& operator=(const MapRules& from) { - CopyFrom(from); - return *this; - } - inline MapRules& operator=(MapRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const MapRules& default_instance() { - return *reinterpret_cast( - &_MapRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 23; - friend void swap(MapRules& a, MapRules& b) { a.Swap(&b); } - inline void Swap(MapRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(MapRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - MapRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const MapRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const MapRules& from) { MapRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(MapRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.MapRules"; } - - explicit MapRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - MapRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const MapRules& from); - MapRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, MapRules&& from) noexcept - : MapRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kKeysFieldNumber = 4, - kValuesFieldNumber = 5, - kMinPairsFieldNumber = 1, - kMaxPairsFieldNumber = 2, - }; - // optional .buf.validate.FieldRules keys = 4; - bool has_keys() const; - void clear_keys() ; - const ::buf::validate::FieldRules& keys() const; - [[nodiscard]] ::buf::validate::FieldRules* PROTOBUF_NULLABLE release_keys(); - ::buf::validate::FieldRules* PROTOBUF_NONNULL mutable_keys(); - void set_allocated_keys(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_keys(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - ::buf::validate::FieldRules* PROTOBUF_NULLABLE unsafe_arena_release_keys(); - - private: - const ::buf::validate::FieldRules& _internal_keys() const; - ::buf::validate::FieldRules* PROTOBUF_NONNULL _internal_mutable_keys(); - - public: - // optional .buf.validate.FieldRules values = 5; - bool has_values() const; - void clear_values() ; - const ::buf::validate::FieldRules& values() const; - [[nodiscard]] ::buf::validate::FieldRules* PROTOBUF_NULLABLE release_values(); - ::buf::validate::FieldRules* PROTOBUF_NONNULL mutable_values(); - void set_allocated_values(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_values(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - ::buf::validate::FieldRules* PROTOBUF_NULLABLE unsafe_arena_release_values(); - - private: - const ::buf::validate::FieldRules& _internal_values() const; - ::buf::validate::FieldRules* PROTOBUF_NONNULL _internal_mutable_values(); - - public: - // optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { - bool has_min_pairs() const; - void clear_min_pairs() ; - ::uint64_t min_pairs() const; - void set_min_pairs(::uint64_t value); - - private: - ::uint64_t _internal_min_pairs() const; - void _internal_set_min_pairs(::uint64_t value); - - public: - // optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { - bool has_max_pairs() const; - void clear_max_pairs() ; - ::uint64_t max_pairs() const; - void set_max_pairs(::uint64_t value); - - private: - ::uint64_t _internal_max_pairs() const; - void _internal_set_max_pairs(::uint64_t value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - MapRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - MapRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - MapRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - // @@protoc_insertion_point(class_scope:buf.validate.MapRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<3, 4, - 2, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const MapRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::buf::validate::FieldRules* PROTOBUF_NULLABLE keys_; - ::buf::validate::FieldRules* PROTOBUF_NULLABLE values_; - ::uint64_t min_pairs_; - ::uint64_t max_pairs_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull MapRules_class_data_; -// ------------------------------------------------------------------- - -class RepeatedRules final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.RepeatedRules) */ { - public: - inline RepeatedRules() : RepeatedRules(nullptr) {} - ~RepeatedRules() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(RepeatedRules* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(RepeatedRules)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR RepeatedRules(::google::protobuf::internal::ConstantInitialized); - - inline RepeatedRules(const RepeatedRules& from) : RepeatedRules(nullptr, from) {} - inline RepeatedRules(RepeatedRules&& from) noexcept - : RepeatedRules(nullptr, ::std::move(from)) {} - inline RepeatedRules& operator=(const RepeatedRules& from) { - CopyFrom(from); - return *this; - } - inline RepeatedRules& operator=(RepeatedRules&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const RepeatedRules& default_instance() { - return *reinterpret_cast( - &_RepeatedRules_default_instance_); - } - static constexpr int kIndexInFileMessages = 22; - friend void swap(RepeatedRules& a, RepeatedRules& b) { a.Swap(&b); } - inline void Swap(RepeatedRules* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(RepeatedRules* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - RepeatedRules* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const RepeatedRules& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const RepeatedRules& from) { RepeatedRules::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return IsInitializedImpl(*this); - } - - private: - static bool IsInitializedImpl(const MessageLite& msg); - - public: - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(RepeatedRules* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.RepeatedRules"; } - - explicit RepeatedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - RepeatedRules(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const RepeatedRules& from); - RepeatedRules( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, RepeatedRules&& from) noexcept - : RepeatedRules(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kItemsFieldNumber = 4, - kMinItemsFieldNumber = 1, - kMaxItemsFieldNumber = 2, - kUniqueFieldNumber = 3, - }; - // optional .buf.validate.FieldRules items = 4; - bool has_items() const; - void clear_items() ; - const ::buf::validate::FieldRules& items() const; - [[nodiscard]] ::buf::validate::FieldRules* PROTOBUF_NULLABLE release_items(); - ::buf::validate::FieldRules* PROTOBUF_NONNULL mutable_items(); - void set_allocated_items(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - void unsafe_arena_set_allocated_items(::buf::validate::FieldRules* PROTOBUF_NULLABLE value); - ::buf::validate::FieldRules* PROTOBUF_NULLABLE unsafe_arena_release_items(); - - private: - const ::buf::validate::FieldRules& _internal_items() const; - ::buf::validate::FieldRules* PROTOBUF_NONNULL _internal_mutable_items(); - - public: - // optional uint64 min_items = 1 [(.buf.validate.predefined) = { - bool has_min_items() const; - void clear_min_items() ; - ::uint64_t min_items() const; - void set_min_items(::uint64_t value); - - private: - ::uint64_t _internal_min_items() const; - void _internal_set_min_items(::uint64_t value); - - public: - // optional uint64 max_items = 2 [(.buf.validate.predefined) = { - bool has_max_items() const; - void clear_max_items() ; - ::uint64_t max_items() const; - void set_max_items(::uint64_t value); - - private: - ::uint64_t _internal_max_items() const; - void _internal_set_max_items(::uint64_t value); - - public: - // optional bool unique = 3 [(.buf.validate.predefined) = { - bool has_unique() const; - void clear_unique() ; - bool unique() const; - void set_unique(bool value); - - private: - bool _internal_unique() const; - void _internal_set_unique(bool value); - - public: - template - PROTOBUF_FUTURE_ADD_NODISCARD inline bool HasExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.Has(id.number()); - } - - template - inline void ClearExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - _impl_._extensions_.ClearExtension(id.number()); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline int ExtensionSize( - const ::google::protobuf::internal::ExtensionIdentifier& id) const { - return _impl_._extensions_.ExtensionSize(id.number()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - RepeatedRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Singular::ConstType - GetExtension(const ::google::protobuf::internal::ExtensionIdentifier< - RepeatedRules, _proto_TypeTraits, _field_type, _is_packed>& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, id.default_value()); - } - - template - inline typename _proto_TypeTraits::Singular::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), _field_type, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::ConstType value) { - _proto_TypeTraits::Set(id.number(), _field_type, value, &_impl_._extensions_); - } - - template - inline void SetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::SetAllocated(id.number(), _field_type, value, - &_impl_._extensions_); - } - template - inline void UnsafeArenaSetAllocatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Singular::MutableType value) { - _proto_TypeTraits::UnsafeArenaSetAllocated(id.number(), _field_type, - value, &_impl_._extensions_); - } - template - [[nodiscard]] inline typename _proto_TypeTraits::Singular::MutableType - ReleaseExtension(const ::google::protobuf::internal::ExtensionIdentifier< - RepeatedRules, _proto_TypeTraits, _field_type, _is_packed>& id) { - return _proto_TypeTraits::Release(id.number(), _field_type, &_impl_._extensions_); - } - template - inline typename _proto_TypeTraits::Singular::MutableType - UnsafeArenaReleaseExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) { - return _proto_TypeTraits::UnsafeArenaRelease(id.number(), _field_type, - &_impl_._extensions_); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template = 0> - PROTOBUF_FUTURE_ADD_NODISCARD inline - typename _proto_TypeTraits::Repeated::ConstType - GetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Get(id.number(), _impl_._extensions_, index); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType MutableExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index) ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::Mutable(id.number(), index, &_impl_._extensions_); - } - - template - inline void SetExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - int index, typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Set(id.number(), index, value, &_impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::MutableType AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - typename _proto_TypeTraits::Repeated::MutableType to_add = - _proto_TypeTraits::Add(id.number(), _field_type, &_impl_._extensions_); - return to_add; - } - - template - inline void AddExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id, - typename _proto_TypeTraits::Repeated::ConstType value) { - _proto_TypeTraits::Add(id.number(), _field_type, _is_packed, value, - &_impl_._extensions_); - } - - template - PROTOBUF_FUTURE_ADD_NODISCARD inline const typename _proto_TypeTraits:: - Repeated::RepeatedFieldType& - GetRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::GetRepeated(id.number(), _impl_._extensions_); - } - - template - inline typename _proto_TypeTraits::Repeated::RepeatedFieldType* PROTOBUF_NONNULL - MutableRepeatedExtension( - const ::google::protobuf::internal::ExtensionIdentifier& id) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _proto_TypeTraits::MutableRepeated(id.number(), _field_type, - _is_packed, &_impl_._extensions_); - } - // @@protoc_insertion_point(class_scope:buf.validate.RepeatedRules) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<2, 4, - 1, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const RepeatedRules& from_msg); - ::google::protobuf::internal::ExtensionSet _extensions_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::buf::validate::FieldRules* PROTOBUF_NULLABLE items_; - ::uint64_t min_items_; - ::uint64_t max_items_; - bool unique_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull RepeatedRules_class_data_; -// ------------------------------------------------------------------- - -class Violations final : public ::google::protobuf::Message -/* @@protoc_insertion_point(class_definition:buf.validate.Violations) */ { - public: - inline Violations() : Violations(nullptr) {} - ~Violations() PROTOBUF_FINAL; - -#if defined(PROTOBUF_CUSTOM_VTABLE) - void operator delete(Violations* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) { - SharedDtor(*msg); - ::google::protobuf::internal::SizedDelete(msg, sizeof(Violations)); - } -#endif - - template - explicit PROTOBUF_CONSTEXPR Violations(::google::protobuf::internal::ConstantInitialized); - - inline Violations(const Violations& from) : Violations(nullptr, from) {} - inline Violations(Violations&& from) noexcept - : Violations(nullptr, ::std::move(from)) {} - inline Violations& operator=(const Violations& from) { - CopyFrom(from); - return *this; - } - inline Violations& operator=(Violations&& from) noexcept { - if (this == &from) return *this; - if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance); - } - inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>(); - } - - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() { - return GetDescriptor(); - } - static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Violations& default_instance() { - return *reinterpret_cast( - &_Violations_default_instance_); - } - static constexpr int kIndexInFileMessages = 28; - friend void swap(Violations& a, Violations& b) { a.Swap(&b); } - inline void Swap(Violations* PROTOBUF_NONNULL other) { - if (other == this) return; - if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) { - InternalSwap(other); - } else { - ::google::protobuf::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Violations* PROTOBUF_NONNULL other) { - if (other == this) return; - ABSL_DCHECK(GetArena() == other->GetArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Violations* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const { - return ::google::protobuf::Message::DefaultConstruct(arena); - } - using ::google::protobuf::Message::CopyFrom; - void CopyFrom(const Violations& from); - using ::google::protobuf::Message::MergeFrom; - void MergeFrom(const Violations& from) { Violations::MergeImpl(*this, from); } - - private: - static void MergeImpl(::google::protobuf::MessageLite& to_msg, - const ::google::protobuf::MessageLite& from_msg); - - public: - bool IsInitialized() const { - return true; - } - ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL; - #if defined(PROTOBUF_CUSTOM_VTABLE) - private: - static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg); - static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream); - - public: - ::size_t ByteSizeLong() const { return ByteSizeLong(*this); } - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const { - return _InternalSerialize(*this, target, stream); - } - #else // PROTOBUF_CUSTOM_VTABLE - ::size_t ByteSizeLong() const final; - ::uint8_t* PROTOBUF_NONNULL _InternalSerialize( - ::uint8_t* PROTOBUF_NONNULL target, - ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final; - #endif // PROTOBUF_CUSTOM_VTABLE - int GetCachedSize() const { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static void SharedDtor(MessageLite& self); - void InternalSwap(Violations* PROTOBUF_NONNULL other); - private: - template - friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)(); - static ::absl::string_view FullMessageName() { return "buf.validate.Violations"; } - - explicit Violations(::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - Violations(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Violations& from); - Violations( - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, Violations&& from) noexcept - : Violations(arena) { - *this = ::std::move(from); - } - const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL; - static void* PROTOBUF_NONNULL PlacementNew_( - const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - static constexpr auto InternalNewImpl_(); - - public: - static constexpr auto InternalGenerateClassData_(); - - ::google::protobuf::Metadata GetMetadata() const; - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - enum : int { - kViolationsFieldNumber = 1, - }; - // repeated .buf.validate.Violation violations = 1; - int violations_size() const; - private: - int _internal_violations_size() const; - - public: - void clear_violations() ; - ::buf::validate::Violation* PROTOBUF_NONNULL mutable_violations(int index); - ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>* PROTOBUF_NONNULL mutable_violations(); - - private: - const ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>& _internal_violations() const; - ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>* PROTOBUF_NONNULL _internal_mutable_violations(); - public: - const ::buf::validate::Violation& violations(int index) const; - ::buf::validate::Violation* PROTOBUF_NONNULL add_violations(); - const ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>& violations() const; - // @@protoc_insertion_point(class_scope:buf.validate.Violations) - private: - class _Internal; - friend class ::google::protobuf::internal::TcParser; - static const ::google::protobuf::internal::TcParseTable<0, 1, - 1, 0, - 2> - _table_; - - friend class ::google::protobuf::MessageLite; - friend class ::google::protobuf::Arena; - template - friend class ::google::protobuf::Arena::InternalHelper; - using InternalArenaConstructable_ = void; - using DestructorSkippable_ = void; - struct Impl_ { - inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept; - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena); - inline explicit Impl_( - ::google::protobuf::internal::InternalVisibility visibility, - ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from, - const Violations& from_msg); - ::google::protobuf::internal::HasBits<1> _has_bits_; - ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::RepeatedPtrField< ::buf::validate::Violation > violations_; - PROTOBUF_TSAN_DECLARE_MEMBER - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_buf_2fvalidate_2fvalidate_2eproto; -}; - -extern const ::google::protobuf::internal::ClassDataFull Violations_class_data_; - -// =================================================================== - - - -inline constexpr int kMessageFieldNumber = 1159; -extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::MessageOptions, ::google::protobuf::internal::MessageTypeTraits< ::buf::validate::MessageRules >, 11, false> - message; -inline constexpr int kOneofFieldNumber = 1159; -extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::OneofOptions, ::google::protobuf::internal::MessageTypeTraits< ::buf::validate::OneofRules >, 11, false> - oneof; -inline constexpr int kFieldFieldNumber = 1159; -extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::FieldOptions, ::google::protobuf::internal::MessageTypeTraits< ::buf::validate::FieldRules >, 11, false> - field; -inline constexpr int kPredefinedFieldNumber = 1160; -extern ::google::protobuf::internal::ExtensionIdentifier< - ::google::protobuf::FieldOptions, ::google::protobuf::internal::MessageTypeTraits< ::buf::validate::PredefinedRules >, 11, false> - predefined; - -// =================================================================== - - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// ------------------------------------------------------------------- - -// Rule - -// optional string id = 1; -inline bool Rule::has_id() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - return value; -} -inline void Rule::clear_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.id_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline const ::std::string& Rule::id() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Rule.id) - return _internal_id(); -} -template -PROTOBUF_ALWAYS_INLINE void Rule::set_id(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - _impl_.id_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.Rule.id) -} -inline ::std::string* PROTOBUF_NONNULL Rule::mutable_id() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::std::string* _s = _internal_mutable_id(); - // @@protoc_insertion_point(field_mutable:buf.validate.Rule.id) - return _s; -} -inline const ::std::string& Rule::_internal_id() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.id_.Get(); -} -inline void Rule::_internal_set_id(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.id_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL Rule::_internal_mutable_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.id_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE Rule::release_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Rule.id) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000001U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - auto* released = _impl_.id_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.id_.Set("", GetArena()); - } - return released; -} -inline void Rule::set_allocated_id(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - _impl_.id_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.id_.IsDefault()) { - _impl_.id_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.Rule.id) -} - -// optional string message = 2; -inline bool Rule::has_message() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void Rule::clear_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.message_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline const ::std::string& Rule::message() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Rule.message) - return _internal_message(); -} -template -PROTOBUF_ALWAYS_INLINE void Rule::set_message(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - _impl_.message_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.Rule.message) -} -inline ::std::string* PROTOBUF_NONNULL Rule::mutable_message() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - ::std::string* _s = _internal_mutable_message(); - // @@protoc_insertion_point(field_mutable:buf.validate.Rule.message) - return _s; -} -inline const ::std::string& Rule::_internal_message() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.message_.Get(); -} -inline void Rule::_internal_set_message(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.message_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL Rule::_internal_mutable_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.message_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE Rule::release_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Rule.message) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000002U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - auto* released = _impl_.message_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.message_.Set("", GetArena()); - } - return released; -} -inline void Rule::set_allocated_message(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - _impl_.message_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.message_.IsDefault()) { - _impl_.message_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.Rule.message) -} - -// optional string expression = 3; -inline bool Rule::has_expression() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void Rule::clear_expression() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.expression_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline const ::std::string& Rule::expression() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Rule.expression) - return _internal_expression(); -} -template -PROTOBUF_ALWAYS_INLINE void Rule::set_expression(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - _impl_.expression_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.Rule.expression) -} -inline ::std::string* PROTOBUF_NONNULL Rule::mutable_expression() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - ::std::string* _s = _internal_mutable_expression(); - // @@protoc_insertion_point(field_mutable:buf.validate.Rule.expression) - return _s; -} -inline const ::std::string& Rule::_internal_expression() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.expression_.Get(); -} -inline void Rule::_internal_set_expression(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.expression_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL Rule::_internal_mutable_expression() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.expression_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE Rule::release_expression() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Rule.expression) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000004U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - auto* released = _impl_.expression_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.expression_.Set("", GetArena()); - } - return released; -} -inline void Rule::set_allocated_expression(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - } - _impl_.expression_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.expression_.IsDefault()) { - _impl_.expression_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.Rule.expression) -} - -// ------------------------------------------------------------------- - -// MessageRules - -// repeated string cel_expression = 5; -inline int MessageRules::_internal_cel_expression_size() const { - return _internal_cel_expression().size(); -} -inline int MessageRules::cel_expression_size() const { - return _internal_cel_expression_size(); -} -inline void MessageRules::clear_cel_expression() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.cel_expression_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::std::string* PROTOBUF_NONNULL MessageRules::add_cel_expression() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_cel_expression()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.MessageRules.cel_expression) - return _s; -} -inline const ::std::string& MessageRules::cel_expression(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MessageRules.cel_expression) - return _internal_cel_expression().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL MessageRules::mutable_cel_expression(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.MessageRules.cel_expression) - return _internal_mutable_cel_expression()->Mutable(index); -} -template -inline void MessageRules::set_cel_expression(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_cel_expression()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.MessageRules.cel_expression) -} -template -inline void MessageRules::add_cel_expression(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_cel_expression(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.MessageRules.cel_expression) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& MessageRules::cel_expression() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.MessageRules.cel_expression) - return _internal_cel_expression(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -MessageRules::mutable_cel_expression() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.MessageRules.cel_expression) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_cel_expression(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -MessageRules::_internal_cel_expression() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.cel_expression_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -MessageRules::_internal_mutable_cel_expression() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.cel_expression_; -} - -// repeated .buf.validate.Rule cel = 3; -inline int MessageRules::_internal_cel_size() const { - return _internal_cel().size(); -} -inline int MessageRules::cel_size() const { - return _internal_cel_size(); -} -inline void MessageRules::clear_cel() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.cel_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL MessageRules::mutable_cel(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.MessageRules.cel) - return _internal_mutable_cel()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL MessageRules::mutable_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.MessageRules.cel) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_cel(); -} -inline const ::buf::validate::Rule& MessageRules::cel(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MessageRules.cel) - return _internal_cel().Get(index); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL MessageRules::add_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::Rule* _add = - _internal_mutable_cel()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.MessageRules.cel) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& MessageRules::cel() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.MessageRules.cel) - return _internal_cel(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& -MessageRules::_internal_cel() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.cel_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL -MessageRules::_internal_mutable_cel() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.cel_; -} - -// repeated .buf.validate.MessageOneofRule oneof = 4; -inline int MessageRules::_internal_oneof_size() const { - return _internal_oneof().size(); -} -inline int MessageRules::oneof_size() const { - return _internal_oneof_size(); -} -inline void MessageRules::clear_oneof() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.oneof_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::buf::validate::MessageOneofRule* PROTOBUF_NONNULL MessageRules::mutable_oneof(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.MessageRules.oneof) - return _internal_mutable_oneof()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>* PROTOBUF_NONNULL MessageRules::mutable_oneof() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.MessageRules.oneof) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_oneof(); -} -inline const ::buf::validate::MessageOneofRule& MessageRules::oneof(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MessageRules.oneof) - return _internal_oneof().Get(index); -} -inline ::buf::validate::MessageOneofRule* PROTOBUF_NONNULL MessageRules::add_oneof() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::MessageOneofRule* _add = - _internal_mutable_oneof()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.MessageRules.oneof) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>& MessageRules::oneof() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.MessageRules.oneof) - return _internal_oneof(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>& -MessageRules::_internal_oneof() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.oneof_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::MessageOneofRule>* PROTOBUF_NONNULL -MessageRules::_internal_mutable_oneof() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.oneof_; -} - -// ------------------------------------------------------------------- - -// MessageOneofRule - -// repeated string fields = 1; -inline int MessageOneofRule::_internal_fields_size() const { - return _internal_fields().size(); -} -inline int MessageOneofRule::fields_size() const { - return _internal_fields_size(); -} -inline void MessageOneofRule::clear_fields() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.fields_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::std::string* PROTOBUF_NONNULL MessageOneofRule::add_fields() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_fields()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.MessageOneofRule.fields) - return _s; -} -inline const ::std::string& MessageOneofRule::fields(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MessageOneofRule.fields) - return _internal_fields().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL MessageOneofRule::mutable_fields(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.MessageOneofRule.fields) - return _internal_mutable_fields()->Mutable(index); -} -template -inline void MessageOneofRule::set_fields(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_fields()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.MessageOneofRule.fields) -} -template -inline void MessageOneofRule::add_fields(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_fields(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.MessageOneofRule.fields) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& MessageOneofRule::fields() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.MessageOneofRule.fields) - return _internal_fields(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -MessageOneofRule::mutable_fields() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.MessageOneofRule.fields) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_fields(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -MessageOneofRule::_internal_fields() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.fields_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -MessageOneofRule::_internal_mutable_fields() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.fields_; -} - -// optional bool required = 2; -inline bool MessageOneofRule::has_required() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void MessageOneofRule::clear_required() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline bool MessageOneofRule::required() const { - // @@protoc_insertion_point(field_get:buf.validate.MessageOneofRule.required) - return _internal_required(); -} -inline void MessageOneofRule::set_required(bool value) { - _internal_set_required(value); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_set:buf.validate.MessageOneofRule.required) -} -inline bool MessageOneofRule::_internal_required() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.required_; -} -inline void MessageOneofRule::_internal_set_required(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = value; -} - -// ------------------------------------------------------------------- - -// OneofRules - -// optional bool required = 1; -inline bool OneofRules::has_required() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - return value; -} -inline void OneofRules::clear_required() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline bool OneofRules::required() const { - // @@protoc_insertion_point(field_get:buf.validate.OneofRules.required) - return _internal_required(); -} -inline void OneofRules::set_required(bool value) { - _internal_set_required(value); - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_set:buf.validate.OneofRules.required) -} -inline bool OneofRules::_internal_required() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.required_; -} -inline void OneofRules::_internal_set_required(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = value; -} - -// ------------------------------------------------------------------- - -// FieldRules - -// repeated string cel_expression = 29; -inline int FieldRules::_internal_cel_expression_size() const { - return _internal_cel_expression().size(); -} -inline int FieldRules::cel_expression_size() const { - return _internal_cel_expression_size(); -} -inline void FieldRules::clear_cel_expression() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.cel_expression_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::std::string* PROTOBUF_NONNULL FieldRules::add_cel_expression() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_cel_expression()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.FieldRules.cel_expression) - return _s; -} -inline const ::std::string& FieldRules::cel_expression(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.cel_expression) - return _internal_cel_expression().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL FieldRules::mutable_cel_expression(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.cel_expression) - return _internal_mutable_cel_expression()->Mutable(index); -} -template -inline void FieldRules::set_cel_expression(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_cel_expression()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.FieldRules.cel_expression) -} -template -inline void FieldRules::add_cel_expression(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_cel_expression(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.FieldRules.cel_expression) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& FieldRules::cel_expression() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldRules.cel_expression) - return _internal_cel_expression(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldRules::mutable_cel_expression() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldRules.cel_expression) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_cel_expression(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -FieldRules::_internal_cel_expression() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.cel_expression_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldRules::_internal_mutable_cel_expression() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.cel_expression_; -} - -// repeated .buf.validate.Rule cel = 23; -inline int FieldRules::_internal_cel_size() const { - return _internal_cel().size(); -} -inline int FieldRules::cel_size() const { - return _internal_cel_size(); -} -inline void FieldRules::clear_cel() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.cel_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL FieldRules::mutable_cel(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.cel) - return _internal_mutable_cel()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL FieldRules::mutable_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldRules.cel) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_cel(); -} -inline const ::buf::validate::Rule& FieldRules::cel(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.cel) - return _internal_cel().Get(index); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL FieldRules::add_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::Rule* _add = - _internal_mutable_cel()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.FieldRules.cel) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& FieldRules::cel() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldRules.cel) - return _internal_cel(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& -FieldRules::_internal_cel() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.cel_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL -FieldRules::_internal_mutable_cel() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.cel_; -} - -// optional bool required = 25; -inline bool FieldRules::has_required() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void FieldRules::clear_required() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline bool FieldRules::required() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.required) - return _internal_required(); -} -inline void FieldRules::set_required(bool value) { - _internal_set_required(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.FieldRules.required) -} -inline bool FieldRules::_internal_required() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.required_; -} -inline void FieldRules::_internal_set_required(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.required_ = value; -} - -// optional .buf.validate.Ignore ignore = 27; -inline bool FieldRules::has_ignore() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void FieldRules::clear_ignore() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.ignore_ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::buf::validate::Ignore FieldRules::ignore() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.ignore) - return _internal_ignore(); -} -inline void FieldRules::set_ignore(::buf::validate::Ignore value) { - _internal_set_ignore(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.FieldRules.ignore) -} -inline ::buf::validate::Ignore FieldRules::_internal_ignore() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return static_cast<::buf::validate::Ignore>(_impl_.ignore_); -} -inline void FieldRules::_internal_set_ignore(::buf::validate::Ignore value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - - assert(::google::protobuf::internal::ValidateEnum( - value, ::buf::validate::Ignore_internal_data_)); - _impl_.ignore_ = value; -} - -// .buf.validate.FloatRules float = 1; -inline bool FieldRules::has_float_() const { - return type_case() == kFloat; -} -inline bool FieldRules::_internal_has_float_() const { - return type_case() == kFloat; -} -inline void FieldRules::set_has_float_() { - _impl_._oneof_case_[0] = kFloat; -} -inline void FieldRules::clear_float_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kFloat) { - if (GetArena() == nullptr) { - delete _impl_.type_.float__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.float__); - } - clear_has_type(); - } -} -inline ::buf::validate::FloatRules* PROTOBUF_NULLABLE FieldRules::release_float_() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.float) - if (type_case() == kFloat) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::FloatRules*>(_impl_.type_.float__); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.float__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::FloatRules& FieldRules::_internal_float_() const { - return type_case() == kFloat ? static_cast(*reinterpret_cast<::buf::validate::FloatRules*>(_impl_.type_.float__)) - : reinterpret_cast(::buf::validate::_FloatRules_default_instance_); -} -inline const ::buf::validate::FloatRules& FieldRules::float_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.float) - return _internal_float_(); -} -inline ::buf::validate::FloatRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_float_() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.float) - if (type_case() == kFloat) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::FloatRules*>(_impl_.type_.float__); - _impl_.type_.float__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_float_( - ::buf::validate::FloatRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_float_(); - _impl_.type_.float__ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.float) -} -inline ::buf::validate::FloatRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_float_() { - if (type_case() != kFloat) { - clear_type(); - set_has_float_(); - _impl_.type_.float__ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::FloatRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::FloatRules*>(_impl_.type_.float__); -} -inline ::buf::validate::FloatRules* PROTOBUF_NONNULL FieldRules::mutable_float_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::FloatRules* _msg = _internal_mutable_float_(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.float) - return _msg; -} - -// .buf.validate.DoubleRules double = 2; -inline bool FieldRules::has_double_() const { - return type_case() == kDouble; -} -inline bool FieldRules::_internal_has_double_() const { - return type_case() == kDouble; -} -inline void FieldRules::set_has_double_() { - _impl_._oneof_case_[0] = kDouble; -} -inline void FieldRules::clear_double_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kDouble) { - if (GetArena() == nullptr) { - delete _impl_.type_.double__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.double__); - } - clear_has_type(); - } -} -inline ::buf::validate::DoubleRules* PROTOBUF_NULLABLE FieldRules::release_double_() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.double) - if (type_case() == kDouble) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::DoubleRules*>(_impl_.type_.double__); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.double__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::DoubleRules& FieldRules::_internal_double_() const { - return type_case() == kDouble ? static_cast(*reinterpret_cast<::buf::validate::DoubleRules*>(_impl_.type_.double__)) - : reinterpret_cast(::buf::validate::_DoubleRules_default_instance_); -} -inline const ::buf::validate::DoubleRules& FieldRules::double_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.double) - return _internal_double_(); -} -inline ::buf::validate::DoubleRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_double_() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.double) - if (type_case() == kDouble) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::DoubleRules*>(_impl_.type_.double__); - _impl_.type_.double__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_double_( - ::buf::validate::DoubleRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_double_(); - _impl_.type_.double__ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.double) -} -inline ::buf::validate::DoubleRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_double_() { - if (type_case() != kDouble) { - clear_type(); - set_has_double_(); - _impl_.type_.double__ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::DoubleRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::DoubleRules*>(_impl_.type_.double__); -} -inline ::buf::validate::DoubleRules* PROTOBUF_NONNULL FieldRules::mutable_double_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::DoubleRules* _msg = _internal_mutable_double_(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.double) - return _msg; -} - -// .buf.validate.Int32Rules int32 = 3; -inline bool FieldRules::has_int32() const { - return type_case() == kInt32; -} -inline bool FieldRules::_internal_has_int32() const { - return type_case() == kInt32; -} -inline void FieldRules::set_has_int32() { - _impl_._oneof_case_[0] = kInt32; -} -inline void FieldRules::clear_int32() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kInt32) { - if (GetArena() == nullptr) { - delete _impl_.type_.int32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.int32_); - } - clear_has_type(); - } -} -inline ::buf::validate::Int32Rules* PROTOBUF_NULLABLE FieldRules::release_int32() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.int32) - if (type_case() == kInt32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Int32Rules*>(_impl_.type_.int32_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.int32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::Int32Rules& FieldRules::_internal_int32() const { - return type_case() == kInt32 ? static_cast(*reinterpret_cast<::buf::validate::Int32Rules*>(_impl_.type_.int32_)) - : reinterpret_cast(::buf::validate::_Int32Rules_default_instance_); -} -inline const ::buf::validate::Int32Rules& FieldRules::int32() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.int32) - return _internal_int32(); -} -inline ::buf::validate::Int32Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_int32() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.int32) - if (type_case() == kInt32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Int32Rules*>(_impl_.type_.int32_); - _impl_.type_.int32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_int32( - ::buf::validate::Int32Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_int32(); - _impl_.type_.int32_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.int32) -} -inline ::buf::validate::Int32Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_int32() { - if (type_case() != kInt32) { - clear_type(); - set_has_int32(); - _impl_.type_.int32_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::Int32Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::Int32Rules*>(_impl_.type_.int32_); -} -inline ::buf::validate::Int32Rules* PROTOBUF_NONNULL FieldRules::mutable_int32() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::Int32Rules* _msg = _internal_mutable_int32(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.int32) - return _msg; -} - -// .buf.validate.Int64Rules int64 = 4; -inline bool FieldRules::has_int64() const { - return type_case() == kInt64; -} -inline bool FieldRules::_internal_has_int64() const { - return type_case() == kInt64; -} -inline void FieldRules::set_has_int64() { - _impl_._oneof_case_[0] = kInt64; -} -inline void FieldRules::clear_int64() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kInt64) { - if (GetArena() == nullptr) { - delete _impl_.type_.int64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.int64_); - } - clear_has_type(); - } -} -inline ::buf::validate::Int64Rules* PROTOBUF_NULLABLE FieldRules::release_int64() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.int64) - if (type_case() == kInt64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Int64Rules*>(_impl_.type_.int64_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.int64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::Int64Rules& FieldRules::_internal_int64() const { - return type_case() == kInt64 ? static_cast(*reinterpret_cast<::buf::validate::Int64Rules*>(_impl_.type_.int64_)) - : reinterpret_cast(::buf::validate::_Int64Rules_default_instance_); -} -inline const ::buf::validate::Int64Rules& FieldRules::int64() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.int64) - return _internal_int64(); -} -inline ::buf::validate::Int64Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_int64() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.int64) - if (type_case() == kInt64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Int64Rules*>(_impl_.type_.int64_); - _impl_.type_.int64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_int64( - ::buf::validate::Int64Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_int64(); - _impl_.type_.int64_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.int64) -} -inline ::buf::validate::Int64Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_int64() { - if (type_case() != kInt64) { - clear_type(); - set_has_int64(); - _impl_.type_.int64_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::Int64Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::Int64Rules*>(_impl_.type_.int64_); -} -inline ::buf::validate::Int64Rules* PROTOBUF_NONNULL FieldRules::mutable_int64() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::Int64Rules* _msg = _internal_mutable_int64(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.int64) - return _msg; -} - -// .buf.validate.UInt32Rules uint32 = 5; -inline bool FieldRules::has_uint32() const { - return type_case() == kUint32; -} -inline bool FieldRules::_internal_has_uint32() const { - return type_case() == kUint32; -} -inline void FieldRules::set_has_uint32() { - _impl_._oneof_case_[0] = kUint32; -} -inline void FieldRules::clear_uint32() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kUint32) { - if (GetArena() == nullptr) { - delete _impl_.type_.uint32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.uint32_); - } - clear_has_type(); - } -} -inline ::buf::validate::UInt32Rules* PROTOBUF_NULLABLE FieldRules::release_uint32() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.uint32) - if (type_case() == kUint32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::UInt32Rules*>(_impl_.type_.uint32_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.uint32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::UInt32Rules& FieldRules::_internal_uint32() const { - return type_case() == kUint32 ? static_cast(*reinterpret_cast<::buf::validate::UInt32Rules*>(_impl_.type_.uint32_)) - : reinterpret_cast(::buf::validate::_UInt32Rules_default_instance_); -} -inline const ::buf::validate::UInt32Rules& FieldRules::uint32() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.uint32) - return _internal_uint32(); -} -inline ::buf::validate::UInt32Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_uint32() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.uint32) - if (type_case() == kUint32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::UInt32Rules*>(_impl_.type_.uint32_); - _impl_.type_.uint32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_uint32( - ::buf::validate::UInt32Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_uint32(); - _impl_.type_.uint32_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.uint32) -} -inline ::buf::validate::UInt32Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_uint32() { - if (type_case() != kUint32) { - clear_type(); - set_has_uint32(); - _impl_.type_.uint32_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::UInt32Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::UInt32Rules*>(_impl_.type_.uint32_); -} -inline ::buf::validate::UInt32Rules* PROTOBUF_NONNULL FieldRules::mutable_uint32() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::UInt32Rules* _msg = _internal_mutable_uint32(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.uint32) - return _msg; -} - -// .buf.validate.UInt64Rules uint64 = 6; -inline bool FieldRules::has_uint64() const { - return type_case() == kUint64; -} -inline bool FieldRules::_internal_has_uint64() const { - return type_case() == kUint64; -} -inline void FieldRules::set_has_uint64() { - _impl_._oneof_case_[0] = kUint64; -} -inline void FieldRules::clear_uint64() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kUint64) { - if (GetArena() == nullptr) { - delete _impl_.type_.uint64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.uint64_); - } - clear_has_type(); - } -} -inline ::buf::validate::UInt64Rules* PROTOBUF_NULLABLE FieldRules::release_uint64() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.uint64) - if (type_case() == kUint64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::UInt64Rules*>(_impl_.type_.uint64_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.uint64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::UInt64Rules& FieldRules::_internal_uint64() const { - return type_case() == kUint64 ? static_cast(*reinterpret_cast<::buf::validate::UInt64Rules*>(_impl_.type_.uint64_)) - : reinterpret_cast(::buf::validate::_UInt64Rules_default_instance_); -} -inline const ::buf::validate::UInt64Rules& FieldRules::uint64() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.uint64) - return _internal_uint64(); -} -inline ::buf::validate::UInt64Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_uint64() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.uint64) - if (type_case() == kUint64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::UInt64Rules*>(_impl_.type_.uint64_); - _impl_.type_.uint64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_uint64( - ::buf::validate::UInt64Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_uint64(); - _impl_.type_.uint64_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.uint64) -} -inline ::buf::validate::UInt64Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_uint64() { - if (type_case() != kUint64) { - clear_type(); - set_has_uint64(); - _impl_.type_.uint64_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::UInt64Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::UInt64Rules*>(_impl_.type_.uint64_); -} -inline ::buf::validate::UInt64Rules* PROTOBUF_NONNULL FieldRules::mutable_uint64() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::UInt64Rules* _msg = _internal_mutable_uint64(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.uint64) - return _msg; -} - -// .buf.validate.SInt32Rules sint32 = 7; -inline bool FieldRules::has_sint32() const { - return type_case() == kSint32; -} -inline bool FieldRules::_internal_has_sint32() const { - return type_case() == kSint32; -} -inline void FieldRules::set_has_sint32() { - _impl_._oneof_case_[0] = kSint32; -} -inline void FieldRules::clear_sint32() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kSint32) { - if (GetArena() == nullptr) { - delete _impl_.type_.sint32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sint32_); - } - clear_has_type(); - } -} -inline ::buf::validate::SInt32Rules* PROTOBUF_NULLABLE FieldRules::release_sint32() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.sint32) - if (type_case() == kSint32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SInt32Rules*>(_impl_.type_.sint32_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.sint32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::SInt32Rules& FieldRules::_internal_sint32() const { - return type_case() == kSint32 ? static_cast(*reinterpret_cast<::buf::validate::SInt32Rules*>(_impl_.type_.sint32_)) - : reinterpret_cast(::buf::validate::_SInt32Rules_default_instance_); -} -inline const ::buf::validate::SInt32Rules& FieldRules::sint32() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.sint32) - return _internal_sint32(); -} -inline ::buf::validate::SInt32Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_sint32() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.sint32) - if (type_case() == kSint32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SInt32Rules*>(_impl_.type_.sint32_); - _impl_.type_.sint32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_sint32( - ::buf::validate::SInt32Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_sint32(); - _impl_.type_.sint32_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.sint32) -} -inline ::buf::validate::SInt32Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_sint32() { - if (type_case() != kSint32) { - clear_type(); - set_has_sint32(); - _impl_.type_.sint32_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::SInt32Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::SInt32Rules*>(_impl_.type_.sint32_); -} -inline ::buf::validate::SInt32Rules* PROTOBUF_NONNULL FieldRules::mutable_sint32() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::SInt32Rules* _msg = _internal_mutable_sint32(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.sint32) - return _msg; -} - -// .buf.validate.SInt64Rules sint64 = 8; -inline bool FieldRules::has_sint64() const { - return type_case() == kSint64; -} -inline bool FieldRules::_internal_has_sint64() const { - return type_case() == kSint64; -} -inline void FieldRules::set_has_sint64() { - _impl_._oneof_case_[0] = kSint64; -} -inline void FieldRules::clear_sint64() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kSint64) { - if (GetArena() == nullptr) { - delete _impl_.type_.sint64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sint64_); - } - clear_has_type(); - } -} -inline ::buf::validate::SInt64Rules* PROTOBUF_NULLABLE FieldRules::release_sint64() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.sint64) - if (type_case() == kSint64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SInt64Rules*>(_impl_.type_.sint64_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.sint64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::SInt64Rules& FieldRules::_internal_sint64() const { - return type_case() == kSint64 ? static_cast(*reinterpret_cast<::buf::validate::SInt64Rules*>(_impl_.type_.sint64_)) - : reinterpret_cast(::buf::validate::_SInt64Rules_default_instance_); -} -inline const ::buf::validate::SInt64Rules& FieldRules::sint64() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.sint64) - return _internal_sint64(); -} -inline ::buf::validate::SInt64Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_sint64() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.sint64) - if (type_case() == kSint64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SInt64Rules*>(_impl_.type_.sint64_); - _impl_.type_.sint64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_sint64( - ::buf::validate::SInt64Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_sint64(); - _impl_.type_.sint64_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.sint64) -} -inline ::buf::validate::SInt64Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_sint64() { - if (type_case() != kSint64) { - clear_type(); - set_has_sint64(); - _impl_.type_.sint64_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::SInt64Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::SInt64Rules*>(_impl_.type_.sint64_); -} -inline ::buf::validate::SInt64Rules* PROTOBUF_NONNULL FieldRules::mutable_sint64() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::SInt64Rules* _msg = _internal_mutable_sint64(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.sint64) - return _msg; -} - -// .buf.validate.Fixed32Rules fixed32 = 9; -inline bool FieldRules::has_fixed32() const { - return type_case() == kFixed32; -} -inline bool FieldRules::_internal_has_fixed32() const { - return type_case() == kFixed32; -} -inline void FieldRules::set_has_fixed32() { - _impl_._oneof_case_[0] = kFixed32; -} -inline void FieldRules::clear_fixed32() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kFixed32) { - if (GetArena() == nullptr) { - delete _impl_.type_.fixed32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.fixed32_); - } - clear_has_type(); - } -} -inline ::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE FieldRules::release_fixed32() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.fixed32) - if (type_case() == kFixed32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Fixed32Rules*>(_impl_.type_.fixed32_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.fixed32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::Fixed32Rules& FieldRules::_internal_fixed32() const { - return type_case() == kFixed32 ? static_cast(*reinterpret_cast<::buf::validate::Fixed32Rules*>(_impl_.type_.fixed32_)) - : reinterpret_cast(::buf::validate::_Fixed32Rules_default_instance_); -} -inline const ::buf::validate::Fixed32Rules& FieldRules::fixed32() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.fixed32) - return _internal_fixed32(); -} -inline ::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_fixed32() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.fixed32) - if (type_case() == kFixed32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Fixed32Rules*>(_impl_.type_.fixed32_); - _impl_.type_.fixed32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_fixed32( - ::buf::validate::Fixed32Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_fixed32(); - _impl_.type_.fixed32_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.fixed32) -} -inline ::buf::validate::Fixed32Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_fixed32() { - if (type_case() != kFixed32) { - clear_type(); - set_has_fixed32(); - _impl_.type_.fixed32_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::Fixed32Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::Fixed32Rules*>(_impl_.type_.fixed32_); -} -inline ::buf::validate::Fixed32Rules* PROTOBUF_NONNULL FieldRules::mutable_fixed32() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::Fixed32Rules* _msg = _internal_mutable_fixed32(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.fixed32) - return _msg; -} - -// .buf.validate.Fixed64Rules fixed64 = 10; -inline bool FieldRules::has_fixed64() const { - return type_case() == kFixed64; -} -inline bool FieldRules::_internal_has_fixed64() const { - return type_case() == kFixed64; -} -inline void FieldRules::set_has_fixed64() { - _impl_._oneof_case_[0] = kFixed64; -} -inline void FieldRules::clear_fixed64() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kFixed64) { - if (GetArena() == nullptr) { - delete _impl_.type_.fixed64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.fixed64_); - } - clear_has_type(); - } -} -inline ::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE FieldRules::release_fixed64() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.fixed64) - if (type_case() == kFixed64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Fixed64Rules*>(_impl_.type_.fixed64_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.fixed64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::Fixed64Rules& FieldRules::_internal_fixed64() const { - return type_case() == kFixed64 ? static_cast(*reinterpret_cast<::buf::validate::Fixed64Rules*>(_impl_.type_.fixed64_)) - : reinterpret_cast(::buf::validate::_Fixed64Rules_default_instance_); -} -inline const ::buf::validate::Fixed64Rules& FieldRules::fixed64() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.fixed64) - return _internal_fixed64(); -} -inline ::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_fixed64() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.fixed64) - if (type_case() == kFixed64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::Fixed64Rules*>(_impl_.type_.fixed64_); - _impl_.type_.fixed64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_fixed64( - ::buf::validate::Fixed64Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_fixed64(); - _impl_.type_.fixed64_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.fixed64) -} -inline ::buf::validate::Fixed64Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_fixed64() { - if (type_case() != kFixed64) { - clear_type(); - set_has_fixed64(); - _impl_.type_.fixed64_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::Fixed64Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::Fixed64Rules*>(_impl_.type_.fixed64_); -} -inline ::buf::validate::Fixed64Rules* PROTOBUF_NONNULL FieldRules::mutable_fixed64() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::Fixed64Rules* _msg = _internal_mutable_fixed64(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.fixed64) - return _msg; -} - -// .buf.validate.SFixed32Rules sfixed32 = 11; -inline bool FieldRules::has_sfixed32() const { - return type_case() == kSfixed32; -} -inline bool FieldRules::_internal_has_sfixed32() const { - return type_case() == kSfixed32; -} -inline void FieldRules::set_has_sfixed32() { - _impl_._oneof_case_[0] = kSfixed32; -} -inline void FieldRules::clear_sfixed32() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kSfixed32) { - if (GetArena() == nullptr) { - delete _impl_.type_.sfixed32_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sfixed32_); - } - clear_has_type(); - } -} -inline ::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE FieldRules::release_sfixed32() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.sfixed32) - if (type_case() == kSfixed32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SFixed32Rules*>(_impl_.type_.sfixed32_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.sfixed32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::SFixed32Rules& FieldRules::_internal_sfixed32() const { - return type_case() == kSfixed32 ? static_cast(*reinterpret_cast<::buf::validate::SFixed32Rules*>(_impl_.type_.sfixed32_)) - : reinterpret_cast(::buf::validate::_SFixed32Rules_default_instance_); -} -inline const ::buf::validate::SFixed32Rules& FieldRules::sfixed32() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.sfixed32) - return _internal_sfixed32(); -} -inline ::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_sfixed32() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.sfixed32) - if (type_case() == kSfixed32) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SFixed32Rules*>(_impl_.type_.sfixed32_); - _impl_.type_.sfixed32_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_sfixed32( - ::buf::validate::SFixed32Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_sfixed32(); - _impl_.type_.sfixed32_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.sfixed32) -} -inline ::buf::validate::SFixed32Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_sfixed32() { - if (type_case() != kSfixed32) { - clear_type(); - set_has_sfixed32(); - _impl_.type_.sfixed32_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::SFixed32Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::SFixed32Rules*>(_impl_.type_.sfixed32_); -} -inline ::buf::validate::SFixed32Rules* PROTOBUF_NONNULL FieldRules::mutable_sfixed32() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::SFixed32Rules* _msg = _internal_mutable_sfixed32(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.sfixed32) - return _msg; -} - -// .buf.validate.SFixed64Rules sfixed64 = 12; -inline bool FieldRules::has_sfixed64() const { - return type_case() == kSfixed64; -} -inline bool FieldRules::_internal_has_sfixed64() const { - return type_case() == kSfixed64; -} -inline void FieldRules::set_has_sfixed64() { - _impl_._oneof_case_[0] = kSfixed64; -} -inline void FieldRules::clear_sfixed64() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kSfixed64) { - if (GetArena() == nullptr) { - delete _impl_.type_.sfixed64_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.sfixed64_); - } - clear_has_type(); - } -} -inline ::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE FieldRules::release_sfixed64() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.sfixed64) - if (type_case() == kSfixed64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SFixed64Rules*>(_impl_.type_.sfixed64_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.sfixed64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::SFixed64Rules& FieldRules::_internal_sfixed64() const { - return type_case() == kSfixed64 ? static_cast(*reinterpret_cast<::buf::validate::SFixed64Rules*>(_impl_.type_.sfixed64_)) - : reinterpret_cast(::buf::validate::_SFixed64Rules_default_instance_); -} -inline const ::buf::validate::SFixed64Rules& FieldRules::sfixed64() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.sfixed64) - return _internal_sfixed64(); -} -inline ::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_sfixed64() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.sfixed64) - if (type_case() == kSfixed64) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::SFixed64Rules*>(_impl_.type_.sfixed64_); - _impl_.type_.sfixed64_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_sfixed64( - ::buf::validate::SFixed64Rules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_sfixed64(); - _impl_.type_.sfixed64_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.sfixed64) -} -inline ::buf::validate::SFixed64Rules* PROTOBUF_NONNULL FieldRules::_internal_mutable_sfixed64() { - if (type_case() != kSfixed64) { - clear_type(); - set_has_sfixed64(); - _impl_.type_.sfixed64_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::SFixed64Rules>(GetArena())); - } - return reinterpret_cast<::buf::validate::SFixed64Rules*>(_impl_.type_.sfixed64_); -} -inline ::buf::validate::SFixed64Rules* PROTOBUF_NONNULL FieldRules::mutable_sfixed64() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::SFixed64Rules* _msg = _internal_mutable_sfixed64(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.sfixed64) - return _msg; -} - -// .buf.validate.BoolRules bool = 13; -inline bool FieldRules::has_bool_() const { - return type_case() == kBool; -} -inline bool FieldRules::_internal_has_bool_() const { - return type_case() == kBool; -} -inline void FieldRules::set_has_bool_() { - _impl_._oneof_case_[0] = kBool; -} -inline void FieldRules::clear_bool_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kBool) { - if (GetArena() == nullptr) { - delete _impl_.type_.bool__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.bool__); - } - clear_has_type(); - } -} -inline ::buf::validate::BoolRules* PROTOBUF_NULLABLE FieldRules::release_bool_() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.bool) - if (type_case() == kBool) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::BoolRules*>(_impl_.type_.bool__); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.bool__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::BoolRules& FieldRules::_internal_bool_() const { - return type_case() == kBool ? static_cast(*reinterpret_cast<::buf::validate::BoolRules*>(_impl_.type_.bool__)) - : reinterpret_cast(::buf::validate::_BoolRules_default_instance_); -} -inline const ::buf::validate::BoolRules& FieldRules::bool_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.bool) - return _internal_bool_(); -} -inline ::buf::validate::BoolRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_bool_() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.bool) - if (type_case() == kBool) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::BoolRules*>(_impl_.type_.bool__); - _impl_.type_.bool__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_bool_( - ::buf::validate::BoolRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_bool_(); - _impl_.type_.bool__ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.bool) -} -inline ::buf::validate::BoolRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_bool_() { - if (type_case() != kBool) { - clear_type(); - set_has_bool_(); - _impl_.type_.bool__ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::BoolRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::BoolRules*>(_impl_.type_.bool__); -} -inline ::buf::validate::BoolRules* PROTOBUF_NONNULL FieldRules::mutable_bool_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::BoolRules* _msg = _internal_mutable_bool_(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.bool) - return _msg; -} - -// .buf.validate.StringRules string = 14; -inline bool FieldRules::has_string() const { - return type_case() == kString; -} -inline bool FieldRules::_internal_has_string() const { - return type_case() == kString; -} -inline void FieldRules::set_has_string() { - _impl_._oneof_case_[0] = kString; -} -inline void FieldRules::clear_string() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kString) { - if (GetArena() == nullptr) { - delete _impl_.type_.string_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.string_); - } - clear_has_type(); - } -} -inline ::buf::validate::StringRules* PROTOBUF_NULLABLE FieldRules::release_string() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.string) - if (type_case() == kString) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::StringRules*>(_impl_.type_.string_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.string_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::StringRules& FieldRules::_internal_string() const { - return type_case() == kString ? static_cast(*reinterpret_cast<::buf::validate::StringRules*>(_impl_.type_.string_)) - : reinterpret_cast(::buf::validate::_StringRules_default_instance_); -} -inline const ::buf::validate::StringRules& FieldRules::string() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.string) - return _internal_string(); -} -inline ::buf::validate::StringRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_string() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.string) - if (type_case() == kString) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::StringRules*>(_impl_.type_.string_); - _impl_.type_.string_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_string( - ::buf::validate::StringRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_string(); - _impl_.type_.string_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.string) -} -inline ::buf::validate::StringRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_string() { - if (type_case() != kString) { - clear_type(); - set_has_string(); - _impl_.type_.string_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::StringRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::StringRules*>(_impl_.type_.string_); -} -inline ::buf::validate::StringRules* PROTOBUF_NONNULL FieldRules::mutable_string() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::StringRules* _msg = _internal_mutable_string(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.string) - return _msg; -} - -// .buf.validate.BytesRules bytes = 15; -inline bool FieldRules::has_bytes() const { - return type_case() == kBytes; -} -inline bool FieldRules::_internal_has_bytes() const { - return type_case() == kBytes; -} -inline void FieldRules::set_has_bytes() { - _impl_._oneof_case_[0] = kBytes; -} -inline void FieldRules::clear_bytes() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kBytes) { - if (GetArena() == nullptr) { - delete _impl_.type_.bytes_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.bytes_); - } - clear_has_type(); - } -} -inline ::buf::validate::BytesRules* PROTOBUF_NULLABLE FieldRules::release_bytes() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.bytes) - if (type_case() == kBytes) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::BytesRules*>(_impl_.type_.bytes_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.bytes_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::BytesRules& FieldRules::_internal_bytes() const { - return type_case() == kBytes ? static_cast(*reinterpret_cast<::buf::validate::BytesRules*>(_impl_.type_.bytes_)) - : reinterpret_cast(::buf::validate::_BytesRules_default_instance_); -} -inline const ::buf::validate::BytesRules& FieldRules::bytes() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.bytes) - return _internal_bytes(); -} -inline ::buf::validate::BytesRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_bytes() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.bytes) - if (type_case() == kBytes) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::BytesRules*>(_impl_.type_.bytes_); - _impl_.type_.bytes_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_bytes( - ::buf::validate::BytesRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_bytes(); - _impl_.type_.bytes_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.bytes) -} -inline ::buf::validate::BytesRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_bytes() { - if (type_case() != kBytes) { - clear_type(); - set_has_bytes(); - _impl_.type_.bytes_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::BytesRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::BytesRules*>(_impl_.type_.bytes_); -} -inline ::buf::validate::BytesRules* PROTOBUF_NONNULL FieldRules::mutable_bytes() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::BytesRules* _msg = _internal_mutable_bytes(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.bytes) - return _msg; -} - -// .buf.validate.EnumRules enum = 16; -inline bool FieldRules::has_enum_() const { - return type_case() == kEnum; -} -inline bool FieldRules::_internal_has_enum_() const { - return type_case() == kEnum; -} -inline void FieldRules::set_has_enum_() { - _impl_._oneof_case_[0] = kEnum; -} -inline void FieldRules::clear_enum_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kEnum) { - if (GetArena() == nullptr) { - delete _impl_.type_.enum__; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.enum__); - } - clear_has_type(); - } -} -inline ::buf::validate::EnumRules* PROTOBUF_NULLABLE FieldRules::release_enum_() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.enum) - if (type_case() == kEnum) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::EnumRules*>(_impl_.type_.enum__); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.enum__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::EnumRules& FieldRules::_internal_enum_() const { - return type_case() == kEnum ? static_cast(*reinterpret_cast<::buf::validate::EnumRules*>(_impl_.type_.enum__)) - : reinterpret_cast(::buf::validate::_EnumRules_default_instance_); -} -inline const ::buf::validate::EnumRules& FieldRules::enum_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.enum) - return _internal_enum_(); -} -inline ::buf::validate::EnumRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_enum_() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.enum) - if (type_case() == kEnum) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::EnumRules*>(_impl_.type_.enum__); - _impl_.type_.enum__ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_enum_( - ::buf::validate::EnumRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_enum_(); - _impl_.type_.enum__ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.enum) -} -inline ::buf::validate::EnumRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_enum_() { - if (type_case() != kEnum) { - clear_type(); - set_has_enum_(); - _impl_.type_.enum__ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::EnumRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::EnumRules*>(_impl_.type_.enum__); -} -inline ::buf::validate::EnumRules* PROTOBUF_NONNULL FieldRules::mutable_enum_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::EnumRules* _msg = _internal_mutable_enum_(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.enum) - return _msg; -} - -// .buf.validate.RepeatedRules repeated = 18; -inline bool FieldRules::has_repeated() const { - return type_case() == kRepeated; -} -inline bool FieldRules::_internal_has_repeated() const { - return type_case() == kRepeated; -} -inline void FieldRules::set_has_repeated() { - _impl_._oneof_case_[0] = kRepeated; -} -inline void FieldRules::clear_repeated() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kRepeated) { - if (GetArena() == nullptr) { - delete _impl_.type_.repeated_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.repeated_); - } - clear_has_type(); - } -} -inline ::buf::validate::RepeatedRules* PROTOBUF_NULLABLE FieldRules::release_repeated() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.repeated) - if (type_case() == kRepeated) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::RepeatedRules*>(_impl_.type_.repeated_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.repeated_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::RepeatedRules& FieldRules::_internal_repeated() const { - return type_case() == kRepeated ? static_cast(*reinterpret_cast<::buf::validate::RepeatedRules*>(_impl_.type_.repeated_)) - : reinterpret_cast(::buf::validate::_RepeatedRules_default_instance_); -} -inline const ::buf::validate::RepeatedRules& FieldRules::repeated() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.repeated) - return _internal_repeated(); -} -inline ::buf::validate::RepeatedRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_repeated() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.repeated) - if (type_case() == kRepeated) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::RepeatedRules*>(_impl_.type_.repeated_); - _impl_.type_.repeated_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_repeated( - ::buf::validate::RepeatedRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_repeated(); - _impl_.type_.repeated_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.repeated) -} -inline ::buf::validate::RepeatedRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_repeated() { - if (type_case() != kRepeated) { - clear_type(); - set_has_repeated(); - _impl_.type_.repeated_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::RepeatedRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::RepeatedRules*>(_impl_.type_.repeated_); -} -inline ::buf::validate::RepeatedRules* PROTOBUF_NONNULL FieldRules::mutable_repeated() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::RepeatedRules* _msg = _internal_mutable_repeated(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.repeated) - return _msg; -} - -// .buf.validate.MapRules map = 19; -inline bool FieldRules::has_map() const { - return type_case() == kMap; -} -inline bool FieldRules::_internal_has_map() const { - return type_case() == kMap; -} -inline void FieldRules::set_has_map() { - _impl_._oneof_case_[0] = kMap; -} -inline void FieldRules::clear_map() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kMap) { - if (GetArena() == nullptr) { - delete _impl_.type_.map_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.map_); - } - clear_has_type(); - } -} -inline ::buf::validate::MapRules* PROTOBUF_NULLABLE FieldRules::release_map() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.map) - if (type_case() == kMap) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::MapRules*>(_impl_.type_.map_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.map_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::MapRules& FieldRules::_internal_map() const { - return type_case() == kMap ? static_cast(*reinterpret_cast<::buf::validate::MapRules*>(_impl_.type_.map_)) - : reinterpret_cast(::buf::validate::_MapRules_default_instance_); -} -inline const ::buf::validate::MapRules& FieldRules::map() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.map) - return _internal_map(); -} -inline ::buf::validate::MapRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_map() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.map) - if (type_case() == kMap) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::MapRules*>(_impl_.type_.map_); - _impl_.type_.map_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_map( - ::buf::validate::MapRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_map(); - _impl_.type_.map_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.map) -} -inline ::buf::validate::MapRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_map() { - if (type_case() != kMap) { - clear_type(); - set_has_map(); - _impl_.type_.map_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::MapRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::MapRules*>(_impl_.type_.map_); -} -inline ::buf::validate::MapRules* PROTOBUF_NONNULL FieldRules::mutable_map() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::MapRules* _msg = _internal_mutable_map(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.map) - return _msg; -} - -// .buf.validate.AnyRules any = 20; -inline bool FieldRules::has_any() const { - return type_case() == kAny; -} -inline bool FieldRules::_internal_has_any() const { - return type_case() == kAny; -} -inline void FieldRules::set_has_any() { - _impl_._oneof_case_[0] = kAny; -} -inline void FieldRules::clear_any() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kAny) { - if (GetArena() == nullptr) { - delete _impl_.type_.any_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.any_); - } - clear_has_type(); - } -} -inline ::buf::validate::AnyRules* PROTOBUF_NULLABLE FieldRules::release_any() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.any) - if (type_case() == kAny) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::AnyRules*>(_impl_.type_.any_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.any_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::AnyRules& FieldRules::_internal_any() const { - return type_case() == kAny ? static_cast(*reinterpret_cast<::buf::validate::AnyRules*>(_impl_.type_.any_)) - : reinterpret_cast(::buf::validate::_AnyRules_default_instance_); -} -inline const ::buf::validate::AnyRules& FieldRules::any() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.any) - return _internal_any(); -} -inline ::buf::validate::AnyRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_any() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.any) - if (type_case() == kAny) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::AnyRules*>(_impl_.type_.any_); - _impl_.type_.any_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_any( - ::buf::validate::AnyRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_any(); - _impl_.type_.any_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.any) -} -inline ::buf::validate::AnyRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_any() { - if (type_case() != kAny) { - clear_type(); - set_has_any(); - _impl_.type_.any_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::AnyRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::AnyRules*>(_impl_.type_.any_); -} -inline ::buf::validate::AnyRules* PROTOBUF_NONNULL FieldRules::mutable_any() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::AnyRules* _msg = _internal_mutable_any(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.any) - return _msg; -} - -// .buf.validate.DurationRules duration = 21; -inline bool FieldRules::has_duration() const { - return type_case() == kDuration; -} -inline bool FieldRules::_internal_has_duration() const { - return type_case() == kDuration; -} -inline void FieldRules::set_has_duration() { - _impl_._oneof_case_[0] = kDuration; -} -inline void FieldRules::clear_duration() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kDuration) { - if (GetArena() == nullptr) { - delete _impl_.type_.duration_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.duration_); - } - clear_has_type(); - } -} -inline ::buf::validate::DurationRules* PROTOBUF_NULLABLE FieldRules::release_duration() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.duration) - if (type_case() == kDuration) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::DurationRules*>(_impl_.type_.duration_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.duration_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::DurationRules& FieldRules::_internal_duration() const { - return type_case() == kDuration ? static_cast(*reinterpret_cast<::buf::validate::DurationRules*>(_impl_.type_.duration_)) - : reinterpret_cast(::buf::validate::_DurationRules_default_instance_); -} -inline const ::buf::validate::DurationRules& FieldRules::duration() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.duration) - return _internal_duration(); -} -inline ::buf::validate::DurationRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_duration() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.duration) - if (type_case() == kDuration) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::DurationRules*>(_impl_.type_.duration_); - _impl_.type_.duration_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_duration( - ::buf::validate::DurationRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_duration(); - _impl_.type_.duration_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.duration) -} -inline ::buf::validate::DurationRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_duration() { - if (type_case() != kDuration) { - clear_type(); - set_has_duration(); - _impl_.type_.duration_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::DurationRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::DurationRules*>(_impl_.type_.duration_); -} -inline ::buf::validate::DurationRules* PROTOBUF_NONNULL FieldRules::mutable_duration() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::DurationRules* _msg = _internal_mutable_duration(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.duration) - return _msg; -} - -// .buf.validate.FieldMaskRules field_mask = 28; -inline bool FieldRules::has_field_mask() const { - return type_case() == kFieldMask; -} -inline bool FieldRules::_internal_has_field_mask() const { - return type_case() == kFieldMask; -} -inline void FieldRules::set_has_field_mask() { - _impl_._oneof_case_[0] = kFieldMask; -} -inline void FieldRules::clear_field_mask() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kFieldMask) { - if (GetArena() == nullptr) { - delete _impl_.type_.field_mask_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.field_mask_); - } - clear_has_type(); - } -} -inline ::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE FieldRules::release_field_mask() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.field_mask) - if (type_case() == kFieldMask) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::FieldMaskRules*>(_impl_.type_.field_mask_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.field_mask_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::FieldMaskRules& FieldRules::_internal_field_mask() const { - return type_case() == kFieldMask ? static_cast(*reinterpret_cast<::buf::validate::FieldMaskRules*>(_impl_.type_.field_mask_)) - : reinterpret_cast(::buf::validate::_FieldMaskRules_default_instance_); -} -inline const ::buf::validate::FieldMaskRules& FieldRules::field_mask() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.field_mask) - return _internal_field_mask(); -} -inline ::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_field_mask() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.field_mask) - if (type_case() == kFieldMask) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::FieldMaskRules*>(_impl_.type_.field_mask_); - _impl_.type_.field_mask_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_field_mask( - ::buf::validate::FieldMaskRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_field_mask(); - _impl_.type_.field_mask_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.field_mask) -} -inline ::buf::validate::FieldMaskRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_field_mask() { - if (type_case() != kFieldMask) { - clear_type(); - set_has_field_mask(); - _impl_.type_.field_mask_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldMaskRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::FieldMaskRules*>(_impl_.type_.field_mask_); -} -inline ::buf::validate::FieldMaskRules* PROTOBUF_NONNULL FieldRules::mutable_field_mask() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::FieldMaskRules* _msg = _internal_mutable_field_mask(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.field_mask) - return _msg; -} - -// .buf.validate.TimestampRules timestamp = 22; -inline bool FieldRules::has_timestamp() const { - return type_case() == kTimestamp; -} -inline bool FieldRules::_internal_has_timestamp() const { - return type_case() == kTimestamp; -} -inline void FieldRules::set_has_timestamp() { - _impl_._oneof_case_[0] = kTimestamp; -} -inline void FieldRules::clear_timestamp() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (type_case() == kTimestamp) { - if (GetArena() == nullptr) { - delete _impl_.type_.timestamp_; - } else if (::google::protobuf::internal::DebugHardenClearOneofMessageOnArena()) { - ::google::protobuf::internal::MaybePoisonAfterClear(_impl_.type_.timestamp_); - } - clear_has_type(); - } -} -inline ::buf::validate::TimestampRules* PROTOBUF_NULLABLE FieldRules::release_timestamp() { - // @@protoc_insertion_point(field_release:buf.validate.FieldRules.timestamp) - if (type_case() == kTimestamp) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::TimestampRules*>(_impl_.type_.timestamp_); - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.type_.timestamp_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::buf::validate::TimestampRules& FieldRules::_internal_timestamp() const { - return type_case() == kTimestamp ? static_cast(*reinterpret_cast<::buf::validate::TimestampRules*>(_impl_.type_.timestamp_)) - : reinterpret_cast(::buf::validate::_TimestampRules_default_instance_); -} -inline const ::buf::validate::TimestampRules& FieldRules::timestamp() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldRules.timestamp) - return _internal_timestamp(); -} -inline ::buf::validate::TimestampRules* PROTOBUF_NULLABLE FieldRules::unsafe_arena_release_timestamp() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.FieldRules.timestamp) - if (type_case() == kTimestamp) { - clear_has_type(); - auto* temp = reinterpret_cast<::buf::validate::TimestampRules*>(_impl_.type_.timestamp_); - _impl_.type_.timestamp_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void FieldRules::unsafe_arena_set_allocated_timestamp( - ::buf::validate::TimestampRules* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_type(); - if (value) { - set_has_timestamp(); - _impl_.type_.timestamp_ = reinterpret_cast<::google::protobuf::Message*>(value); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldRules.timestamp) -} -inline ::buf::validate::TimestampRules* PROTOBUF_NONNULL FieldRules::_internal_mutable_timestamp() { - if (type_case() != kTimestamp) { - clear_type(); - set_has_timestamp(); - _impl_.type_.timestamp_ = reinterpret_cast<::google::protobuf::Message*>( - ::google::protobuf::Message::DefaultConstruct<::buf::validate::TimestampRules>(GetArena())); - } - return reinterpret_cast<::buf::validate::TimestampRules*>(_impl_.type_.timestamp_); -} -inline ::buf::validate::TimestampRules* PROTOBUF_NONNULL FieldRules::mutable_timestamp() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::buf::validate::TimestampRules* _msg = _internal_mutable_timestamp(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldRules.timestamp) - return _msg; -} - -inline bool FieldRules::has_type() const { - return type_case() != TYPE_NOT_SET; -} -inline void FieldRules::clear_has_type() { - _impl_._oneof_case_[0] = TYPE_NOT_SET; -} -inline FieldRules::TypeCase FieldRules::type_case() const { - return FieldRules::TypeCase(_impl_._oneof_case_[0]); -} -// ------------------------------------------------------------------- - -// PredefinedRules - -// repeated .buf.validate.Rule cel = 1; -inline int PredefinedRules::_internal_cel_size() const { - return _internal_cel().size(); -} -inline int PredefinedRules::cel_size() const { - return _internal_cel_size(); -} -inline void PredefinedRules::clear_cel() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.cel_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL PredefinedRules::mutable_cel(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.PredefinedRules.cel) - return _internal_mutable_cel()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL PredefinedRules::mutable_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.PredefinedRules.cel) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_cel(); -} -inline const ::buf::validate::Rule& PredefinedRules::cel(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.PredefinedRules.cel) - return _internal_cel().Get(index); -} -inline ::buf::validate::Rule* PROTOBUF_NONNULL PredefinedRules::add_cel() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::Rule* _add = - _internal_mutable_cel()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.PredefinedRules.cel) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& PredefinedRules::cel() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.PredefinedRules.cel) - return _internal_cel(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>& -PredefinedRules::_internal_cel() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.cel_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Rule>* PROTOBUF_NONNULL -PredefinedRules::_internal_mutable_cel() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.cel_; -} - -// ------------------------------------------------------------------- - -// FloatRules - -// optional float const = 1 [(.buf.validate.predefined) = { -inline bool FloatRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void FloatRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline float FloatRules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.const) - return _internal_const_(); -} -inline void FloatRules::set_const_(float value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.const) -} -inline float FloatRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void FloatRules::_internal_set_const_(float value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// float lt = 2 [(.buf.validate.predefined) = { -inline bool FloatRules::has_lt() const { - return less_than_case() == kLt; -} -inline void FloatRules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void FloatRules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0; - clear_has_less_than(); - } -} -inline float FloatRules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.lt) - return _internal_lt(); -} -inline void FloatRules::set_lt(float value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.lt) -} -inline float FloatRules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0; -} - -// float lte = 3 [(.buf.validate.predefined) = { -inline bool FloatRules::has_lte() const { - return less_than_case() == kLte; -} -inline void FloatRules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void FloatRules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0; - clear_has_less_than(); - } -} -inline float FloatRules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.lte) - return _internal_lte(); -} -inline void FloatRules::set_lte(float value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.lte) -} -inline float FloatRules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0; -} - -// float gt = 4 [(.buf.validate.predefined) = { -inline bool FloatRules::has_gt() const { - return greater_than_case() == kGt; -} -inline void FloatRules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void FloatRules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0; - clear_has_greater_than(); - } -} -inline float FloatRules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.gt) - return _internal_gt(); -} -inline void FloatRules::set_gt(float value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.gt) -} -inline float FloatRules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0; -} - -// float gte = 5 [(.buf.validate.predefined) = { -inline bool FloatRules::has_gte() const { - return greater_than_case() == kGte; -} -inline void FloatRules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void FloatRules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0; - clear_has_greater_than(); - } -} -inline float FloatRules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.gte) - return _internal_gte(); -} -inline void FloatRules::set_gte(float value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.gte) -} -inline float FloatRules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0; -} - -// repeated float in = 6 [(.buf.validate.predefined) = { -inline int FloatRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int FloatRules::in_size() const { - return _internal_in_size(); -} -inline void FloatRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline float FloatRules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.in) - return _internal_in().Get(index); -} -inline void FloatRules::set_in(int index, float value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.in) -} -inline void FloatRules::add_in(float value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.FloatRules.in) -} -inline const ::google::protobuf::RepeatedField& FloatRules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FloatRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL FloatRules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FloatRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField& -FloatRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -FloatRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated float not_in = 7 [(.buf.validate.predefined) = { -inline int FloatRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int FloatRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void FloatRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline float FloatRules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.not_in) - return _internal_not_in().Get(index); -} -inline void FloatRules::set_not_in(int index, float value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.not_in) -} -inline void FloatRules::add_not_in(float value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.FloatRules.not_in) -} -inline const ::google::protobuf::RepeatedField& FloatRules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FloatRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL FloatRules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FloatRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField& -FloatRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -FloatRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// optional bool finite = 8 [(.buf.validate.predefined) = { -inline bool FloatRules::has_finite() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void FloatRules::clear_finite() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.finite_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline bool FloatRules::finite() const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.finite) - return _internal_finite(); -} -inline void FloatRules::set_finite(bool value) { - _internal_set_finite(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.finite) -} -inline bool FloatRules::_internal_finite() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.finite_; -} -inline void FloatRules::_internal_set_finite(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.finite_ = value; -} - -// repeated float example = 9 [(.buf.validate.predefined) = { -inline int FloatRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int FloatRules::example_size() const { - return _internal_example_size(); -} -inline void FloatRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000010U); -} -inline float FloatRules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.FloatRules.example) - return _internal_example().Get(index); -} -inline void FloatRules::set_example(int index, float value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.FloatRules.example) -} -inline void FloatRules::add_example(float value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_add:buf.validate.FloatRules.example) -} -inline const ::google::protobuf::RepeatedField& FloatRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FloatRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL FloatRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FloatRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField& -FloatRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -FloatRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool FloatRules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void FloatRules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool FloatRules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void FloatRules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline FloatRules::LessThanCase FloatRules::less_than_case() const { - return FloatRules::LessThanCase(_impl_._oneof_case_[0]); -} -inline FloatRules::GreaterThanCase FloatRules::greater_than_case() const { - return FloatRules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// DoubleRules - -// optional double const = 1 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void DoubleRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline double DoubleRules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.const) - return _internal_const_(); -} -inline void DoubleRules::set_const_(double value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.const) -} -inline double DoubleRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void DoubleRules::_internal_set_const_(double value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// double lt = 2 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_lt() const { - return less_than_case() == kLt; -} -inline void DoubleRules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void DoubleRules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0; - clear_has_less_than(); - } -} -inline double DoubleRules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.lt) - return _internal_lt(); -} -inline void DoubleRules::set_lt(double value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.lt) -} -inline double DoubleRules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0; -} - -// double lte = 3 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_lte() const { - return less_than_case() == kLte; -} -inline void DoubleRules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void DoubleRules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0; - clear_has_less_than(); - } -} -inline double DoubleRules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.lte) - return _internal_lte(); -} -inline void DoubleRules::set_lte(double value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.lte) -} -inline double DoubleRules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0; -} - -// double gt = 4 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_gt() const { - return greater_than_case() == kGt; -} -inline void DoubleRules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void DoubleRules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0; - clear_has_greater_than(); - } -} -inline double DoubleRules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.gt) - return _internal_gt(); -} -inline void DoubleRules::set_gt(double value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.gt) -} -inline double DoubleRules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0; -} - -// double gte = 5 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_gte() const { - return greater_than_case() == kGte; -} -inline void DoubleRules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void DoubleRules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0; - clear_has_greater_than(); - } -} -inline double DoubleRules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.gte) - return _internal_gte(); -} -inline void DoubleRules::set_gte(double value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.gte) -} -inline double DoubleRules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0; -} - -// repeated double in = 6 [(.buf.validate.predefined) = { -inline int DoubleRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int DoubleRules::in_size() const { - return _internal_in_size(); -} -inline void DoubleRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline double DoubleRules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.in) - return _internal_in().Get(index); -} -inline void DoubleRules::set_in(int index, double value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.in) -} -inline void DoubleRules::add_in(double value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.DoubleRules.in) -} -inline const ::google::protobuf::RepeatedField& DoubleRules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DoubleRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL DoubleRules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DoubleRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField& -DoubleRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -DoubleRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated double not_in = 7 [(.buf.validate.predefined) = { -inline int DoubleRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int DoubleRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void DoubleRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline double DoubleRules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.not_in) - return _internal_not_in().Get(index); -} -inline void DoubleRules::set_not_in(int index, double value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.not_in) -} -inline void DoubleRules::add_not_in(double value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.DoubleRules.not_in) -} -inline const ::google::protobuf::RepeatedField& DoubleRules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DoubleRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL DoubleRules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DoubleRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField& -DoubleRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -DoubleRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// optional bool finite = 8 [(.buf.validate.predefined) = { -inline bool DoubleRules::has_finite() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void DoubleRules::clear_finite() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.finite_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline bool DoubleRules::finite() const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.finite) - return _internal_finite(); -} -inline void DoubleRules::set_finite(bool value) { - _internal_set_finite(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.finite) -} -inline bool DoubleRules::_internal_finite() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.finite_; -} -inline void DoubleRules::_internal_set_finite(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.finite_ = value; -} - -// repeated double example = 9 [(.buf.validate.predefined) = { -inline int DoubleRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int DoubleRules::example_size() const { - return _internal_example_size(); -} -inline void DoubleRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000010U); -} -inline double DoubleRules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.DoubleRules.example) - return _internal_example().Get(index); -} -inline void DoubleRules::set_example(int index, double value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.DoubleRules.example) -} -inline void DoubleRules::add_example(double value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_add:buf.validate.DoubleRules.example) -} -inline const ::google::protobuf::RepeatedField& DoubleRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DoubleRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL DoubleRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DoubleRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField& -DoubleRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -DoubleRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool DoubleRules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void DoubleRules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool DoubleRules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void DoubleRules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline DoubleRules::LessThanCase DoubleRules::less_than_case() const { - return DoubleRules::LessThanCase(_impl_._oneof_case_[0]); -} -inline DoubleRules::GreaterThanCase DoubleRules::greater_than_case() const { - return DoubleRules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// Int32Rules - -// optional int32 const = 1 [(.buf.validate.predefined) = { -inline bool Int32Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void Int32Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int32_t Int32Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.const) - return _internal_const_(); -} -inline void Int32Rules::set_const_(::int32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.const) -} -inline ::int32_t Int32Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void Int32Rules::_internal_set_const_(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// int32 lt = 2 [(.buf.validate.predefined) = { -inline bool Int32Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void Int32Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void Int32Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t Int32Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.lt) - return _internal_lt(); -} -inline void Int32Rules::set_lt(::int32_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.lt) -} -inline ::int32_t Int32Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0; -} - -// int32 lte = 3 [(.buf.validate.predefined) = { -inline bool Int32Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void Int32Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void Int32Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t Int32Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.lte) - return _internal_lte(); -} -inline void Int32Rules::set_lte(::int32_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.lte) -} -inline ::int32_t Int32Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0; -} - -// int32 gt = 4 [(.buf.validate.predefined) = { -inline bool Int32Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void Int32Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void Int32Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t Int32Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.gt) - return _internal_gt(); -} -inline void Int32Rules::set_gt(::int32_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.gt) -} -inline ::int32_t Int32Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0; -} - -// int32 gte = 5 [(.buf.validate.predefined) = { -inline bool Int32Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void Int32Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void Int32Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t Int32Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.gte) - return _internal_gte(); -} -inline void Int32Rules::set_gte(::int32_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.gte) -} -inline ::int32_t Int32Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0; -} - -// repeated int32 in = 6 [(.buf.validate.predefined) = { -inline int Int32Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int Int32Rules::in_size() const { - return _internal_in_size(); -} -inline void Int32Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int32_t Int32Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.in) - return _internal_in().Get(index); -} -inline void Int32Rules::set_in(int index, ::int32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.in) -} -inline void Int32Rules::add_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.Int32Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& Int32Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int32Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL Int32Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int32Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -Int32Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -Int32Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated int32 not_in = 7 [(.buf.validate.predefined) = { -inline int Int32Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int Int32Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void Int32Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int32_t Int32Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.not_in) - return _internal_not_in().Get(index); -} -inline void Int32Rules::set_not_in(int index, ::int32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.not_in) -} -inline void Int32Rules::add_not_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.Int32Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& Int32Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int32Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL Int32Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int32Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -Int32Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -Int32Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated int32 example = 8 [(.buf.validate.predefined) = { -inline int Int32Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int Int32Rules::example_size() const { - return _internal_example_size(); -} -inline void Int32Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int32_t Int32Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int32Rules.example) - return _internal_example().Get(index); -} -inline void Int32Rules::set_example(int index, ::int32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int32Rules.example) -} -inline void Int32Rules::add_example(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.Int32Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& Int32Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int32Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL Int32Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int32Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -Int32Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -Int32Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool Int32Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void Int32Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool Int32Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void Int32Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline Int32Rules::LessThanCase Int32Rules::less_than_case() const { - return Int32Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline Int32Rules::GreaterThanCase Int32Rules::greater_than_case() const { - return Int32Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// Int64Rules - -// optional int64 const = 1 [(.buf.validate.predefined) = { -inline bool Int64Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void Int64Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = ::int64_t{0}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int64_t Int64Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.const) - return _internal_const_(); -} -inline void Int64Rules::set_const_(::int64_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.const) -} -inline ::int64_t Int64Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void Int64Rules::_internal_set_const_(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// int64 lt = 2 [(.buf.validate.predefined) = { -inline bool Int64Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void Int64Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void Int64Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t Int64Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.lt) - return _internal_lt(); -} -inline void Int64Rules::set_lt(::int64_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.lt) -} -inline ::int64_t Int64Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return ::int64_t{0}; -} - -// int64 lte = 3 [(.buf.validate.predefined) = { -inline bool Int64Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void Int64Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void Int64Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t Int64Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.lte) - return _internal_lte(); -} -inline void Int64Rules::set_lte(::int64_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.lte) -} -inline ::int64_t Int64Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return ::int64_t{0}; -} - -// int64 gt = 4 [(.buf.validate.predefined) = { -inline bool Int64Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void Int64Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void Int64Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t Int64Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.gt) - return _internal_gt(); -} -inline void Int64Rules::set_gt(::int64_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.gt) -} -inline ::int64_t Int64Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return ::int64_t{0}; -} - -// int64 gte = 5 [(.buf.validate.predefined) = { -inline bool Int64Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void Int64Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void Int64Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t Int64Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.gte) - return _internal_gte(); -} -inline void Int64Rules::set_gte(::int64_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.gte) -} -inline ::int64_t Int64Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return ::int64_t{0}; -} - -// repeated int64 in = 6 [(.buf.validate.predefined) = { -inline int Int64Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int Int64Rules::in_size() const { - return _internal_in_size(); -} -inline void Int64Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int64_t Int64Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.in) - return _internal_in().Get(index); -} -inline void Int64Rules::set_in(int index, ::int64_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.in) -} -inline void Int64Rules::add_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.Int64Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& Int64Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int64Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL Int64Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int64Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -Int64Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -Int64Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated int64 not_in = 7 [(.buf.validate.predefined) = { -inline int Int64Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int Int64Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void Int64Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int64_t Int64Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.not_in) - return _internal_not_in().Get(index); -} -inline void Int64Rules::set_not_in(int index, ::int64_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.not_in) -} -inline void Int64Rules::add_not_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.Int64Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& Int64Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int64Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL Int64Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int64Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -Int64Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -Int64Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated int64 example = 9 [(.buf.validate.predefined) = { -inline int Int64Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int Int64Rules::example_size() const { - return _internal_example_size(); -} -inline void Int64Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int64_t Int64Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Int64Rules.example) - return _internal_example().Get(index); -} -inline void Int64Rules::set_example(int index, ::int64_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Int64Rules.example) -} -inline void Int64Rules::add_example(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_add:buf.validate.Int64Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& Int64Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Int64Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL Int64Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Int64Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -Int64Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -Int64Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool Int64Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void Int64Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool Int64Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void Int64Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline Int64Rules::LessThanCase Int64Rules::less_than_case() const { - return Int64Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline Int64Rules::GreaterThanCase Int64Rules::greater_than_case() const { - return Int64Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// UInt32Rules - -// optional uint32 const = 1 [(.buf.validate.predefined) = { -inline bool UInt32Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void UInt32Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0u; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::uint32_t UInt32Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.const) - return _internal_const_(); -} -inline void UInt32Rules::set_const_(::uint32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.const) -} -inline ::uint32_t UInt32Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void UInt32Rules::_internal_set_const_(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// uint32 lt = 2 [(.buf.validate.predefined) = { -inline bool UInt32Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void UInt32Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void UInt32Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0u; - clear_has_less_than(); - } -} -inline ::uint32_t UInt32Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.lt) - return _internal_lt(); -} -inline void UInt32Rules::set_lt(::uint32_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.lt) -} -inline ::uint32_t UInt32Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0u; -} - -// uint32 lte = 3 [(.buf.validate.predefined) = { -inline bool UInt32Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void UInt32Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void UInt32Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0u; - clear_has_less_than(); - } -} -inline ::uint32_t UInt32Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.lte) - return _internal_lte(); -} -inline void UInt32Rules::set_lte(::uint32_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.lte) -} -inline ::uint32_t UInt32Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0u; -} - -// uint32 gt = 4 [(.buf.validate.predefined) = { -inline bool UInt32Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void UInt32Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void UInt32Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0u; - clear_has_greater_than(); - } -} -inline ::uint32_t UInt32Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.gt) - return _internal_gt(); -} -inline void UInt32Rules::set_gt(::uint32_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.gt) -} -inline ::uint32_t UInt32Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0u; -} - -// uint32 gte = 5 [(.buf.validate.predefined) = { -inline bool UInt32Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void UInt32Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void UInt32Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0u; - clear_has_greater_than(); - } -} -inline ::uint32_t UInt32Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.gte) - return _internal_gte(); -} -inline void UInt32Rules::set_gte(::uint32_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.gte) -} -inline ::uint32_t UInt32Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0u; -} - -// repeated uint32 in = 6 [(.buf.validate.predefined) = { -inline int UInt32Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int UInt32Rules::in_size() const { - return _internal_in_size(); -} -inline void UInt32Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::uint32_t UInt32Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.in) - return _internal_in().Get(index); -} -inline void UInt32Rules::set_in(int index, ::uint32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.in) -} -inline void UInt32Rules::add_in(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.UInt32Rules.in) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& UInt32Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt32Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL UInt32Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt32Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -UInt32Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -UInt32Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated uint32 not_in = 7 [(.buf.validate.predefined) = { -inline int UInt32Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int UInt32Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void UInt32Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::uint32_t UInt32Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.not_in) - return _internal_not_in().Get(index); -} -inline void UInt32Rules::set_not_in(int index, ::uint32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.not_in) -} -inline void UInt32Rules::add_not_in(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.UInt32Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& UInt32Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt32Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL UInt32Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt32Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -UInt32Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -UInt32Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated uint32 example = 8 [(.buf.validate.predefined) = { -inline int UInt32Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int UInt32Rules::example_size() const { - return _internal_example_size(); -} -inline void UInt32Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint32_t UInt32Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt32Rules.example) - return _internal_example().Get(index); -} -inline void UInt32Rules::set_example(int index, ::uint32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt32Rules.example) -} -inline void UInt32Rules::add_example(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.UInt32Rules.example) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& UInt32Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt32Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL UInt32Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt32Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -UInt32Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -UInt32Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool UInt32Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void UInt32Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool UInt32Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void UInt32Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline UInt32Rules::LessThanCase UInt32Rules::less_than_case() const { - return UInt32Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline UInt32Rules::GreaterThanCase UInt32Rules::greater_than_case() const { - return UInt32Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// UInt64Rules - -// optional uint64 const = 1 [(.buf.validate.predefined) = { -inline bool UInt64Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void UInt64Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::uint64_t UInt64Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.const) - return _internal_const_(); -} -inline void UInt64Rules::set_const_(::uint64_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.const) -} -inline ::uint64_t UInt64Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void UInt64Rules::_internal_set_const_(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// uint64 lt = 2 [(.buf.validate.predefined) = { -inline bool UInt64Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void UInt64Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void UInt64Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = ::uint64_t{0u}; - clear_has_less_than(); - } -} -inline ::uint64_t UInt64Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.lt) - return _internal_lt(); -} -inline void UInt64Rules::set_lt(::uint64_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.lt) -} -inline ::uint64_t UInt64Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return ::uint64_t{0u}; -} - -// uint64 lte = 3 [(.buf.validate.predefined) = { -inline bool UInt64Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void UInt64Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void UInt64Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = ::uint64_t{0u}; - clear_has_less_than(); - } -} -inline ::uint64_t UInt64Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.lte) - return _internal_lte(); -} -inline void UInt64Rules::set_lte(::uint64_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.lte) -} -inline ::uint64_t UInt64Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return ::uint64_t{0u}; -} - -// uint64 gt = 4 [(.buf.validate.predefined) = { -inline bool UInt64Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void UInt64Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void UInt64Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = ::uint64_t{0u}; - clear_has_greater_than(); - } -} -inline ::uint64_t UInt64Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.gt) - return _internal_gt(); -} -inline void UInt64Rules::set_gt(::uint64_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.gt) -} -inline ::uint64_t UInt64Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return ::uint64_t{0u}; -} - -// uint64 gte = 5 [(.buf.validate.predefined) = { -inline bool UInt64Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void UInt64Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void UInt64Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = ::uint64_t{0u}; - clear_has_greater_than(); - } -} -inline ::uint64_t UInt64Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.gte) - return _internal_gte(); -} -inline void UInt64Rules::set_gte(::uint64_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.gte) -} -inline ::uint64_t UInt64Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return ::uint64_t{0u}; -} - -// repeated uint64 in = 6 [(.buf.validate.predefined) = { -inline int UInt64Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int UInt64Rules::in_size() const { - return _internal_in_size(); -} -inline void UInt64Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::uint64_t UInt64Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.in) - return _internal_in().Get(index); -} -inline void UInt64Rules::set_in(int index, ::uint64_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.in) -} -inline void UInt64Rules::add_in(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.UInt64Rules.in) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& UInt64Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt64Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL UInt64Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt64Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -UInt64Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -UInt64Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated uint64 not_in = 7 [(.buf.validate.predefined) = { -inline int UInt64Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int UInt64Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void UInt64Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::uint64_t UInt64Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.not_in) - return _internal_not_in().Get(index); -} -inline void UInt64Rules::set_not_in(int index, ::uint64_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.not_in) -} -inline void UInt64Rules::add_not_in(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.UInt64Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& UInt64Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt64Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL UInt64Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt64Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -UInt64Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -UInt64Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated uint64 example = 8 [(.buf.validate.predefined) = { -inline int UInt64Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int UInt64Rules::example_size() const { - return _internal_example_size(); -} -inline void UInt64Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint64_t UInt64Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.UInt64Rules.example) - return _internal_example().Get(index); -} -inline void UInt64Rules::set_example(int index, ::uint64_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.UInt64Rules.example) -} -inline void UInt64Rules::add_example(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.UInt64Rules.example) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& UInt64Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.UInt64Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL UInt64Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.UInt64Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -UInt64Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -UInt64Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool UInt64Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void UInt64Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool UInt64Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void UInt64Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline UInt64Rules::LessThanCase UInt64Rules::less_than_case() const { - return UInt64Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline UInt64Rules::GreaterThanCase UInt64Rules::greater_than_case() const { - return UInt64Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// SInt32Rules - -// optional sint32 const = 1 [(.buf.validate.predefined) = { -inline bool SInt32Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void SInt32Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int32_t SInt32Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.const) - return _internal_const_(); -} -inline void SInt32Rules::set_const_(::int32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.const) -} -inline ::int32_t SInt32Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void SInt32Rules::_internal_set_const_(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// sint32 lt = 2 [(.buf.validate.predefined) = { -inline bool SInt32Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void SInt32Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void SInt32Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t SInt32Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.lt) - return _internal_lt(); -} -inline void SInt32Rules::set_lt(::int32_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.lt) -} -inline ::int32_t SInt32Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0; -} - -// sint32 lte = 3 [(.buf.validate.predefined) = { -inline bool SInt32Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void SInt32Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void SInt32Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t SInt32Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.lte) - return _internal_lte(); -} -inline void SInt32Rules::set_lte(::int32_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.lte) -} -inline ::int32_t SInt32Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0; -} - -// sint32 gt = 4 [(.buf.validate.predefined) = { -inline bool SInt32Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void SInt32Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void SInt32Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t SInt32Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.gt) - return _internal_gt(); -} -inline void SInt32Rules::set_gt(::int32_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.gt) -} -inline ::int32_t SInt32Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0; -} - -// sint32 gte = 5 [(.buf.validate.predefined) = { -inline bool SInt32Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void SInt32Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void SInt32Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t SInt32Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.gte) - return _internal_gte(); -} -inline void SInt32Rules::set_gte(::int32_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.gte) -} -inline ::int32_t SInt32Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0; -} - -// repeated sint32 in = 6 [(.buf.validate.predefined) = { -inline int SInt32Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int SInt32Rules::in_size() const { - return _internal_in_size(); -} -inline void SInt32Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int32_t SInt32Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.in) - return _internal_in().Get(index); -} -inline void SInt32Rules::set_in(int index, ::int32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.in) -} -inline void SInt32Rules::add_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.SInt32Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SInt32Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt32Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SInt32Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt32Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SInt32Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SInt32Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated sint32 not_in = 7 [(.buf.validate.predefined) = { -inline int SInt32Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int SInt32Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void SInt32Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int32_t SInt32Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.not_in) - return _internal_not_in().Get(index); -} -inline void SInt32Rules::set_not_in(int index, ::int32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.not_in) -} -inline void SInt32Rules::add_not_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.SInt32Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SInt32Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt32Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SInt32Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt32Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SInt32Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SInt32Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated sint32 example = 8 [(.buf.validate.predefined) = { -inline int SInt32Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int SInt32Rules::example_size() const { - return _internal_example_size(); -} -inline void SInt32Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int32_t SInt32Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt32Rules.example) - return _internal_example().Get(index); -} -inline void SInt32Rules::set_example(int index, ::int32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt32Rules.example) -} -inline void SInt32Rules::add_example(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.SInt32Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SInt32Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt32Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SInt32Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt32Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SInt32Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SInt32Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool SInt32Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void SInt32Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool SInt32Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void SInt32Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline SInt32Rules::LessThanCase SInt32Rules::less_than_case() const { - return SInt32Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline SInt32Rules::GreaterThanCase SInt32Rules::greater_than_case() const { - return SInt32Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// SInt64Rules - -// optional sint64 const = 1 [(.buf.validate.predefined) = { -inline bool SInt64Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void SInt64Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = ::int64_t{0}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int64_t SInt64Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.const) - return _internal_const_(); -} -inline void SInt64Rules::set_const_(::int64_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.const) -} -inline ::int64_t SInt64Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void SInt64Rules::_internal_set_const_(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// sint64 lt = 2 [(.buf.validate.predefined) = { -inline bool SInt64Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void SInt64Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void SInt64Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t SInt64Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.lt) - return _internal_lt(); -} -inline void SInt64Rules::set_lt(::int64_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.lt) -} -inline ::int64_t SInt64Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return ::int64_t{0}; -} - -// sint64 lte = 3 [(.buf.validate.predefined) = { -inline bool SInt64Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void SInt64Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void SInt64Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t SInt64Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.lte) - return _internal_lte(); -} -inline void SInt64Rules::set_lte(::int64_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.lte) -} -inline ::int64_t SInt64Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return ::int64_t{0}; -} - -// sint64 gt = 4 [(.buf.validate.predefined) = { -inline bool SInt64Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void SInt64Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void SInt64Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t SInt64Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.gt) - return _internal_gt(); -} -inline void SInt64Rules::set_gt(::int64_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.gt) -} -inline ::int64_t SInt64Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return ::int64_t{0}; -} - -// sint64 gte = 5 [(.buf.validate.predefined) = { -inline bool SInt64Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void SInt64Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void SInt64Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t SInt64Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.gte) - return _internal_gte(); -} -inline void SInt64Rules::set_gte(::int64_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.gte) -} -inline ::int64_t SInt64Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return ::int64_t{0}; -} - -// repeated sint64 in = 6 [(.buf.validate.predefined) = { -inline int SInt64Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int SInt64Rules::in_size() const { - return _internal_in_size(); -} -inline void SInt64Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int64_t SInt64Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.in) - return _internal_in().Get(index); -} -inline void SInt64Rules::set_in(int index, ::int64_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.in) -} -inline void SInt64Rules::add_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.SInt64Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SInt64Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt64Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SInt64Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt64Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SInt64Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SInt64Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated sint64 not_in = 7 [(.buf.validate.predefined) = { -inline int SInt64Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int SInt64Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void SInt64Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int64_t SInt64Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.not_in) - return _internal_not_in().Get(index); -} -inline void SInt64Rules::set_not_in(int index, ::int64_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.not_in) -} -inline void SInt64Rules::add_not_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.SInt64Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SInt64Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt64Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SInt64Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt64Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SInt64Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SInt64Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated sint64 example = 8 [(.buf.validate.predefined) = { -inline int SInt64Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int SInt64Rules::example_size() const { - return _internal_example_size(); -} -inline void SInt64Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int64_t SInt64Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SInt64Rules.example) - return _internal_example().Get(index); -} -inline void SInt64Rules::set_example(int index, ::int64_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SInt64Rules.example) -} -inline void SInt64Rules::add_example(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.SInt64Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SInt64Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SInt64Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SInt64Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SInt64Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SInt64Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SInt64Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool SInt64Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void SInt64Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool SInt64Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void SInt64Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline SInt64Rules::LessThanCase SInt64Rules::less_than_case() const { - return SInt64Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline SInt64Rules::GreaterThanCase SInt64Rules::greater_than_case() const { - return SInt64Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// Fixed32Rules - -// optional fixed32 const = 1 [(.buf.validate.predefined) = { -inline bool Fixed32Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void Fixed32Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0u; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::uint32_t Fixed32Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.const) - return _internal_const_(); -} -inline void Fixed32Rules::set_const_(::uint32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.const) -} -inline ::uint32_t Fixed32Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void Fixed32Rules::_internal_set_const_(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// fixed32 lt = 2 [(.buf.validate.predefined) = { -inline bool Fixed32Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void Fixed32Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void Fixed32Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0u; - clear_has_less_than(); - } -} -inline ::uint32_t Fixed32Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.lt) - return _internal_lt(); -} -inline void Fixed32Rules::set_lt(::uint32_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.lt) -} -inline ::uint32_t Fixed32Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0u; -} - -// fixed32 lte = 3 [(.buf.validate.predefined) = { -inline bool Fixed32Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void Fixed32Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void Fixed32Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0u; - clear_has_less_than(); - } -} -inline ::uint32_t Fixed32Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.lte) - return _internal_lte(); -} -inline void Fixed32Rules::set_lte(::uint32_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.lte) -} -inline ::uint32_t Fixed32Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0u; -} - -// fixed32 gt = 4 [(.buf.validate.predefined) = { -inline bool Fixed32Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void Fixed32Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void Fixed32Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0u; - clear_has_greater_than(); - } -} -inline ::uint32_t Fixed32Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.gt) - return _internal_gt(); -} -inline void Fixed32Rules::set_gt(::uint32_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.gt) -} -inline ::uint32_t Fixed32Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0u; -} - -// fixed32 gte = 5 [(.buf.validate.predefined) = { -inline bool Fixed32Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void Fixed32Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void Fixed32Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0u; - clear_has_greater_than(); - } -} -inline ::uint32_t Fixed32Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.gte) - return _internal_gte(); -} -inline void Fixed32Rules::set_gte(::uint32_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.gte) -} -inline ::uint32_t Fixed32Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0u; -} - -// repeated fixed32 in = 6 [(.buf.validate.predefined) = { -inline int Fixed32Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int Fixed32Rules::in_size() const { - return _internal_in_size(); -} -inline void Fixed32Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::uint32_t Fixed32Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.in) - return _internal_in().Get(index); -} -inline void Fixed32Rules::set_in(int index, ::uint32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.in) -} -inline void Fixed32Rules::add_in(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed32Rules.in) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& Fixed32Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed32Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL Fixed32Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed32Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -Fixed32Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -Fixed32Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated fixed32 not_in = 7 [(.buf.validate.predefined) = { -inline int Fixed32Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int Fixed32Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void Fixed32Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::uint32_t Fixed32Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.not_in) - return _internal_not_in().Get(index); -} -inline void Fixed32Rules::set_not_in(int index, ::uint32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.not_in) -} -inline void Fixed32Rules::add_not_in(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed32Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& Fixed32Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed32Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL Fixed32Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed32Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -Fixed32Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -Fixed32Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated fixed32 example = 8 [(.buf.validate.predefined) = { -inline int Fixed32Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int Fixed32Rules::example_size() const { - return _internal_example_size(); -} -inline void Fixed32Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint32_t Fixed32Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed32Rules.example) - return _internal_example().Get(index); -} -inline void Fixed32Rules::set_example(int index, ::uint32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed32Rules.example) -} -inline void Fixed32Rules::add_example(::uint32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed32Rules.example) -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& Fixed32Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed32Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL Fixed32Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed32Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::uint32_t>& -Fixed32Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::uint32_t>* PROTOBUF_NONNULL -Fixed32Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool Fixed32Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void Fixed32Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool Fixed32Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void Fixed32Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline Fixed32Rules::LessThanCase Fixed32Rules::less_than_case() const { - return Fixed32Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline Fixed32Rules::GreaterThanCase Fixed32Rules::greater_than_case() const { - return Fixed32Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// Fixed64Rules - -// optional fixed64 const = 1 [(.buf.validate.predefined) = { -inline bool Fixed64Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void Fixed64Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::uint64_t Fixed64Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.const) - return _internal_const_(); -} -inline void Fixed64Rules::set_const_(::uint64_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.const) -} -inline ::uint64_t Fixed64Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void Fixed64Rules::_internal_set_const_(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// fixed64 lt = 2 [(.buf.validate.predefined) = { -inline bool Fixed64Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void Fixed64Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void Fixed64Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = ::uint64_t{0u}; - clear_has_less_than(); - } -} -inline ::uint64_t Fixed64Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.lt) - return _internal_lt(); -} -inline void Fixed64Rules::set_lt(::uint64_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.lt) -} -inline ::uint64_t Fixed64Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return ::uint64_t{0u}; -} - -// fixed64 lte = 3 [(.buf.validate.predefined) = { -inline bool Fixed64Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void Fixed64Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void Fixed64Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = ::uint64_t{0u}; - clear_has_less_than(); - } -} -inline ::uint64_t Fixed64Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.lte) - return _internal_lte(); -} -inline void Fixed64Rules::set_lte(::uint64_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.lte) -} -inline ::uint64_t Fixed64Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return ::uint64_t{0u}; -} - -// fixed64 gt = 4 [(.buf.validate.predefined) = { -inline bool Fixed64Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void Fixed64Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void Fixed64Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = ::uint64_t{0u}; - clear_has_greater_than(); - } -} -inline ::uint64_t Fixed64Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.gt) - return _internal_gt(); -} -inline void Fixed64Rules::set_gt(::uint64_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.gt) -} -inline ::uint64_t Fixed64Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return ::uint64_t{0u}; -} - -// fixed64 gte = 5 [(.buf.validate.predefined) = { -inline bool Fixed64Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void Fixed64Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void Fixed64Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = ::uint64_t{0u}; - clear_has_greater_than(); - } -} -inline ::uint64_t Fixed64Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.gte) - return _internal_gte(); -} -inline void Fixed64Rules::set_gte(::uint64_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.gte) -} -inline ::uint64_t Fixed64Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return ::uint64_t{0u}; -} - -// repeated fixed64 in = 6 [(.buf.validate.predefined) = { -inline int Fixed64Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int Fixed64Rules::in_size() const { - return _internal_in_size(); -} -inline void Fixed64Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::uint64_t Fixed64Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.in) - return _internal_in().Get(index); -} -inline void Fixed64Rules::set_in(int index, ::uint64_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.in) -} -inline void Fixed64Rules::add_in(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed64Rules.in) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& Fixed64Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed64Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL Fixed64Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed64Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -Fixed64Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -Fixed64Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated fixed64 not_in = 7 [(.buf.validate.predefined) = { -inline int Fixed64Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int Fixed64Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void Fixed64Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::uint64_t Fixed64Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.not_in) - return _internal_not_in().Get(index); -} -inline void Fixed64Rules::set_not_in(int index, ::uint64_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.not_in) -} -inline void Fixed64Rules::add_not_in(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed64Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& Fixed64Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed64Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL Fixed64Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed64Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -Fixed64Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -Fixed64Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated fixed64 example = 8 [(.buf.validate.predefined) = { -inline int Fixed64Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int Fixed64Rules::example_size() const { - return _internal_example_size(); -} -inline void Fixed64Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint64_t Fixed64Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.Fixed64Rules.example) - return _internal_example().Get(index); -} -inline void Fixed64Rules::set_example(int index, ::uint64_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.Fixed64Rules.example) -} -inline void Fixed64Rules::add_example(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.Fixed64Rules.example) -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& Fixed64Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Fixed64Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL Fixed64Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Fixed64Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::uint64_t>& -Fixed64Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::uint64_t>* PROTOBUF_NONNULL -Fixed64Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool Fixed64Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void Fixed64Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool Fixed64Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void Fixed64Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline Fixed64Rules::LessThanCase Fixed64Rules::less_than_case() const { - return Fixed64Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline Fixed64Rules::GreaterThanCase Fixed64Rules::greater_than_case() const { - return Fixed64Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// SFixed32Rules - -// optional sfixed32 const = 1 [(.buf.validate.predefined) = { -inline bool SFixed32Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void SFixed32Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int32_t SFixed32Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.const) - return _internal_const_(); -} -inline void SFixed32Rules::set_const_(::int32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.const) -} -inline ::int32_t SFixed32Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void SFixed32Rules::_internal_set_const_(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// sfixed32 lt = 2 [(.buf.validate.predefined) = { -inline bool SFixed32Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void SFixed32Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void SFixed32Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t SFixed32Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.lt) - return _internal_lt(); -} -inline void SFixed32Rules::set_lt(::int32_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.lt) -} -inline ::int32_t SFixed32Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return 0; -} - -// sfixed32 lte = 3 [(.buf.validate.predefined) = { -inline bool SFixed32Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void SFixed32Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void SFixed32Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = 0; - clear_has_less_than(); - } -} -inline ::int32_t SFixed32Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.lte) - return _internal_lte(); -} -inline void SFixed32Rules::set_lte(::int32_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.lte) -} -inline ::int32_t SFixed32Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return 0; -} - -// sfixed32 gt = 4 [(.buf.validate.predefined) = { -inline bool SFixed32Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void SFixed32Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void SFixed32Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t SFixed32Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.gt) - return _internal_gt(); -} -inline void SFixed32Rules::set_gt(::int32_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.gt) -} -inline ::int32_t SFixed32Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return 0; -} - -// sfixed32 gte = 5 [(.buf.validate.predefined) = { -inline bool SFixed32Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void SFixed32Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void SFixed32Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = 0; - clear_has_greater_than(); - } -} -inline ::int32_t SFixed32Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.gte) - return _internal_gte(); -} -inline void SFixed32Rules::set_gte(::int32_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.gte) -} -inline ::int32_t SFixed32Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return 0; -} - -// repeated sfixed32 in = 6 [(.buf.validate.predefined) = { -inline int SFixed32Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int SFixed32Rules::in_size() const { - return _internal_in_size(); -} -inline void SFixed32Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int32_t SFixed32Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.in) - return _internal_in().Get(index); -} -inline void SFixed32Rules::set_in(int index, ::int32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.in) -} -inline void SFixed32Rules::add_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed32Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SFixed32Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed32Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SFixed32Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed32Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SFixed32Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SFixed32Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated sfixed32 not_in = 7 [(.buf.validate.predefined) = { -inline int SFixed32Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int SFixed32Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void SFixed32Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int32_t SFixed32Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.not_in) - return _internal_not_in().Get(index); -} -inline void SFixed32Rules::set_not_in(int index, ::int32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.not_in) -} -inline void SFixed32Rules::add_not_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed32Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SFixed32Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed32Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SFixed32Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed32Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SFixed32Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SFixed32Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated sfixed32 example = 8 [(.buf.validate.predefined) = { -inline int SFixed32Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int SFixed32Rules::example_size() const { - return _internal_example_size(); -} -inline void SFixed32Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int32_t SFixed32Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed32Rules.example) - return _internal_example().Get(index); -} -inline void SFixed32Rules::set_example(int index, ::int32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed32Rules.example) -} -inline void SFixed32Rules::add_example(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed32Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& SFixed32Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed32Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL SFixed32Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed32Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -SFixed32Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -SFixed32Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool SFixed32Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void SFixed32Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool SFixed32Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void SFixed32Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline SFixed32Rules::LessThanCase SFixed32Rules::less_than_case() const { - return SFixed32Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline SFixed32Rules::GreaterThanCase SFixed32Rules::greater_than_case() const { - return SFixed32Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// SFixed64Rules - -// optional sfixed64 const = 1 [(.buf.validate.predefined) = { -inline bool SFixed64Rules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void SFixed64Rules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = ::int64_t{0}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int64_t SFixed64Rules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.const) - return _internal_const_(); -} -inline void SFixed64Rules::set_const_(::int64_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.const) -} -inline ::int64_t SFixed64Rules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void SFixed64Rules::_internal_set_const_(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// sfixed64 lt = 2 [(.buf.validate.predefined) = { -inline bool SFixed64Rules::has_lt() const { - return less_than_case() == kLt; -} -inline void SFixed64Rules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline void SFixed64Rules::clear_lt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLt) { - _impl_.less_than_.lt_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t SFixed64Rules::lt() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.lt) - return _internal_lt(); -} -inline void SFixed64Rules::set_lt(::int64_t value) { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - } - _impl_.less_than_.lt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.lt) -} -inline ::int64_t SFixed64Rules::_internal_lt() const { - if (less_than_case() == kLt) { - return _impl_.less_than_.lt_; - } - return ::int64_t{0}; -} - -// sfixed64 lte = 3 [(.buf.validate.predefined) = { -inline bool SFixed64Rules::has_lte() const { - return less_than_case() == kLte; -} -inline void SFixed64Rules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline void SFixed64Rules::clear_lte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLte) { - _impl_.less_than_.lte_ = ::int64_t{0}; - clear_has_less_than(); - } -} -inline ::int64_t SFixed64Rules::lte() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.lte) - return _internal_lte(); -} -inline void SFixed64Rules::set_lte(::int64_t value) { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - } - _impl_.less_than_.lte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.lte) -} -inline ::int64_t SFixed64Rules::_internal_lte() const { - if (less_than_case() == kLte) { - return _impl_.less_than_.lte_; - } - return ::int64_t{0}; -} - -// sfixed64 gt = 4 [(.buf.validate.predefined) = { -inline bool SFixed64Rules::has_gt() const { - return greater_than_case() == kGt; -} -inline void SFixed64Rules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline void SFixed64Rules::clear_gt() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGt) { - _impl_.greater_than_.gt_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t SFixed64Rules::gt() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.gt) - return _internal_gt(); -} -inline void SFixed64Rules::set_gt(::int64_t value) { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - } - _impl_.greater_than_.gt_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.gt) -} -inline ::int64_t SFixed64Rules::_internal_gt() const { - if (greater_than_case() == kGt) { - return _impl_.greater_than_.gt_; - } - return ::int64_t{0}; -} - -// sfixed64 gte = 5 [(.buf.validate.predefined) = { -inline bool SFixed64Rules::has_gte() const { - return greater_than_case() == kGte; -} -inline void SFixed64Rules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline void SFixed64Rules::clear_gte() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGte) { - _impl_.greater_than_.gte_ = ::int64_t{0}; - clear_has_greater_than(); - } -} -inline ::int64_t SFixed64Rules::gte() const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.gte) - return _internal_gte(); -} -inline void SFixed64Rules::set_gte(::int64_t value) { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - } - _impl_.greater_than_.gte_ = value; - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.gte) -} -inline ::int64_t SFixed64Rules::_internal_gte() const { - if (greater_than_case() == kGte) { - return _impl_.greater_than_.gte_; - } - return ::int64_t{0}; -} - -// repeated sfixed64 in = 6 [(.buf.validate.predefined) = { -inline int SFixed64Rules::_internal_in_size() const { - return _internal_in().size(); -} -inline int SFixed64Rules::in_size() const { - return _internal_in_size(); -} -inline void SFixed64Rules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int64_t SFixed64Rules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.in) - return _internal_in().Get(index); -} -inline void SFixed64Rules::set_in(int index, ::int64_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.in) -} -inline void SFixed64Rules::add_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed64Rules.in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SFixed64Rules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed64Rules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SFixed64Rules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed64Rules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SFixed64Rules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SFixed64Rules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated sfixed64 not_in = 7 [(.buf.validate.predefined) = { -inline int SFixed64Rules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int SFixed64Rules::not_in_size() const { - return _internal_not_in_size(); -} -inline void SFixed64Rules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int64_t SFixed64Rules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.not_in) - return _internal_not_in().Get(index); -} -inline void SFixed64Rules::set_not_in(int index, ::int64_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.not_in) -} -inline void SFixed64Rules::add_not_in(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed64Rules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SFixed64Rules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed64Rules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SFixed64Rules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed64Rules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SFixed64Rules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SFixed64Rules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated sfixed64 example = 8 [(.buf.validate.predefined) = { -inline int SFixed64Rules::_internal_example_size() const { - return _internal_example().size(); -} -inline int SFixed64Rules::example_size() const { - return _internal_example_size(); -} -inline void SFixed64Rules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int64_t SFixed64Rules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.SFixed64Rules.example) - return _internal_example().Get(index); -} -inline void SFixed64Rules::set_example(int index, ::int64_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.SFixed64Rules.example) -} -inline void SFixed64Rules::add_example(::int64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.SFixed64Rules.example) -} -inline const ::google::protobuf::RepeatedField<::int64_t>& SFixed64Rules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.SFixed64Rules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL SFixed64Rules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.SFixed64Rules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int64_t>& -SFixed64Rules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int64_t>* PROTOBUF_NONNULL -SFixed64Rules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool SFixed64Rules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void SFixed64Rules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool SFixed64Rules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void SFixed64Rules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline SFixed64Rules::LessThanCase SFixed64Rules::less_than_case() const { - return SFixed64Rules::LessThanCase(_impl_._oneof_case_[0]); -} -inline SFixed64Rules::GreaterThanCase SFixed64Rules::greater_than_case() const { - return SFixed64Rules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// BoolRules - -// optional bool const = 1 [(.buf.validate.predefined) = { -inline bool BoolRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void BoolRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline bool BoolRules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.BoolRules.const) - return _internal_const_(); -} -inline void BoolRules::set_const_(bool value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_set:buf.validate.BoolRules.const) -} -inline bool BoolRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void BoolRules::_internal_set_const_(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// repeated bool example = 2 [(.buf.validate.predefined) = { -inline int BoolRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int BoolRules::example_size() const { - return _internal_example_size(); -} -inline void BoolRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline bool BoolRules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.BoolRules.example) - return _internal_example().Get(index); -} -inline void BoolRules::set_example(int index, bool value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.BoolRules.example) -} -inline void BoolRules::add_example(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.BoolRules.example) -} -inline const ::google::protobuf::RepeatedField& BoolRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.BoolRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL BoolRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.BoolRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField& -BoolRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField* PROTOBUF_NONNULL -BoolRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -// ------------------------------------------------------------------- - -// StringRules - -// optional string const = 1 [(.buf.validate.predefined) = { -inline bool StringRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void StringRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline const ::std::string& StringRules::const_() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.const) - return _internal_const_(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_const_(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - _impl_.const__.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.const) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_const_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - ::std::string* _s = _internal_mutable_const_(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.const) - return _s; -} -inline const ::std::string& StringRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__.Get(); -} -inline void StringRules::_internal_set_const_(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.const__.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.const) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000008U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - auto* released = _impl_.const__.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.const__.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_const_(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - _impl_.const__.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.const__.IsDefault()) { - _impl_.const__.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.const) -} - -// optional uint64 len = 19 [(.buf.validate.predefined) = { -inline bool StringRules::has_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00002000U); - return value; -} -inline void StringRules::clear_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00002000U); -} -inline ::uint64_t StringRules::len() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.len) - return _internal_len(); -} -inline void StringRules::set_len(::uint64_t value) { - _internal_set_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00002000U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.len) -} -inline ::uint64_t StringRules::_internal_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.len_; -} -inline void StringRules::_internal_set_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_ = value; -} - -// optional uint64 min_len = 2 [(.buf.validate.predefined) = { -inline bool StringRules::has_min_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000200U); - return value; -} -inline void StringRules::clear_min_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000200U); -} -inline ::uint64_t StringRules::min_len() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.min_len) - return _internal_min_len(); -} -inline void StringRules::set_min_len(::uint64_t value) { - _internal_set_min_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00000200U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.min_len) -} -inline ::uint64_t StringRules::_internal_min_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.min_len_; -} -inline void StringRules::_internal_set_min_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_len_ = value; -} - -// optional uint64 max_len = 3 [(.buf.validate.predefined) = { -inline bool StringRules::has_max_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000400U); - return value; -} -inline void StringRules::clear_max_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000400U); -} -inline ::uint64_t StringRules::max_len() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.max_len) - return _internal_max_len(); -} -inline void StringRules::set_max_len(::uint64_t value) { - _internal_set_max_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00000400U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.max_len) -} -inline ::uint64_t StringRules::_internal_max_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.max_len_; -} -inline void StringRules::_internal_set_max_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_len_ = value; -} - -// optional uint64 len_bytes = 20 [(.buf.validate.predefined) = { -inline bool StringRules::has_len_bytes() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00004000U); - return value; -} -inline void StringRules::clear_len_bytes() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_bytes_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00004000U); -} -inline ::uint64_t StringRules::len_bytes() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.len_bytes) - return _internal_len_bytes(); -} -inline void StringRules::set_len_bytes(::uint64_t value) { - _internal_set_len_bytes(value); - SetHasBit(_impl_._has_bits_[0], 0x00004000U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.len_bytes) -} -inline ::uint64_t StringRules::_internal_len_bytes() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.len_bytes_; -} -inline void StringRules::_internal_set_len_bytes(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_bytes_ = value; -} - -// optional uint64 min_bytes = 4 [(.buf.validate.predefined) = { -inline bool StringRules::has_min_bytes() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000800U); - return value; -} -inline void StringRules::clear_min_bytes() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_bytes_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000800U); -} -inline ::uint64_t StringRules::min_bytes() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.min_bytes) - return _internal_min_bytes(); -} -inline void StringRules::set_min_bytes(::uint64_t value) { - _internal_set_min_bytes(value); - SetHasBit(_impl_._has_bits_[0], 0x00000800U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.min_bytes) -} -inline ::uint64_t StringRules::_internal_min_bytes() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.min_bytes_; -} -inline void StringRules::_internal_set_min_bytes(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_bytes_ = value; -} - -// optional uint64 max_bytes = 5 [(.buf.validate.predefined) = { -inline bool StringRules::has_max_bytes() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00001000U); - return value; -} -inline void StringRules::clear_max_bytes() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_bytes_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00001000U); -} -inline ::uint64_t StringRules::max_bytes() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.max_bytes) - return _internal_max_bytes(); -} -inline void StringRules::set_max_bytes(::uint64_t value) { - _internal_set_max_bytes(value); - SetHasBit(_impl_._has_bits_[0], 0x00001000U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.max_bytes) -} -inline ::uint64_t StringRules::_internal_max_bytes() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.max_bytes_; -} -inline void StringRules::_internal_set_max_bytes(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_bytes_ = value; -} - -// optional string pattern = 6 [(.buf.validate.predefined) = { -inline bool StringRules::has_pattern() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000010U); - return value; -} -inline void StringRules::clear_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.pattern_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000010U); -} -inline const ::std::string& StringRules::pattern() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.pattern) - return _internal_pattern(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_pattern(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - _impl_.pattern_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.pattern) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_pattern() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - ::std::string* _s = _internal_mutable_pattern(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.pattern) - return _s; -} -inline const ::std::string& StringRules::_internal_pattern() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.pattern_.Get(); -} -inline void StringRules::_internal_set_pattern(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.pattern_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.pattern_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.pattern) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000010U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000010U); - auto* released = _impl_.pattern_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.pattern_.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_pattern(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000010U); - } - _impl_.pattern_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.pattern_.IsDefault()) { - _impl_.pattern_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.pattern) -} - -// optional string prefix = 7 [(.buf.validate.predefined) = { -inline bool StringRules::has_prefix() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000020U); - return value; -} -inline void StringRules::clear_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.prefix_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000020U); -} -inline const ::std::string& StringRules::prefix() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.prefix) - return _internal_prefix(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_prefix(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - _impl_.prefix_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.prefix) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_prefix() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - ::std::string* _s = _internal_mutable_prefix(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.prefix) - return _s; -} -inline const ::std::string& StringRules::_internal_prefix() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.prefix_.Get(); -} -inline void StringRules::_internal_set_prefix(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.prefix_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.prefix_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.prefix) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000020U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000020U); - auto* released = _impl_.prefix_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.prefix_.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_prefix(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000020U); - } - _impl_.prefix_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.prefix_.IsDefault()) { - _impl_.prefix_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.prefix) -} - -// optional string suffix = 8 [(.buf.validate.predefined) = { -inline bool StringRules::has_suffix() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000040U); - return value; -} -inline void StringRules::clear_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.suffix_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000040U); -} -inline const ::std::string& StringRules::suffix() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.suffix) - return _internal_suffix(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_suffix(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - _impl_.suffix_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.suffix) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_suffix() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - ::std::string* _s = _internal_mutable_suffix(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.suffix) - return _s; -} -inline const ::std::string& StringRules::_internal_suffix() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.suffix_.Get(); -} -inline void StringRules::_internal_set_suffix(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.suffix_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.suffix_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.suffix) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000040U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000040U); - auto* released = _impl_.suffix_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.suffix_.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_suffix(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000040U); - } - _impl_.suffix_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.suffix_.IsDefault()) { - _impl_.suffix_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.suffix) -} - -// optional string contains = 9 [(.buf.validate.predefined) = { -inline bool StringRules::has_contains() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000080U); - return value; -} -inline void StringRules::clear_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.contains_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000080U); -} -inline const ::std::string& StringRules::contains() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.contains) - return _internal_contains(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_contains(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - _impl_.contains_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.contains) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_contains() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - ::std::string* _s = _internal_mutable_contains(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.contains) - return _s; -} -inline const ::std::string& StringRules::_internal_contains() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.contains_.Get(); -} -inline void StringRules::_internal_set_contains(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.contains_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.contains_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.contains) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000080U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000080U); - auto* released = _impl_.contains_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.contains_.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_contains(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000080U); - } - _impl_.contains_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.contains_.IsDefault()) { - _impl_.contains_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.contains) -} - -// optional string not_contains = 23 [(.buf.validate.predefined) = { -inline bool StringRules::has_not_contains() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000100U); - return value; -} -inline void StringRules::clear_not_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_contains_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000100U); -} -inline const ::std::string& StringRules::not_contains() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.not_contains) - return _internal_not_contains(); -} -template -PROTOBUF_ALWAYS_INLINE void StringRules::set_not_contains(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000100U); - _impl_.not_contains_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.not_contains) -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_not_contains() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000100U); - ::std::string* _s = _internal_mutable_not_contains(); - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.not_contains) - return _s; -} -inline const ::std::string& StringRules::_internal_not_contains() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_contains_.Get(); -} -inline void StringRules::_internal_set_not_contains(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_contains_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::_internal_mutable_not_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.not_contains_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE StringRules::release_not_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.StringRules.not_contains) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000100U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000100U); - auto* released = _impl_.not_contains_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.not_contains_.Set("", GetArena()); - } - return released; -} -inline void StringRules::set_allocated_not_contains(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000100U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000100U); - } - _impl_.not_contains_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.not_contains_.IsDefault()) { - _impl_.not_contains_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.StringRules.not_contains) -} - -// repeated string in = 10 [(.buf.validate.predefined) = { -inline int StringRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int StringRules::in_size() const { - return _internal_in_size(); -} -inline void StringRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::add_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.StringRules.in) - return _s; -} -inline const ::std::string& StringRules::in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.in) - return _internal_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.in) - return _internal_mutable_in()->Mutable(index); -} -template -inline void StringRules::set_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.in) -} -template -inline void StringRules::add_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.StringRules.in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& StringRules::in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.StringRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::mutable_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.StringRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -StringRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated string not_in = 11 [(.buf.validate.predefined) = { -inline int StringRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int StringRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void StringRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::add_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_not_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.StringRules.not_in) - return _s; -} -inline const ::std::string& StringRules::not_in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.not_in) - return _internal_not_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_not_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.not_in) - return _internal_mutable_not_in()->Mutable(index); -} -template -inline void StringRules::set_not_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_not_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.not_in) -} -template -inline void StringRules::add_not_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_not_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.StringRules.not_in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& StringRules::not_in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.StringRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::mutable_not_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.StringRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -StringRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// bool email = 12 [(.buf.validate.predefined) = { -inline bool StringRules::has_email() const { - return well_known_case() == kEmail; -} -inline void StringRules::set_has_email() { - _impl_._oneof_case_[0] = kEmail; -} -inline void StringRules::clear_email() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kEmail) { - _impl_.well_known_.email_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::email() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.email) - return _internal_email(); -} -inline void StringRules::set_email(bool value) { - if (well_known_case() != kEmail) { - clear_well_known(); - set_has_email(); - } - _impl_.well_known_.email_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.email) -} -inline bool StringRules::_internal_email() const { - if (well_known_case() == kEmail) { - return _impl_.well_known_.email_; - } - return false; -} - -// bool hostname = 13 [(.buf.validate.predefined) = { -inline bool StringRules::has_hostname() const { - return well_known_case() == kHostname; -} -inline void StringRules::set_has_hostname() { - _impl_._oneof_case_[0] = kHostname; -} -inline void StringRules::clear_hostname() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kHostname) { - _impl_.well_known_.hostname_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::hostname() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.hostname) - return _internal_hostname(); -} -inline void StringRules::set_hostname(bool value) { - if (well_known_case() != kHostname) { - clear_well_known(); - set_has_hostname(); - } - _impl_.well_known_.hostname_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.hostname) -} -inline bool StringRules::_internal_hostname() const { - if (well_known_case() == kHostname) { - return _impl_.well_known_.hostname_; - } - return false; -} - -// bool ip = 14 [(.buf.validate.predefined) = { -inline bool StringRules::has_ip() const { - return well_known_case() == kIp; -} -inline void StringRules::set_has_ip() { - _impl_._oneof_case_[0] = kIp; -} -inline void StringRules::clear_ip() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIp) { - _impl_.well_known_.ip_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ip() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ip) - return _internal_ip(); -} -inline void StringRules::set_ip(bool value) { - if (well_known_case() != kIp) { - clear_well_known(); - set_has_ip(); - } - _impl_.well_known_.ip_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ip) -} -inline bool StringRules::_internal_ip() const { - if (well_known_case() == kIp) { - return _impl_.well_known_.ip_; - } - return false; -} - -// bool ipv4 = 15 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv4() const { - return well_known_case() == kIpv4; -} -inline void StringRules::set_has_ipv4() { - _impl_._oneof_case_[0] = kIpv4; -} -inline void StringRules::clear_ipv4() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv4) { - _impl_.well_known_.ipv4_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv4() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv4) - return _internal_ipv4(); -} -inline void StringRules::set_ipv4(bool value) { - if (well_known_case() != kIpv4) { - clear_well_known(); - set_has_ipv4(); - } - _impl_.well_known_.ipv4_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv4) -} -inline bool StringRules::_internal_ipv4() const { - if (well_known_case() == kIpv4) { - return _impl_.well_known_.ipv4_; - } - return false; -} - -// bool ipv6 = 16 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv6() const { - return well_known_case() == kIpv6; -} -inline void StringRules::set_has_ipv6() { - _impl_._oneof_case_[0] = kIpv6; -} -inline void StringRules::clear_ipv6() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv6) { - _impl_.well_known_.ipv6_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv6() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv6) - return _internal_ipv6(); -} -inline void StringRules::set_ipv6(bool value) { - if (well_known_case() != kIpv6) { - clear_well_known(); - set_has_ipv6(); - } - _impl_.well_known_.ipv6_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv6) -} -inline bool StringRules::_internal_ipv6() const { - if (well_known_case() == kIpv6) { - return _impl_.well_known_.ipv6_; - } - return false; -} - -// bool uri = 17 [(.buf.validate.predefined) = { -inline bool StringRules::has_uri() const { - return well_known_case() == kUri; -} -inline void StringRules::set_has_uri() { - _impl_._oneof_case_[0] = kUri; -} -inline void StringRules::clear_uri() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kUri) { - _impl_.well_known_.uri_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::uri() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.uri) - return _internal_uri(); -} -inline void StringRules::set_uri(bool value) { - if (well_known_case() != kUri) { - clear_well_known(); - set_has_uri(); - } - _impl_.well_known_.uri_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.uri) -} -inline bool StringRules::_internal_uri() const { - if (well_known_case() == kUri) { - return _impl_.well_known_.uri_; - } - return false; -} - -// bool uri_ref = 18 [(.buf.validate.predefined) = { -inline bool StringRules::has_uri_ref() const { - return well_known_case() == kUriRef; -} -inline void StringRules::set_has_uri_ref() { - _impl_._oneof_case_[0] = kUriRef; -} -inline void StringRules::clear_uri_ref() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kUriRef) { - _impl_.well_known_.uri_ref_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::uri_ref() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.uri_ref) - return _internal_uri_ref(); -} -inline void StringRules::set_uri_ref(bool value) { - if (well_known_case() != kUriRef) { - clear_well_known(); - set_has_uri_ref(); - } - _impl_.well_known_.uri_ref_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.uri_ref) -} -inline bool StringRules::_internal_uri_ref() const { - if (well_known_case() == kUriRef) { - return _impl_.well_known_.uri_ref_; - } - return false; -} - -// bool address = 21 [(.buf.validate.predefined) = { -inline bool StringRules::has_address() const { - return well_known_case() == kAddress; -} -inline void StringRules::set_has_address() { - _impl_._oneof_case_[0] = kAddress; -} -inline void StringRules::clear_address() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kAddress) { - _impl_.well_known_.address_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::address() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.address) - return _internal_address(); -} -inline void StringRules::set_address(bool value) { - if (well_known_case() != kAddress) { - clear_well_known(); - set_has_address(); - } - _impl_.well_known_.address_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.address) -} -inline bool StringRules::_internal_address() const { - if (well_known_case() == kAddress) { - return _impl_.well_known_.address_; - } - return false; -} - -// bool uuid = 22 [(.buf.validate.predefined) = { -inline bool StringRules::has_uuid() const { - return well_known_case() == kUuid; -} -inline void StringRules::set_has_uuid() { - _impl_._oneof_case_[0] = kUuid; -} -inline void StringRules::clear_uuid() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kUuid) { - _impl_.well_known_.uuid_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::uuid() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.uuid) - return _internal_uuid(); -} -inline void StringRules::set_uuid(bool value) { - if (well_known_case() != kUuid) { - clear_well_known(); - set_has_uuid(); - } - _impl_.well_known_.uuid_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.uuid) -} -inline bool StringRules::_internal_uuid() const { - if (well_known_case() == kUuid) { - return _impl_.well_known_.uuid_; - } - return false; -} - -// bool tuuid = 33 [(.buf.validate.predefined) = { -inline bool StringRules::has_tuuid() const { - return well_known_case() == kTuuid; -} -inline void StringRules::set_has_tuuid() { - _impl_._oneof_case_[0] = kTuuid; -} -inline void StringRules::clear_tuuid() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kTuuid) { - _impl_.well_known_.tuuid_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::tuuid() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.tuuid) - return _internal_tuuid(); -} -inline void StringRules::set_tuuid(bool value) { - if (well_known_case() != kTuuid) { - clear_well_known(); - set_has_tuuid(); - } - _impl_.well_known_.tuuid_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.tuuid) -} -inline bool StringRules::_internal_tuuid() const { - if (well_known_case() == kTuuid) { - return _impl_.well_known_.tuuid_; - } - return false; -} - -// bool ip_with_prefixlen = 26 [(.buf.validate.predefined) = { -inline bool StringRules::has_ip_with_prefixlen() const { - return well_known_case() == kIpWithPrefixlen; -} -inline void StringRules::set_has_ip_with_prefixlen() { - _impl_._oneof_case_[0] = kIpWithPrefixlen; -} -inline void StringRules::clear_ip_with_prefixlen() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpWithPrefixlen) { - _impl_.well_known_.ip_with_prefixlen_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ip_with_prefixlen() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ip_with_prefixlen) - return _internal_ip_with_prefixlen(); -} -inline void StringRules::set_ip_with_prefixlen(bool value) { - if (well_known_case() != kIpWithPrefixlen) { - clear_well_known(); - set_has_ip_with_prefixlen(); - } - _impl_.well_known_.ip_with_prefixlen_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ip_with_prefixlen) -} -inline bool StringRules::_internal_ip_with_prefixlen() const { - if (well_known_case() == kIpWithPrefixlen) { - return _impl_.well_known_.ip_with_prefixlen_; - } - return false; -} - -// bool ipv4_with_prefixlen = 27 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv4_with_prefixlen() const { - return well_known_case() == kIpv4WithPrefixlen; -} -inline void StringRules::set_has_ipv4_with_prefixlen() { - _impl_._oneof_case_[0] = kIpv4WithPrefixlen; -} -inline void StringRules::clear_ipv4_with_prefixlen() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv4WithPrefixlen) { - _impl_.well_known_.ipv4_with_prefixlen_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv4_with_prefixlen() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv4_with_prefixlen) - return _internal_ipv4_with_prefixlen(); -} -inline void StringRules::set_ipv4_with_prefixlen(bool value) { - if (well_known_case() != kIpv4WithPrefixlen) { - clear_well_known(); - set_has_ipv4_with_prefixlen(); - } - _impl_.well_known_.ipv4_with_prefixlen_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv4_with_prefixlen) -} -inline bool StringRules::_internal_ipv4_with_prefixlen() const { - if (well_known_case() == kIpv4WithPrefixlen) { - return _impl_.well_known_.ipv4_with_prefixlen_; - } - return false; -} - -// bool ipv6_with_prefixlen = 28 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv6_with_prefixlen() const { - return well_known_case() == kIpv6WithPrefixlen; -} -inline void StringRules::set_has_ipv6_with_prefixlen() { - _impl_._oneof_case_[0] = kIpv6WithPrefixlen; -} -inline void StringRules::clear_ipv6_with_prefixlen() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv6WithPrefixlen) { - _impl_.well_known_.ipv6_with_prefixlen_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv6_with_prefixlen() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv6_with_prefixlen) - return _internal_ipv6_with_prefixlen(); -} -inline void StringRules::set_ipv6_with_prefixlen(bool value) { - if (well_known_case() != kIpv6WithPrefixlen) { - clear_well_known(); - set_has_ipv6_with_prefixlen(); - } - _impl_.well_known_.ipv6_with_prefixlen_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv6_with_prefixlen) -} -inline bool StringRules::_internal_ipv6_with_prefixlen() const { - if (well_known_case() == kIpv6WithPrefixlen) { - return _impl_.well_known_.ipv6_with_prefixlen_; - } - return false; -} - -// bool ip_prefix = 29 [(.buf.validate.predefined) = { -inline bool StringRules::has_ip_prefix() const { - return well_known_case() == kIpPrefix; -} -inline void StringRules::set_has_ip_prefix() { - _impl_._oneof_case_[0] = kIpPrefix; -} -inline void StringRules::clear_ip_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpPrefix) { - _impl_.well_known_.ip_prefix_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ip_prefix() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ip_prefix) - return _internal_ip_prefix(); -} -inline void StringRules::set_ip_prefix(bool value) { - if (well_known_case() != kIpPrefix) { - clear_well_known(); - set_has_ip_prefix(); - } - _impl_.well_known_.ip_prefix_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ip_prefix) -} -inline bool StringRules::_internal_ip_prefix() const { - if (well_known_case() == kIpPrefix) { - return _impl_.well_known_.ip_prefix_; - } - return false; -} - -// bool ipv4_prefix = 30 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv4_prefix() const { - return well_known_case() == kIpv4Prefix; -} -inline void StringRules::set_has_ipv4_prefix() { - _impl_._oneof_case_[0] = kIpv4Prefix; -} -inline void StringRules::clear_ipv4_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv4Prefix) { - _impl_.well_known_.ipv4_prefix_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv4_prefix() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv4_prefix) - return _internal_ipv4_prefix(); -} -inline void StringRules::set_ipv4_prefix(bool value) { - if (well_known_case() != kIpv4Prefix) { - clear_well_known(); - set_has_ipv4_prefix(); - } - _impl_.well_known_.ipv4_prefix_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv4_prefix) -} -inline bool StringRules::_internal_ipv4_prefix() const { - if (well_known_case() == kIpv4Prefix) { - return _impl_.well_known_.ipv4_prefix_; - } - return false; -} - -// bool ipv6_prefix = 31 [(.buf.validate.predefined) = { -inline bool StringRules::has_ipv6_prefix() const { - return well_known_case() == kIpv6Prefix; -} -inline void StringRules::set_has_ipv6_prefix() { - _impl_._oneof_case_[0] = kIpv6Prefix; -} -inline void StringRules::clear_ipv6_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv6Prefix) { - _impl_.well_known_.ipv6_prefix_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ipv6_prefix() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ipv6_prefix) - return _internal_ipv6_prefix(); -} -inline void StringRules::set_ipv6_prefix(bool value) { - if (well_known_case() != kIpv6Prefix) { - clear_well_known(); - set_has_ipv6_prefix(); - } - _impl_.well_known_.ipv6_prefix_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ipv6_prefix) -} -inline bool StringRules::_internal_ipv6_prefix() const { - if (well_known_case() == kIpv6Prefix) { - return _impl_.well_known_.ipv6_prefix_; - } - return false; -} - -// bool host_and_port = 32 [(.buf.validate.predefined) = { -inline bool StringRules::has_host_and_port() const { - return well_known_case() == kHostAndPort; -} -inline void StringRules::set_has_host_and_port() { - _impl_._oneof_case_[0] = kHostAndPort; -} -inline void StringRules::clear_host_and_port() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kHostAndPort) { - _impl_.well_known_.host_and_port_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::host_and_port() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.host_and_port) - return _internal_host_and_port(); -} -inline void StringRules::set_host_and_port(bool value) { - if (well_known_case() != kHostAndPort) { - clear_well_known(); - set_has_host_and_port(); - } - _impl_.well_known_.host_and_port_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.host_and_port) -} -inline bool StringRules::_internal_host_and_port() const { - if (well_known_case() == kHostAndPort) { - return _impl_.well_known_.host_and_port_; - } - return false; -} - -// bool ulid = 35 [(.buf.validate.predefined) = { -inline bool StringRules::has_ulid() const { - return well_known_case() == kUlid; -} -inline void StringRules::set_has_ulid() { - _impl_._oneof_case_[0] = kUlid; -} -inline void StringRules::clear_ulid() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kUlid) { - _impl_.well_known_.ulid_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::ulid() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.ulid) - return _internal_ulid(); -} -inline void StringRules::set_ulid(bool value) { - if (well_known_case() != kUlid) { - clear_well_known(); - set_has_ulid(); - } - _impl_.well_known_.ulid_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.ulid) -} -inline bool StringRules::_internal_ulid() const { - if (well_known_case() == kUlid) { - return _impl_.well_known_.ulid_; - } - return false; -} - -// bool protobuf_fqn = 37 [(.buf.validate.predefined) = { -inline bool StringRules::has_protobuf_fqn() const { - return well_known_case() == kProtobufFqn; -} -inline void StringRules::set_has_protobuf_fqn() { - _impl_._oneof_case_[0] = kProtobufFqn; -} -inline void StringRules::clear_protobuf_fqn() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kProtobufFqn) { - _impl_.well_known_.protobuf_fqn_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::protobuf_fqn() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.protobuf_fqn) - return _internal_protobuf_fqn(); -} -inline void StringRules::set_protobuf_fqn(bool value) { - if (well_known_case() != kProtobufFqn) { - clear_well_known(); - set_has_protobuf_fqn(); - } - _impl_.well_known_.protobuf_fqn_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.protobuf_fqn) -} -inline bool StringRules::_internal_protobuf_fqn() const { - if (well_known_case() == kProtobufFqn) { - return _impl_.well_known_.protobuf_fqn_; - } - return false; -} - -// bool protobuf_dot_fqn = 38 [(.buf.validate.predefined) = { -inline bool StringRules::has_protobuf_dot_fqn() const { - return well_known_case() == kProtobufDotFqn; -} -inline void StringRules::set_has_protobuf_dot_fqn() { - _impl_._oneof_case_[0] = kProtobufDotFqn; -} -inline void StringRules::clear_protobuf_dot_fqn() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kProtobufDotFqn) { - _impl_.well_known_.protobuf_dot_fqn_ = false; - clear_has_well_known(); - } -} -inline bool StringRules::protobuf_dot_fqn() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.protobuf_dot_fqn) - return _internal_protobuf_dot_fqn(); -} -inline void StringRules::set_protobuf_dot_fqn(bool value) { - if (well_known_case() != kProtobufDotFqn) { - clear_well_known(); - set_has_protobuf_dot_fqn(); - } - _impl_.well_known_.protobuf_dot_fqn_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.protobuf_dot_fqn) -} -inline bool StringRules::_internal_protobuf_dot_fqn() const { - if (well_known_case() == kProtobufDotFqn) { - return _impl_.well_known_.protobuf_dot_fqn_; - } - return false; -} - -// .buf.validate.KnownRegex well_known_regex = 24 [(.buf.validate.predefined) = { -inline bool StringRules::has_well_known_regex() const { - return well_known_case() == kWellKnownRegex; -} -inline void StringRules::set_has_well_known_regex() { - _impl_._oneof_case_[0] = kWellKnownRegex; -} -inline void StringRules::clear_well_known_regex() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kWellKnownRegex) { - _impl_.well_known_.well_known_regex_ = 0; - clear_has_well_known(); - } -} -inline ::buf::validate::KnownRegex StringRules::well_known_regex() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.well_known_regex) - return _internal_well_known_regex(); -} -inline void StringRules::set_well_known_regex(::buf::validate::KnownRegex value) { - - assert(::google::protobuf::internal::ValidateEnum( - value, ::buf::validate::KnownRegex_internal_data_)); - if (well_known_case() != kWellKnownRegex) { - clear_well_known(); - set_has_well_known_regex(); - } - _impl_.well_known_.well_known_regex_ = value; - // @@protoc_insertion_point(field_set:buf.validate.StringRules.well_known_regex) -} -inline ::buf::validate::KnownRegex StringRules::_internal_well_known_regex() const { - if (well_known_case() == kWellKnownRegex) { - return static_cast<::buf::validate::KnownRegex>(_impl_.well_known_.well_known_regex_); - } - return static_cast<::buf::validate::KnownRegex>(0); -} - -// optional bool strict = 25; -inline bool StringRules::has_strict() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00008000U); - return value; -} -inline void StringRules::clear_strict() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.strict_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00008000U); -} -inline bool StringRules::strict() const { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.strict) - return _internal_strict(); -} -inline void StringRules::set_strict(bool value) { - _internal_set_strict(value); - SetHasBit(_impl_._has_bits_[0], 0x00008000U); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.strict) -} -inline bool StringRules::_internal_strict() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.strict_; -} -inline void StringRules::_internal_set_strict(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.strict_ = value; -} - -// repeated string example = 34 [(.buf.validate.predefined) = { -inline int StringRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int StringRules::example_size() const { - return _internal_example_size(); -} -inline void StringRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::add_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_example()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.StringRules.example) - return _s; -} -inline const ::std::string& StringRules::example(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.StringRules.example) - return _internal_example().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL StringRules::mutable_example(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.StringRules.example) - return _internal_mutable_example()->Mutable(index); -} -template -inline void StringRules::set_example(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_example()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.StringRules.example) -} -template -inline void StringRules::add_example(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_example(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.StringRules.example) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& StringRules::example() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.StringRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::mutable_example() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.StringRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -StringRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -StringRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool StringRules::has_well_known() const { - return well_known_case() != WELL_KNOWN_NOT_SET; -} -inline void StringRules::clear_has_well_known() { - _impl_._oneof_case_[0] = WELL_KNOWN_NOT_SET; -} -inline StringRules::WellKnownCase StringRules::well_known_case() const { - return StringRules::WellKnownCase(_impl_._oneof_case_[0]); -} -// ------------------------------------------------------------------- - -// BytesRules - -// optional bytes const = 1 [(.buf.validate.predefined) = { -inline bool BytesRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void BytesRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline const ::std::string& BytesRules::const_() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.const) - return _internal_const_(); -} -template -PROTOBUF_ALWAYS_INLINE void BytesRules::set_const_(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - _impl_.const__.SetBytes(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.const) -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_const_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - ::std::string* _s = _internal_mutable_const_(); - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.const) - return _s; -} -inline const ::std::string& BytesRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__.Get(); -} -inline void BytesRules::_internal_set_const_(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::_internal_mutable_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.const__.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE BytesRules::release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.BytesRules.const) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000008U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - auto* released = _impl_.const__.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.const__.Set("", GetArena()); - } - return released; -} -inline void BytesRules::set_allocated_const_(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - _impl_.const__.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.const__.IsDefault()) { - _impl_.const__.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.BytesRules.const) -} - -// optional uint64 len = 13 [(.buf.validate.predefined) = { -inline bool BytesRules::has_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000400U); - return value; -} -inline void BytesRules::clear_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000400U); -} -inline ::uint64_t BytesRules::len() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.len) - return _internal_len(); -} -inline void BytesRules::set_len(::uint64_t value) { - _internal_set_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00000400U); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.len) -} -inline ::uint64_t BytesRules::_internal_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.len_; -} -inline void BytesRules::_internal_set_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.len_ = value; -} - -// optional uint64 min_len = 2 [(.buf.validate.predefined) = { -inline bool BytesRules::has_min_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000100U); - return value; -} -inline void BytesRules::clear_min_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000100U); -} -inline ::uint64_t BytesRules::min_len() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.min_len) - return _internal_min_len(); -} -inline void BytesRules::set_min_len(::uint64_t value) { - _internal_set_min_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00000100U); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.min_len) -} -inline ::uint64_t BytesRules::_internal_min_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.min_len_; -} -inline void BytesRules::_internal_set_min_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_len_ = value; -} - -// optional uint64 max_len = 3 [(.buf.validate.predefined) = { -inline bool BytesRules::has_max_len() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000200U); - return value; -} -inline void BytesRules::clear_max_len() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_len_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000200U); -} -inline ::uint64_t BytesRules::max_len() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.max_len) - return _internal_max_len(); -} -inline void BytesRules::set_max_len(::uint64_t value) { - _internal_set_max_len(value); - SetHasBit(_impl_._has_bits_[0], 0x00000200U); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.max_len) -} -inline ::uint64_t BytesRules::_internal_max_len() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.max_len_; -} -inline void BytesRules::_internal_set_max_len(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_len_ = value; -} - -// optional string pattern = 4 [(.buf.validate.predefined) = { -inline bool BytesRules::has_pattern() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000010U); - return value; -} -inline void BytesRules::clear_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.pattern_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000010U); -} -inline const ::std::string& BytesRules::pattern() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.pattern) - return _internal_pattern(); -} -template -PROTOBUF_ALWAYS_INLINE void BytesRules::set_pattern(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - _impl_.pattern_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.pattern) -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_pattern() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - ::std::string* _s = _internal_mutable_pattern(); - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.pattern) - return _s; -} -inline const ::std::string& BytesRules::_internal_pattern() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.pattern_.Get(); -} -inline void BytesRules::_internal_set_pattern(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.pattern_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::_internal_mutable_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.pattern_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE BytesRules::release_pattern() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.BytesRules.pattern) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000010U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000010U); - auto* released = _impl_.pattern_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.pattern_.Set("", GetArena()); - } - return released; -} -inline void BytesRules::set_allocated_pattern(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000010U); - } - _impl_.pattern_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.pattern_.IsDefault()) { - _impl_.pattern_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.BytesRules.pattern) -} - -// optional bytes prefix = 5 [(.buf.validate.predefined) = { -inline bool BytesRules::has_prefix() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000020U); - return value; -} -inline void BytesRules::clear_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.prefix_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000020U); -} -inline const ::std::string& BytesRules::prefix() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.prefix) - return _internal_prefix(); -} -template -PROTOBUF_ALWAYS_INLINE void BytesRules::set_prefix(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - _impl_.prefix_.SetBytes(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.prefix) -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_prefix() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - ::std::string* _s = _internal_mutable_prefix(); - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.prefix) - return _s; -} -inline const ::std::string& BytesRules::_internal_prefix() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.prefix_.Get(); -} -inline void BytesRules::_internal_set_prefix(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.prefix_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::_internal_mutable_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.prefix_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE BytesRules::release_prefix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.BytesRules.prefix) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000020U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000020U); - auto* released = _impl_.prefix_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.prefix_.Set("", GetArena()); - } - return released; -} -inline void BytesRules::set_allocated_prefix(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000020U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000020U); - } - _impl_.prefix_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.prefix_.IsDefault()) { - _impl_.prefix_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.BytesRules.prefix) -} - -// optional bytes suffix = 6 [(.buf.validate.predefined) = { -inline bool BytesRules::has_suffix() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000040U); - return value; -} -inline void BytesRules::clear_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.suffix_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000040U); -} -inline const ::std::string& BytesRules::suffix() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.suffix) - return _internal_suffix(); -} -template -PROTOBUF_ALWAYS_INLINE void BytesRules::set_suffix(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - _impl_.suffix_.SetBytes(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.suffix) -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_suffix() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - ::std::string* _s = _internal_mutable_suffix(); - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.suffix) - return _s; -} -inline const ::std::string& BytesRules::_internal_suffix() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.suffix_.Get(); -} -inline void BytesRules::_internal_set_suffix(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.suffix_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::_internal_mutable_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.suffix_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE BytesRules::release_suffix() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.BytesRules.suffix) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000040U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000040U); - auto* released = _impl_.suffix_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.suffix_.Set("", GetArena()); - } - return released; -} -inline void BytesRules::set_allocated_suffix(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000040U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000040U); - } - _impl_.suffix_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.suffix_.IsDefault()) { - _impl_.suffix_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.BytesRules.suffix) -} - -// optional bytes contains = 7 [(.buf.validate.predefined) = { -inline bool BytesRules::has_contains() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000080U); - return value; -} -inline void BytesRules::clear_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.contains_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000080U); -} -inline const ::std::string& BytesRules::contains() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.contains) - return _internal_contains(); -} -template -PROTOBUF_ALWAYS_INLINE void BytesRules::set_contains(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - _impl_.contains_.SetBytes(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.contains) -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_contains() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - ::std::string* _s = _internal_mutable_contains(); - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.contains) - return _s; -} -inline const ::std::string& BytesRules::_internal_contains() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.contains_.Get(); -} -inline void BytesRules::_internal_set_contains(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.contains_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::_internal_mutable_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.contains_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE BytesRules::release_contains() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.BytesRules.contains) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000080U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000080U); - auto* released = _impl_.contains_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.contains_.Set("", GetArena()); - } - return released; -} -inline void BytesRules::set_allocated_contains(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000080U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000080U); - } - _impl_.contains_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.contains_.IsDefault()) { - _impl_.contains_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.BytesRules.contains) -} - -// repeated bytes in = 8 [(.buf.validate.predefined) = { -inline int BytesRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int BytesRules::in_size() const { - return _internal_in_size(); -} -inline void BytesRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::add_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.BytesRules.in) - return _s; -} -inline const ::std::string& BytesRules::in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.in) - return _internal_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.in) - return _internal_mutable_in()->Mutable(index); -} -template -inline void BytesRules::set_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_in()->Mutable(index), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.in) -} -template -inline void BytesRules::add_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_in(), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.BytesRules.in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& BytesRules::in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.BytesRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::mutable_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.BytesRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -BytesRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated bytes not_in = 9 [(.buf.validate.predefined) = { -inline int BytesRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int BytesRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void BytesRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::add_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_not_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.BytesRules.not_in) - return _s; -} -inline const ::std::string& BytesRules::not_in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.not_in) - return _internal_not_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_not_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.not_in) - return _internal_mutable_not_in()->Mutable(index); -} -template -inline void BytesRules::set_not_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_not_in()->Mutable(index), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.not_in) -} -template -inline void BytesRules::add_not_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_not_in(), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.BytesRules.not_in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& BytesRules::not_in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.BytesRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::mutable_not_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.BytesRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -BytesRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// bool ip = 10 [(.buf.validate.predefined) = { -inline bool BytesRules::has_ip() const { - return well_known_case() == kIp; -} -inline void BytesRules::set_has_ip() { - _impl_._oneof_case_[0] = kIp; -} -inline void BytesRules::clear_ip() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIp) { - _impl_.well_known_.ip_ = false; - clear_has_well_known(); - } -} -inline bool BytesRules::ip() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.ip) - return _internal_ip(); -} -inline void BytesRules::set_ip(bool value) { - if (well_known_case() != kIp) { - clear_well_known(); - set_has_ip(); - } - _impl_.well_known_.ip_ = value; - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.ip) -} -inline bool BytesRules::_internal_ip() const { - if (well_known_case() == kIp) { - return _impl_.well_known_.ip_; - } - return false; -} - -// bool ipv4 = 11 [(.buf.validate.predefined) = { -inline bool BytesRules::has_ipv4() const { - return well_known_case() == kIpv4; -} -inline void BytesRules::set_has_ipv4() { - _impl_._oneof_case_[0] = kIpv4; -} -inline void BytesRules::clear_ipv4() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv4) { - _impl_.well_known_.ipv4_ = false; - clear_has_well_known(); - } -} -inline bool BytesRules::ipv4() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.ipv4) - return _internal_ipv4(); -} -inline void BytesRules::set_ipv4(bool value) { - if (well_known_case() != kIpv4) { - clear_well_known(); - set_has_ipv4(); - } - _impl_.well_known_.ipv4_ = value; - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.ipv4) -} -inline bool BytesRules::_internal_ipv4() const { - if (well_known_case() == kIpv4) { - return _impl_.well_known_.ipv4_; - } - return false; -} - -// bool ipv6 = 12 [(.buf.validate.predefined) = { -inline bool BytesRules::has_ipv6() const { - return well_known_case() == kIpv6; -} -inline void BytesRules::set_has_ipv6() { - _impl_._oneof_case_[0] = kIpv6; -} -inline void BytesRules::clear_ipv6() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kIpv6) { - _impl_.well_known_.ipv6_ = false; - clear_has_well_known(); - } -} -inline bool BytesRules::ipv6() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.ipv6) - return _internal_ipv6(); -} -inline void BytesRules::set_ipv6(bool value) { - if (well_known_case() != kIpv6) { - clear_well_known(); - set_has_ipv6(); - } - _impl_.well_known_.ipv6_ = value; - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.ipv6) -} -inline bool BytesRules::_internal_ipv6() const { - if (well_known_case() == kIpv6) { - return _impl_.well_known_.ipv6_; - } - return false; -} - -// bool uuid = 15 [(.buf.validate.predefined) = { -inline bool BytesRules::has_uuid() const { - return well_known_case() == kUuid; -} -inline void BytesRules::set_has_uuid() { - _impl_._oneof_case_[0] = kUuid; -} -inline void BytesRules::clear_uuid() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (well_known_case() == kUuid) { - _impl_.well_known_.uuid_ = false; - clear_has_well_known(); - } -} -inline bool BytesRules::uuid() const { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.uuid) - return _internal_uuid(); -} -inline void BytesRules::set_uuid(bool value) { - if (well_known_case() != kUuid) { - clear_well_known(); - set_has_uuid(); - } - _impl_.well_known_.uuid_ = value; - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.uuid) -} -inline bool BytesRules::_internal_uuid() const { - if (well_known_case() == kUuid) { - return _impl_.well_known_.uuid_; - } - return false; -} - -// repeated bytes example = 14 [(.buf.validate.predefined) = { -inline int BytesRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int BytesRules::example_size() const { - return _internal_example_size(); -} -inline void BytesRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::add_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_example()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.BytesRules.example) - return _s; -} -inline const ::std::string& BytesRules::example(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.BytesRules.example) - return _internal_example().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL BytesRules::mutable_example(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.BytesRules.example) - return _internal_mutable_example()->Mutable(index); -} -template -inline void BytesRules::set_example(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_example()->Mutable(index), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - // @@protoc_insertion_point(field_set:buf.validate.BytesRules.example) -} -template -inline void BytesRules::add_example(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_example(), ::std::forward(value), - args... , ::google::protobuf::internal::BytesTag{}); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.BytesRules.example) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& BytesRules::example() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.BytesRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::mutable_example() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.BytesRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -BytesRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -BytesRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool BytesRules::has_well_known() const { - return well_known_case() != WELL_KNOWN_NOT_SET; -} -inline void BytesRules::clear_has_well_known() { - _impl_._oneof_case_[0] = WELL_KNOWN_NOT_SET; -} -inline BytesRules::WellKnownCase BytesRules::well_known_case() const { - return BytesRules::WellKnownCase(_impl_._oneof_case_[0]); -} -// ------------------------------------------------------------------- - -// EnumRules - -// optional int32 const = 1 [(.buf.validate.predefined) = { -inline bool EnumRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void EnumRules::clear_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::int32_t EnumRules::const_() const { - // @@protoc_insertion_point(field_get:buf.validate.EnumRules.const) - return _internal_const_(); -} -inline void EnumRules::set_const_(::int32_t value) { - _internal_set_const_(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.EnumRules.const) -} -inline ::int32_t EnumRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.const__; -} -inline void EnumRules::_internal_set_const_(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.const__ = value; -} - -// optional bool defined_only = 2; -inline bool EnumRules::has_defined_only() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000010U); - return value; -} -inline void EnumRules::clear_defined_only() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.defined_only_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000010U); -} -inline bool EnumRules::defined_only() const { - // @@protoc_insertion_point(field_get:buf.validate.EnumRules.defined_only) - return _internal_defined_only(); -} -inline void EnumRules::set_defined_only(bool value) { - _internal_set_defined_only(value); - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_set:buf.validate.EnumRules.defined_only) -} -inline bool EnumRules::_internal_defined_only() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.defined_only_; -} -inline void EnumRules::_internal_set_defined_only(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.defined_only_ = value; -} - -// repeated int32 in = 3 [(.buf.validate.predefined) = { -inline int EnumRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int EnumRules::in_size() const { - return _internal_in_size(); -} -inline void EnumRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::int32_t EnumRules::in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.EnumRules.in) - return _internal_in().Get(index); -} -inline void EnumRules::set_in(int index, ::int32_t value) { - _internal_mutable_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.EnumRules.in) -} -inline void EnumRules::add_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.EnumRules.in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& EnumRules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.EnumRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL EnumRules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.EnumRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -EnumRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -EnumRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated int32 not_in = 4 [(.buf.validate.predefined) = { -inline int EnumRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int EnumRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void EnumRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int32_t EnumRules::not_in(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.EnumRules.not_in) - return _internal_not_in().Get(index); -} -inline void EnumRules::set_not_in(int index, ::int32_t value) { - _internal_mutable_not_in()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.EnumRules.not_in) -} -inline void EnumRules::add_not_in(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_not_in()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.EnumRules.not_in) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& EnumRules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.EnumRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL EnumRules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.EnumRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -EnumRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -EnumRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated int32 example = 5 [(.buf.validate.predefined) = { -inline int EnumRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int EnumRules::example_size() const { - return _internal_example_size(); -} -inline void EnumRules::clear_example() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.example_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::int32_t EnumRules::example(int index) const { - // @@protoc_insertion_point(field_get:buf.validate.EnumRules.example) - return _internal_example().Get(index); -} -inline void EnumRules::set_example(int index, ::int32_t value) { - _internal_mutable_example()->Set(index, value); - // @@protoc_insertion_point(field_set:buf.validate.EnumRules.example) -} -inline void EnumRules::add_example(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _internal_mutable_example()->Add(value); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.EnumRules.example) -} -inline const ::google::protobuf::RepeatedField<::int32_t>& EnumRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.EnumRules.example) - return _internal_example(); -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL EnumRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.EnumRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::RepeatedField<::int32_t>& -EnumRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedField<::int32_t>* PROTOBUF_NONNULL -EnumRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -// ------------------------------------------------------------------- - -// RepeatedRules - -// optional uint64 min_items = 1 [(.buf.validate.predefined) = { -inline bool RepeatedRules::has_min_items() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void RepeatedRules::clear_min_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_items_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::uint64_t RepeatedRules::min_items() const { - // @@protoc_insertion_point(field_get:buf.validate.RepeatedRules.min_items) - return _internal_min_items(); -} -inline void RepeatedRules::set_min_items(::uint64_t value) { - _internal_set_min_items(value); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_set:buf.validate.RepeatedRules.min_items) -} -inline ::uint64_t RepeatedRules::_internal_min_items() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.min_items_; -} -inline void RepeatedRules::_internal_set_min_items(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_items_ = value; -} - -// optional uint64 max_items = 2 [(.buf.validate.predefined) = { -inline bool RepeatedRules::has_max_items() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void RepeatedRules::clear_max_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_items_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint64_t RepeatedRules::max_items() const { - // @@protoc_insertion_point(field_get:buf.validate.RepeatedRules.max_items) - return _internal_max_items(); -} -inline void RepeatedRules::set_max_items(::uint64_t value) { - _internal_set_max_items(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.RepeatedRules.max_items) -} -inline ::uint64_t RepeatedRules::_internal_max_items() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.max_items_; -} -inline void RepeatedRules::_internal_set_max_items(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_items_ = value; -} - -// optional bool unique = 3 [(.buf.validate.predefined) = { -inline bool RepeatedRules::has_unique() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void RepeatedRules::clear_unique() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.unique_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline bool RepeatedRules::unique() const { - // @@protoc_insertion_point(field_get:buf.validate.RepeatedRules.unique) - return _internal_unique(); -} -inline void RepeatedRules::set_unique(bool value) { - _internal_set_unique(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.RepeatedRules.unique) -} -inline bool RepeatedRules::_internal_unique() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.unique_; -} -inline void RepeatedRules::_internal_set_unique(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.unique_ = value; -} - -// optional .buf.validate.FieldRules items = 4; -inline bool RepeatedRules::has_items() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - PROTOBUF_ASSUME(!value || _impl_.items_ != nullptr); - return value; -} -inline void RepeatedRules::clear_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.items_ != nullptr) _impl_.items_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline const ::buf::validate::FieldRules& RepeatedRules::_internal_items() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::buf::validate::FieldRules* p = _impl_.items_; - return p != nullptr ? *p : reinterpret_cast(::buf::validate::_FieldRules_default_instance_); -} -inline const ::buf::validate::FieldRules& RepeatedRules::items() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.RepeatedRules.items) - return _internal_items(); -} -inline void RepeatedRules::unsafe_arena_set_allocated_items( - ::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.items_); - } - _impl_.items_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.RepeatedRules.items) -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE RepeatedRules::release_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* released = _impl_.items_; - _impl_.items_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE RepeatedRules::unsafe_arena_release_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.RepeatedRules.items) - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* temp = _impl_.items_; - _impl_.items_ = nullptr; - return temp; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL RepeatedRules::_internal_mutable_items() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.items_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldRules>(GetArena()); - _impl_.items_ = reinterpret_cast<::buf::validate::FieldRules*>(p); - } - return _impl_.items_; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL RepeatedRules::mutable_items() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* _msg = _internal_mutable_items(); - // @@protoc_insertion_point(field_mutable:buf.validate.RepeatedRules.items) - return _msg; -} -inline void RepeatedRules::set_allocated_items(::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.items_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - - _impl_.items_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.RepeatedRules.items) -} - -// ------------------------------------------------------------------- - -// MapRules - -// optional uint64 min_pairs = 1 [(.buf.validate.predefined) = { -inline bool MapRules::has_min_pairs() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void MapRules::clear_min_pairs() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_pairs_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::uint64_t MapRules::min_pairs() const { - // @@protoc_insertion_point(field_get:buf.validate.MapRules.min_pairs) - return _internal_min_pairs(); -} -inline void MapRules::set_min_pairs(::uint64_t value) { - _internal_set_min_pairs(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.MapRules.min_pairs) -} -inline ::uint64_t MapRules::_internal_min_pairs() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.min_pairs_; -} -inline void MapRules::_internal_set_min_pairs(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.min_pairs_ = value; -} - -// optional uint64 max_pairs = 2 [(.buf.validate.predefined) = { -inline bool MapRules::has_max_pairs() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void MapRules::clear_max_pairs() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_pairs_ = ::uint64_t{0u}; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::uint64_t MapRules::max_pairs() const { - // @@protoc_insertion_point(field_get:buf.validate.MapRules.max_pairs) - return _internal_max_pairs(); -} -inline void MapRules::set_max_pairs(::uint64_t value) { - _internal_set_max_pairs(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.MapRules.max_pairs) -} -inline ::uint64_t MapRules::_internal_max_pairs() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.max_pairs_; -} -inline void MapRules::_internal_set_max_pairs(::uint64_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.max_pairs_ = value; -} - -// optional .buf.validate.FieldRules keys = 4; -inline bool MapRules::has_keys() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - PROTOBUF_ASSUME(!value || _impl_.keys_ != nullptr); - return value; -} -inline void MapRules::clear_keys() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.keys_ != nullptr) _impl_.keys_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline const ::buf::validate::FieldRules& MapRules::_internal_keys() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::buf::validate::FieldRules* p = _impl_.keys_; - return p != nullptr ? *p : reinterpret_cast(::buf::validate::_FieldRules_default_instance_); -} -inline const ::buf::validate::FieldRules& MapRules::keys() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MapRules.keys) - return _internal_keys(); -} -inline void MapRules::unsafe_arena_set_allocated_keys( - ::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.keys_); - } - _impl_.keys_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.MapRules.keys) -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE MapRules::release_keys() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* released = _impl_.keys_; - _impl_.keys_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE MapRules::unsafe_arena_release_keys() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.MapRules.keys) - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* temp = _impl_.keys_; - _impl_.keys_ = nullptr; - return temp; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL MapRules::_internal_mutable_keys() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.keys_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldRules>(GetArena()); - _impl_.keys_ = reinterpret_cast<::buf::validate::FieldRules*>(p); - } - return _impl_.keys_; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL MapRules::mutable_keys() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::buf::validate::FieldRules* _msg = _internal_mutable_keys(); - // @@protoc_insertion_point(field_mutable:buf.validate.MapRules.keys) - return _msg; -} -inline void MapRules::set_allocated_keys(::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.keys_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - - _impl_.keys_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.MapRules.keys) -} - -// optional .buf.validate.FieldRules values = 5; -inline bool MapRules::has_values() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - PROTOBUF_ASSUME(!value || _impl_.values_ != nullptr); - return value; -} -inline void MapRules::clear_values() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.values_ != nullptr) _impl_.values_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline const ::buf::validate::FieldRules& MapRules::_internal_values() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::buf::validate::FieldRules* p = _impl_.values_; - return p != nullptr ? *p : reinterpret_cast(::buf::validate::_FieldRules_default_instance_); -} -inline const ::buf::validate::FieldRules& MapRules::values() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.MapRules.values) - return _internal_values(); -} -inline void MapRules::unsafe_arena_set_allocated_values( - ::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.values_); - } - _impl_.values_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.MapRules.values) -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE MapRules::release_values() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - ::buf::validate::FieldRules* released = _impl_.values_; - _impl_.values_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::buf::validate::FieldRules* PROTOBUF_NULLABLE MapRules::unsafe_arena_release_values() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.MapRules.values) - - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - ::buf::validate::FieldRules* temp = _impl_.values_; - _impl_.values_ = nullptr; - return temp; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL MapRules::_internal_mutable_values() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.values_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldRules>(GetArena()); - _impl_.values_ = reinterpret_cast<::buf::validate::FieldRules*>(p); - } - return _impl_.values_; -} -inline ::buf::validate::FieldRules* PROTOBUF_NONNULL MapRules::mutable_values() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - ::buf::validate::FieldRules* _msg = _internal_mutable_values(); - // @@protoc_insertion_point(field_mutable:buf.validate.MapRules.values) - return _msg; -} -inline void MapRules::set_allocated_values(::buf::validate::FieldRules* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.values_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - - _impl_.values_ = reinterpret_cast<::buf::validate::FieldRules*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.MapRules.values) -} - -// ------------------------------------------------------------------- - -// AnyRules - -// repeated string in = 2; -inline int AnyRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int AnyRules::in_size() const { - return _internal_in_size(); -} -inline void AnyRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::std::string* PROTOBUF_NONNULL AnyRules::add_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.AnyRules.in) - return _s; -} -inline const ::std::string& AnyRules::in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.AnyRules.in) - return _internal_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL AnyRules::mutable_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.AnyRules.in) - return _internal_mutable_in()->Mutable(index); -} -template -inline void AnyRules::set_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.AnyRules.in) -} -template -inline void AnyRules::add_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.AnyRules.in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& AnyRules::in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.AnyRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -AnyRules::mutable_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.AnyRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -AnyRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -AnyRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated string not_in = 3; -inline int AnyRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int AnyRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void AnyRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::std::string* PROTOBUF_NONNULL AnyRules::add_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_not_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.AnyRules.not_in) - return _s; -} -inline const ::std::string& AnyRules::not_in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.AnyRules.not_in) - return _internal_not_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL AnyRules::mutable_not_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.AnyRules.not_in) - return _internal_mutable_not_in()->Mutable(index); -} -template -inline void AnyRules::set_not_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_not_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.AnyRules.not_in) -} -template -inline void AnyRules::add_not_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_not_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.AnyRules.not_in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& AnyRules::not_in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.AnyRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -AnyRules::mutable_not_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.AnyRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -AnyRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -AnyRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// ------------------------------------------------------------------- - -// DurationRules - -// optional .google.protobuf.Duration const = 2 [(.buf.validate.predefined) = { -inline bool DurationRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - PROTOBUF_ASSUME(!value || _impl_.const__ != nullptr); - return value; -} -inline const ::google::protobuf::Duration& DurationRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::google::protobuf::Duration* p = _impl_.const__; - return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& DurationRules::const_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.const) - return _internal_const_(); -} -inline void DurationRules::unsafe_arena_set_allocated_const_( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - _impl_.const__ = reinterpret_cast<::google::protobuf::Duration*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.DurationRules.const) -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::Duration* released = _impl_.const__; - _impl_.const__ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::unsafe_arena_release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.DurationRules.const) - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::Duration* temp = _impl_.const__; - _impl_.const__ = nullptr; - return temp; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::_internal_mutable_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - _impl_.const__ = reinterpret_cast<::google::protobuf::Duration*>(p); - } - return _impl_.const__; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_const_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::Duration* _msg = _internal_mutable_const_(); - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.const) - return _msg; -} -inline void DurationRules::set_allocated_const_(::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - - _impl_.const__ = reinterpret_cast<::google::protobuf::Duration*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.DurationRules.const) -} - -// .google.protobuf.Duration lt = 3 [(.buf.validate.predefined) = { -inline bool DurationRules::has_lt() const { - return less_than_case() == kLt; -} -inline bool DurationRules::_internal_has_lt() const { - return less_than_case() == kLt; -} -inline void DurationRules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::release_lt() { - // @@protoc_insertion_point(field_release:buf.validate.DurationRules.lt) - if (less_than_case() == kLt) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lt_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.less_than_.lt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Duration& DurationRules::_internal_lt() const { - return less_than_case() == kLt ? static_cast(*_impl_.less_than_.lt_) - : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& DurationRules::lt() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.lt) - return _internal_lt(); -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::unsafe_arena_release_lt() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.DurationRules.lt) - if (less_than_case() == kLt) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lt_; - _impl_.less_than_.lt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void DurationRules::unsafe_arena_set_allocated_lt( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_less_than(); - if (value) { - set_has_lt(); - _impl_.less_than_.lt_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.DurationRules.lt) -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::_internal_mutable_lt() { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - _impl_.less_than_.lt_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - } - return _impl_.less_than_.lt_; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_lt() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Duration* _msg = _internal_mutable_lt(); - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.lt) - return _msg; -} - -// .google.protobuf.Duration lte = 4 [(.buf.validate.predefined) = { -inline bool DurationRules::has_lte() const { - return less_than_case() == kLte; -} -inline bool DurationRules::_internal_has_lte() const { - return less_than_case() == kLte; -} -inline void DurationRules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::release_lte() { - // @@protoc_insertion_point(field_release:buf.validate.DurationRules.lte) - if (less_than_case() == kLte) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lte_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.less_than_.lte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Duration& DurationRules::_internal_lte() const { - return less_than_case() == kLte ? static_cast(*_impl_.less_than_.lte_) - : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& DurationRules::lte() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.lte) - return _internal_lte(); -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::unsafe_arena_release_lte() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.DurationRules.lte) - if (less_than_case() == kLte) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lte_; - _impl_.less_than_.lte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void DurationRules::unsafe_arena_set_allocated_lte( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_less_than(); - if (value) { - set_has_lte(); - _impl_.less_than_.lte_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.DurationRules.lte) -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::_internal_mutable_lte() { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - _impl_.less_than_.lte_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - } - return _impl_.less_than_.lte_; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_lte() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Duration* _msg = _internal_mutable_lte(); - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.lte) - return _msg; -} - -// .google.protobuf.Duration gt = 5 [(.buf.validate.predefined) = { -inline bool DurationRules::has_gt() const { - return greater_than_case() == kGt; -} -inline bool DurationRules::_internal_has_gt() const { - return greater_than_case() == kGt; -} -inline void DurationRules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::release_gt() { - // @@protoc_insertion_point(field_release:buf.validate.DurationRules.gt) - if (greater_than_case() == kGt) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gt_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.greater_than_.gt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Duration& DurationRules::_internal_gt() const { - return greater_than_case() == kGt ? static_cast(*_impl_.greater_than_.gt_) - : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& DurationRules::gt() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.gt) - return _internal_gt(); -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::unsafe_arena_release_gt() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.DurationRules.gt) - if (greater_than_case() == kGt) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gt_; - _impl_.greater_than_.gt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void DurationRules::unsafe_arena_set_allocated_gt( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_greater_than(); - if (value) { - set_has_gt(); - _impl_.greater_than_.gt_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.DurationRules.gt) -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::_internal_mutable_gt() { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - _impl_.greater_than_.gt_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - } - return _impl_.greater_than_.gt_; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_gt() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Duration* _msg = _internal_mutable_gt(); - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.gt) - return _msg; -} - -// .google.protobuf.Duration gte = 6 [(.buf.validate.predefined) = { -inline bool DurationRules::has_gte() const { - return greater_than_case() == kGte; -} -inline bool DurationRules::_internal_has_gte() const { - return greater_than_case() == kGte; -} -inline void DurationRules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::release_gte() { - // @@protoc_insertion_point(field_release:buf.validate.DurationRules.gte) - if (greater_than_case() == kGte) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gte_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.greater_than_.gte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Duration& DurationRules::_internal_gte() const { - return greater_than_case() == kGte ? static_cast(*_impl_.greater_than_.gte_) - : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& DurationRules::gte() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.gte) - return _internal_gte(); -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE DurationRules::unsafe_arena_release_gte() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.DurationRules.gte) - if (greater_than_case() == kGte) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gte_; - _impl_.greater_than_.gte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void DurationRules::unsafe_arena_set_allocated_gte( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_greater_than(); - if (value) { - set_has_gte(); - _impl_.greater_than_.gte_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.DurationRules.gte) -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::_internal_mutable_gte() { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - _impl_.greater_than_.gte_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - } - return _impl_.greater_than_.gte_; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_gte() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Duration* _msg = _internal_mutable_gte(); - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.gte) - return _msg; -} - -// repeated .google.protobuf.Duration in = 7 [(.buf.validate.predefined) = { -inline int DurationRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int DurationRules::in_size() const { - return _internal_in_size(); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.in) - return _internal_mutable_in()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL DurationRules::mutable_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DurationRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::Duration& DurationRules::in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.in) - return _internal_in().Get(index); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::add_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::Duration* _add = - _internal_mutable_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.DurationRules.in) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& DurationRules::in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DurationRules.in) - return _internal_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& -DurationRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL -DurationRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated .google.protobuf.Duration not_in = 8 [(.buf.validate.predefined) = { -inline int DurationRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int DurationRules::not_in_size() const { - return _internal_not_in_size(); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_not_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.not_in) - return _internal_mutable_not_in()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL DurationRules::mutable_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DurationRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::Duration& DurationRules::not_in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.not_in) - return _internal_not_in().Get(index); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::add_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::Duration* _add = - _internal_mutable_not_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.DurationRules.not_in) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& DurationRules::not_in() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DurationRules.not_in) - return _internal_not_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& -DurationRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL -DurationRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated .google.protobuf.Duration example = 9 [(.buf.validate.predefined) = { -inline int DurationRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int DurationRules::example_size() const { - return _internal_example_size(); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::mutable_example(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.DurationRules.example) - return _internal_mutable_example()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL DurationRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.DurationRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::Duration& DurationRules::example(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.DurationRules.example) - return _internal_example().Get(index); -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL DurationRules::add_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::Duration* _add = - _internal_mutable_example()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.DurationRules.example) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& DurationRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.DurationRules.example) - return _internal_example(); -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>& -DurationRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Duration>* PROTOBUF_NONNULL -DurationRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool DurationRules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void DurationRules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool DurationRules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void DurationRules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline DurationRules::LessThanCase DurationRules::less_than_case() const { - return DurationRules::LessThanCase(_impl_._oneof_case_[0]); -} -inline DurationRules::GreaterThanCase DurationRules::greater_than_case() const { - return DurationRules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// FieldMaskRules - -// optional .google.protobuf.FieldMask const = 1 [(.buf.validate.predefined) = { -inline bool FieldMaskRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - PROTOBUF_ASSUME(!value || _impl_.const__ != nullptr); - return value; -} -inline const ::google::protobuf::FieldMask& FieldMaskRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::google::protobuf::FieldMask* p = _impl_.const__; - return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_FieldMask_default_instance_); -} -inline const ::google::protobuf::FieldMask& FieldMaskRules::const_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldMaskRules.const) - return _internal_const_(); -} -inline void FieldMaskRules::unsafe_arena_set_allocated_const_( - ::google::protobuf::FieldMask* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - _impl_.const__ = reinterpret_cast<::google::protobuf::FieldMask*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.FieldMaskRules.const) -} -inline ::google::protobuf::FieldMask* PROTOBUF_NULLABLE FieldMaskRules::release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::FieldMask* released = _impl_.const__; - _impl_.const__ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::google::protobuf::FieldMask* PROTOBUF_NULLABLE FieldMaskRules::unsafe_arena_release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.FieldMaskRules.const) - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::FieldMask* temp = _impl_.const__; - _impl_.const__ = nullptr; - return temp; -} -inline ::google::protobuf::FieldMask* PROTOBUF_NONNULL FieldMaskRules::_internal_mutable_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FieldMask>(GetArena()); - _impl_.const__ = reinterpret_cast<::google::protobuf::FieldMask*>(p); - } - return _impl_.const__; -} -inline ::google::protobuf::FieldMask* PROTOBUF_NONNULL FieldMaskRules::mutable_const_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - ::google::protobuf::FieldMask* _msg = _internal_mutable_const_(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldMaskRules.const) - return _msg; -} -inline void FieldMaskRules::set_allocated_const_(::google::protobuf::FieldMask* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - - _impl_.const__ = reinterpret_cast<::google::protobuf::FieldMask*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldMaskRules.const) -} - -// repeated string in = 2 [(.buf.validate.predefined) = { -inline int FieldMaskRules::_internal_in_size() const { - return _internal_in().size(); -} -inline int FieldMaskRules::in_size() const { - return _internal_in_size(); -} -inline void FieldMaskRules::clear_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::std::string* PROTOBUF_NONNULL FieldMaskRules::add_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.FieldMaskRules.in) - return _s; -} -inline const ::std::string& FieldMaskRules::in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldMaskRules.in) - return _internal_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL FieldMaskRules::mutable_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldMaskRules.in) - return _internal_mutable_in()->Mutable(index); -} -template -inline void FieldMaskRules::set_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.FieldMaskRules.in) -} -template -inline void FieldMaskRules::add_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.FieldMaskRules.in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& FieldMaskRules::in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldMaskRules.in) - return _internal_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldMaskRules::mutable_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldMaskRules.in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -FieldMaskRules::_internal_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldMaskRules::_internal_mutable_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.in_; -} - -// repeated string not_in = 3 [(.buf.validate.predefined) = { -inline int FieldMaskRules::_internal_not_in_size() const { - return _internal_not_in().size(); -} -inline int FieldMaskRules::not_in_size() const { - return _internal_not_in_size(); -} -inline void FieldMaskRules::clear_not_in() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.not_in_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::std::string* PROTOBUF_NONNULL FieldMaskRules::add_not_in() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::std::string* _s = - _internal_mutable_not_in()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add_mutable:buf.validate.FieldMaskRules.not_in) - return _s; -} -inline const ::std::string& FieldMaskRules::not_in(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldMaskRules.not_in) - return _internal_not_in().Get(index); -} -inline ::std::string* PROTOBUF_NONNULL FieldMaskRules::mutable_not_in(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldMaskRules.not_in) - return _internal_mutable_not_in()->Mutable(index); -} -template -inline void FieldMaskRules::set_not_in(int index, Arg_&& value, Args_... args) { - ::google::protobuf::internal::AssignToString(*_internal_mutable_not_in()->Mutable(index), ::std::forward(value), - args... ); - // @@protoc_insertion_point(field_set:buf.validate.FieldMaskRules.not_in) -} -template -inline void FieldMaskRules::add_not_in(Arg_&& value, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::internal::AddToRepeatedPtrField( - ::google::protobuf::MessageLite::internal_visibility(), GetArena(), - *_internal_mutable_not_in(), ::std::forward(value), - args... ); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_add:buf.validate.FieldMaskRules.not_in) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& FieldMaskRules::not_in() - const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldMaskRules.not_in) - return _internal_not_in(); -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldMaskRules::mutable_not_in() ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldMaskRules.not_in) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_not_in(); -} -inline const ::google::protobuf::RepeatedPtrField<::std::string>& -FieldMaskRules::_internal_not_in() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.not_in_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string>* PROTOBUF_NONNULL -FieldMaskRules::_internal_mutable_not_in() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.not_in_; -} - -// repeated .google.protobuf.FieldMask example = 4 [(.buf.validate.predefined) = { -inline int FieldMaskRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int FieldMaskRules::example_size() const { - return _internal_example_size(); -} -inline ::google::protobuf::FieldMask* PROTOBUF_NONNULL FieldMaskRules::mutable_example(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldMaskRules.example) - return _internal_mutable_example()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>* PROTOBUF_NONNULL FieldMaskRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldMaskRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::FieldMask& FieldMaskRules::example(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldMaskRules.example) - return _internal_example().Get(index); -} -inline ::google::protobuf::FieldMask* PROTOBUF_NONNULL FieldMaskRules::add_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::FieldMask* _add = - _internal_mutable_example()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.FieldMaskRules.example) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>& FieldMaskRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldMaskRules.example) - return _internal_example(); -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>& -FieldMaskRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::FieldMask>* PROTOBUF_NONNULL -FieldMaskRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -// ------------------------------------------------------------------- - -// TimestampRules - -// optional .google.protobuf.Timestamp const = 2 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_const_() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - PROTOBUF_ASSUME(!value || _impl_.const__ != nullptr); - return value; -} -inline const ::google::protobuf::Timestamp& TimestampRules::_internal_const_() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::google::protobuf::Timestamp* p = _impl_.const__; - return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_Timestamp_default_instance_); -} -inline const ::google::protobuf::Timestamp& TimestampRules::const_() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.const) - return _internal_const_(); -} -inline void TimestampRules::unsafe_arena_set_allocated_const_( - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - _impl_.const__ = reinterpret_cast<::google::protobuf::Timestamp*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.const) -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::google::protobuf::Timestamp* released = _impl_.const__; - _impl_.const__ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.const) - - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - ::google::protobuf::Timestamp* temp = _impl_.const__; - _impl_.const__ = nullptr; - return temp; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::_internal_mutable_const_() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.const__ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Timestamp>(GetArena()); - _impl_.const__ = reinterpret_cast<::google::protobuf::Timestamp*>(p); - } - return _impl_.const__; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_const_() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::google::protobuf::Timestamp* _msg = _internal_mutable_const_(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.const) - return _msg; -} -inline void TimestampRules::set_allocated_const_(::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.const__); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - - _impl_.const__ = reinterpret_cast<::google::protobuf::Timestamp*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.const) -} - -// .google.protobuf.Timestamp lt = 3 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_lt() const { - return less_than_case() == kLt; -} -inline bool TimestampRules::_internal_has_lt() const { - return less_than_case() == kLt; -} -inline void TimestampRules::set_has_lt() { - _impl_._oneof_case_[0] = kLt; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::release_lt() { - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.lt) - if (less_than_case() == kLt) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lt_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.less_than_.lt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Timestamp& TimestampRules::_internal_lt() const { - return less_than_case() == kLt ? static_cast(*_impl_.less_than_.lt_) - : reinterpret_cast(::google::protobuf::_Timestamp_default_instance_); -} -inline const ::google::protobuf::Timestamp& TimestampRules::lt() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.lt) - return _internal_lt(); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_lt() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.TimestampRules.lt) - if (less_than_case() == kLt) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lt_; - _impl_.less_than_.lt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void TimestampRules::unsafe_arena_set_allocated_lt( - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_less_than(); - if (value) { - set_has_lt(); - _impl_.less_than_.lt_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.lt) -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::_internal_mutable_lt() { - if (less_than_case() != kLt) { - clear_less_than(); - set_has_lt(); - _impl_.less_than_.lt_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Timestamp>(GetArena()); - } - return _impl_.less_than_.lt_; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_lt() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Timestamp* _msg = _internal_mutable_lt(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.lt) - return _msg; -} - -// .google.protobuf.Timestamp lte = 4 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_lte() const { - return less_than_case() == kLte; -} -inline bool TimestampRules::_internal_has_lte() const { - return less_than_case() == kLte; -} -inline void TimestampRules::set_has_lte() { - _impl_._oneof_case_[0] = kLte; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::release_lte() { - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.lte) - if (less_than_case() == kLte) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lte_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.less_than_.lte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Timestamp& TimestampRules::_internal_lte() const { - return less_than_case() == kLte ? static_cast(*_impl_.less_than_.lte_) - : reinterpret_cast(::google::protobuf::_Timestamp_default_instance_); -} -inline const ::google::protobuf::Timestamp& TimestampRules::lte() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.lte) - return _internal_lte(); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_lte() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.TimestampRules.lte) - if (less_than_case() == kLte) { - clear_has_less_than(); - auto* temp = _impl_.less_than_.lte_; - _impl_.less_than_.lte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void TimestampRules::unsafe_arena_set_allocated_lte( - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_less_than(); - if (value) { - set_has_lte(); - _impl_.less_than_.lte_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.lte) -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::_internal_mutable_lte() { - if (less_than_case() != kLte) { - clear_less_than(); - set_has_lte(); - _impl_.less_than_.lte_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Timestamp>(GetArena()); - } - return _impl_.less_than_.lte_; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_lte() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Timestamp* _msg = _internal_mutable_lte(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.lte) - return _msg; -} - -// bool lt_now = 7 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_lt_now() const { - return less_than_case() == kLtNow; -} -inline void TimestampRules::set_has_lt_now() { - _impl_._oneof_case_[0] = kLtNow; -} -inline void TimestampRules::clear_lt_now() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (less_than_case() == kLtNow) { - _impl_.less_than_.lt_now_ = false; - clear_has_less_than(); - } -} -inline bool TimestampRules::lt_now() const { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.lt_now) - return _internal_lt_now(); -} -inline void TimestampRules::set_lt_now(bool value) { - if (less_than_case() != kLtNow) { - clear_less_than(); - set_has_lt_now(); - } - _impl_.less_than_.lt_now_ = value; - // @@protoc_insertion_point(field_set:buf.validate.TimestampRules.lt_now) -} -inline bool TimestampRules::_internal_lt_now() const { - if (less_than_case() == kLtNow) { - return _impl_.less_than_.lt_now_; - } - return false; -} - -// .google.protobuf.Timestamp gt = 5 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_gt() const { - return greater_than_case() == kGt; -} -inline bool TimestampRules::_internal_has_gt() const { - return greater_than_case() == kGt; -} -inline void TimestampRules::set_has_gt() { - _impl_._oneof_case_[1] = kGt; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::release_gt() { - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.gt) - if (greater_than_case() == kGt) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gt_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.greater_than_.gt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Timestamp& TimestampRules::_internal_gt() const { - return greater_than_case() == kGt ? static_cast(*_impl_.greater_than_.gt_) - : reinterpret_cast(::google::protobuf::_Timestamp_default_instance_); -} -inline const ::google::protobuf::Timestamp& TimestampRules::gt() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.gt) - return _internal_gt(); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_gt() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.TimestampRules.gt) - if (greater_than_case() == kGt) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gt_; - _impl_.greater_than_.gt_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void TimestampRules::unsafe_arena_set_allocated_gt( - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_greater_than(); - if (value) { - set_has_gt(); - _impl_.greater_than_.gt_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.gt) -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::_internal_mutable_gt() { - if (greater_than_case() != kGt) { - clear_greater_than(); - set_has_gt(); - _impl_.greater_than_.gt_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Timestamp>(GetArena()); - } - return _impl_.greater_than_.gt_; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_gt() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Timestamp* _msg = _internal_mutable_gt(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.gt) - return _msg; -} - -// .google.protobuf.Timestamp gte = 6 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_gte() const { - return greater_than_case() == kGte; -} -inline bool TimestampRules::_internal_has_gte() const { - return greater_than_case() == kGte; -} -inline void TimestampRules::set_has_gte() { - _impl_._oneof_case_[1] = kGte; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::release_gte() { - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.gte) - if (greater_than_case() == kGte) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gte_; - if (GetArena() != nullptr) { - temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); - } - _impl_.greater_than_.gte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline const ::google::protobuf::Timestamp& TimestampRules::_internal_gte() const { - return greater_than_case() == kGte ? static_cast(*_impl_.greater_than_.gte_) - : reinterpret_cast(::google::protobuf::_Timestamp_default_instance_); -} -inline const ::google::protobuf::Timestamp& TimestampRules::gte() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.gte) - return _internal_gte(); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_gte() { - // @@protoc_insertion_point(field_unsafe_arena_release:buf.validate.TimestampRules.gte) - if (greater_than_case() == kGte) { - clear_has_greater_than(); - auto* temp = _impl_.greater_than_.gte_; - _impl_.greater_than_.gte_ = nullptr; - return temp; - } else { - return nullptr; - } -} -inline void TimestampRules::unsafe_arena_set_allocated_gte( - ::google::protobuf::Timestamp* PROTOBUF_NULLABLE value) { - // We rely on the oneof clear method to free the earlier contents - // of this oneof. We can directly use the pointer we're given to - // set the new value. - clear_greater_than(); - if (value) { - set_has_gte(); - _impl_.greater_than_.gte_ = value; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.gte) -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::_internal_mutable_gte() { - if (greater_than_case() != kGte) { - clear_greater_than(); - set_has_gte(); - _impl_.greater_than_.gte_ = - ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Timestamp>(GetArena()); - } - return _impl_.greater_than_.gte_; -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_gte() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::Timestamp* _msg = _internal_mutable_gte(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.gte) - return _msg; -} - -// bool gt_now = 8 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_gt_now() const { - return greater_than_case() == kGtNow; -} -inline void TimestampRules::set_has_gt_now() { - _impl_._oneof_case_[1] = kGtNow; -} -inline void TimestampRules::clear_gt_now() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (greater_than_case() == kGtNow) { - _impl_.greater_than_.gt_now_ = false; - clear_has_greater_than(); - } -} -inline bool TimestampRules::gt_now() const { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.gt_now) - return _internal_gt_now(); -} -inline void TimestampRules::set_gt_now(bool value) { - if (greater_than_case() != kGtNow) { - clear_greater_than(); - set_has_gt_now(); - } - _impl_.greater_than_.gt_now_ = value; - // @@protoc_insertion_point(field_set:buf.validate.TimestampRules.gt_now) -} -inline bool TimestampRules::_internal_gt_now() const { - if (greater_than_case() == kGtNow) { - return _impl_.greater_than_.gt_now_; - } - return false; -} - -// optional .google.protobuf.Duration within = 9 [(.buf.validate.predefined) = { -inline bool TimestampRules::has_within() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - PROTOBUF_ASSUME(!value || _impl_.within_ != nullptr); - return value; -} -inline const ::google::protobuf::Duration& TimestampRules::_internal_within() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::google::protobuf::Duration* p = _impl_.within_; - return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_Duration_default_instance_); -} -inline const ::google::protobuf::Duration& TimestampRules::within() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.within) - return _internal_within(); -} -inline void TimestampRules::unsafe_arena_set_allocated_within( - ::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.within_); - } - _impl_.within_ = reinterpret_cast<::google::protobuf::Duration*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.TimestampRules.within) -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE TimestampRules::release_within() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - ::google::protobuf::Duration* released = _impl_.within_; - _impl_.within_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::google::protobuf::Duration* PROTOBUF_NULLABLE TimestampRules::unsafe_arena_release_within() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.TimestampRules.within) - - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - ::google::protobuf::Duration* temp = _impl_.within_; - _impl_.within_ = nullptr; - return temp; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL TimestampRules::_internal_mutable_within() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.within_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::Duration>(GetArena()); - _impl_.within_ = reinterpret_cast<::google::protobuf::Duration*>(p); - } - return _impl_.within_; -} -inline ::google::protobuf::Duration* PROTOBUF_NONNULL TimestampRules::mutable_within() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - ::google::protobuf::Duration* _msg = _internal_mutable_within(); - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.within) - return _msg; -} -inline void TimestampRules::set_allocated_within(::google::protobuf::Duration* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.within_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = reinterpret_cast<::google::protobuf::Message*>(value)->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - - _impl_.within_ = reinterpret_cast<::google::protobuf::Duration*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.TimestampRules.within) -} - -// repeated .google.protobuf.Timestamp example = 10 [(.buf.validate.predefined) = { -inline int TimestampRules::_internal_example_size() const { - return _internal_example().size(); -} -inline int TimestampRules::example_size() const { - return _internal_example_size(); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::mutable_example(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.TimestampRules.example) - return _internal_mutable_example()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>* PROTOBUF_NONNULL TimestampRules::mutable_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.TimestampRules.example) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_example(); -} -inline const ::google::protobuf::Timestamp& TimestampRules::example(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.TimestampRules.example) - return _internal_example().Get(index); -} -inline ::google::protobuf::Timestamp* PROTOBUF_NONNULL TimestampRules::add_example() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::google::protobuf::Timestamp* _add = - _internal_mutable_example()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_add:buf.validate.TimestampRules.example) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>& TimestampRules::example() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.TimestampRules.example) - return _internal_example(); -} -inline const ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>& -TimestampRules::_internal_example() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.example_; -} -inline ::google::protobuf::RepeatedPtrField<::google::protobuf::Timestamp>* PROTOBUF_NONNULL -TimestampRules::_internal_mutable_example() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.example_; -} - -inline bool TimestampRules::has_less_than() const { - return less_than_case() != LESS_THAN_NOT_SET; -} -inline void TimestampRules::clear_has_less_than() { - _impl_._oneof_case_[0] = LESS_THAN_NOT_SET; -} -inline bool TimestampRules::has_greater_than() const { - return greater_than_case() != GREATER_THAN_NOT_SET; -} -inline void TimestampRules::clear_has_greater_than() { - _impl_._oneof_case_[1] = GREATER_THAN_NOT_SET; -} -inline TimestampRules::LessThanCase TimestampRules::less_than_case() const { - return TimestampRules::LessThanCase(_impl_._oneof_case_[0]); -} -inline TimestampRules::GreaterThanCase TimestampRules::greater_than_case() const { - return TimestampRules::GreaterThanCase(_impl_._oneof_case_[1]); -} -// ------------------------------------------------------------------- - -// Violations - -// repeated .buf.validate.Violation violations = 1; -inline int Violations::_internal_violations_size() const { - return _internal_violations().size(); -} -inline int Violations::violations_size() const { - return _internal_violations_size(); -} -inline void Violations::clear_violations() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.violations_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::buf::validate::Violation* PROTOBUF_NONNULL Violations::mutable_violations(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.Violations.violations) - return _internal_mutable_violations()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>* PROTOBUF_NONNULL Violations::mutable_violations() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.Violations.violations) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_violations(); -} -inline const ::buf::validate::Violation& Violations::violations(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Violations.violations) - return _internal_violations().Get(index); -} -inline ::buf::validate::Violation* PROTOBUF_NONNULL Violations::add_violations() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::Violation* _add = - _internal_mutable_violations()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.Violations.violations) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>& Violations::violations() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.Violations.violations) - return _internal_violations(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>& -Violations::_internal_violations() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.violations_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::Violation>* PROTOBUF_NONNULL -Violations::_internal_mutable_violations() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.violations_; -} - -// ------------------------------------------------------------------- - -// Violation - -// optional .buf.validate.FieldPath field = 5; -inline bool Violation::has_field() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - PROTOBUF_ASSUME(!value || _impl_.field_ != nullptr); - return value; -} -inline void Violation::clear_field() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.field_ != nullptr) _impl_.field_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline const ::buf::validate::FieldPath& Violation::_internal_field() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::buf::validate::FieldPath* p = _impl_.field_; - return p != nullptr ? *p : reinterpret_cast(::buf::validate::_FieldPath_default_instance_); -} -inline const ::buf::validate::FieldPath& Violation::field() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Violation.field) - return _internal_field(); -} -inline void Violation::unsafe_arena_set_allocated_field( - ::buf::validate::FieldPath* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.field_); - } - _impl_.field_ = reinterpret_cast<::buf::validate::FieldPath*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.Violation.field) -} -inline ::buf::validate::FieldPath* PROTOBUF_NULLABLE Violation::release_field() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - ::buf::validate::FieldPath* released = _impl_.field_; - _impl_.field_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::buf::validate::FieldPath* PROTOBUF_NULLABLE Violation::unsafe_arena_release_field() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Violation.field) - - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - ::buf::validate::FieldPath* temp = _impl_.field_; - _impl_.field_ = nullptr; - return temp; -} -inline ::buf::validate::FieldPath* PROTOBUF_NONNULL Violation::_internal_mutable_field() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.field_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldPath>(GetArena()); - _impl_.field_ = reinterpret_cast<::buf::validate::FieldPath*>(p); - } - return _impl_.field_; -} -inline ::buf::validate::FieldPath* PROTOBUF_NONNULL Violation::mutable_field() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - ::buf::validate::FieldPath* _msg = _internal_mutable_field(); - // @@protoc_insertion_point(field_mutable:buf.validate.Violation.field) - return _msg; -} -inline void Violation::set_allocated_field(::buf::validate::FieldPath* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.field_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000004U); - } - - _impl_.field_ = reinterpret_cast<::buf::validate::FieldPath*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.Violation.field) -} - -// optional .buf.validate.FieldPath rule = 6; -inline bool Violation::has_rule() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - PROTOBUF_ASSUME(!value || _impl_.rule_ != nullptr); - return value; -} -inline void Violation::clear_rule() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.rule_ != nullptr) _impl_.rule_->Clear(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline const ::buf::validate::FieldPath& Violation::_internal_rule() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::buf::validate::FieldPath* p = _impl_.rule_; - return p != nullptr ? *p : reinterpret_cast(::buf::validate::_FieldPath_default_instance_); -} -inline const ::buf::validate::FieldPath& Violation::rule() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Violation.rule) - return _internal_rule(); -} -inline void Violation::unsafe_arena_set_allocated_rule( - ::buf::validate::FieldPath* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.rule_); - } - _impl_.rule_ = reinterpret_cast<::buf::validate::FieldPath*>(value); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:buf.validate.Violation.rule) -} -inline ::buf::validate::FieldPath* PROTOBUF_NULLABLE Violation::release_rule() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::buf::validate::FieldPath* released = _impl_.rule_; - _impl_.rule_ = nullptr; - if (::google::protobuf::internal::DebugHardenForceCopyInRelease()) { - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } - } else { - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } - } - return released; -} -inline ::buf::validate::FieldPath* PROTOBUF_NULLABLE Violation::unsafe_arena_release_rule() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Violation.rule) - - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - ::buf::validate::FieldPath* temp = _impl_.rule_; - _impl_.rule_ = nullptr; - return temp; -} -inline ::buf::validate::FieldPath* PROTOBUF_NONNULL Violation::_internal_mutable_rule() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.rule_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::buf::validate::FieldPath>(GetArena()); - _impl_.rule_ = reinterpret_cast<::buf::validate::FieldPath*>(p); - } - return _impl_.rule_; -} -inline ::buf::validate::FieldPath* PROTOBUF_NONNULL Violation::mutable_rule() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - ::buf::validate::FieldPath* _msg = _internal_mutable_rule(); - // @@protoc_insertion_point(field_mutable:buf.validate.Violation.rule) - return _msg; -} -inline void Violation::set_allocated_rule(::buf::validate::FieldPath* PROTOBUF_NULLABLE value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.rule_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = value->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000008U); - } - - _impl_.rule_ = reinterpret_cast<::buf::validate::FieldPath*>(value); - // @@protoc_insertion_point(field_set_allocated:buf.validate.Violation.rule) -} - -// optional string rule_id = 2; -inline bool Violation::has_rule_id() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - return value; -} -inline void Violation::clear_rule_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.rule_id_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline const ::std::string& Violation::rule_id() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Violation.rule_id) - return _internal_rule_id(); -} -template -PROTOBUF_ALWAYS_INLINE void Violation::set_rule_id(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - _impl_.rule_id_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.Violation.rule_id) -} -inline ::std::string* PROTOBUF_NONNULL Violation::mutable_rule_id() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::std::string* _s = _internal_mutable_rule_id(); - // @@protoc_insertion_point(field_mutable:buf.validate.Violation.rule_id) - return _s; -} -inline const ::std::string& Violation::_internal_rule_id() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.rule_id_.Get(); -} -inline void Violation::_internal_set_rule_id(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.rule_id_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL Violation::_internal_mutable_rule_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.rule_id_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE Violation::release_rule_id() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Violation.rule_id) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000001U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - auto* released = _impl_.rule_id_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.rule_id_.Set("", GetArena()); - } - return released; -} -inline void Violation::set_allocated_rule_id(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - _impl_.rule_id_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.rule_id_.IsDefault()) { - _impl_.rule_id_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.Violation.rule_id) -} - -// optional string message = 3; -inline bool Violation::has_message() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void Violation::clear_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.message_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline const ::std::string& Violation::message() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.Violation.message) - return _internal_message(); -} -template -PROTOBUF_ALWAYS_INLINE void Violation::set_message(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - _impl_.message_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.Violation.message) -} -inline ::std::string* PROTOBUF_NONNULL Violation::mutable_message() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - ::std::string* _s = _internal_mutable_message(); - // @@protoc_insertion_point(field_mutable:buf.validate.Violation.message) - return _s; -} -inline const ::std::string& Violation::_internal_message() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.message_.Get(); -} -inline void Violation::_internal_set_message(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.message_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL Violation::_internal_mutable_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.message_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE Violation::release_message() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.Violation.message) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000002U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - auto* released = _impl_.message_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.message_.Set("", GetArena()); - } - return released; -} -inline void Violation::set_allocated_message(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000002U); - } - _impl_.message_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.message_.IsDefault()) { - _impl_.message_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.Violation.message) -} - -// optional bool for_key = 4; -inline bool Violation::has_for_key() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000010U); - return value; -} -inline void Violation::clear_for_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.for_key_ = false; - ClearHasBit(_impl_._has_bits_[0], - 0x00000010U); -} -inline bool Violation::for_key() const { - // @@protoc_insertion_point(field_get:buf.validate.Violation.for_key) - return _internal_for_key(); -} -inline void Violation::set_for_key(bool value) { - _internal_set_for_key(value); - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_set:buf.validate.Violation.for_key) -} -inline bool Violation::_internal_for_key() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.for_key_; -} -inline void Violation::_internal_set_for_key(bool value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.for_key_ = value; -} - -// ------------------------------------------------------------------- - -// FieldPath - -// repeated .buf.validate.FieldPathElement elements = 1; -inline int FieldPath::_internal_elements_size() const { - return _internal_elements().size(); -} -inline int FieldPath::elements_size() const { - return _internal_elements_size(); -} -inline void FieldPath::clear_elements() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.elements_.Clear(); - ClearHasBitForRepeated(_impl_._has_bits_[0], - 0x00000001U); -} -inline ::buf::validate::FieldPathElement* PROTOBUF_NONNULL FieldPath::mutable_elements(int index) - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_mutable:buf.validate.FieldPath.elements) - return _internal_mutable_elements()->Mutable(index); -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>* PROTOBUF_NONNULL FieldPath::mutable_elements() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_mutable_list:buf.validate.FieldPath.elements) - ::google::protobuf::internal::TSanWrite(&_impl_); - return _internal_mutable_elements(); -} -inline const ::buf::validate::FieldPathElement& FieldPath::elements(int index) const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldPath.elements) - return _internal_elements().Get(index); -} -inline ::buf::validate::FieldPathElement* PROTOBUF_NONNULL FieldPath::add_elements() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - ::google::protobuf::internal::TSanWrite(&_impl_); - ::buf::validate::FieldPathElement* _add = - _internal_mutable_elements()->InternalAddWithArena( - ::google::protobuf::MessageLite::internal_visibility(), GetArena()); - SetHasBitForRepeated(_impl_._has_bits_[0], 0x00000001U); - // @@protoc_insertion_point(field_add:buf.validate.FieldPath.elements) - return _add; -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>& FieldPath::elements() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_list:buf.validate.FieldPath.elements) - return _internal_elements(); -} -inline const ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>& -FieldPath::_internal_elements() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.elements_; -} -inline ::google::protobuf::RepeatedPtrField<::buf::validate::FieldPathElement>* PROTOBUF_NONNULL -FieldPath::_internal_mutable_elements() { - ::google::protobuf::internal::TSanRead(&_impl_); - return &_impl_.elements_; -} - -// ------------------------------------------------------------------- - -// FieldPathElement - -// optional int32 field_number = 1; -inline bool FieldPathElement::has_field_number() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000002U); - return value; -} -inline void FieldPathElement::clear_field_number() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.field_number_ = 0; - ClearHasBit(_impl_._has_bits_[0], - 0x00000002U); -} -inline ::int32_t FieldPathElement::field_number() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.field_number) - return _internal_field_number(); -} -inline void FieldPathElement::set_field_number(::int32_t value) { - _internal_set_field_number(value); - SetHasBit(_impl_._has_bits_[0], 0x00000002U); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.field_number) -} -inline ::int32_t FieldPathElement::_internal_field_number() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.field_number_; -} -inline void FieldPathElement::_internal_set_field_number(::int32_t value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.field_number_ = value; -} - -// optional string field_name = 2; -inline bool FieldPathElement::has_field_name() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000001U); - return value; -} -inline void FieldPathElement::clear_field_name() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.field_name_.ClearToEmpty(); - ClearHasBit(_impl_._has_bits_[0], - 0x00000001U); -} -inline const ::std::string& FieldPathElement::field_name() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.field_name) - return _internal_field_name(); -} -template -PROTOBUF_ALWAYS_INLINE void FieldPathElement::set_field_name(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - _impl_.field_name_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.field_name) -} -inline ::std::string* PROTOBUF_NONNULL FieldPathElement::mutable_field_name() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - ::std::string* _s = _internal_mutable_field_name(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldPathElement.field_name) - return _s; -} -inline const ::std::string& FieldPathElement::_internal_field_name() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return _impl_.field_name_.Get(); -} -inline void FieldPathElement::_internal_set_field_name(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.field_name_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL FieldPathElement::_internal_mutable_field_name() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.field_name_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE FieldPathElement::release_field_name() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.FieldPathElement.field_name) - if (!CheckHasBit(_impl_._has_bits_[0], 0x00000001U)) { - return nullptr; - } - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - auto* released = _impl_.field_name_.Release(); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) { - _impl_.field_name_.Set("", GetArena()); - } - return released; -} -inline void FieldPathElement::set_allocated_field_name(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (value != nullptr) { - SetHasBit(_impl_._has_bits_[0], 0x00000001U); - } else { - ClearHasBit(_impl_._has_bits_[0], 0x00000001U); - } - _impl_.field_name_.SetAllocated(value, GetArena()); - if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.field_name_.IsDefault()) { - _impl_.field_name_.Set("", GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldPathElement.field_name) -} - -// optional .google.protobuf.FieldDescriptorProto.Type field_type = 3; -inline bool FieldPathElement::has_field_type() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000008U); - return value; -} -inline void FieldPathElement::clear_field_type() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.field_type_ = 1; - ClearHasBit(_impl_._has_bits_[0], - 0x00000008U); -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::field_type() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.field_type) - return _internal_field_type(); -} -inline void FieldPathElement::set_field_type(::google::protobuf::FieldDescriptorProto_Type value) { - _internal_set_field_type(value); - SetHasBit(_impl_._has_bits_[0], 0x00000008U); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.field_type) -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::_internal_field_type() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return static_cast<::google::protobuf::FieldDescriptorProto_Type>(_impl_.field_type_); -} -inline void FieldPathElement::_internal_set_field_type(::google::protobuf::FieldDescriptorProto_Type value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - - assert(::google::protobuf::internal::ValidateEnum( - value, ::google::protobuf::FieldDescriptorProto_Type_internal_data_)); - _impl_.field_type_ = value; -} - -// optional .google.protobuf.FieldDescriptorProto.Type key_type = 4; -inline bool FieldPathElement::has_key_type() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000010U); - return value; -} -inline void FieldPathElement::clear_key_type() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.key_type_ = 1; - ClearHasBit(_impl_._has_bits_[0], - 0x00000010U); -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::key_type() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.key_type) - return _internal_key_type(); -} -inline void FieldPathElement::set_key_type(::google::protobuf::FieldDescriptorProto_Type value) { - _internal_set_key_type(value); - SetHasBit(_impl_._has_bits_[0], 0x00000010U); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.key_type) -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::_internal_key_type() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return static_cast<::google::protobuf::FieldDescriptorProto_Type>(_impl_.key_type_); -} -inline void FieldPathElement::_internal_set_key_type(::google::protobuf::FieldDescriptorProto_Type value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - - assert(::google::protobuf::internal::ValidateEnum( - value, ::google::protobuf::FieldDescriptorProto_Type_internal_data_)); - _impl_.key_type_ = value; -} - -// optional .google.protobuf.FieldDescriptorProto.Type value_type = 5; -inline bool FieldPathElement::has_value_type() const { - bool value = CheckHasBit(_impl_._has_bits_[0], 0x00000004U); - return value; -} -inline void FieldPathElement::clear_value_type() { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.value_type_ = 1; - ClearHasBit(_impl_._has_bits_[0], - 0x00000004U); -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::value_type() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.value_type) - return _internal_value_type(); -} -inline void FieldPathElement::set_value_type(::google::protobuf::FieldDescriptorProto_Type value) { - _internal_set_value_type(value); - SetHasBit(_impl_._has_bits_[0], 0x00000004U); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.value_type) -} -inline ::google::protobuf::FieldDescriptorProto_Type FieldPathElement::_internal_value_type() const { - ::google::protobuf::internal::TSanRead(&_impl_); - return static_cast<::google::protobuf::FieldDescriptorProto_Type>(_impl_.value_type_); -} -inline void FieldPathElement::_internal_set_value_type(::google::protobuf::FieldDescriptorProto_Type value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - - assert(::google::protobuf::internal::ValidateEnum( - value, ::google::protobuf::FieldDescriptorProto_Type_internal_data_)); - _impl_.value_type_ = value; -} - -// uint64 index = 6; -inline bool FieldPathElement::has_index() const { - return subscript_case() == kIndex; -} -inline void FieldPathElement::set_has_index() { - _impl_._oneof_case_[0] = kIndex; -} -inline void FieldPathElement::clear_index() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() == kIndex) { - _impl_.subscript_.index_ = ::uint64_t{0u}; - clear_has_subscript(); - } -} -inline ::uint64_t FieldPathElement::index() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.index) - return _internal_index(); -} -inline void FieldPathElement::set_index(::uint64_t value) { - if (subscript_case() != kIndex) { - clear_subscript(); - set_has_index(); - } - _impl_.subscript_.index_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.index) -} -inline ::uint64_t FieldPathElement::_internal_index() const { - if (subscript_case() == kIndex) { - return _impl_.subscript_.index_; - } - return ::uint64_t{0u}; -} - -// bool bool_key = 7; -inline bool FieldPathElement::has_bool_key() const { - return subscript_case() == kBoolKey; -} -inline void FieldPathElement::set_has_bool_key() { - _impl_._oneof_case_[0] = kBoolKey; -} -inline void FieldPathElement::clear_bool_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() == kBoolKey) { - _impl_.subscript_.bool_key_ = false; - clear_has_subscript(); - } -} -inline bool FieldPathElement::bool_key() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.bool_key) - return _internal_bool_key(); -} -inline void FieldPathElement::set_bool_key(bool value) { - if (subscript_case() != kBoolKey) { - clear_subscript(); - set_has_bool_key(); - } - _impl_.subscript_.bool_key_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.bool_key) -} -inline bool FieldPathElement::_internal_bool_key() const { - if (subscript_case() == kBoolKey) { - return _impl_.subscript_.bool_key_; - } - return false; -} - -// int64 int_key = 8; -inline bool FieldPathElement::has_int_key() const { - return subscript_case() == kIntKey; -} -inline void FieldPathElement::set_has_int_key() { - _impl_._oneof_case_[0] = kIntKey; -} -inline void FieldPathElement::clear_int_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() == kIntKey) { - _impl_.subscript_.int_key_ = ::int64_t{0}; - clear_has_subscript(); - } -} -inline ::int64_t FieldPathElement::int_key() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.int_key) - return _internal_int_key(); -} -inline void FieldPathElement::set_int_key(::int64_t value) { - if (subscript_case() != kIntKey) { - clear_subscript(); - set_has_int_key(); - } - _impl_.subscript_.int_key_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.int_key) -} -inline ::int64_t FieldPathElement::_internal_int_key() const { - if (subscript_case() == kIntKey) { - return _impl_.subscript_.int_key_; - } - return ::int64_t{0}; -} - -// uint64 uint_key = 9; -inline bool FieldPathElement::has_uint_key() const { - return subscript_case() == kUintKey; -} -inline void FieldPathElement::set_has_uint_key() { - _impl_._oneof_case_[0] = kUintKey; -} -inline void FieldPathElement::clear_uint_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() == kUintKey) { - _impl_.subscript_.uint_key_ = ::uint64_t{0u}; - clear_has_subscript(); - } -} -inline ::uint64_t FieldPathElement::uint_key() const { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.uint_key) - return _internal_uint_key(); -} -inline void FieldPathElement::set_uint_key(::uint64_t value) { - if (subscript_case() != kUintKey) { - clear_subscript(); - set_has_uint_key(); - } - _impl_.subscript_.uint_key_ = value; - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.uint_key) -} -inline ::uint64_t FieldPathElement::_internal_uint_key() const { - if (subscript_case() == kUintKey) { - return _impl_.subscript_.uint_key_; - } - return ::uint64_t{0u}; -} - -// string string_key = 10; -inline bool FieldPathElement::has_string_key() const { - return subscript_case() == kStringKey; -} -inline void FieldPathElement::set_has_string_key() { - _impl_._oneof_case_[0] = kStringKey; -} -inline void FieldPathElement::clear_string_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() == kStringKey) { - _impl_.subscript_.string_key_.Destroy(); - clear_has_subscript(); - } -} -inline const ::std::string& FieldPathElement::string_key() const - ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:buf.validate.FieldPathElement.string_key) - return _internal_string_key(); -} -template -PROTOBUF_ALWAYS_INLINE void FieldPathElement::set_string_key(Arg_&& arg, Args_... args) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (subscript_case() != kStringKey) { - clear_subscript(); - - set_has_string_key(); - _impl_.subscript_.string_key_.InitDefault(); - } - _impl_.subscript_.string_key_.Set(static_cast(arg), args..., GetArena()); - // @@protoc_insertion_point(field_set:buf.validate.FieldPathElement.string_key) -} -inline ::std::string* PROTOBUF_NONNULL FieldPathElement::mutable_string_key() - ABSL_ATTRIBUTE_LIFETIME_BOUND { - if (subscript_case() != kStringKey) { - clear_subscript(); - - set_has_string_key(); - _impl_.subscript_.string_key_.InitDefault(); - } - ::std::string* _s = _internal_mutable_string_key(); - // @@protoc_insertion_point(field_mutable:buf.validate.FieldPathElement.string_key) - return _s; -} -inline const ::std::string& FieldPathElement::_internal_string_key() const { - ::google::protobuf::internal::TSanRead(&_impl_); - if (subscript_case() != kStringKey) { - return ::google::protobuf::internal::GetEmptyStringAlreadyInited(); - } - return _impl_.subscript_.string_key_.Get(); -} -inline void FieldPathElement::_internal_set_string_key(const ::std::string& value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_.subscript_.string_key_.Set(value, GetArena()); -} -inline ::std::string* PROTOBUF_NONNULL FieldPathElement::_internal_mutable_string_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - return _impl_.subscript_.string_key_.Mutable( GetArena()); -} -inline ::std::string* PROTOBUF_NULLABLE FieldPathElement::release_string_key() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:buf.validate.FieldPathElement.string_key) - if (subscript_case() != kStringKey) { - return nullptr; - } - clear_has_subscript(); - return _impl_.subscript_.string_key_.Release(); -} -inline void FieldPathElement::set_allocated_string_key(::std::string* PROTOBUF_NULLABLE value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (has_subscript()) { - clear_subscript(); - } - if (value != nullptr) { - set_has_string_key(); - _impl_.subscript_.string_key_.InitAllocated(value, GetArena()); - } - // @@protoc_insertion_point(field_set_allocated:buf.validate.FieldPathElement.string_key) -} - -inline bool FieldPathElement::has_subscript() const { - return subscript_case() != SUBSCRIPT_NOT_SET; -} -inline void FieldPathElement::clear_has_subscript() { - _impl_._oneof_case_[0] = SUBSCRIPT_NOT_SET; -} -inline FieldPathElement::SubscriptCase FieldPathElement::subscript_case() const { - return FieldPathElement::SubscriptCase(_impl_._oneof_case_[0]); -} -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif // __GNUC__ - -// @@protoc_insertion_point(namespace_scope) -} // namespace validate -} // namespace buf - - -namespace google { -namespace protobuf { - -template <> -struct is_proto_enum<::buf::validate::Ignore> : std::true_type {}; -template <> -inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::buf::validate::Ignore>() { - return ::buf::validate::Ignore_descriptor(); -} -template <> -struct is_proto_enum<::buf::validate::KnownRegex> : std::true_type {}; -template <> -inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::buf::validate::KnownRegex>() { - return ::buf::validate::KnownRegex_descriptor(); -} - -} // namespace protobuf -} // namespace google - -// @@protoc_insertion_point(global_scope) - -#include "google/protobuf/port_undef.inc" - -#endif // buf_2fvalidate_2fvalidate_2eproto_2epb_2eh diff --git a/crates/protovalidate-rs/gen/internal/empty_descriptor_set_embed.inc b/crates/protovalidate-rs/gen/internal/empty_descriptor_set_embed.inc deleted file mode 100644 index cdc59856..00000000 --- a/crates/protovalidate-rs/gen/internal/empty_descriptor_set_embed.inc +++ /dev/null @@ -1 +0,0 @@ -0x0a, 0xff, 0x11, 0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x4a, 0xbe, 0x10, 0x0a, 0x06, 0x12, 0x04, 0x1e, 0x00, 0x32, 0x10, 0x0a, 0xcc, 0x0c, 0x0a, 0x01, 0x0c, 0x12, 0x03, 0x1e, 0x00, 0x12, 0x32, 0xc1, 0x0c, 0x20, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x20, 0x2d, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x27, 0x73, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x0a, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30, 0x30, 0x38, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x0a, 0x20, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2d, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x0a, 0x0a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x73, 0x2c, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x0a, 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x61, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x72, 0x65, 0x0a, 0x20, 0x6d, 0x65, 0x74, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x0a, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x52, 0x65, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x72, 0x65, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x62, 0x6f, 0x76, 0x65, 0x0a, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x2c, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x69, 0x73, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x72, 0x0a, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72, 0x20, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x0a, 0x20, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x4e, 0x65, 0x69, 0x74, 0x68, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x20, 0x6e, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x69, 0x74, 0x73, 0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x6f, 0x72, 0x73, 0x20, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x65, 0x20, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x65, 0x64, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x0a, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x20, 0x77, 0x72, 0x69, 0x74, 0x74, 0x65, 0x6e, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x0a, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x49, 0x53, 0x20, 0x50, 0x52, 0x4f, 0x56, 0x49, 0x44, 0x45, 0x44, 0x20, 0x42, 0x59, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x48, 0x4f, 0x4c, 0x44, 0x45, 0x52, 0x53, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x0a, 0x20, 0x22, 0x41, 0x53, 0x20, 0x49, 0x53, 0x22, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x45, 0x58, 0x50, 0x52, 0x45, 0x53, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x49, 0x4d, 0x50, 0x4c, 0x49, 0x45, 0x44, 0x20, 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x49, 0x45, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41, 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x46, 0x49, 0x54, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52, 0x0a, 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49, 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55, 0x52, 0x50, 0x4f, 0x53, 0x45, 0x20, 0x41, 0x52, 0x45, 0x20, 0x44, 0x49, 0x53, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x45, 0x44, 0x2e, 0x20, 0x49, 0x4e, 0x20, 0x4e, 0x4f, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x20, 0x53, 0x48, 0x41, 0x4c, 0x4c, 0x20, 0x54, 0x48, 0x45, 0x20, 0x43, 0x4f, 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x0a, 0x20, 0x4f, 0x57, 0x4e, 0x45, 0x52, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x49, 0x42, 0x55, 0x54, 0x4f, 0x52, 0x53, 0x20, 0x42, 0x45, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x4c, 0x45, 0x20, 0x46, 0x4f, 0x52, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x2c, 0x20, 0x49, 0x4e, 0x43, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x41, 0x4c, 0x2c, 0x0a, 0x20, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x2c, 0x20, 0x45, 0x58, 0x45, 0x4d, 0x50, 0x4c, 0x41, 0x52, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x43, 0x4f, 0x4e, 0x53, 0x45, 0x51, 0x55, 0x45, 0x4e, 0x54, 0x49, 0x41, 0x4c, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x53, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x2c, 0x20, 0x42, 0x55, 0x54, 0x20, 0x4e, 0x4f, 0x54, 0x0a, 0x20, 0x4c, 0x49, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x20, 0x54, 0x4f, 0x2c, 0x20, 0x50, 0x52, 0x4f, 0x43, 0x55, 0x52, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x42, 0x53, 0x54, 0x49, 0x54, 0x55, 0x54, 0x45, 0x20, 0x47, 0x4f, 0x4f, 0x44, 0x53, 0x20, 0x4f, 0x52, 0x20, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x53, 0x3b, 0x20, 0x4c, 0x4f, 0x53, 0x53, 0x20, 0x4f, 0x46, 0x20, 0x55, 0x53, 0x45, 0x2c, 0x0a, 0x20, 0x44, 0x41, 0x54, 0x41, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x50, 0x52, 0x4f, 0x46, 0x49, 0x54, 0x53, 0x3b, 0x20, 0x4f, 0x52, 0x20, 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x20, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x52, 0x55, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x29, 0x20, 0x48, 0x4f, 0x57, 0x45, 0x56, 0x45, 0x52, 0x20, 0x43, 0x41, 0x55, 0x53, 0x45, 0x44, 0x20, 0x41, 0x4e, 0x44, 0x20, 0x4f, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x0a, 0x20, 0x54, 0x48, 0x45, 0x4f, 0x52, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x57, 0x48, 0x45, 0x54, 0x48, 0x45, 0x52, 0x20, 0x49, 0x4e, 0x20, 0x43, 0x4f, 0x4e, 0x54, 0x52, 0x41, 0x43, 0x54, 0x2c, 0x20, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x20, 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x2c, 0x20, 0x4f, 0x52, 0x20, 0x54, 0x4f, 0x52, 0x54, 0x0a, 0x20, 0x28, 0x49, 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x49, 0x4e, 0x47, 0x20, 0x4e, 0x45, 0x47, 0x4c, 0x49, 0x47, 0x45, 0x4e, 0x43, 0x45, 0x20, 0x4f, 0x52, 0x20, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x57, 0x49, 0x53, 0x45, 0x29, 0x20, 0x41, 0x52, 0x49, 0x53, 0x49, 0x4e, 0x47, 0x20, 0x49, 0x4e, 0x20, 0x41, 0x4e, 0x59, 0x20, 0x57, 0x41, 0x59, 0x20, 0x4f, 0x55, 0x54, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x55, 0x53, 0x45, 0x0a, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x49, 0x53, 0x20, 0x53, 0x4f, 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x2c, 0x20, 0x45, 0x56, 0x45, 0x4e, 0x20, 0x49, 0x46, 0x20, 0x41, 0x44, 0x56, 0x49, 0x53, 0x45, 0x44, 0x20, 0x4f, 0x46, 0x20, 0x54, 0x48, 0x45, 0x20, 0x50, 0x4f, 0x53, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x20, 0x4f, 0x46, 0x20, 0x53, 0x55, 0x43, 0x48, 0x20, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x2e, 0x0a, 0x0a, 0x08, 0x0a, 0x01, 0x02, 0x12, 0x03, 0x20, 0x00, 0x18, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x22, 0x00, 0x45, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x0b, 0x12, 0x03, 0x22, 0x00, 0x45, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x23, 0x00, 0x2c, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x01, 0x12, 0x03, 0x23, 0x00, 0x2c, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x24, 0x00, 0x2b, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x08, 0x12, 0x03, 0x24, 0x00, 0x2b, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x25, 0x00, 0x22, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x0a, 0x12, 0x03, 0x25, 0x00, 0x22, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x26, 0x00, 0x21, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x24, 0x12, 0x03, 0x26, 0x00, 0x21, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x27, 0x00, 0x3b, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x25, 0x12, 0x03, 0x27, 0x00, 0x3b, 0x0a, 0x08, 0x0a, 0x01, 0x08, 0x12, 0x03, 0x28, 0x00, 0x1f, 0x0a, 0x09, 0x0a, 0x02, 0x08, 0x1f, 0x12, 0x03, 0x28, 0x00, 0x1f, 0x0a, 0xbb, 0x02, 0x0a, 0x02, 0x04, 0x00, 0x12, 0x03, 0x32, 0x00, 0x10, 0x1a, 0xaf, 0x02, 0x20, 0x41, 0x20, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x72, 0x65, 0x2d, 0x75, 0x73, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x0a, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x41, 0x50, 0x49, 0x73, 0x2e, 0x20, 0x41, 0x20, 0x74, 0x79, 0x70, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x69, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x73, 0x65, 0x20, 0x69, 0x74, 0x20, 0x61, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x0a, 0x20, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x20, 0x74, 0x79, 0x70, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x50, 0x49, 0x20, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x46, 0x6f, 0x6f, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x70, 0x63, 0x20, 0x42, 0x61, 0x72, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x29, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x28, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x00, 0x01, 0x12, 0x03, 0x32, 0x08, 0x0d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.cpp b/crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.cpp deleted file mode 100644 index 488dddde..00000000 --- a/crates/protovalidate-rs/gen/parser/internal/CelBaseVisitor.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 - - -#include "CelBaseVisitor.h" - - -using namespace cel_parser_internal; - diff --git a/crates/protovalidate-rs/gen/parser/internal/CelVisitor.cpp b/crates/protovalidate-rs/gen/parser/internal/CelVisitor.cpp deleted file mode 100644 index 18224394..00000000 --- a/crates/protovalidate-rs/gen/parser/internal/CelVisitor.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -// Generated from external/cel-cpp+/parser/internal/Cel.g4 by ANTLR 4.13.2 - - -#include "CelVisitor.h" - - -using namespace cel_parser_internal; - diff --git a/crates/protovalidate-rs/shim/pv_shim.cc b/crates/protovalidate-rs/shim/pv_shim.cc deleted file mode 100644 index f92b99d6..00000000 --- a/crates/protovalidate-rs/shim/pv_shim.cc +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (c) 2023-2026 Buf Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "pv_shim.h" - -#include -#include -#include -#include -#include - -#include "absl/container/flat_hash_set.h" -#include "absl/status/status.h" -#include "absl/strings/str_cat.h" -#include "absl/strings/string_view.h" -#include "absl/status/statusor.h" -#include "absl/synchronization/mutex.h" -#include "buf/validate/validator.h" -#include "google/protobuf/arena.h" -#include "google/protobuf/descriptor.h" -#include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/dynamic_message.h" -#include "google/protobuf/message.h" - -namespace { - -// Collects BuildFile errors so they reach the caller instead of being logged. -// Without one, protobuf writes descriptor errors to ABSL_LOG(ERROR) and -// BuildFile just returns null, which makes bad descriptors hard to diagnose -// from Python. -class StringErrorCollector : public google::protobuf::DescriptorPool::ErrorCollector { - public: - void RecordError(absl::string_view filename, absl::string_view element_name, - const google::protobuf::Message* descriptor, - ErrorLocation location, absl::string_view message) override { - if (!text_.empty()) text_ += "; "; - absl::StrAppend(&text_, filename, ": ", element_name, ": ", message); - } - - const std::string& text() const { return text_; } - - private: - std::string text_; -}; - -char* CopyCString(const std::string& value) { - char* out = static_cast(std::malloc(value.size() + 1)); - if (out == nullptr) return nullptr; - std::memcpy(out, value.data(), value.size() + 1); - return out; -} - -void SetError(char** error, const std::string& message) { - if (error != nullptr) *error = CopyCString(message); -} - -// Classifies a status from Validate, which runs only after CompileRules has -// accepted every message type reachable from the descriptor, so a failure -// here happened while rules were being evaluated. The mapping mirrors -// protovalidate-cc's own conformance runner, in -// buf/validate/conformance/runner.cc: InvalidArgument means a rule failed -// while being evaluated. FailedPrecondition means compilation, reachable -// only for types CompileRules cannot see ahead of time, such as a message -// unpacked out of an Any. -int ClassifyStatus(const absl::Status& status) { - switch (status.code()) { - case absl::StatusCode::kInvalidArgument: - return PV_ERR_RUNTIME; - case absl::StatusCode::kFailedPrecondition: - return PV_ERR_COMPILATION; - default: - return PV_ERR_UNEXPECTED; - } -} - -// Compiles the rules of a message type and every message type reachable from -// its fields. -// -// Rules otherwise compile lazily inside Validate, and protovalidate-cc -// reports some compile-time failures with the same status code as runtime -// CEL failures (NewFieldRules in buf/validate/internal/field_rules.cc returns -// InvalidArgument for a rule whose type does not match its field), so the -// status of Validate alone cannot tell the two apart. Compiling ahead keeps -// the phases separate: a failure here is a compilation error, classified as -// such. -// -// The walk cannot rely on Add's own field recursion: Add returns a cached -// per-descriptor status without revisiting fields, so once a type has -// compiled cleanly, only walking the fields here resurfaces an error cached -// for one of its nested types. `seen` breaks recursion cycles. -absl::Status CompileRules( - buf::validate::ValidatorFactory& factory, - const google::protobuf::Descriptor* descriptor, - absl::flat_hash_set& seen) { - if (!seen.insert(descriptor).second) return absl::OkStatus(); - if (absl::Status status = factory.Add(descriptor); !status.ok()) { - return status; - } - for (int i = 0; i < descriptor->field_count(); i++) { - const google::protobuf::FieldDescriptor* field = descriptor->field(i); - if (field->cpp_type() != google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - continue; - } - if (absl::Status status = CompileRules(factory, field->message_type(), seen); - !status.ok()) { - return status; - } - } - return absl::OkStatus(); -} - -} // namespace - -// The pool is an overlay on the descriptors compiled into this extension -// (well-known types plus buf.validate), so the rule extensions protovalidate-cc -// reads always match the C++ types it was built against, and user files are -// only consulted for names the underlay does not define. -// -// Files are added with BuildFile rather than by feeding a DescriptorDatabase. -// A database-backed pool would be the more usual choice, but protobuf requires -// that such a database not be mutated during the pool's lifetime -- "changes to -// the content of the DescriptorDatabase may not be reflected in subsequent -// lookups" -- and this engine learns about descriptors incrementally, as Python -// encounters new message types. BuildFile on an overlay pool is the supported -// way to add files after construction; it is what python-protobuf's own -// DescriptorPool.Add does. -// -// The consequence for callers: a file's imports must be added before the file -// itself, since BuildFile resolves dependencies eagerly. -struct pv_engine { - pv_engine() - : pool(google::protobuf::DescriptorPool::generated_pool()), - message_factory(&pool) {} - - google::protobuf::DescriptorPool pool; - google::protobuf::DynamicMessageFactory message_factory; - std::unique_ptr validator_factory; - // Message types whose reachable rules have compiled cleanly, so the steady - // state skips the CompileRules walk. Types that failed stay out and are - // walked again, keeping the error a compilation error on every call. - absl::Mutex compiled_mutex; - absl::flat_hash_set compiled - ABSL_GUARDED_BY(compiled_mutex); -}; - -extern "C" { - -pv_engine* pv_engine_new(char** error) { - auto engine = std::make_unique(); - auto factory = buf::validate::ValidatorFactory::New(); - if (!factory.ok()) { - SetError(error, std::string(factory.status().message())); - return nullptr; - } - engine->validator_factory = std::move(*factory); - engine->validator_factory->SetMessageFactory(&engine->message_factory, - &engine->pool); - return engine.release(); -} - -void pv_engine_free(pv_engine* engine) { delete engine; } - -int pv_engine_add_file(pv_engine* engine, const uint8_t* file_descriptor_proto, - size_t len, char** error) { - google::protobuf::FileDescriptorProto proto; - if (!proto.ParseFromArray(file_descriptor_proto, static_cast(len))) { - SetError(error, "could not parse FileDescriptorProto"); - return PV_ERR_ARGUMENT; - } - // Already known, either from the linked-in descriptors or a previous add. - // Callers may re-send descriptors without tracking what we have seen. - if (engine->pool.FindFileByName(proto.name()) != nullptr) return PV_OK; - - StringErrorCollector collector; - if (engine->pool.BuildFileCollectingErrors(proto, &collector) == nullptr) { - std::string message = "could not add " + proto.name() + " to descriptor pool"; - if (!collector.text().empty()) message += ": " + collector.text(); - SetError(error, message); - return PV_ERR_ARGUMENT; - } - return PV_OK; -} - -int pv_engine_validate(pv_engine* engine, const char* type_name, - size_t type_name_len, const uint8_t* payload, - size_t payload_len, int fail_fast, uint8_t** out, - size_t* out_len, char** error) { - absl::string_view name(type_name, type_name_len); - const google::protobuf::Descriptor* descriptor = - engine->pool.FindMessageTypeByName(name); - if (descriptor == nullptr) { - SetError(error, absl::StrCat("unknown message type: ", name)); - return PV_ERR_ARGUMENT; - } - - bool known; - { - absl::ReaderMutexLock lock(&engine->compiled_mutex); - known = engine->compiled.contains(descriptor); - } - if (!known) { - absl::flat_hash_set seen; - absl::Status compiled = - CompileRules(*engine->validator_factory, descriptor, seen); - if (!compiled.ok()) { - SetError(error, std::string(compiled.message())); - return PV_ERR_COMPILATION; - } - absl::WriterMutexLock lock(&engine->compiled_mutex); - engine->compiled.insert(descriptor); - } - - google::protobuf::Arena arena; - google::protobuf::Message* message = - engine->message_factory.GetPrototype(descriptor)->New(&arena); - if (!message->ParseFromArray(payload, static_cast(payload_len))) { - SetError(error, absl::StrCat("could not parse payload as ", name)); - return PV_ERR_ARGUMENT; - } - - auto validator = - engine->validator_factory->NewValidator(&arena, fail_fast != 0); - auto result = validator.Validate(*message); - if (!result.ok()) { - SetError(error, std::string(result.status().message())); - return ClassifyStatus(result.status()); - } - - // Serialized straight into the output buffer; the +1 keeps the allocation - // nonzero (and the pointer meaningful) when there are no violations. - size_t size = result->proto().ByteSizeLong(); - uint8_t* buffer = static_cast(std::malloc(size + 1)); - if (buffer == nullptr) { - SetError(error, "out of memory"); - return PV_ERR_RUNTIME; - } - if (!result->proto().SerializeToArray(buffer, static_cast(size))) { - std::free(buffer); - SetError(error, "could not serialize violations"); - return PV_ERR_RUNTIME; - } - *out = buffer; - *out_len = size; - return PV_OK; -} - -void pv_free(void* ptr) { std::free(ptr); } - -} // extern "C" diff --git a/crates/protovalidate-rs/shim/pv_shim.h b/crates/protovalidate-rs/shim/pv_shim.h deleted file mode 100644 index 8c15c83e..00000000 --- a/crates/protovalidate-rs/shim/pv_shim.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2023-2026 Buf Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// C ABI over protovalidate-cc. Nothing but bytes and primitives crosses this -// boundary: descriptors arrive as serialized google.protobuf.FileDescriptorProto, -// payloads as serialized messages, results as a serialized -// buf.validate.Violations. - -#ifndef PROTOVALIDATE_EXT_PV_SHIM_H_ -#define PROTOVALIDATE_EXT_PV_SHIM_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct pv_engine pv_engine; - -// Status codes returned by the fallible entry points. The Python layer maps -// these onto exception types, and the conformance harness buckets results by -// exception type, so the compilation/runtime distinction is observable -// behaviour rather than an internal detail. -enum { - PV_OK = 0, - PV_ERR_COMPILATION = 1, // rules could not be compiled - PV_ERR_RUNTIME = 2, // a rule failed while being evaluated - PV_ERR_ARGUMENT = 3, // bad descriptor / unknown type / unparsable payload - PV_ERR_UNEXPECTED = 4, // a status protovalidate-cc does not otherwise use -}; - -// Creates an engine: a descriptor pool layered over the descriptors linked into -// this extension (well-known types and buf.validate), a dynamic message -// factory, and a protovalidate ValidatorFactory bound to both. -// -// On failure returns NULL and, if `error` is non-NULL, stores a malloc'd -// message in *error which the caller must release with pv_free. -pv_engine* pv_engine_new(char** error); - -void pv_engine_free(pv_engine* engine); - -// Adds one serialized FileDescriptorProto to the engine's pool. Adding a file -// whose name is already known is a no-op success, so callers may re-send -// descriptors without tracking what the engine has seen. -// -// Files may reference imports that have not been added yet; the pool is -// database-backed and resolves lazily when a type is first looked up. -int pv_engine_add_file(pv_engine* engine, const uint8_t* file_descriptor_proto, - size_t len, char** error); - -// Validates `payload`, a serialized message of the fully-qualified type named -// by `type_name` and `type_name_len`. The name need not be NUL-terminated: -// the pool lookup takes a string view, so callers pass their own string -// storage directly. -// -// On PV_OK, *out receives a malloc'd buffer of length *out_len holding a -// serialized buf.validate.Violations — empty when the message is valid. The -// caller must release it with pv_free. On failure returns one of the -// PV_ERR_* codes and stores a malloc'd message in *error. -int pv_engine_validate(pv_engine* engine, const char* type_name, - size_t type_name_len, const uint8_t* payload, - size_t payload_len, int fail_fast, uint8_t** out, - size_t* out_len, char** error); - -// Releases a buffer returned by pv_engine_validate or an error string. -void pv_free(void* ptr); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // PROTOVALIDATE_EXT_PV_SHIM_H_ diff --git a/crates/protovalidate-rs/src/lib.rs b/crates/protovalidate-rs/src/lib.rs deleted file mode 100644 index 832e78f6..00000000 --- a/crates/protovalidate-rs/src/lib.rs +++ /dev/null @@ -1,176 +0,0 @@ -//! Safe interface to the C shim over protovalidate-cc. -//! -//! The raw ABI mirrors `shim/pv_shim.h`, which this crate's build script -//! compiles together with the protovalidate-cc sources, and stays private: -//! [`Engine`] is the API. - -use std::ffi::{CStr, c_char, c_int}; -use std::ptr; - -const PV_OK: c_int = 0; -const PV_ERR_COMPILATION: c_int = 1; -const PV_ERR_RUNTIME: c_int = 2; -const PV_ERR_ARGUMENT: c_int = 3; -const PV_ERR_UNEXPECTED: c_int = 4; - -/// Opaque raw engine handle. -#[repr(C)] -struct PvEngine { - _opaque: [u8; 0], -} - -unsafe extern "C" { - fn pv_engine_new(error: *mut *mut c_char) -> *mut PvEngine; - fn pv_engine_free(engine: *mut PvEngine); - fn pv_engine_add_file( - engine: *mut PvEngine, - file_descriptor_proto: *const u8, - len: usize, - error: *mut *mut c_char, - ) -> c_int; - fn pv_engine_validate( - engine: *mut PvEngine, - type_name: *const c_char, - type_name_len: usize, - payload: *const u8, - payload_len: usize, - fail_fast: c_int, - out: *mut *mut u8, - out_len: *mut usize, - error: *mut *mut c_char, - ) -> c_int; - fn pv_free(ptr: *mut u8); -} - -/// An engine failure, classified by the shim's status code. -pub enum PvError { - Compilation(String), - Evaluation(String), - Argument(String), - Unexpected(String), - Unknown(i32, String), -} - -/// Takes ownership of a shim-allocated error string. -unsafe fn take_error(error: *mut c_char) -> String { - if error.is_null() { - return "unknown error".to_owned(); - } - let message = unsafe { CStr::from_ptr(error) } - .to_string_lossy() - .into_owned(); - unsafe { pv_free(error.cast()) }; - message -} - -/// Takes ownership of a shim-allocated error string, classified by `code`. -unsafe fn status_error(code: c_int, error: *mut c_char) -> PvError { - let message = unsafe { take_error(error) }; - match code { - PV_ERR_COMPILATION => PvError::Compilation(message), - PV_ERR_RUNTIME => PvError::Evaluation(message), - PV_ERR_ARGUMENT => PvError::Argument(message), - PV_ERR_UNEXPECTED => PvError::Unexpected(message), - code => PvError::Unknown(code, message), - } -} - -/// The C++ engine. -pub struct Engine(*mut PvEngine); - -// SAFETY: the engine has no thread affinity, so it may move between threads. -unsafe impl Send for Engine {} -// SAFETY: protovalidate-cc documents `validate` as thread-safe, while `add_file` requires exclusive access. -unsafe impl Sync for Engine {} - -impl Engine { - pub fn new() -> Result { - let mut error: *mut c_char = ptr::null_mut(); - let engine = unsafe { pv_engine_new(&raw mut error) }; - if engine.is_null() { - return Err(unsafe { take_error(error) }); - } - Ok(Self(engine)) - } - - /// Adds a serialized `FileDescriptorProto` to the engine's pool. - pub fn add_file(&mut self, bytes: &[u8]) -> Result<(), PvError> { - let mut error: *mut c_char = ptr::null_mut(); - let code = - unsafe { pv_engine_add_file(self.0, bytes.as_ptr(), bytes.len(), &raw mut error) }; - if code == PV_OK { - Ok(()) - } else { - Err(unsafe { status_error(code, error) }) - } - } - - /// Validates a serialized message against the rules of `type_name`, - /// returning the serialized `buf.validate.Violations`, or `None` when the - /// message is valid. - pub fn validate( - &self, - type_name: &str, - payload: &[u8], - fail_fast: bool, - ) -> Result, PvError> { - let mut error: *mut c_char = ptr::null_mut(); - let mut out: *mut u8 = ptr::null_mut(); - let mut out_len: usize = 0; - let code = unsafe { - pv_engine_validate( - self.0, - // The shim takes pointer + length -- the pool lookup is an - // absl::string_view -- so the name needs no NUL terminator - // and no copy. - type_name.as_ptr().cast::(), - type_name.len(), - payload.as_ptr(), - payload.len(), - c_int::from(fail_fast), - &raw mut out, - &raw mut out_len, - &raw mut error, - ) - }; - if code != PV_OK { - return Err(unsafe { status_error(code, error) }); - } - if out_len == 0 { - unsafe { pv_free(out) }; - return Ok(None); - } - Ok(Some(PvBuffer { - ptr: out, - len: out_len, - })) - } -} - -impl Drop for Engine { - fn drop(&mut self) { - unsafe { pv_engine_free(self.0) }; - } -} - -/// A byte buffer owned by the shim, freed on drop. -pub struct PvBuffer { - ptr: *mut u8, - len: usize, -} - -// SAFETY: exclusively owned, never aliased. -unsafe impl Send for PvBuffer {} - -impl PvBuffer { - pub fn as_slice(&self) -> &[u8] { - // SAFETY: the shim wrote `len` initialized bytes, owned until drop. - unsafe { std::slice::from_raw_parts(self.ptr, self.len) } - } -} - -impl Drop for PvBuffer { - fn drop(&mut self) { - unsafe { pv_free(self.ptr) }; - } -} diff --git a/crates/protovalidate-rs/third_party/protovalidate-cc b/crates/protovalidate-rs/third_party/protovalidate-cc deleted file mode 160000 index dbc6dfe6..00000000 --- a/crates/protovalidate-rs/third_party/protovalidate-cc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit dbc6dfe6855491a62da4fa2ced46ff2163f13d11 diff --git a/crates/protovalidate/Cargo.toml b/crates/protovalidate/Cargo.toml new file mode 100644 index 00000000..3ab1eb3a --- /dev/null +++ b/crates/protovalidate/Cargo.toml @@ -0,0 +1,45 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[package] +name = "protovalidate" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +description = "Protocol Buffer message validation for Rust" +license.workspace = true +publish.workspace = true + +[dependencies] +protovalidate-deps = { workspace = true, optional = true } + +buffa.workspace = true +buffa-descriptor.workspace = true +buffa-types.workspace = true +foldhash.workspace = true +iri-string.workspace = true +jiff.workspace = true +percent-encoding.workspace = true +regex.workspace = true + +[features] +default = ["cel"] +# Custom CEL rules, evaluated by cel-cpp, which `protovalidate-deps` builds +# from source. The standard rules are implemented natively and never need +# it, so a schema without custom rules can drop the C++ toolchain by +# disabling this feature. +cel = ["dep:protovalidate-deps"] + +[lints] +workspace = true diff --git a/crates/protovalidate/src/cel/library.rs b/crates/protovalidate/src/cel/library.rs new file mode 100644 index 00000000..74b5a77f --- /dev/null +++ b/crates/protovalidate/src/cel/library.rs @@ -0,0 +1,326 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! protovalidate's CEL function library: the functions custom rules can +//! call beyond CEL's own. Each entry of [`FUNCTIONS`] is one overload, named +//! and typed as CEL sees it. + +use protovalidate_deps::{Arg, Element, Kind, NativeFn}; + +use crate::rules::standard::{UniqueKey, has_duplicates, wellknown}; + +/// The key `unique()` compares a list element by; `None` for a NaN, which +/// equals nothing. `unique()` has no overload for a list of messages, +/// lists or maps, so those are an error. +fn unique_key<'a>(element: &'a Element<'a>) -> Result>, String> { + Ok(match element { + Element::Bool(b) => Some(UniqueKey::Bool(*b)), + Element::Int(i) => Some(UniqueKey::Int(*i)), + Element::Uint(u) => Some(UniqueKey::Uint(*u)), + Element::Double(f) => UniqueKey::double(*f), + Element::String(s) => Some(UniqueKey::Str(s)), + Element::Bytes(b) => Some(UniqueKey::Bytes(b)), + Element::Other => { + return Err("no such overload: unique(list) on non-scalar elements".to_owned()); + } + }) +} + +/// One library function, called as a method of its first argument: +/// `arg0.name(args...)`. +pub(super) struct Function { + pub name: &'static str, + pub args: &'static [Kind], + pub call: NativeFn, +} + +/// Every function protovalidate adds to CEL, every overload a separate +/// entry. The backend registers each with its argument kinds, so a call +/// reaching `call` has arguments of exactly those kinds. +pub(super) static FUNCTIONS: &[Function] = &[ + Function { + name: "isNan", + args: &[Kind::Double], + call: is_nan, + }, + Function { + name: "isInf", + args: &[Kind::Double], + call: is_inf, + }, + Function { + name: "isInf", + args: &[Kind::Double, Kind::Int], + call: is_inf, + }, + Function { + name: "unique", + args: &[Kind::List], + call: unique, + }, + Function { + name: "contains", + args: &[Kind::Bytes, Kind::Bytes], + call: contains, + }, + Function { + name: "startsWith", + args: &[Kind::Bytes, Kind::Bytes], + call: starts_with, + }, + Function { + name: "endsWith", + args: &[Kind::Bytes, Kind::Bytes], + call: ends_with, + }, + Function { + name: "isHostname", + args: &[Kind::String], + call: is_hostname, + }, + Function { + name: "isEmail", + args: &[Kind::String], + call: is_email, + }, + Function { + name: "isIp", + args: &[Kind::String], + call: is_ip, + }, + Function { + name: "isIp", + args: &[Kind::String, Kind::Int], + call: is_ip, + }, + Function { + name: "isIpPrefix", + args: &[Kind::String], + call: is_ip_prefix, + }, + Function { + name: "isIpPrefix", + args: &[Kind::String, Kind::Int], + call: is_ip_prefix, + }, + Function { + name: "isIpPrefix", + args: &[Kind::String, Kind::Bool], + call: is_ip_prefix, + }, + Function { + name: "isIpPrefix", + args: &[Kind::String, Kind::Int, Kind::Bool], + call: is_ip_prefix, + }, + Function { + name: "isUri", + args: &[Kind::String], + call: is_uri, + }, + Function { + name: "isUriRef", + args: &[Kind::String], + call: is_uri_ref, + }, + Function { + name: "isHostAndPort", + args: &[Kind::String, Kind::Bool], + call: is_host_and_port, + }, +]; + +// Below functions read the arguments passed from the C++ shim to +// pass to the wellknown functions that are also used for native rules. + +fn mismatch(name: &str) -> String { + format!("{name}: unexpected arguments") +} + +fn is_nan(args: &[Arg<'_>]) -> Result { + match args { + [Arg::Double(value)] => Ok(value.is_nan()), + _ => Err(mismatch("isNan")), + } +} + +/// `isInf()` for either infinity, `isInf(sign)` for the positive one when +/// `sign > 0`, the negative one when `sign < 0`, either when zero. +fn is_inf(args: &[Arg<'_>]) -> Result { + let (value, sign) = match args { + [Arg::Double(value)] => (*value, 0), + [Arg::Double(value), Arg::Int(sign)] => (*value, *sign), + _ => return Err(mismatch("isInf")), + }; + Ok(value.is_infinite() && (sign == 0 || (sign > 0) == (value > 0.0))) +} + +fn unique(args: &[Arg<'_>]) -> Result { + match args { + [Arg::List(elements)] => { + let keys = elements + .iter() + .map(unique_key) + .collect::, _>>()?; + Ok(!has_duplicates(keys)) + } + _ => Err(mismatch("unique")), + } +} + +fn bytes_pair<'a>(args: &'a [Arg<'_>], name: &str) -> Result<(&'a [u8], &'a [u8]), String> { + match args { + [Arg::Bytes(lhs), Arg::Bytes(rhs)] => Ok((lhs, rhs)), + _ => Err(mismatch(name)), + } +} + +fn contains(args: &[Arg<'_>]) -> Result { + let (haystack, needle) = bytes_pair(args, "contains")?; + Ok(needle.is_empty() + || haystack + .windows(needle.len()) + .any(|window| window == needle)) +} + +fn starts_with(args: &[Arg<'_>]) -> Result { + let (value, prefix) = bytes_pair(args, "startsWith")?; + Ok(value.starts_with(prefix)) +} + +fn ends_with(args: &[Arg<'_>]) -> Result { + let (value, suffix) = bytes_pair(args, "endsWith")?; + Ok(value.ends_with(suffix)) +} + +fn string_arg<'a>(args: &'a [Arg<'_>], name: &str) -> Result<&'a str, String> { + match args.first() { + Some(Arg::String(value)) => Ok(value), + _ => Err(mismatch(name)), + } +} + +fn is_hostname(args: &[Arg<'_>]) -> Result { + Ok(wellknown::is_hostname(string_arg(args, "isHostname")?)) +} + +fn is_email(args: &[Arg<'_>]) -> Result { + Ok(wellknown::is_email(string_arg(args, "isEmail")?)) +} + +/// `isIp()` for either version, `isIp(4)` or `isIp(6)` for one; any other +/// version is no IP address. +fn is_ip(args: &[Arg<'_>]) -> Result { + let value = string_arg(args, "isIp")?; + Ok(match args.get(1) { + None | Some(Arg::Int(0)) => wellknown::is_ip(value), + Some(Arg::Int(4)) => wellknown::is_ipv4(value), + Some(Arg::Int(6)) => wellknown::is_ipv6(value), + Some(Arg::Int(_)) => false, + Some(_) => return Err(mismatch("isIp")), + }) +} + +/// `isIpPrefix()`, `isIpPrefix(version)`, `isIpPrefix(strict)` or +/// `isIpPrefix(version, strict)`; strict also requires the host bits to be +/// zero. +fn is_ip_prefix(args: &[Arg<'_>]) -> Result { + let value = string_arg(args, "isIpPrefix")?; + let (version, strict) = match &args[1..] { + [] => (0, false), + [Arg::Int(version)] => (*version, false), + [Arg::Bool(strict)] => (0, *strict), + [Arg::Int(version), Arg::Bool(strict)] => (*version, *strict), + _ => return Err(mismatch("isIpPrefix")), + }; + Ok(match version { + 0 => wellknown::is_ip_prefix(value, strict), + 4 => wellknown::is_ipv4_prefix(value, strict), + 6 => wellknown::is_ipv6_prefix(value, strict), + _ => false, + }) +} + +fn is_uri(args: &[Arg<'_>]) -> Result { + Ok(wellknown::is_uri(string_arg(args, "isUri")?)) +} + +fn is_uri_ref(args: &[Arg<'_>]) -> Result { + Ok(wellknown::is_uri_ref(string_arg(args, "isUriRef")?)) +} + +fn is_host_and_port(args: &[Arg<'_>]) -> Result { + match args { + [Arg::String(value), Arg::Bool(port_required)] => { + Ok(wellknown::is_host_and_port(value, *port_required)) + } + _ => Err(mismatch("isHostAndPort")), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn infinities() { + let inf = |v: f64, sign: i64| is_inf(&[Arg::Double(v), Arg::Int(sign)]).unwrap(); + assert!(inf(f64::INFINITY, 0)); + assert!(inf(f64::INFINITY, 1)); + assert!(!inf(f64::INFINITY, -1)); + assert!(inf(f64::NEG_INFINITY, -1)); + assert!(!inf(f64::NEG_INFINITY, 1)); + assert!(!inf(1.0, 0)); + assert!(is_inf(&[Arg::Double(f64::NEG_INFINITY)]).unwrap()); + } + + #[test] + fn uniqueness() { + let list = |elements| unique(&[Arg::List(elements)]).unwrap(); + assert!(list(vec![Element::Int(1), Element::Int(2)])); + assert!(!list(vec![Element::Int(1), Element::Int(1)])); + assert!(list(vec![ + Element::Double(f64::NAN), + Element::Double(f64::NAN) + ])); + assert!(!list(vec![Element::Double(0.0), Element::Double(-0.0)])); + assert!(unique(&[Arg::List(vec![Element::Other, Element::Other])]).is_err()); + assert!(unique(&[Arg::List(vec![Element::Int(1), Element::Other])]).is_err()); + assert!(!list(vec![ + Element::String("a".into()), + Element::String("a".into()) + ])); + } + + #[test] + fn overload_shapes_match_registrations() { + // Every entry's `call` accepts arguments of the kinds it declares. + for function in FUNCTIONS { + let args: Vec> = function + .args + .iter() + .map(|kind| match kind { + Kind::Bool => Arg::Bool(false), + Kind::Int => Arg::Int(0), + Kind::Uint => Arg::Uint(0), + Kind::Double => Arg::Double(0.0), + Kind::String => Arg::String("".into()), + Kind::Bytes => Arg::Bytes(b""), + Kind::List => Arg::List(Vec::new()), + }) + .collect(); + assert!((function.call)(&args).is_ok(), "{}", function.name); + } + } +} diff --git a/crates/protovalidate/src/cel/mod.rs b/crates/protovalidate/src/cel/mod.rs new file mode 100644 index 00000000..9fd3b5d9 --- /dev/null +++ b/crates/protovalidate/src/cel/mod.rs @@ -0,0 +1,51 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The CEL backend. +//! +//! Everything the validator needs from a CEL runtime passes through the +//! types exported here: an [`Env`] that compiles rule expressions into a +//! [`Program`], and a [`Frame`] holding a message that programs can be +//! evaluated against. With the `cel` feature they come from +//! `protovalidate-deps`, whose engine wraps cel-cpp, with protovalidate's +//! function [`library`] registered by [`new_env`]. Without it they come +//! from the [`stub`], whose environment compiles nothing, so no program +//! ever exists to run. + +#[cfg(feature = "cel")] +mod library; +#[cfg(not(feature = "cel"))] +mod stub; + +#[cfg(feature = "cel")] +pub(crate) use protovalidate_deps::{ + Engine as Env, Error, Expression, Frame, Program, ScalarValue, This, Value, +}; +#[cfg(not(feature = "cel"))] +pub(crate) use stub::{Env, Error, Expression, Frame, Program, ScalarValue, This, Value, new_env}; + +/// A CEL environment knowing protovalidate's functions. +/// +/// # Errors +/// +/// Fails if the runtime cannot be initialized or the library cannot be +/// registered, which indicates a broken build rather than bad input. +#[cfg(feature = "cel")] +pub(crate) fn new_env() -> Result { + let mut env = Env::new()?; + for function in library::FUNCTIONS { + env.register(function.name, true, function.args, function.call)?; + } + Ok(env) +} diff --git a/crates/protovalidate/src/cel/stub.rs b/crates/protovalidate/src/cel/stub.rs new file mode 100644 index 00000000..9dadc157 --- /dev/null +++ b/crates/protovalidate/src/cel/stub.rs @@ -0,0 +1,124 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The CEL backend without the `cel` feature. +//! +//! The types have the shapes the validator uses, but the environment +//! compiles nothing: a custom rule fails to compile, and no [`Program`] or +//! [`Frame`] can be constructed, so the code that would run one is +//! unreachable. + +// The shapes mirror the engine's whether or not anything reaches them. +#![allow(dead_code, clippy::unused_self, clippy::unnecessary_wraps)] + +/// A scalar, as an expression's `this`. +#[derive(Clone, Copy, Debug)] +pub(crate) enum ScalarValue<'a> { + Bool(bool), + Int(i64), + Uint(u64), + Double(f64), + String(&'a str), + Bytes(&'a [u8]), +} + +/// What `this` is bound to while a program runs. +#[derive(Clone, Copy, Debug)] +pub(crate) enum This<'a> { + Scalar(ScalarValue<'a>), + Message(&'a Frame), + Field(&'a Frame, i32), +} + +/// One expression to compile. +#[derive(Clone, Copy, Debug)] +pub(crate) struct Expression<'a> { + pub expression: &'a str, + pub rule_field_number: i32, +} + +/// What an expression produced. +#[derive(Debug)] +pub(crate) enum Value { + Bool(bool), + String(String), + Other, +} + +/// Why the backend could not do what was asked. +#[derive(Debug)] +pub(crate) enum Error { + Compilation(String), + Runtime(String), + Argument(String), + Unexpected(String), +} + +impl Error { + pub(crate) fn message(&self) -> &str { + match self { + Self::Compilation(m) | Self::Runtime(m) | Self::Argument(m) | Self::Unexpected(m) => m, + } + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.message()) + } +} + +/// A compiled program. None exists. +#[derive(Debug)] +pub(crate) enum Program {} + +impl Program { + pub(crate) fn eval(&self, _index: usize, _this: This<'_>) -> Result { + match *self {} + } +} + +/// A parsed message. None exists. +#[derive(Debug)] +pub(crate) enum Frame {} + +/// An environment that knows the schema but compiles nothing. +#[derive(Debug)] +pub(crate) struct Env; + +pub(crate) fn new_env() -> Result { + Ok(Env) +} + +impl Env { + pub(crate) fn add_file(&mut self, _bytes: &[u8]) -> Result<(), Error> { + Ok(()) + } + + pub(crate) fn compile( + &mut self, + _rules: Option<(&str, &[u8])>, + _expressions: &[Expression<'_>], + ) -> Result { + Err(Error::Compilation( + "custom CEL rules require the `cel` feature of the protovalidate crate".to_owned(), + )) + } + + pub(crate) fn frame(&self, _type_name: &str, _payload: &[u8]) -> Result { + Err(Error::Unexpected( + "no CEL program exists to need a message frame".to_owned(), + )) + } +} diff --git a/crates/protovalidate/src/descriptors.rs b/crates/protovalidate/src/descriptors.rs new file mode 100644 index 00000000..be980b62 --- /dev/null +++ b/crates/protovalidate/src/descriptors.rs @@ -0,0 +1,307 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The descriptor pool the validator reflects over, and the pieces of the +//! `buf.validate` schema it reads from that pool. + +use std::sync::Arc; + +use buffa::ExtensionSet as _; +use buffa_descriptor::generated::descriptor::FileDescriptorSet; +use buffa_descriptor::generated::descriptor::field_descriptor_proto::Type; +use buffa_descriptor::{ + DescriptorPool, ExtensionDescriptor, FieldDescriptor, FieldKind, MessageDescriptor, + MessageIndex, ScalarType, SingularKind, +}; + +use crate::validate::{FieldPathElement, FieldRules, MessageRules, OneofRules, PredefinedRules}; + +/// `buf/validate/validate.proto` and its imports, as a serialized +/// `FileDescriptorSet`. Built by `poe generate`. +pub(crate) const BASE_DESCRIPTOR_SET: &[u8] = include_bytes!("gen/buf.validate.binpb"); + +pub(crate) const FIELD_RULES: &str = "buf.validate.FieldRules"; +pub(crate) const ANY: &str = "google.protobuf.Any"; +pub(crate) const DURATION: &str = "google.protobuf.Duration"; +pub(crate) const TIMESTAMP: &str = "google.protobuf.Timestamp"; +pub(crate) const FIELD_MASK: &str = "google.protobuf.FieldMask"; + +/// Decodes a serialized descriptor message, such as a `FileDescriptorSet` +/// or a `FileDescriptorProto`. +pub(crate) fn decode(bytes: &[u8]) -> Result { + // Descriptors are trusted schema, and a large set exceeds the + // element-memory bound buffa applies to untrusted input. + buffa::DecodeOptions::new() + .with_element_memory_limit(usize::MAX) + .decode_from_slice(bytes) + .map_err(|error| format!("could not parse {}: {error}", M::NAME)) +} + +/// The `buf.validate` schema, decoded. +pub(crate) fn base_file_set() -> FileDescriptorSet { + decode(BASE_DESCRIPTOR_SET).expect("embedded descriptor set decodes") +} + +/// The `FieldDescriptorProto.Type` of a field, as protovalidate reports it +/// in field paths. +pub(crate) fn proto_type(field: &FieldDescriptor) -> Type { + let singular = match field.kind() { + FieldKind::Singular(kind) | FieldKind::List(kind) => kind, + FieldKind::Map { .. } => return Type::TYPE_MESSAGE, + }; + match singular { + SingularKind::Scalar(scalar) => scalar_type(scalar), + SingularKind::Enum(_) => Type::TYPE_ENUM, + SingularKind::Message(_) if field.is_delimited() => Type::TYPE_GROUP, + SingularKind::Message(_) => Type::TYPE_MESSAGE, + } +} + +pub(crate) fn scalar_type(scalar: ScalarType) -> Type { + match scalar { + ScalarType::Double => Type::TYPE_DOUBLE, + ScalarType::Float => Type::TYPE_FLOAT, + ScalarType::Int64 => Type::TYPE_INT64, + ScalarType::Uint64 => Type::TYPE_UINT64, + ScalarType::Int32 => Type::TYPE_INT32, + ScalarType::Fixed64 => Type::TYPE_FIXED64, + ScalarType::Fixed32 => Type::TYPE_FIXED32, + ScalarType::Bool => Type::TYPE_BOOL, + ScalarType::String => Type::TYPE_STRING, + ScalarType::Bytes => Type::TYPE_BYTES, + ScalarType::Uint32 => Type::TYPE_UINT32, + ScalarType::Sfixed32 => Type::TYPE_SFIXED32, + ScalarType::Sfixed64 => Type::TYPE_SFIXED64, + ScalarType::Sint32 => Type::TYPE_SINT32, + ScalarType::Sint64 => Type::TYPE_SINT64, + } +} + +/// The name protovalidate prints for a type, as in `field type does not match +/// rule type: string != int32`. +pub(crate) fn type_name(ty: Type) -> &'static str { + match ty { + Type::TYPE_DOUBLE => "double", + Type::TYPE_FLOAT => "float", + Type::TYPE_INT64 => "int64", + Type::TYPE_UINT64 => "uint64", + Type::TYPE_INT32 => "int32", + Type::TYPE_FIXED64 => "fixed64", + Type::TYPE_FIXED32 => "fixed32", + Type::TYPE_BOOL => "bool", + Type::TYPE_STRING => "string", + Type::TYPE_GROUP => "group", + Type::TYPE_MESSAGE => "message", + Type::TYPE_BYTES => "bytes", + Type::TYPE_UINT32 => "uint32", + Type::TYPE_ENUM => "enum", + Type::TYPE_SFIXED32 => "sfixed32", + Type::TYPE_SFIXED64 => "sfixed64", + Type::TYPE_SINT32 => "sint32", + Type::TYPE_SINT64 => "sint64", + } +} + +/// The path element naming `field`. +pub(crate) fn path_element(field: &FieldDescriptor) -> FieldPathElement { + path_element_named(field, field.name().to_owned()) +} + +/// The path element naming an extension field, which protovalidate renders +/// as `[pkg.name]`. +pub(crate) fn extension_path_element(extension: &ExtensionDescriptor) -> FieldPathElement { + path_element_named(extension.field(), format!("[{}]", extension.full_name())) +} + +/// A field number as `FieldPathElement` and CEL represent it. +pub(crate) fn field_number(number: u32) -> i32 { + i32::try_from(number).unwrap_or(i32::MAX) +} + +fn path_element_named(field: &FieldDescriptor, name: String) -> FieldPathElement { + FieldPathElement { + field_number: Some(field_number(field.number())), + field_name: Some(name), + field_type: Some(proto_type(field)), + ..Default::default() + } +} + +/// The path element naming a oneof, which carries only the name. +pub(crate) fn oneof_path_element(name: &str) -> FieldPathElement { + FieldPathElement { + field_name: Some(name.to_owned()), + ..Default::default() + } +} + +/// The message type a field holds, if it is message-typed. +pub(crate) fn message_type(field: &FieldDescriptor) -> Option { + match field.kind() { + FieldKind::Singular(SingularKind::Message(idx)) + | FieldKind::List(SingularKind::Message(idx)) + | FieldKind::Map { + value: SingularKind::Message(idx), + .. + } => Some(idx), + _ => None, + } +} + +/// The `(buf.validate.message)` option on a message, if any. +pub(crate) fn message_rules(message: &MessageDescriptor) -> Option { + message + .options() + .and_then(|options| options.extension(&crate::validate::MESSAGE)) +} + +/// The `(buf.validate.field)` option on a field, if any. +pub(crate) fn field_rules(field: &FieldDescriptor) -> Option { + field + .options() + .and_then(|options| options.extension(&crate::validate::FIELD)) +} + +/// The `(buf.validate.oneof)` option on a oneof, if any. +pub(crate) fn oneof_rules(oneof: &buffa_descriptor::OneofDescriptor) -> Option { + oneof + .options() + .and_then(|options| options.extension(&crate::validate::ONEOF)) +} + +/// The `(buf.validate.predefined)` option on a field of a rules message, if +/// any. +pub(crate) fn predefined_rules(field: &FieldDescriptor) -> Option { + field + .options() + .and_then(|options| options.extension(&crate::validate::PREDEFINED)) +} + +/// The fields of well-known types the rules read through a runtime during validation. +pub(crate) mod wkt { + use crate::protobuf::{Field, Kind, Runtime, Scalar, Singular}; + + /// `google.protobuf.Any.type_url`. + pub(crate) const fn any_type_url() -> Field { + Field::well_known( + 1, + "type_url", + Kind::Singular(Singular::Scalar(Scalar::String)), + ) + } + + // Small hack, since the field numbers are the same, and they could never + // be changed, we use the same Fields for duration and timestamp. + + /// `seconds` of `google.protobuf.Duration` and `Timestamp`. + pub(crate) const fn seconds() -> Field { + Field::well_known( + 1, + "seconds", + Kind::Singular(Singular::Scalar(Scalar::Int64)), + ) + } + + /// `nanos` of `google.protobuf.Duration` and `Timestamp`. + pub(crate) const fn nanos() -> Field { + Field::well_known(2, "nanos", Kind::Singular(Singular::Scalar(Scalar::Int32))) + } + + /// `google.protobuf.FieldMask.paths`. + pub(crate) const fn field_mask_paths() -> Field { + Field::well_known(1, "paths", Kind::List(Singular::Scalar(Scalar::String))) + } +} + +/// The fields of the `buf.validate` schema that rule paths name, resolved +/// once as path elements for error messages. +pub(crate) struct Schema { + pub field_rules: MessageIndex, + pub required: FieldPathElement, + pub cel: FieldPathElement, + pub cel_expression: FieldPathElement, + pub repeated: FieldPathElement, + pub repeated_items: FieldPathElement, + pub map: FieldPathElement, + pub map_keys: FieldPathElement, + pub map_values: FieldPathElement, +} + +impl Schema { + pub(crate) fn new(pool: &DescriptorPool) -> Self { + let element = |message: &str, field: &str| { + let message = pool + .message_by_name(message) + .unwrap_or_else(|| panic!("{message} is in the embedded descriptor set")); + path_element( + message + .field_by_name(field) + .unwrap_or_else(|| panic!("{}.{field} exists", message.full_name())), + ) + }; + Self { + field_rules: pool + .message_index(FIELD_RULES) + .expect("FieldRules is in the embedded descriptor set"), + required: element(FIELD_RULES, "required"), + cel: element(FIELD_RULES, "cel"), + cel_expression: element(FIELD_RULES, "cel_expression"), + repeated: element(FIELD_RULES, "repeated"), + repeated_items: element("buf.validate.RepeatedRules", "items"), + map: element(FIELD_RULES, "map"), + map_keys: element("buf.validate.MapRules", "keys"), + map_values: element("buf.validate.MapRules", "values"), + } + } + + /// The `FieldRules` field holding the standard rules of one type, such as + /// `FieldRules.string`. + pub(crate) fn type_element(&self, pool: &DescriptorPool, name: &str) -> FieldPathElement { + let field_rules = pool.message(self.field_rules); + path_element( + field_rules + .field_by_name(name) + .unwrap_or_else(|| panic!("FieldRules.{name} exists")), + ) + } +} + +/// The descriptors a validator reflects over. +pub(crate) struct Descriptors { + pub pool: Arc, + pub schema: Schema, +} + +impl Descriptors { + /// Descriptors over a set of files that includes the `buf.validate` + /// schema, which is expected to link. + pub(crate) fn from_set(set: FileDescriptorSet) -> Self { + let pool = DescriptorPool::new(set).expect("the descriptor set links"); + let schema = Schema::new(&pool); + Self { + pool: Arc::new(pool), + schema, + } + } + + /// Adds the files of a set, skipping files already known by name. + pub(crate) fn add_file_set(&mut self, set: FileDescriptorSet) -> Result<(), String> { + // The pool is shared with nothing that outlives a validation, so + // this rarely copies. When it does, the copy is the new pool and the + // old one dies with its last borrower. + Arc::make_mut(&mut self.pool) + .add_file_descriptor_set(set) + .map_err(|error| error.to_string()) + } +} diff --git a/crates/protovalidate/src/error.rs b/crates/protovalidate/src/error.rs new file mode 100644 index 00000000..2ec217f1 --- /dev/null +++ b/crates/protovalidate/src/error.rs @@ -0,0 +1,115 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt; + +/// A descriptor that could not be registered. +#[derive(Debug)] +pub struct DescriptorError { + message: String, +} + +impl DescriptorError { + pub(crate) fn new(message: String) -> Self { + Self { message } + } +} + +impl fmt::Display for DescriptorError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.message) + } +} + +impl std::error::Error for DescriptorError {} + +/// A failed validation. +/// +/// [`Validation`](Self::Validation) means the message broke its rules and +/// carries the violations, while every other variant means validation itself +/// did not run to completion. `E` is the runtime's own error, which a read of +/// the message can fail with; see [`Runtime::Error`](crate::protobuf::Runtime::Error). +#[derive(Debug)] +#[non_exhaustive] +pub enum Error { + /// The message broke one or more of its rules. + Validation(ValidationError), + /// The runtime could not read the message, or resolve one of its + /// message types. + Read(E), + /// Validation rules could not be compiled. + Compilation(String), + /// A rule failed while being evaluated. + Evaluation(String), + /// Bad input: an unparsable payload or an unknown type. + Argument(String), + /// A failure that fits no other category. + Unexpected(String), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Validation(error) => error.fmt(f), + Self::Read(error) => write!(f, "could not read message: {error}"), + Self::Compilation(message) => write!(f, "compilation error: {message}"), + Self::Evaluation(message) => write!(f, "evaluation error: {message}"), + Self::Argument(message) => write!(f, "invalid argument: {message}"), + Self::Unexpected(message) => write!(f, "unexpected error: {message}"), + } + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Read(error) => Some(error), + _ => None, + } + } +} + +/// One or more rule violations, carried by [`Error::Validation`] as a +/// serialized `buf.validate.Violations`. +pub struct ValidationError { + violations: Vec, +} + +impl ValidationError { + pub(crate) fn new(violations: Vec) -> Self { + Self { violations } + } + + /// The violations, as a serialized `buf.validate.Violations`. + #[must_use] + pub fn violations(&self) -> &[u8] { + &self.violations + } +} + +impl std::error::Error for ValidationError {} + +impl fmt::Debug for ValidationError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ValidationError") + .field("violations_len", &self.violations.len()) + .finish() + } +} + +impl fmt::Display for ValidationError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("validation failed") + } +} diff --git a/crates/protovalidate/src/gen/buf.validate.binpb b/crates/protovalidate/src/gen/buf.validate.binpb new file mode 100644 index 00000000..208f27c1 Binary files /dev/null and b/crates/protovalidate/src/gen/buf.validate.binpb differ diff --git a/crates/protovalidate/src/gen/buf.validate.mod.rs b/crates/protovalidate/src/gen/buf.validate.mod.rs new file mode 100644 index 00000000..5408d958 --- /dev/null +++ b/crates/protovalidate/src/gen/buf.validate.mod.rs @@ -0,0 +1,36 @@ +// @generated by buffa-codegen. DO NOT EDIT. + +include!("buf.validate.validate.rs"); +#[allow( + non_camel_case_types, + dead_code, + unused_imports, + unused_qualifications, + clippy::derivable_impls, + clippy::match_single_binding, + clippy::uninlined_format_args, + clippy::doc_lazy_continuation, + clippy::module_inception +)] +pub mod __buffa { + #[allow(unused_imports)] + use super::*; + pub mod oneof { + #[allow(unused_imports)] + use super::*; + include!("buf.validate.validate.__oneof.rs"); + } + pub mod ext { + #[allow(unused_imports)] + use super::*; + include!("buf.validate.validate.__ext.rs"); + } +} +#[doc(inline)] +pub use self::__buffa::ext::MESSAGE; +#[doc(inline)] +pub use self::__buffa::ext::ONEOF; +#[doc(inline)] +pub use self::__buffa::ext::FIELD; +#[doc(inline)] +pub use self::__buffa::ext::PREDEFINED; diff --git a/crates/protovalidate/src/gen/buf.validate.validate.__ext.rs b/crates/protovalidate/src/gen/buf.validate.validate.__ext.rs new file mode 100644 index 00000000..968581e4 --- /dev/null +++ b/crates/protovalidate/src/gen/buf.validate.validate.__ext.rs @@ -0,0 +1,19 @@ +// @generated by buffa-codegen. DO NOT EDIT. +// source: buf/validate/validate.proto + +///Extension `message` on `.google.protobuf.MessageOptions` (field 1159). +pub const MESSAGE: ::buffa::Extension< + ::buffa::extension::codecs::MessageCodec, +> = ::buffa::Extension::new(1159u32, "google.protobuf.MessageOptions"); +///Extension `oneof` on `.google.protobuf.OneofOptions` (field 1159). +pub const ONEOF: ::buffa::Extension< + ::buffa::extension::codecs::MessageCodec, +> = ::buffa::Extension::new(1159u32, "google.protobuf.OneofOptions"); +///Extension `field` on `.google.protobuf.FieldOptions` (field 1159). +pub const FIELD: ::buffa::Extension< + ::buffa::extension::codecs::MessageCodec, +> = ::buffa::Extension::new(1159u32, "google.protobuf.FieldOptions"); +///Extension `predefined` on `.google.protobuf.FieldOptions` (field 1160). +pub const PREDEFINED: ::buffa::Extension< + ::buffa::extension::codecs::MessageCodec, +> = ::buffa::Extension::new(1160u32, "google.protobuf.FieldOptions"); diff --git a/crates/protovalidate/src/gen/buf.validate.validate.__oneof.rs b/crates/protovalidate/src/gen/buf.validate.validate.__oneof.rs new file mode 100644 index 00000000..ad30fe8c --- /dev/null +++ b/crates/protovalidate/src/gen/buf.validate.validate.__oneof.rs @@ -0,0 +1,538 @@ +// @generated by buffa-codegen. DO NOT EDIT. +// source: buf/validate/validate.proto + +pub mod field_rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum Type { + Float(::buffa::alloc::boxed::Box), + Double(::buffa::alloc::boxed::Box), + Int32(::buffa::alloc::boxed::Box), + Int64(::buffa::alloc::boxed::Box), + Uint32(::buffa::alloc::boxed::Box), + Uint64(::buffa::alloc::boxed::Box), + Sint32(::buffa::alloc::boxed::Box), + Sint64(::buffa::alloc::boxed::Box), + Fixed32(::buffa::alloc::boxed::Box), + Fixed64(::buffa::alloc::boxed::Box), + Sfixed32(::buffa::alloc::boxed::Box), + Sfixed64(::buffa::alloc::boxed::Box), + Bool(::buffa::alloc::boxed::Box), + String(::buffa::alloc::boxed::Box), + Bytes(::buffa::alloc::boxed::Box), + Enum(::buffa::alloc::boxed::Box), + Repeated(::buffa::alloc::boxed::Box), + Map(::buffa::alloc::boxed::Box), + Any(::buffa::alloc::boxed::Box), + Duration(::buffa::alloc::boxed::Box), + FieldMask(::buffa::alloc::boxed::Box), + Timestamp(::buffa::alloc::boxed::Box), + } + impl ::buffa::Oneof for Type {} + impl From for Type { + fn from(v: super::super::super::FloatRules) -> Self { + Self::Float(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::FloatRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::DoubleRules) -> Self { + Self::Double(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::DoubleRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::Int32Rules) -> Self { + Self::Int32(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::Int32Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::Int64Rules) -> Self { + Self::Int64(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::Int64Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::UInt32Rules) -> Self { + Self::Uint32(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::UInt32Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::UInt64Rules) -> Self { + Self::Uint64(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::UInt64Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::SInt32Rules) -> Self { + Self::Sint32(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::SInt32Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::SInt64Rules) -> Self { + Self::Sint64(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::SInt64Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::Fixed32Rules) -> Self { + Self::Fixed32(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::Fixed32Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::Fixed64Rules) -> Self { + Self::Fixed64(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::Fixed64Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::SFixed32Rules) -> Self { + Self::Sfixed32(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::SFixed32Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::SFixed64Rules) -> Self { + Self::Sfixed64(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::SFixed64Rules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::BoolRules) -> Self { + Self::Bool(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::BoolRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::StringRules) -> Self { + Self::String(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::StringRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::BytesRules) -> Self { + Self::Bytes(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::BytesRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::EnumRules) -> Self { + Self::Enum(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::EnumRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::RepeatedRules) -> Self { + Self::Repeated(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::RepeatedRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::MapRules) -> Self { + Self::Map(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::MapRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::AnyRules) -> Self { + Self::Any(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::AnyRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::DurationRules) -> Self { + Self::Duration(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::DurationRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::FieldMaskRules) -> Self { + Self::FieldMask(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::FieldMaskRules) -> Self { + Self::Some(Type::from(v)) + } + } + impl From for Type { + fn from(v: super::super::super::TimestampRules) -> Self { + Self::Timestamp(::buffa::alloc::boxed::Box::new(v)) + } + } + impl From for ::core::option::Option { + fn from(v: super::super::super::TimestampRules) -> Self { + Self::Some(Type::from(v)) + } + } +} +pub mod float_rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(f32), + Lte(f32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(f32), + Gte(f32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod double_rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(f64), + Lte(f64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(f64), + Gte(f64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod int32rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i32), + Lte(i32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i32), + Gte(i32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod int64rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i64), + Lte(i64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i64), + Gte(i64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod u_int32rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(u32), + Lte(u32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(u32), + Gte(u32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod u_int64rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(u64), + Lte(u64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(u64), + Gte(u64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod s_int32rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i32), + Lte(i32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i32), + Gte(i32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod s_int64rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i64), + Lte(i64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i64), + Gte(i64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod fixed32rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(u32), + Lte(u32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(u32), + Gte(u32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod fixed64rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(u64), + Lte(u64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(u64), + Gte(u64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod s_fixed32rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i32), + Lte(i32), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i32), + Gte(i32), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod s_fixed64rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(i64), + Lte(i64), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(i64), + Gte(i64), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod string_rules { + #[allow(unused_imports)] + use super::*; + /// `WellKnown` rules provide advanced rules against common string + /// patterns. + #[derive(Clone, PartialEq, Debug)] + pub enum WellKnown { + Email(bool), + Hostname(bool), + Ip(bool), + Ipv4(bool), + Ipv6(bool), + Uri(bool), + UriRef(bool), + Address(bool), + Uuid(bool), + Tuuid(bool), + IpWithPrefixlen(bool), + Ipv4WithPrefixlen(bool), + Ipv6WithPrefixlen(bool), + IpPrefix(bool), + Ipv4Prefix(bool), + Ipv6Prefix(bool), + HostAndPort(bool), + Ulid(bool), + ProtobufFqn(bool), + ProtobufDotFqn(bool), + WellKnownRegex(super::super::super::KnownRegex), + } + impl ::buffa::Oneof for WellKnown {} +} +pub mod bytes_rules { + #[allow(unused_imports)] + use super::*; + /// WellKnown rules provide advanced rules against common byte + /// patterns + #[derive(Clone, PartialEq, Debug)] + pub enum WellKnown { + Ip(bool), + Ipv4(bool), + Ipv6(bool), + Uuid(bool), + } + impl ::buffa::Oneof for WellKnown {} +} +pub mod duration_rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Duration>), + Lte(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Duration>), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Duration>), + Gte(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Duration>), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod timestamp_rules { + #[allow(unused_imports)] + use super::*; + #[derive(Clone, PartialEq, Debug)] + pub enum LessThan { + Lt(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Timestamp>), + Lte(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Timestamp>), + LtNow(bool), + } + impl ::buffa::Oneof for LessThan {} + #[derive(Clone, PartialEq, Debug)] + pub enum GreaterThan { + Gt(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Timestamp>), + Gte(::buffa::alloc::boxed::Box<::buffa_types::google::protobuf::Timestamp>), + GtNow(bool), + } + impl ::buffa::Oneof for GreaterThan {} +} +pub mod field_path_element { + #[allow(unused_imports)] + use super::*; + /// `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. + #[derive(Clone, PartialEq, Debug)] + pub enum Subscript { + Index(u64), + BoolKey(bool), + IntKey(i64), + UintKey(u64), + StringKey(::buffa::alloc::string::String), + } + impl ::buffa::Oneof for Subscript {} +} diff --git a/crates/protovalidate/src/gen/buf.validate.validate.rs b/crates/protovalidate/src/gen/buf.validate.validate.rs new file mode 100644 index 00000000..410f8133 --- /dev/null +++ b/crates/protovalidate/src/gen/buf.validate.validate.rs @@ -0,0 +1,11457 @@ +// @generated by buffa-codegen. DO NOT EDIT. +// source: buf/validate/validate.proto + +/// Specifies how `FieldRules.ignore` behaves, depending on the field's value, and +/// whether the field tracks presence. +#[allow(non_camel_case_types)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] +#[repr(i32)] +pub enum Ignore { + /// Ignore rules if the field tracks presence and is unset. This is the default + /// behavior. + /// + /// In proto3, only message fields, members of a Protobuf `oneof`, and fields + /// with the `optional` label track presence. Consequently, the following fields + /// are always validated, whether a value is set or not: + /// + /// ```proto,ignore + /// syntax="proto3"; + /// + /// message RulesApply { + /// string email = 1 [ + /// (buf.validate.field).string.email = true + /// ]; + /// int32 age = 2 [ + /// (buf.validate.field).int32.gt = 0 + /// ]; + /// repeated string labels = 3 [ + /// (buf.validate.field).repeated.min_items = 1 + /// ]; + /// } + /// ``` + /// + /// In contrast, the following fields track presence, and are only validated if + /// a value is set: + /// + /// ```proto,ignore + /// syntax="proto3"; + /// + /// message RulesApplyIfSet { + /// optional string email = 1 [ + /// (buf.validate.field).string.email = true + /// ]; + /// oneof ref { + /// string reference = 2 [ + /// (buf.validate.field).string.uuid = true + /// ]; + /// string name = 3 [ + /// (buf.validate.field).string.min_len = 4 + /// ]; + /// } + /// SomeMessage msg = 4 [ + /// (buf.validate.field).cel = {/* ... */} + /// ]; + /// } + /// ``` + /// + /// To ensure that such a field is set, add the `required` rule. + /// + /// To learn which fields track presence, see the + /// [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + IGNORE_UNSPECIFIED = 0i32, + /// Ignore rules if the field is unset, or set to the zero value. + /// + /// The zero value depends on the field type: + /// - For strings, the zero value is the empty string. + /// - For bytes, the zero value is empty bytes. + /// - For bool, the zero value is false. + /// - For numeric types, the zero value is zero. + /// - For enums, the zero value is the first defined enum value. + /// - For repeated fields, the zero is an empty list. + /// - For map fields, the zero is an empty map. + /// - For message fields, absence of the message (typically a null-value) is considered zero value. + /// + /// For fields that track presence (e.g. adding the `optional` label in proto3), + /// this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`. + IGNORE_IF_ZERO_VALUE = 1i32, + /// Always ignore rules, including the `required` rule. + /// + /// This is useful for ignoring the rules of a referenced message, or to + /// temporarily ignore rules during development. + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field's rules will always be ignored, including any validations + /// // on value's fields. + /// MyOtherMessage value = 1 [ + /// (buf.validate.field).ignore = IGNORE_ALWAYS + /// ]; + /// } + /// ``` + IGNORE_ALWAYS = 3i32, +} +impl Ignore { + ///Idiomatic alias for [`Self::IGNORE_UNSPECIFIED`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const Unspecified: Self = Self::IGNORE_UNSPECIFIED; + ///Idiomatic alias for [`Self::IGNORE_IF_ZERO_VALUE`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const IfZeroValue: Self = Self::IGNORE_IF_ZERO_VALUE; + ///Idiomatic alias for [`Self::IGNORE_ALWAYS`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const Always: Self = Self::IGNORE_ALWAYS; +} +impl ::core::default::Default for Ignore { + fn default() -> Self { + Self::IGNORE_UNSPECIFIED + } +} +impl ::buffa::Enumeration for Ignore { + fn from_i32(value: i32) -> ::core::option::Option { + match value { + 0i32 => ::core::option::Option::Some(Self::IGNORE_UNSPECIFIED), + 1i32 => ::core::option::Option::Some(Self::IGNORE_IF_ZERO_VALUE), + 3i32 => ::core::option::Option::Some(Self::IGNORE_ALWAYS), + _ => ::core::option::Option::None, + } + } + fn to_i32(&self) -> i32 { + *self as i32 + } + fn proto_name(&self) -> &'static str { + match self { + Self::IGNORE_UNSPECIFIED => "IGNORE_UNSPECIFIED", + Self::IGNORE_IF_ZERO_VALUE => "IGNORE_IF_ZERO_VALUE", + Self::IGNORE_ALWAYS => "IGNORE_ALWAYS", + } + } + fn from_proto_name(name: &str) -> ::core::option::Option { + match name { + "IGNORE_UNSPECIFIED" => { + ::core::option::Option::Some(Self::IGNORE_UNSPECIFIED) + } + "IGNORE_IF_ZERO_VALUE" => { + ::core::option::Option::Some(Self::IGNORE_IF_ZERO_VALUE) + } + "IGNORE_ALWAYS" => ::core::option::Option::Some(Self::IGNORE_ALWAYS), + _ => ::core::option::Option::None, + } + } + fn values() -> &'static [Self] { + &[Self::IGNORE_UNSPECIFIED, Self::IGNORE_IF_ZERO_VALUE, Self::IGNORE_ALWAYS] + } +} +/// KnownRegex contains some well-known patterns. +#[allow(non_camel_case_types)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] +#[repr(i32)] +pub enum KnownRegex { + KNOWN_REGEX_UNSPECIFIED = 0i32, + /// HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2). + KNOWN_REGEX_HTTP_HEADER_NAME = 1i32, + /// HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4). + KNOWN_REGEX_HTTP_HEADER_VALUE = 2i32, +} +impl KnownRegex { + ///Idiomatic alias for [`Self::KNOWN_REGEX_UNSPECIFIED`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const Unspecified: Self = Self::KNOWN_REGEX_UNSPECIFIED; + ///Idiomatic alias for [`Self::KNOWN_REGEX_HTTP_HEADER_NAME`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const HttpHeaderName: Self = Self::KNOWN_REGEX_HTTP_HEADER_NAME; + ///Idiomatic alias for [`Self::KNOWN_REGEX_HTTP_HEADER_VALUE`]; `Debug` prints the variant name. + #[allow(non_upper_case_globals)] + pub const HttpHeaderValue: Self = Self::KNOWN_REGEX_HTTP_HEADER_VALUE; +} +impl ::core::default::Default for KnownRegex { + fn default() -> Self { + Self::KNOWN_REGEX_UNSPECIFIED + } +} +impl ::buffa::Enumeration for KnownRegex { + fn from_i32(value: i32) -> ::core::option::Option { + match value { + 0i32 => ::core::option::Option::Some(Self::KNOWN_REGEX_UNSPECIFIED), + 1i32 => ::core::option::Option::Some(Self::KNOWN_REGEX_HTTP_HEADER_NAME), + 2i32 => ::core::option::Option::Some(Self::KNOWN_REGEX_HTTP_HEADER_VALUE), + _ => ::core::option::Option::None, + } + } + fn to_i32(&self) -> i32 { + *self as i32 + } + fn proto_name(&self) -> &'static str { + match self { + Self::KNOWN_REGEX_UNSPECIFIED => "KNOWN_REGEX_UNSPECIFIED", + Self::KNOWN_REGEX_HTTP_HEADER_NAME => "KNOWN_REGEX_HTTP_HEADER_NAME", + Self::KNOWN_REGEX_HTTP_HEADER_VALUE => "KNOWN_REGEX_HTTP_HEADER_VALUE", + } + } + fn from_proto_name(name: &str) -> ::core::option::Option { + match name { + "KNOWN_REGEX_UNSPECIFIED" => { + ::core::option::Option::Some(Self::KNOWN_REGEX_UNSPECIFIED) + } + "KNOWN_REGEX_HTTP_HEADER_NAME" => { + ::core::option::Option::Some(Self::KNOWN_REGEX_HTTP_HEADER_NAME) + } + "KNOWN_REGEX_HTTP_HEADER_VALUE" => { + ::core::option::Option::Some(Self::KNOWN_REGEX_HTTP_HEADER_VALUE) + } + _ => ::core::option::Option::None, + } + } + fn values() -> &'static [Self] { + &[ + Self::KNOWN_REGEX_UNSPECIFIED, + Self::KNOWN_REGEX_HTTP_HEADER_NAME, + Self::KNOWN_REGEX_HTTP_HEADER_VALUE, + ] + } +} +/// `Rule` represents a validation rule written in the Common Expression +/// Language (CEL) syntax. Each Rule includes a unique identifier, an +/// optional error message, and the CEL expression to evaluate. For more +/// information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). +/// +/// ```proto,ignore +/// message Foo { +/// option (buf.validate.message).cel = { +/// id: "foo.bar" +/// message: "bar must be greater than 0" +/// expression: "this.bar > 0" +/// }; +/// int32 bar = 1; +/// } +/// ``` +#[derive(Clone, PartialEq, Default)] +pub struct Rule { + /// `id` is a string that serves as a machine-readable name for this Rule. + /// It should be unique within its scope, which could be either a message or a field. + /// + /// Field 1: `id` + pub id: ::core::option::Option<::buffa::alloc::string::String>, + /// `message` is an optional field that provides a human-readable error message + /// for this Rule when the CEL expression evaluates to false. If a + /// non-empty message is provided, any strings resulting from the CEL + /// expression evaluation are ignored. + /// + /// Field 2: `message` + pub message: ::core::option::Option<::buffa::alloc::string::String>, + /// `expression` is the actual CEL expression that will be evaluated for + /// validation. This string must resolve to either a boolean or a string + /// value. If the expression evaluates to false or a non-empty string, the + /// validation is considered failed, and the message is rejected. + /// + /// Field 3: `expression` + pub expression: ::core::option::Option<::buffa::alloc::string::String>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Rule { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Rule") + .field("id", &self.id) + .field("message", &self.message) + .field("expression", &self.expression) + .finish() + } +} +impl Rule { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Rule"; +} +::buffa::impl_default_instance!(Rule); +impl ::buffa::MessageName for Rule { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Rule"; + const FULL_NAME: &'static str = "buf.validate.Rule"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Rule"; +} +impl ::buffa::Message for Rule { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(ref v) = self.id { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.message { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.expression { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(ref v) = self.id { + ::buffa::types::put_string_field(1u32, v, buf); + } + if let Some(ref v) = self.message { + ::buffa::types::put_string_field(2u32, v, buf); + } + if let Some(ref v) = self.expression { + ::buffa::types::put_string_field(3u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.id.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.message.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self + .expression + .get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.id = ::core::option::Option::None; + self.message = ::core::option::Option::None; + self.expression = ::core::option::Option::None; + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Rule { + const PROTO_FQN: &'static str = "buf.validate.Rule"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// MessageRules represents validation rules that are applied to the entire message. +/// It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules. +#[derive(Clone, PartialEq, Default)] +pub struct MessageRules { + /// `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + /// rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + /// + /// This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + /// simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + /// be same as the `expression`. + /// + /// For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field `foo` must be greater than 42. + /// option (buf.validate.message).cel_expression = "this.foo > 42"; + /// // The field `foo` must be less than 84. + /// option (buf.validate.message).cel_expression = "this.foo < 84"; + /// optional int32 foo = 1; + /// } + /// ``` + /// + /// Field 5: `cel_expression` + pub cel_expression: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message. + /// These rules are written in Common Expression Language (CEL) syntax. For more information, + /// [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + /// + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field `foo` must be greater than 42. + /// option (buf.validate.message).cel = { + /// id: "my_message.value", + /// message: "must be greater than 42", + /// expression: "this.foo > 42", + /// }; + /// optional int32 foo = 1; + /// } + /// ``` + /// + /// Field 3: `cel` + pub cel: ::buffa::alloc::vec::Vec, + /// `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields + /// of which at most one can be present. If `required` is also specified, then exactly one + /// of the specified fields _must_ be present. + /// + /// This will enforce oneof-like constraints with a few features not provided by + /// actual Protobuf oneof declarations: + /// 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof, + /// ```text + /// only scalar fields are allowed. + /// ``` + /// 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member + /// ```text + /// fields have explicit presence. This means that, for the purpose of determining + /// how many fields are set, explicitly setting such a field to its zero value is + /// effectively the same as not setting it at all. + /// ``` + /// 3. This will always generate validation errors for a message unmarshalled from + /// ```text + /// serialized data that sets more than one field. With a Protobuf oneof, when + /// multiple fields are present in the serialized form, earlier values are usually + /// silently ignored when unmarshalling, with only the last field being set when + /// unmarshalling completes. + /// ``` + /// + /// Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means + /// only the field that is set will be validated and the unset fields are not validated according to the field rules. + /// This behavior can be overridden by setting `ignore` against a field. + /// + /// ```proto,ignore + /// message MyMessage { + /// // Only one of `field1` or `field2` _can_ be present in this message. + /// option (buf.validate.message).oneof = { fields: ["field1", "field2"] }; + /// // Exactly one of `field3` or `field4` _must_ be present in this message. + /// option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true }; + /// string field1 = 1; + /// bytes field2 = 2; + /// bool field3 = 3; + /// int32 field4 = 4; + /// } + /// ``` + /// + /// Field 4: `oneof` + pub oneof: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for MessageRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("MessageRules") + .field("cel_expression", &self.cel_expression) + .field("cel", &self.cel) + .field("oneof", &self.oneof) + .finish() + } +} +impl MessageRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MessageRules"; +} +::buffa::impl_default_instance!(MessageRules); +impl ::buffa::MessageName for MessageRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "MessageRules"; + const FULL_NAME: &'static str = "buf.validate.MessageRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MessageRules"; +} +impl ::buffa::Message for MessageRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.cel { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.oneof { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.cel_expression { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.cel { + ::buffa::types::put_len_delimited_header( + 3u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + for v in &self.oneof { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + for v in &self.cel_expression { + ::buffa::types::put_string_field(5u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.cel.push(elem); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.oneof.push(elem); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.cel_expression.push(__elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.cel.clear(); + self.oneof.clear(); + self.cel_expression.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for MessageRules { + const PROTO_FQN: &'static str = "buf.validate.MessageRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +#[derive(Clone, PartialEq, Default)] +pub struct MessageOneofRule { + /// A list of field names to include in the oneof. All field names must be + /// defined in the message. At least one field must be specified, and + /// duplicates are not permitted. + /// + /// Field 1: `fields` + pub fields: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// If true, one of the fields specified _must_ be set. + /// + /// Field 2: `required` + pub required: ::core::option::Option, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for MessageOneofRule { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("MessageOneofRule") + .field("fields", &self.fields) + .field("required", &self.required) + .finish() + } +} +impl MessageOneofRule { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MessageOneofRule"; +} +::buffa::impl_default_instance!(MessageOneofRule); +impl ::buffa::MessageName for MessageOneofRule { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "MessageOneofRule"; + const FULL_NAME: &'static str = "buf.validate.MessageOneofRule"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MessageOneofRule"; +} +impl ::buffa::Message for MessageOneofRule { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.fields { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if self.required.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.fields { + ::buffa::types::put_string_field(1u32, v, buf); + } + if let Some(v) = self.required { + ::buffa::types::put_bool_field(2u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.fields.push(__elem); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.required = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.fields.clear(); + self.required = ::core::option::Option::None; + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for MessageOneofRule { + const PROTO_FQN: &'static str = "buf.validate.MessageOneofRule"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// The `OneofRules` message type enables you to manage rules for +/// oneof fields in your protobuf messages. +#[derive(Clone, PartialEq, Default)] +pub struct OneofRules { + /// If `required` is true, exactly one field of the oneof must be set. A + /// validation error is returned if no fields in the oneof are set. Further rules + /// should be placed on the fields themselves to ensure they are valid values, + /// such as `min_len` or `gt`. + /// + /// ```proto,ignore + /// message MyMessage { + /// oneof value { + /// // Either `a` or `b` must be set. If `a` is set, it must also be + /// // non-empty; whereas if `b` is set, it can still be an empty string. + /// option (buf.validate.oneof).required = true; + /// string a = 1 [(buf.validate.field).string.min_len = 1]; + /// string b = 2; + /// } + /// } + /// ``` + /// + /// Field 1: `required` + pub required: ::core::option::Option, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for OneofRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("OneofRules").field("required", &self.required).finish() + } +} +impl OneofRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.OneofRules"; +} +::buffa::impl_default_instance!(OneofRules); +impl ::buffa::MessageName for OneofRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "OneofRules"; + const FULL_NAME: &'static str = "buf.validate.OneofRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.OneofRules"; +} +impl ::buffa::Message for OneofRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.required.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.required { + ::buffa::types::put_bool_field(1u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.required = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.required = ::core::option::Option::None; + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for OneofRules { + const PROTO_FQN: &'static str = "buf.validate.OneofRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// FieldRules encapsulates the rules for each type of field. Depending on +/// the field, the correct set should be used to ensure proper validations. +#[derive(Clone, PartialEq, Default)] +pub struct FieldRules { + /// `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + /// rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + /// + /// This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + /// simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + /// be same as the `expression`. + /// + /// For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field `value` must be greater than 42. + /// optional int32 value = 1 [(buf.validate.field).cel_expression = "this > 42"]; + /// } + /// ``` + /// + /// Field 29: `cel_expression` + pub cel_expression: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `cel` is a repeated field used to represent a textual expression + /// in the Common Expression Language (CEL) syntax. For more information, + /// [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field `value` must be greater than 42. + /// optional int32 value = 1 [(buf.validate.field).cel = { + /// id: "my_message.value", + /// message: "must be greater than 42", + /// expression: "this > 42", + /// }]; + /// } + /// ``` + /// + /// Field 23: `cel` + pub cel: ::buffa::alloc::vec::Vec, + /// If `required` is true, the field must be set. A validation error is returned + /// if the field is not set. + /// + /// ```proto,ignore + /// syntax="proto3"; + /// + /// message FieldsWithPresence { + /// // Requires any string to be set, including the empty string. + /// optional string link = 1 [ + /// (buf.validate.field).required = true + /// ]; + /// // Requires true or false to be set. + /// optional bool disabled = 2 [ + /// (buf.validate.field).required = true + /// ]; + /// // Requires a message to be set, including the empty message. + /// SomeMessage msg = 4 [ + /// (buf.validate.field).required = true + /// ]; + /// } + /// ``` + /// + /// All fields in the example above track presence. By default, Protovalidate + /// ignores rules on those fields if no value is set. `required` ensures that + /// the fields are set and valid. + /// + /// Fields that don't track presence are always validated by Protovalidate, + /// whether they are set or not. It is not necessary to add `required`. It + /// can be added to indicate that the field cannot be the zero value. + /// + /// ```proto,ignore + /// syntax="proto3"; + /// + /// message FieldsWithoutPresence { + /// // `string.email` always applies, even to an empty string. + /// string link = 1 [ + /// (buf.validate.field).string.email = true + /// ]; + /// // `repeated.min_items` always applies, even to an empty list. + /// repeated string labels = 2 [ + /// (buf.validate.field).repeated.min_items = 1 + /// ]; + /// // `required`, for fields that don't track presence, indicates + /// // the value of the field can't be the zero value. + /// int32 zero_value_not_allowed = 3 [ + /// (buf.validate.field).required = true + /// ]; + /// } + /// ``` + /// + /// To learn which fields track presence, see the + /// [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + /// + /// Note: While field rules can be applied to repeated items, map keys, and map + /// values, the elements are always considered to be set. Consequently, + /// specifying `repeated.items.required` is redundant. + /// + /// Field 25: `required` + pub required: ::core::option::Option, + /// Ignore validation rules on the field if its value matches the specified + /// criteria. See the `Ignore` enum for details. + /// + /// ```proto,ignore + /// message UpdateRequest { + /// // The uri rule only applies if the field is not an empty string. + /// string url = 1 [ + /// (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, + /// (buf.validate.field).string.uri = true + /// ]; + /// } + /// ``` + /// + /// Field 27: `ignore` + pub ignore: ::core::option::Option, + pub r#type: ::core::option::Option<__buffa::oneof::field_rules::Type>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for FieldRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FieldRules") + .field("cel_expression", &self.cel_expression) + .field("cel", &self.cel) + .field("required", &self.required) + .field("ignore", &self.ignore) + .field("type", &self.r#type) + .finish() + } +} +impl FieldRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldRules"; +} +::buffa::impl_default_instance!(FieldRules); +impl ::buffa::MessageName for FieldRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "FieldRules"; + const FULL_NAME: &'static str = "buf.validate.FieldRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldRules"; +} +impl ::buffa::Message for FieldRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let ::core::option::Option::Some(ref v) = self.r#type { + match v { + __buffa::oneof::field_rules::Type::Float(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Double(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Int32(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Int64(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Uint32(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Uint64(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Sint32(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Sint64(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Fixed32(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Fixed64(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Sfixed32(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Sfixed64(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Bool(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::String(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Bytes(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Enum(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Repeated(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Map(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Any(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Duration(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::FieldMask(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::field_rules::Type::Timestamp(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 2u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + } + } + for v in &self.cel { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 2u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + if self.required.is_some() { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + if let Some(ref v) = self.ignore { + size += 2u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; + } + for v in &self.cel_expression { + size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let ::core::option::Option::Some(ref v) = self.r#type { + match v { + __buffa::oneof::field_rules::Type::Float(x) => { + ::buffa::types::put_len_delimited_header( + 1u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Double(x) => { + ::buffa::types::put_len_delimited_header( + 2u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Int32(x) => { + ::buffa::types::put_len_delimited_header( + 3u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Int64(x) => { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Uint32(x) => { + ::buffa::types::put_len_delimited_header( + 5u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Uint64(x) => { + ::buffa::types::put_len_delimited_header( + 6u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Sint32(x) => { + ::buffa::types::put_len_delimited_header( + 7u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Sint64(x) => { + ::buffa::types::put_len_delimited_header( + 8u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Fixed32(x) => { + ::buffa::types::put_len_delimited_header( + 9u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Fixed64(x) => { + ::buffa::types::put_len_delimited_header( + 10u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Sfixed32(x) => { + ::buffa::types::put_len_delimited_header( + 11u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Sfixed64(x) => { + ::buffa::types::put_len_delimited_header( + 12u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Bool(x) => { + ::buffa::types::put_len_delimited_header( + 13u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::String(x) => { + ::buffa::types::put_len_delimited_header( + 14u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Bytes(x) => { + ::buffa::types::put_len_delimited_header( + 15u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Enum(x) => { + ::buffa::types::put_len_delimited_header( + 16u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Repeated(x) => { + ::buffa::types::put_len_delimited_header( + 18u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Map(x) => { + ::buffa::types::put_len_delimited_header( + 19u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Any(x) => { + ::buffa::types::put_len_delimited_header( + 20u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Duration(x) => { + ::buffa::types::put_len_delimited_header( + 21u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::FieldMask(x) => { + ::buffa::types::put_len_delimited_header( + 28u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::field_rules::Type::Timestamp(x) => { + ::buffa::types::put_len_delimited_header( + 22u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + } + } + for v in &self.cel { + ::buffa::types::put_len_delimited_header( + 23u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + if let Some(v) = self.required { + ::buffa::types::put_bool_field(25u32, v, buf); + } + if let Some(ref v) = self.ignore { + ::buffa::types::put_int32_field(27u32, v.to_i32(), buf); + } + for v in &self.cel_expression { + ::buffa::types::put_string_field(29u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Float(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Float( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Double(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Double( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Int32(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Int32( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Int64(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Int64( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Uint32(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Uint32( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Uint64(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Uint64( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sint32(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sint32( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sint64(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sint64( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Fixed32(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Fixed32( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 10u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Fixed64(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Fixed64( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 11u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sfixed32(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sfixed32( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 12u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sfixed64(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Sfixed64( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 13u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Bool(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Bool( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 14u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::String(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::String( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 15u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Bytes(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Bytes( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 16u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Enum(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Enum( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 18u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Repeated(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Repeated( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 19u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Map(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Map( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 20u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Any(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Any( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 21u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Duration(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Duration( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 28u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::FieldMask(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::FieldMask( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 22u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Timestamp(ref mut existing), + ) = self.r#type + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.r#type = ::core::option::Option::Some( + __buffa::oneof::field_rules::Type::Timestamp( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 23u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.cel.push(elem); + } + 25u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.required = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 27u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + let __raw = ::buffa::types::decode_int32(buf)?; + if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32( + __raw, + ) { + self.ignore = ::core::option::Option::Some(__v); + } else { + ctx.register_unknown_field()?; + self.__buffa_unknown_fields + .push(::buffa::UnknownField { + number: 27u32, + data: ::buffa::UnknownFieldData::Varint(__raw as u64), + }); + } + } + 29u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.cel_expression.push(__elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#type = ::core::option::Option::None; + self.cel.clear(); + self.required = ::core::option::Option::None; + self.ignore = ::core::option::Option::None; + self.cel_expression.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for FieldRules { + const PROTO_FQN: &'static str = "buf.validate.FieldRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod field_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::field_rules::Type; +} +/// PredefinedRules are custom rules that can be re-used with +/// multiple fields. +#[derive(Clone, PartialEq, Default)] +pub struct PredefinedRules { + /// `cel` is a repeated field used to represent a textual expression + /// in the Common Expression Language (CEL) syntax. For more information, + /// [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/). + /// + /// ```proto,ignore + /// message MyMessage { + /// // The field `value` must be greater than 42. + /// optional int32 value = 1 [(buf.validate.predefined).cel = { + /// id: "my_message.value", + /// message: "must be greater than 42", + /// expression: "this > 42", + /// }]; + /// } + /// ``` + /// + /// Field 1: `cel` + pub cel: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for PredefinedRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("PredefinedRules").field("cel", &self.cel).finish() + } +} +impl PredefinedRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.PredefinedRules"; +} +::buffa::impl_default_instance!(PredefinedRules); +impl ::buffa::MessageName for PredefinedRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "PredefinedRules"; + const FULL_NAME: &'static str = "buf.validate.PredefinedRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.PredefinedRules"; +} +impl ::buffa::Message for PredefinedRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.cel { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.cel { + ::buffa::types::put_len_delimited_header( + 1u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.cel.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.cel.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for PredefinedRules { + const PROTO_FQN: &'static str = "buf.validate.PredefinedRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// FloatRules describes the rules applied to `float` values. These +/// rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct FloatRules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyFloat { + /// // value must equal 42.0 + /// float value = 1 [(buf.validate.field).float.const = 42.0]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message + /// is generated. + /// + /// ```proto,ignore + /// message MyFloat { + /// // must be in list [1.0, 2.0, 3.0] + /// float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyFloat { + /// // value must not be in list [1.0, 2.0, 3.0] + /// float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `finite` requires the field value to be finite. If the field value is + /// infinite or NaN, an error message is generated. + /// + /// Field 8: `finite` + pub finite: ::core::option::Option, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyFloat { + /// float value = 1 [ + /// (buf.validate.field).float.example = 1.0, + /// (buf.validate.field).float.example = inf + /// ]; + /// } + /// ``` + /// + /// Field 9: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::float_rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::float_rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for FloatRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FloatRules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("finite", &self.finite) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl FloatRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FloatRules"; +} +::buffa::impl_default_instance!(FloatRules); +impl ::buffa::MessageName for FloatRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "FloatRules"; + const FULL_NAME: &'static str = "buf.validate.FloatRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FloatRules"; +} +impl ::buffa::Message for FloatRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::float_rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::float_rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::float_rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::float_rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + if self.finite.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_float_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::float_rules::LessThan::Lt(x) => { + ::buffa::types::put_float_field(2u32, *x, buf); + } + __buffa::oneof::float_rules::LessThan::Lte(x) => { + ::buffa::types::put_float_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::float_rules::GreaterThan::Gt(x) => { + ::buffa::types::put_float_field(4u32, *x, buf); + } + __buffa::oneof::float_rules::GreaterThan::Gte(x) => { + ::buffa::types::put_float_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_float_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_float_field(7u32, *v, buf); + } + if let Some(v) = self.finite { + ::buffa::types::put_bool_field(8u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_float_field(9u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_float(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::float_rules::LessThan::Lt( + ::buffa::types::decode_float(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::float_rules::LessThan::Lte( + ::buffa::types::decode_float(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::float_rules::GreaterThan::Gt( + ::buffa::types::decode_float(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::float_rules::GreaterThan::Gte( + ::buffa::types::decode_float(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_float( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in.push(::buffa::types::decode_float(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.r#in.push(::buffa::types::decode_float(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_float( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_float(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.not_in.push(::buffa::types::decode_float(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.finite = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 9u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_float( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_float(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.example.push(::buffa::types::decode_float(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.finite = ::core::option::Option::None; + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for FloatRules { + const PROTO_FQN: &'static str = "buf.validate.FloatRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod float_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::float_rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::float_rules::GreaterThan; +} +/// DoubleRules describes the rules applied to `double` values. These +/// rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct DoubleRules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyDouble { + /// // value must equal 42.0 + /// double value = 1 [(buf.validate.field).double.const = 42.0]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyDouble { + /// // must be in list [1.0, 2.0, 3.0] + /// double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyDouble { + /// // value must not be in list [1.0, 2.0, 3.0] + /// double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `finite` requires the field value to be finite. If the field value is + /// infinite or NaN, an error message is generated. + /// + /// Field 8: `finite` + pub finite: ::core::option::Option, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyDouble { + /// double value = 1 [ + /// (buf.validate.field).double.example = 1.0, + /// (buf.validate.field).double.example = inf + /// ]; + /// } + /// ``` + /// + /// Field 9: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::double_rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::double_rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for DoubleRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DoubleRules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("finite", &self.finite) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl DoubleRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.DoubleRules"; +} +::buffa::impl_default_instance!(DoubleRules); +impl ::buffa::MessageName for DoubleRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "DoubleRules"; + const FULL_NAME: &'static str = "buf.validate.DoubleRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.DoubleRules"; +} +impl ::buffa::Message for DoubleRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::double_rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::double_rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::double_rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::double_rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + if self.finite.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_double_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::double_rules::LessThan::Lt(x) => { + ::buffa::types::put_double_field(2u32, *x, buf); + } + __buffa::oneof::double_rules::LessThan::Lte(x) => { + ::buffa::types::put_double_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::double_rules::GreaterThan::Gt(x) => { + ::buffa::types::put_double_field(4u32, *x, buf); + } + __buffa::oneof::double_rules::GreaterThan::Gte(x) => { + ::buffa::types::put_double_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_double_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_double_field(7u32, *v, buf); + } + if let Some(v) = self.finite { + ::buffa::types::put_bool_field(8u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_double_field(9u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_double(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::double_rules::LessThan::Lt( + ::buffa::types::decode_double(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::double_rules::LessThan::Lte( + ::buffa::types::decode_double(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::double_rules::GreaterThan::Gt( + ::buffa::types::decode_double(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::double_rules::GreaterThan::Gte( + ::buffa::types::decode_double(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_double( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in.push(::buffa::types::decode_double(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.r#in.push(::buffa::types::decode_double(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_double( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_double(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.not_in.push(::buffa::types::decode_double(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.finite = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 9u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_double( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_double(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.example.push(::buffa::types::decode_double(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.finite = ::core::option::Option::None; + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for DoubleRules { + const PROTO_FQN: &'static str = "buf.validate.DoubleRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod double_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::double_rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::double_rules::GreaterThan; +} +/// Int32Rules describes the rules applied to `int32` values. These +/// rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct Int32Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyInt32 { + /// // value must equal 42 + /// int32 value = 1 [(buf.validate.field).int32.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyInt32 { + /// // must be in list [1, 2, 3] + /// int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error message + /// is generated. + /// + /// ```proto,ignore + /// message MyInt32 { + /// // value must not be in list [1, 2, 3] + /// int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyInt32 { + /// int32 value = 1 [ + /// (buf.validate.field).int32.example = 1, + /// (buf.validate.field).int32.example = -10 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::int32rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::int32rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Int32Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Int32Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl Int32Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Int32Rules"; +} +::buffa::impl_default_instance!(Int32Rules); +impl ::buffa::MessageName for Int32Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Int32Rules"; + const FULL_NAME: &'static str = "buf.validate.Int32Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Int32Rules"; +} +impl ::buffa::Message for Int32Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::int32rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + __buffa::oneof::int32rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::int32rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + __buffa::oneof::int32rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_int32_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::int32rules::LessThan::Lt(x) => { + ::buffa::types::put_int32_field(2u32, *x, buf); + } + __buffa::oneof::int32rules::LessThan::Lte(x) => { + ::buffa::types::put_int32_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::int32rules::GreaterThan::Gt(x) => { + ::buffa::types::put_int32_field(4u32, *x, buf); + } + __buffa::oneof::int32rules::GreaterThan::Gte(x) => { + ::buffa::types::put_int32_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_int32_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_int32_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_int32_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_int32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::int32rules::LessThan::Lt( + ::buffa::types::decode_int32(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::int32rules::LessThan::Lte( + ::buffa::types::decode_int32(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::int32rules::GreaterThan::Gt( + ::buffa::types::decode_int32(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::int32rules::GreaterThan::Gte( + ::buffa::types::decode_int32(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Int32Rules { + const PROTO_FQN: &'static str = "buf.validate.Int32Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod int32rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::int32rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::int32rules::GreaterThan; +} +/// Int64Rules describes the rules applied to `int64` values. These +/// rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct Int64Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyInt64 { + /// // value must equal 42 + /// int64 value = 1 [(buf.validate.field).int64.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyInt64 { + /// // must be in list [1, 2, 3] + /// int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyInt64 { + /// // value must not be in list [1, 2, 3] + /// int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyInt64 { + /// int64 value = 1 [ + /// (buf.validate.field).int64.example = 1, + /// (buf.validate.field).int64.example = -10 + /// ]; + /// } + /// ``` + /// + /// Field 9: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::int64rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::int64rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Int64Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Int64Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl Int64Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Int64Rules"; +} +::buffa::impl_default_instance!(Int64Rules); +impl ::buffa::MessageName for Int64Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Int64Rules"; + const FULL_NAME: &'static str = "buf.validate.Int64Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Int64Rules"; +} +impl ::buffa::Message for Int64Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::int64_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::int64rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + __buffa::oneof::int64rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::int64rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + __buffa::oneof::int64rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_int64_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::int64rules::LessThan::Lt(x) => { + ::buffa::types::put_int64_field(2u32, *x, buf); + } + __buffa::oneof::int64rules::LessThan::Lte(x) => { + ::buffa::types::put_int64_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::int64rules::GreaterThan::Gt(x) => { + ::buffa::types::put_int64_field(4u32, *x, buf); + } + __buffa::oneof::int64rules::GreaterThan::Gte(x) => { + ::buffa::types::put_int64_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_int64_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_int64_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_int64_field(9u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_int64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::int64rules::LessThan::Lt( + ::buffa::types::decode_int64(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::int64rules::LessThan::Lte( + ::buffa::types::decode_int64(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::int64rules::GreaterThan::Gt( + ::buffa::types::decode_int64(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::int64rules::GreaterThan::Gte( + ::buffa::types::decode_int64(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int64( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_int64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_int64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int64( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_int64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_int64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 9u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int64( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_int64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_int64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Int64Rules { + const PROTO_FQN: &'static str = "buf.validate.Int64Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod int64rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::int64rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::int64rules::GreaterThan; +} +/// UInt32Rules describes the rules applied to `uint32` values. These +/// rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct UInt32Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyUInt32 { + /// // value must equal 42 + /// uint32 value = 1 [(buf.validate.field).uint32.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyUInt32 { + /// // must be in list [1, 2, 3] + /// uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyUInt32 { + /// // value must not be in list [1, 2, 3] + /// uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyUInt32 { + /// uint32 value = 1 [ + /// (buf.validate.field).uint32.example = 1, + /// (buf.validate.field).uint32.example = 10 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::u_int32rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::u_int32rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for UInt32Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("UInt32Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl UInt32Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.UInt32Rules"; +} +::buffa::impl_default_instance!(UInt32Rules); +impl ::buffa::MessageName for UInt32Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "UInt32Rules"; + const FULL_NAME: &'static str = "buf.validate.UInt32Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.UInt32Rules"; +} +impl ::buffa::Message for UInt32Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::uint32_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::u_int32rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + __buffa::oneof::u_int32rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::u_int32rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + __buffa::oneof::u_int32rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::uint32_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_uint32_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::u_int32rules::LessThan::Lt(x) => { + ::buffa::types::put_uint32_field(2u32, *x, buf); + } + __buffa::oneof::u_int32rules::LessThan::Lte(x) => { + ::buffa::types::put_uint32_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::u_int32rules::GreaterThan::Gt(x) => { + ::buffa::types::put_uint32_field(4u32, *x, buf); + } + __buffa::oneof::u_int32rules::GreaterThan::Gte(x) => { + ::buffa::types::put_uint32_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_uint32_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_uint32_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_uint32_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_uint32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::u_int32rules::LessThan::Lt( + ::buffa::types::decode_uint32(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::u_int32rules::LessThan::Lte( + ::buffa::types::decode_uint32(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::u_int32rules::GreaterThan::Gt( + ::buffa::types::decode_uint32(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::u_int32rules::GreaterThan::Gte( + ::buffa::types::decode_uint32(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint32( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_uint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_uint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint32( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_uint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_uint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint32( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_uint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_uint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for UInt32Rules { + const PROTO_FQN: &'static str = "buf.validate.UInt32Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod u_int32rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::u_int32rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::u_int32rules::GreaterThan; +} +/// UInt64Rules describes the rules applied to `uint64` values. These +/// rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct UInt64Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyUInt64 { + /// // value must equal 42 + /// uint64 value = 1 [(buf.validate.field).uint64.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyUInt64 { + /// // must be in list [1, 2, 3] + /// uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyUInt64 { + /// // value must not be in list [1, 2, 3] + /// uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyUInt64 { + /// uint64 value = 1 [ + /// (buf.validate.field).uint64.example = 1, + /// (buf.validate.field).uint64.example = -10 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::u_int64rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::u_int64rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for UInt64Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("UInt64Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl UInt64Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.UInt64Rules"; +} +::buffa::impl_default_instance!(UInt64Rules); +impl ::buffa::MessageName for UInt64Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "UInt64Rules"; + const FULL_NAME: &'static str = "buf.validate.UInt64Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.UInt64Rules"; +} +impl ::buffa::Message for UInt64Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::u_int64rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + __buffa::oneof::u_int64rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::u_int64rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + __buffa::oneof::u_int64rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_uint64_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::u_int64rules::LessThan::Lt(x) => { + ::buffa::types::put_uint64_field(2u32, *x, buf); + } + __buffa::oneof::u_int64rules::LessThan::Lte(x) => { + ::buffa::types::put_uint64_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::u_int64rules::GreaterThan::Gt(x) => { + ::buffa::types::put_uint64_field(4u32, *x, buf); + } + __buffa::oneof::u_int64rules::GreaterThan::Gte(x) => { + ::buffa::types::put_uint64_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_uint64_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_uint64_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_uint64_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::u_int64rules::LessThan::Lt( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::u_int64rules::LessThan::Lte( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::u_int64rules::GreaterThan::Gt( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::u_int64rules::GreaterThan::Gte( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint64( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_uint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_uint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint64( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_uint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_uint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_uint64( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_uint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_uint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for UInt64Rules { + const PROTO_FQN: &'static str = "buf.validate.UInt64Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod u_int64rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::u_int64rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::u_int64rules::GreaterThan; +} +/// SInt32Rules describes the rules applied to `sint32` values. +#[derive(Clone, PartialEq, Default)] +pub struct SInt32Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MySInt32 { + /// // value must equal 42 + /// sint32 value = 1 [(buf.validate.field).sint32.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MySInt32 { + /// // must be in list [1, 2, 3] + /// sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MySInt32 { + /// // value must not be in list [1, 2, 3] + /// sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MySInt32 { + /// sint32 value = 1 [ + /// (buf.validate.field).sint32.example = 1, + /// (buf.validate.field).sint32.example = -10 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::s_int32rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::s_int32rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for SInt32Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("SInt32Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl SInt32Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SInt32Rules"; +} +::buffa::impl_default_instance!(SInt32Rules); +impl ::buffa::MessageName for SInt32Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "SInt32Rules"; + const FULL_NAME: &'static str = "buf.validate.SInt32Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SInt32Rules"; +} +impl ::buffa::Message for SInt32Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::sint32_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_int32rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + __buffa::oneof::s_int32rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_int32rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + __buffa::oneof::s_int32rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::sint32_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_sint32_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_int32rules::LessThan::Lt(x) => { + ::buffa::types::put_sint32_field(2u32, *x, buf); + } + __buffa::oneof::s_int32rules::LessThan::Lte(x) => { + ::buffa::types::put_sint32_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_int32rules::GreaterThan::Gt(x) => { + ::buffa::types::put_sint32_field(4u32, *x, buf); + } + __buffa::oneof::s_int32rules::GreaterThan::Gte(x) => { + ::buffa::types::put_sint32_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_sint32_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_sint32_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_sint32_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_sint32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_int32rules::LessThan::Lt( + ::buffa::types::decode_sint32(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_int32rules::LessThan::Lte( + ::buffa::types::decode_sint32(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_int32rules::GreaterThan::Gt( + ::buffa::types::decode_sint32(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_int32rules::GreaterThan::Gte( + ::buffa::types::decode_sint32(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint32( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_sint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_sint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint32( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_sint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_sint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint32( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_sint32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_sint32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for SInt32Rules { + const PROTO_FQN: &'static str = "buf.validate.SInt32Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod s_int32rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::s_int32rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::s_int32rules::GreaterThan; +} +/// SInt64Rules describes the rules applied to `sint64` values. +#[derive(Clone, PartialEq, Default)] +pub struct SInt64Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MySInt64 { + /// // value must equal 42 + /// sint64 value = 1 [(buf.validate.field).sint64.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message + /// is generated. + /// + /// ```proto,ignore + /// message MySInt64 { + /// // must be in list [1, 2, 3] + /// sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MySInt64 { + /// // value must not be in list [1, 2, 3] + /// sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MySInt64 { + /// sint64 value = 1 [ + /// (buf.validate.field).sint64.example = 1, + /// (buf.validate.field).sint64.example = -10 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::s_int64rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::s_int64rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for SInt64Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("SInt64Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl SInt64Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SInt64Rules"; +} +::buffa::impl_default_instance!(SInt64Rules); +impl ::buffa::MessageName for SInt64Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "SInt64Rules"; + const FULL_NAME: &'static str = "buf.validate.SInt64Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SInt64Rules"; +} +impl ::buffa::Message for SInt64Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::sint64_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_int64rules::LessThan::Lt(v) => { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + __buffa::oneof::s_int64rules::LessThan::Lte(v) => { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_int64rules::GreaterThan::Gt(v) => { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + __buffa::oneof::s_int64rules::GreaterThan::Gte(v) => { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + } + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::sint64_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_sint64_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_int64rules::LessThan::Lt(x) => { + ::buffa::types::put_sint64_field(2u32, *x, buf); + } + __buffa::oneof::s_int64rules::LessThan::Lte(x) => { + ::buffa::types::put_sint64_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_int64rules::GreaterThan::Gt(x) => { + ::buffa::types::put_sint64_field(4u32, *x, buf); + } + __buffa::oneof::s_int64rules::GreaterThan::Gte(x) => { + ::buffa::types::put_sint64_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_sint64_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_sint64_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_sint64_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_sint64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_int64rules::LessThan::Lt( + ::buffa::types::decode_sint64(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_int64rules::LessThan::Lte( + ::buffa::types::decode_sint64(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_int64rules::GreaterThan::Gt( + ::buffa::types::decode_sint64(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_int64rules::GreaterThan::Gte( + ::buffa::types::decode_sint64(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint64( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_sint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_sint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint64( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_sint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_sint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sint64( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_sint64_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_sint64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for SInt64Rules { + const PROTO_FQN: &'static str = "buf.validate.SInt64Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod s_int64rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::s_int64rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::s_int64rules::GreaterThan; +} +/// Fixed32Rules describes the rules applied to `fixed32` values. +#[derive(Clone, PartialEq, Default)] +pub struct Fixed32Rules { + /// `const` requires the field value to exactly match the specified value. + /// If the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyFixed32 { + /// // value must equal 42 + /// fixed32 value = 1 [(buf.validate.field).fixed32.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message + /// is generated. + /// + /// ```proto,ignore + /// message MyFixed32 { + /// // must be in list [1, 2, 3] + /// fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyFixed32 { + /// // value must not be in list [1, 2, 3] + /// fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyFixed32 { + /// fixed32 value = 1 [ + /// (buf.validate.field).fixed32.example = 1, + /// (buf.validate.field).fixed32.example = 2 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::fixed32rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::fixed32rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Fixed32Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Fixed32Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl Fixed32Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Fixed32Rules"; +} +::buffa::impl_default_instance!(Fixed32Rules); +impl ::buffa::MessageName for Fixed32Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Fixed32Rules"; + const FULL_NAME: &'static str = "buf.validate.Fixed32Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Fixed32Rules"; +} +impl ::buffa::Message for Fixed32Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::fixed32rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::fixed32rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::fixed32rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::fixed32rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_fixed32_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::fixed32rules::LessThan::Lt(x) => { + ::buffa::types::put_fixed32_field(2u32, *x, buf); + } + __buffa::oneof::fixed32rules::LessThan::Lte(x) => { + ::buffa::types::put_fixed32_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::fixed32rules::GreaterThan::Gt(x) => { + ::buffa::types::put_fixed32_field(4u32, *x, buf); + } + __buffa::oneof::fixed32rules::GreaterThan::Gte(x) => { + ::buffa::types::put_fixed32_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_fixed32_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_fixed32_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_fixed32_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_fixed32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::fixed32rules::LessThan::Lt( + ::buffa::types::decode_fixed32(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::fixed32rules::LessThan::Lte( + ::buffa::types::decode_fixed32(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::fixed32rules::GreaterThan::Gt( + ::buffa::types::decode_fixed32(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::fixed32rules::GreaterThan::Gte( + ::buffa::types::decode_fixed32(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed32( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_fixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.r#in.push(::buffa::types::decode_fixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed32( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_fixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.not_in.push(::buffa::types::decode_fixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed32( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_fixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.example.push(::buffa::types::decode_fixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Fixed32Rules { + const PROTO_FQN: &'static str = "buf.validate.Fixed32Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod fixed32rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::fixed32rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::fixed32rules::GreaterThan; +} +/// Fixed64Rules describes the rules applied to `fixed64` values. +#[derive(Clone, PartialEq, Default)] +pub struct Fixed64Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyFixed64 { + /// // value must equal 42 + /// fixed64 value = 1 [(buf.validate.field).fixed64.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyFixed64 { + /// // must be in list [1, 2, 3] + /// fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyFixed64 { + /// // value must not be in list [1, 2, 3] + /// fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyFixed64 { + /// fixed64 value = 1 [ + /// (buf.validate.field).fixed64.example = 1, + /// (buf.validate.field).fixed64.example = 2 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::fixed64rules::LessThan>, + pub greater_than: ::core::option::Option<__buffa::oneof::fixed64rules::GreaterThan>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Fixed64Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Fixed64Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl Fixed64Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Fixed64Rules"; +} +::buffa::impl_default_instance!(Fixed64Rules); +impl ::buffa::MessageName for Fixed64Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Fixed64Rules"; + const FULL_NAME: &'static str = "buf.validate.Fixed64Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Fixed64Rules"; +} +impl ::buffa::Message for Fixed64Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::fixed64rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::fixed64rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::fixed64rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::fixed64rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_fixed64_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::fixed64rules::LessThan::Lt(x) => { + ::buffa::types::put_fixed64_field(2u32, *x, buf); + } + __buffa::oneof::fixed64rules::LessThan::Lte(x) => { + ::buffa::types::put_fixed64_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::fixed64rules::GreaterThan::Gt(x) => { + ::buffa::types::put_fixed64_field(4u32, *x, buf); + } + __buffa::oneof::fixed64rules::GreaterThan::Gte(x) => { + ::buffa::types::put_fixed64_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_fixed64_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_fixed64_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_fixed64_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_fixed64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::fixed64rules::LessThan::Lt( + ::buffa::types::decode_fixed64(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::fixed64rules::LessThan::Lte( + ::buffa::types::decode_fixed64(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::fixed64rules::GreaterThan::Gt( + ::buffa::types::decode_fixed64(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::fixed64rules::GreaterThan::Gte( + ::buffa::types::decode_fixed64(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed64( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_fixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.r#in.push(::buffa::types::decode_fixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed64( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_fixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.not_in.push(::buffa::types::decode_fixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_fixed64( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_fixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.example.push(::buffa::types::decode_fixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Fixed64Rules { + const PROTO_FQN: &'static str = "buf.validate.Fixed64Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod fixed64rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::fixed64rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::fixed64rules::GreaterThan; +} +/// SFixed32Rules describes the rules applied to `fixed32` values. +#[derive(Clone, PartialEq, Default)] +pub struct SFixed32Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MySFixed32 { + /// // value must equal 42 + /// sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MySFixed32 { + /// // must be in list [1, 2, 3] + /// sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MySFixed32 { + /// // value must not be in list [1, 2, 3] + /// sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MySFixed32 { + /// sfixed32 value = 1 [ + /// (buf.validate.field).sfixed32.example = 1, + /// (buf.validate.field).sfixed32.example = 2 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::s_fixed32rules::LessThan>, + pub greater_than: ::core::option::Option< + __buffa::oneof::s_fixed32rules::GreaterThan, + >, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for SFixed32Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("SFixed32Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl SFixed32Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SFixed32Rules"; +} +::buffa::impl_default_instance!(SFixed32Rules); +impl ::buffa::MessageName for SFixed32Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "SFixed32Rules"; + const FULL_NAME: &'static str = "buf.validate.SFixed32Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SFixed32Rules"; +} +impl ::buffa::Message for SFixed32Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_fixed32rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::s_fixed32rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_fixed32rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + __buffa::oneof::s_fixed32rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_sfixed32_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_fixed32rules::LessThan::Lt(x) => { + ::buffa::types::put_sfixed32_field(2u32, *x, buf); + } + __buffa::oneof::s_fixed32rules::LessThan::Lte(x) => { + ::buffa::types::put_sfixed32_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_fixed32rules::GreaterThan::Gt(x) => { + ::buffa::types::put_sfixed32_field(4u32, *x, buf); + } + __buffa::oneof::s_fixed32rules::GreaterThan::Gte(x) => { + ::buffa::types::put_sfixed32_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_sfixed32_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_sfixed32_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_sfixed32_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_sfixed32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed32rules::LessThan::Lt( + ::buffa::types::decode_sfixed32(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed32rules::LessThan::Lte( + ::buffa::types::decode_sfixed32(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed32rules::GreaterThan::Gt( + ::buffa::types::decode_sfixed32(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed32, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed32rules::GreaterThan::Gte( + ::buffa::types::decode_sfixed32(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed32( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_sfixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.r#in.push(::buffa::types::decode_sfixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed32( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_sfixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.not_in.push(::buffa::types::decode_sfixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed32( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 4usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_sfixed32(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed32 { + self.example.push(::buffa::types::decode_sfixed32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for SFixed32Rules { + const PROTO_FQN: &'static str = "buf.validate.SFixed32Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod s_fixed32rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::s_fixed32rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::s_fixed32rules::GreaterThan; +} +/// SFixed64Rules describes the rules applied to `fixed64` values. +#[derive(Clone, PartialEq, Default)] +pub struct SFixed64Rules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MySFixed64 { + /// // value must equal 42 + /// sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `in` requires the field value to be equal to one of the specified values. + /// If the field value isn't one of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MySFixed64 { + /// // must be in list [1, 2, 3] + /// sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 6: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to not be equal to any of the specified + /// values. If the field value is one of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MySFixed64 { + /// // value must not be in list [1, 2, 3] + /// sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }]; + /// } + /// ``` + /// + /// Field 7: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MySFixed64 { + /// sfixed64 value = 1 [ + /// (buf.validate.field).sfixed64.example = 1, + /// (buf.validate.field).sfixed64.example = 2 + /// ]; + /// } + /// ``` + /// + /// Field 8: `example` + pub example: ::buffa::alloc::vec::Vec, + pub less_than: ::core::option::Option<__buffa::oneof::s_fixed64rules::LessThan>, + pub greater_than: ::core::option::Option< + __buffa::oneof::s_fixed64rules::GreaterThan, + >, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for SFixed64Rules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("SFixed64Rules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl SFixed64Rules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SFixed64Rules"; +} +::buffa::impl_default_instance!(SFixed64Rules); +impl ::buffa::MessageName for SFixed64Rules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "SFixed64Rules"; + const FULL_NAME: &'static str = "buf.validate.SFixed64Rules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.SFixed64Rules"; +} +impl ::buffa::Message for SFixed64Rules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_fixed64rules::LessThan::Lt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::s_fixed64rules::LessThan::Lte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_fixed64rules::GreaterThan::Gt(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + __buffa::oneof::s_fixed64rules::GreaterThan::Gte(_x) => { + size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64; + } + } + } + size + += self.r#in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size + += self.not_in.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_sfixed64_field(1u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::s_fixed64rules::LessThan::Lt(x) => { + ::buffa::types::put_sfixed64_field(2u32, *x, buf); + } + __buffa::oneof::s_fixed64rules::LessThan::Lte(x) => { + ::buffa::types::put_sfixed64_field(3u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::s_fixed64rules::GreaterThan::Gt(x) => { + ::buffa::types::put_sfixed64_field(4u32, *x, buf); + } + __buffa::oneof::s_fixed64rules::GreaterThan::Gte(x) => { + ::buffa::types::put_sfixed64_field(5u32, *x, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_sfixed64_field(6u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_sfixed64_field(7u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_sfixed64_field(8u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_sfixed64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed64rules::LessThan::Lt( + ::buffa::types::decode_sfixed64(buf)?, + ), + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed64rules::LessThan::Lte( + ::buffa::types::decode_sfixed64(buf)?, + ), + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed64rules::GreaterThan::Gt( + ::buffa::types::decode_sfixed64(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Fixed64, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::s_fixed64rules::GreaterThan::Gte( + ::buffa::types::decode_sfixed64(buf)?, + ), + ); + } + 6u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed64( + &buf.chunk()[..len], + &mut self.r#in, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_sfixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.r#in.push(::buffa::types::decode_sfixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 7u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed64( + &buf.chunk()[..len], + &mut self.not_in, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_sfixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.not_in.push(::buffa::types::decode_sfixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 8u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_sfixed64( + &buf.chunk()[..len], + &mut self.example, + )?; + buf.advance(len); + } else { + self.example.reserve(len / 8usize); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_sfixed64(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Fixed64 { + self.example.push(::buffa::types::decode_sfixed64(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for SFixed64Rules { + const PROTO_FQN: &'static str = "buf.validate.SFixed64Rules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod s_fixed64rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::s_fixed64rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::s_fixed64rules::GreaterThan; +} +/// BoolRules describes the rules applied to `bool` values. These rules +/// may also be applied to the `google.protobuf.BoolValue` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct BoolRules { + /// `const` requires the field value to exactly match the specified boolean value. + /// If the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyBool { + /// // value must equal true + /// bool value = 1 [(buf.validate.field).bool.const = true]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyBool { + /// bool value = 1 [ + /// (buf.validate.field).bool.example = 1, + /// (buf.validate.field).bool.example = 2 + /// ]; + /// } + /// ``` + /// + /// Field 2: `example` + pub example: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for BoolRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("BoolRules") + .field("const", &self.r#const) + .field("example", &self.example) + .finish() + } +} +impl BoolRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.BoolRules"; +} +::buffa::impl_default_instance!(BoolRules); +impl ::buffa::MessageName for BoolRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "BoolRules"; + const FULL_NAME: &'static str = "buf.validate.BoolRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.BoolRules"; +} +impl ::buffa::Message for BoolRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + size + += self.example.len() as u64 + * (1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64); + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_bool_field(1u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_bool_field(2u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 2u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_bool( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_bool_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_bool(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for BoolRules { + const PROTO_FQN: &'static str = "buf.validate.BoolRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// StringRules describes the rules applied to `string` values These +/// rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct StringRules { + /// `const` requires the field value to exactly match the specified value. If + /// the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value must equal `hello` + /// string value = 1 [(buf.validate.field).string.const = "hello"]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option<::buffa::alloc::string::String>, + /// `len` dictates that the field value must have the specified + /// number of characters (Unicode code points), which may differ from the number + /// of bytes in the string. If the field value does not meet the specified + /// length, an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be 5 characters + /// string value = 1 [(buf.validate.field).string.len = 5]; + /// } + /// ``` + /// + /// Field 19: `len` + pub len: ::core::option::Option, + /// `min_len` specifies that the field value must have at least the specified + /// number of characters (Unicode code points), which may differ from the number + /// of bytes in the string. If the field value contains fewer characters, an error + /// message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be at least 3 characters + /// string value = 1 [(buf.validate.field).string.min_len = 3]; + /// } + /// ``` + /// + /// Field 2: `min_len` + pub min_len: ::core::option::Option, + /// `max_len` specifies that the field value must have no more than the specified + /// number of characters (Unicode code points), which may differ from the + /// number of bytes in the string. If the field value contains more characters, + /// an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be at most 10 characters + /// string value = 1 [(buf.validate.field).string.max_len = 10]; + /// } + /// ``` + /// + /// Field 3: `max_len` + pub max_len: ::core::option::Option, + /// `len_bytes` dictates that the field value must have the specified number of + /// bytes. If the field value does not match the specified length in bytes, + /// an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be 6 bytes + /// string value = 1 [(buf.validate.field).string.len_bytes = 6]; + /// } + /// ``` + /// + /// Field 20: `len_bytes` + pub len_bytes: ::core::option::Option, + /// `min_bytes` specifies that the field value must have at least the specified + /// number of bytes. If the field value contains fewer bytes, an error message + /// will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be at least 4 bytes + /// string value = 1 [(buf.validate.field).string.min_bytes = 4]; + /// } + /// + /// ``` + /// + /// Field 4: `min_bytes` + pub min_bytes: ::core::option::Option, + /// `max_bytes` specifies that the field value must have no more than the + /// specified number of bytes. If the field value contains more bytes, an + /// error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value length must be at most 8 bytes + /// string value = 1 [(buf.validate.field).string.max_bytes = 8]; + /// } + /// ``` + /// + /// Field 5: `max_bytes` + pub max_bytes: ::core::option::Option, + /// `pattern` specifies that the field value must match the specified + /// regular expression (RE2 syntax), with the expression provided without any + /// delimiters. If the field value doesn't match the regular expression, an + /// error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value does not match regex pattern `^[a-zA-Z]//$` + /// string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"]; + /// } + /// ``` + /// + /// Field 6: `pattern` + pub pattern: ::core::option::Option<::buffa::alloc::string::String>, + /// `prefix` specifies that the field value must have the + /// specified substring at the beginning of the string. If the field value + /// doesn't start with the specified prefix, an error message will be + /// generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value does not have prefix `pre` + /// string value = 1 [(buf.validate.field).string.prefix = "pre"]; + /// } + /// ``` + /// + /// Field 7: `prefix` + pub prefix: ::core::option::Option<::buffa::alloc::string::String>, + /// `suffix` specifies that the field value must have the + /// specified substring at the end of the string. If the field value doesn't + /// end with the specified suffix, an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value does not have suffix `post` + /// string value = 1 [(buf.validate.field).string.suffix = "post"]; + /// } + /// ``` + /// + /// Field 8: `suffix` + pub suffix: ::core::option::Option<::buffa::alloc::string::String>, + /// `contains` specifies that the field value must have the + /// specified substring anywhere in the string. If the field value doesn't + /// contain the specified substring, an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value does not contain substring `inside`. + /// string value = 1 [(buf.validate.field).string.contains = "inside"]; + /// } + /// ``` + /// + /// Field 9: `contains` + pub contains: ::core::option::Option<::buffa::alloc::string::String>, + /// `not_contains` specifies that the field value must not have the + /// specified substring anywhere in the string. If the field value contains + /// the specified substring, an error message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // value contains substring `inside`. + /// string value = 1 [(buf.validate.field).string.not_contains = "inside"]; + /// } + /// ``` + /// + /// Field 23: `not_contains` + pub not_contains: ::core::option::Option<::buffa::alloc::string::String>, + /// `in` specifies that the field value must be equal to one of the specified + /// values. If the field value isn't one of the specified values, an error + /// message will be generated. + /// + /// ```proto,ignore + /// message MyString { + /// // must be in list ["apple", "banana"] + /// string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; + /// } + /// ``` + /// + /// Field 10: `in` + pub r#in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `not_in` specifies that the field value cannot be equal to any + /// of the specified values. If the field value is one of the specified values, + /// an error message will be generated. + /// ```proto,ignore + /// message MyString { + /// // value must not be in list ["orange", "grape"] + /// string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"]; + /// } + /// ``` + /// + /// Field 11: `not_in` + pub not_in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to + /// enable strict header validation. By default, this is true, and HTTP header + /// validations are [RFC-compliant](https://datatracker.ietf.org/doc/html/rfc7230#section-3). Setting to false will enable looser + /// validations that only disallow `\r\n\0` characters, which can be used to + /// bypass header matching rules. + /// + /// ```proto,ignore + /// message MyString { + /// // The field `value` must have be a valid HTTP headers, but not enforced with strict rules. + /// string value = 1 [(buf.validate.field).string.strict = false]; + /// } + /// ``` + /// + /// Field 25: `strict` + pub strict: ::core::option::Option, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyString { + /// string value = 1 [ + /// (buf.validate.field).string.example = "hello", + /// (buf.validate.field).string.example = "world" + /// ]; + /// } + /// ``` + /// + /// Field 34: `example` + pub example: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + pub well_known: ::core::option::Option<__buffa::oneof::string_rules::WellKnown>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for StringRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("StringRules") + .field("const", &self.r#const) + .field("len", &self.len) + .field("min_len", &self.min_len) + .field("max_len", &self.max_len) + .field("len_bytes", &self.len_bytes) + .field("min_bytes", &self.min_bytes) + .field("max_bytes", &self.max_bytes) + .field("pattern", &self.pattern) + .field("prefix", &self.prefix) + .field("suffix", &self.suffix) + .field("contains", &self.contains) + .field("not_contains", &self.not_contains) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("strict", &self.strict) + .field("example", &self.example) + .field("well_known", &self.well_known) + .finish() + } +} +impl StringRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.StringRules"; +} +::buffa::impl_default_instance!(StringRules); +impl ::buffa::MessageName for StringRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "StringRules"; + const FULL_NAME: &'static str = "buf.validate.StringRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.StringRules"; +} +impl ::buffa::Message for StringRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(ref v) = self.r#const { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(v) = self.min_len { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.max_len { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.min_bytes { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.max_bytes { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(ref v) = self.pattern { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.prefix { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.suffix { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.contains { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.well_known { + match v { + __buffa::oneof::string_rules::WellKnown::Email(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Hostname(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ip(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv4(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv6(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Uri(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::UriRef(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Address(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Uuid(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Tuuid(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::IpWithPrefixlen(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv4WithPrefixlen(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv6WithPrefixlen(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::IpPrefix(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv4Prefix(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ipv6Prefix(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::HostAndPort(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::Ulid(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::ProtobufFqn(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::ProtobufDotFqn(_x) => { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::string_rules::WellKnown::WellKnownRegex(x) => { + size += 2u64 + ::buffa::types::int32_encoded_len(x.to_i32()) as u64; + } + } + } + if let Some(v) = self.len { + size += 2u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.len_bytes { + size += 2u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(ref v) = self.not_contains { + size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if self.strict.is_some() { + size += 2u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + for v in &self.example { + size += 2u64 + ::buffa::types::string_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(ref v) = self.r#const { + ::buffa::types::put_string_field(1u32, v, buf); + } + if let Some(v) = self.min_len { + ::buffa::types::put_uint64_field(2u32, v, buf); + } + if let Some(v) = self.max_len { + ::buffa::types::put_uint64_field(3u32, v, buf); + } + if let Some(v) = self.min_bytes { + ::buffa::types::put_uint64_field(4u32, v, buf); + } + if let Some(v) = self.max_bytes { + ::buffa::types::put_uint64_field(5u32, v, buf); + } + if let Some(ref v) = self.pattern { + ::buffa::types::put_string_field(6u32, v, buf); + } + if let Some(ref v) = self.prefix { + ::buffa::types::put_string_field(7u32, v, buf); + } + if let Some(ref v) = self.suffix { + ::buffa::types::put_string_field(8u32, v, buf); + } + if let Some(ref v) = self.contains { + ::buffa::types::put_string_field(9u32, v, buf); + } + for v in &self.r#in { + ::buffa::types::put_string_field(10u32, v, buf); + } + for v in &self.not_in { + ::buffa::types::put_string_field(11u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.well_known { + match v { + __buffa::oneof::string_rules::WellKnown::Email(x) => { + ::buffa::types::put_bool_field(12u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Hostname(x) => { + ::buffa::types::put_bool_field(13u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ip(x) => { + ::buffa::types::put_bool_field(14u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv4(x) => { + ::buffa::types::put_bool_field(15u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv6(x) => { + ::buffa::types::put_bool_field(16u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Uri(x) => { + ::buffa::types::put_bool_field(17u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::UriRef(x) => { + ::buffa::types::put_bool_field(18u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Address(x) => { + ::buffa::types::put_bool_field(21u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Uuid(x) => { + ::buffa::types::put_bool_field(22u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Tuuid(x) => { + ::buffa::types::put_bool_field(33u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::IpWithPrefixlen(x) => { + ::buffa::types::put_bool_field(26u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv4WithPrefixlen(x) => { + ::buffa::types::put_bool_field(27u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv6WithPrefixlen(x) => { + ::buffa::types::put_bool_field(28u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::IpPrefix(x) => { + ::buffa::types::put_bool_field(29u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv4Prefix(x) => { + ::buffa::types::put_bool_field(30u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ipv6Prefix(x) => { + ::buffa::types::put_bool_field(31u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::HostAndPort(x) => { + ::buffa::types::put_bool_field(32u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::Ulid(x) => { + ::buffa::types::put_bool_field(35u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::ProtobufFqn(x) => { + ::buffa::types::put_bool_field(37u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::ProtobufDotFqn(x) => { + ::buffa::types::put_bool_field(38u32, *x, buf); + } + __buffa::oneof::string_rules::WellKnown::WellKnownRegex(x) => { + ::buffa::types::put_int32_field(24u32, x.to_i32(), buf); + } + } + } + if let Some(v) = self.len { + ::buffa::types::put_uint64_field(19u32, v, buf); + } + if let Some(v) = self.len_bytes { + ::buffa::types::put_uint64_field(20u32, v, buf); + } + if let Some(ref v) = self.not_contains { + ::buffa::types::put_string_field(23u32, v, buf); + } + if let Some(v) = self.strict { + ::buffa::types::put_bool_field(25u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_string_field(34u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.r#const.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.min_len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.max_len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.min_bytes = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.max_bytes = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.pattern.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.prefix.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.suffix.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self + .contains + .get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 10u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.r#in.push(__elem); + } + 11u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.not_in.push(__elem); + } + 12u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Email( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 13u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Hostname( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 14u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ip( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 15u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv4( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 16u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv6( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 17u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Uri( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 18u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::UriRef( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 21u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Address( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 22u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Uuid( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 33u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Tuuid( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 26u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::IpWithPrefixlen( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 27u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv4WithPrefixlen( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 28u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv6WithPrefixlen( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 29u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::IpPrefix( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 30u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv4Prefix( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 31u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ipv6Prefix( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 32u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::HostAndPort( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 35u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::Ulid( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 37u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::ProtobufFqn( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 38u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::ProtobufDotFqn( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 24u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + let __raw = ::buffa::types::decode_int32(buf)?; + if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32( + __raw, + ) { + self.well_known = ::core::option::Option::Some( + __buffa::oneof::string_rules::WellKnown::WellKnownRegex(__v), + ); + } else { + ctx.register_unknown_field()?; + self.__buffa_unknown_fields + .push(::buffa::UnknownField { + number: 24u32, + data: ::buffa::UnknownFieldData::Varint(__raw as u64), + }); + } + } + 19u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 20u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.len_bytes = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 23u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self + .not_contains + .get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 25u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.strict = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 34u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.example.push(__elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.min_len = ::core::option::Option::None; + self.max_len = ::core::option::Option::None; + self.min_bytes = ::core::option::Option::None; + self.max_bytes = ::core::option::Option::None; + self.pattern = ::core::option::Option::None; + self.prefix = ::core::option::Option::None; + self.suffix = ::core::option::Option::None; + self.contains = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.well_known = ::core::option::Option::None; + self.len = ::core::option::Option::None; + self.len_bytes = ::core::option::Option::None; + self.not_contains = ::core::option::Option::None; + self.strict = ::core::option::Option::None; + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for StringRules { + const PROTO_FQN: &'static str = "buf.validate.StringRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod string_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::string_rules::WellKnown; +} +/// BytesRules describe the rules applied to `bytes` values. These rules +/// may also be applied to the `google.protobuf.BytesValue` Well-Known-Type. +#[derive(Clone, PartialEq, Default)] +pub struct BytesRules { + /// `const` requires the field value to exactly match the specified bytes + /// value. If the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // must be "\x01\x02\x03\x04" + /// bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option<::buffa::alloc::vec::Vec>, + /// `len` requires the field value to have the specified length in bytes. + /// If the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value length must be 4 bytes. + /// optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; + /// } + /// ``` + /// + /// Field 13: `len` + pub len: ::core::option::Option, + /// `min_len` requires the field value to have at least the specified minimum + /// length in bytes. + /// If the field value doesn't meet the requirement, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value length must be at least 2 bytes. + /// optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; + /// } + /// ``` + /// + /// Field 2: `min_len` + pub min_len: ::core::option::Option, + /// `max_len` requires the field value to have at most the specified maximum + /// length in bytes. + /// If the field value exceeds the requirement, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // must be at most 6 bytes. + /// optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; + /// } + /// ``` + /// + /// Field 3: `max_len` + pub max_len: ::core::option::Option, + /// `pattern` requires the field value to match the specified regular + /// expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). + /// The value of the field must be valid UTF-8 or validation will fail with a + /// runtime error. + /// If the field value doesn't match the pattern, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value must match regex pattern "^[a-zA-Z0-9]+$". + /// optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; + /// } + /// ``` + /// + /// Field 4: `pattern` + pub pattern: ::core::option::Option<::buffa::alloc::string::String>, + /// `prefix` requires the field value to have the specified bytes at the + /// beginning of the string. + /// If the field value doesn't meet the requirement, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value does not have prefix \x01\x02 + /// optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; + /// } + /// ``` + /// + /// Field 5: `prefix` + pub prefix: ::core::option::Option<::buffa::alloc::vec::Vec>, + /// `suffix` requires the field value to have the specified bytes at the end + /// of the string. + /// If the field value doesn't meet the requirement, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value does not have suffix \x03\x04 + /// optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; + /// } + /// ``` + /// + /// Field 6: `suffix` + pub suffix: ::core::option::Option<::buffa::alloc::vec::Vec>, + /// `contains` requires the field value to have the specified bytes anywhere in + /// the string. + /// If the field value doesn't meet the requirement, an error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value does not contain \x02\x03 + /// optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; + /// } + /// ``` + /// + /// Field 7: `contains` + pub contains: ::core::option::Option<::buffa::alloc::vec::Vec>, + /// `in` requires the field value to be equal to one of the specified + /// values. If the field value doesn't match any of the specified values, an + /// error message is generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] + /// optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + /// } + /// ``` + /// + /// Field 8: `in` + pub r#in: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec>, + /// `not_in` requires the field value to be not equal to any of the specified + /// values. + /// If the field value matches any of the specified values, an error message is + /// generated. + /// + /// ```proto,ignore + /// message MyBytes { + /// // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] + /// optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + /// } + /// ``` + /// + /// Field 9: `not_in` + pub not_in: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec>, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyBytes { + /// bytes value = 1 [ + /// (buf.validate.field).bytes.example = "\x01\x02", + /// (buf.validate.field).bytes.example = "\x02\x03" + /// ]; + /// } + /// ``` + /// + /// Field 14: `example` + pub example: ::buffa::alloc::vec::Vec<::buffa::alloc::vec::Vec>, + pub well_known: ::core::option::Option<__buffa::oneof::bytes_rules::WellKnown>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for BytesRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("BytesRules") + .field("const", &self.r#const) + .field("len", &self.len) + .field("min_len", &self.min_len) + .field("max_len", &self.max_len) + .field("pattern", &self.pattern) + .field("prefix", &self.prefix) + .field("suffix", &self.suffix) + .field("contains", &self.contains) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("well_known", &self.well_known) + .finish() + } +} +impl BytesRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.BytesRules"; +} +::buffa::impl_default_instance!(BytesRules); +impl ::buffa::MessageName for BytesRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "BytesRules"; + const FULL_NAME: &'static str = "buf.validate.BytesRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.BytesRules"; +} +impl ::buffa::Message for BytesRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(ref v) = self.r#const { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + if let Some(v) = self.min_len { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.max_len { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(ref v) = self.pattern { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.prefix { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + if let Some(ref v) = self.suffix { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + if let Some(ref v) = self.contains { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + if let ::core::option::Option::Some(ref v) = self.well_known { + match v { + __buffa::oneof::bytes_rules::WellKnown::Ip(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::bytes_rules::WellKnown::Ipv4(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::bytes_rules::WellKnown::Ipv6(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::bytes_rules::WellKnown::Uuid(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + } + } + if let Some(v) = self.len { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(ref v) = self.r#const { + ::buffa::types::put_shared_bytes_field(1u32, v, buf); + } + if let Some(v) = self.min_len { + ::buffa::types::put_uint64_field(2u32, v, buf); + } + if let Some(v) = self.max_len { + ::buffa::types::put_uint64_field(3u32, v, buf); + } + if let Some(ref v) = self.pattern { + ::buffa::types::put_string_field(4u32, v, buf); + } + if let Some(ref v) = self.prefix { + ::buffa::types::put_shared_bytes_field(5u32, v, buf); + } + if let Some(ref v) = self.suffix { + ::buffa::types::put_shared_bytes_field(6u32, v, buf); + } + if let Some(ref v) = self.contains { + ::buffa::types::put_shared_bytes_field(7u32, v, buf); + } + for v in &self.r#in { + ::buffa::types::put_shared_bytes_field(8u32, v, buf); + } + for v in &self.not_in { + ::buffa::types::put_shared_bytes_field(9u32, v, buf); + } + if let ::core::option::Option::Some(ref v) = self.well_known { + match v { + __buffa::oneof::bytes_rules::WellKnown::Ip(x) => { + ::buffa::types::put_bool_field(10u32, *x, buf); + } + __buffa::oneof::bytes_rules::WellKnown::Ipv4(x) => { + ::buffa::types::put_bool_field(11u32, *x, buf); + } + __buffa::oneof::bytes_rules::WellKnown::Ipv6(x) => { + ::buffa::types::put_bool_field(12u32, *x, buf); + } + __buffa::oneof::bytes_rules::WellKnown::Uuid(x) => { + ::buffa::types::put_bool_field(15u32, *x, buf); + } + } + } + if let Some(v) = self.len { + ::buffa::types::put_uint64_field(13u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_shared_bytes_field(14u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_bytes( + self.r#const.get_or_insert_with(::buffa::alloc::vec::Vec::new), + buf, + )?; + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.min_len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.max_len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.pattern.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_bytes( + self.prefix.get_or_insert_with(::buffa::alloc::vec::Vec::new), + buf, + )?; + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_bytes( + self.suffix.get_or_insert_with(::buffa::alloc::vec::Vec::new), + buf, + )?; + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_bytes( + self.contains.get_or_insert_with(::buffa::alloc::vec::Vec::new), + buf, + )?; + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_bytes(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.r#in.push(__elem); + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_bytes(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.not_in.push(__elem); + } + 10u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::bytes_rules::WellKnown::Ip( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 11u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::bytes_rules::WellKnown::Ipv4( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 12u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::bytes_rules::WellKnown::Ipv6( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 15u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.well_known = ::core::option::Option::Some( + __buffa::oneof::bytes_rules::WellKnown::Uuid( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 13u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.len = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 14u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_bytes(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.example.push(__elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.min_len = ::core::option::Option::None; + self.max_len = ::core::option::Option::None; + self.pattern = ::core::option::Option::None; + self.prefix = ::core::option::Option::None; + self.suffix = ::core::option::Option::None; + self.contains = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.well_known = ::core::option::Option::None; + self.len = ::core::option::Option::None; + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for BytesRules { + const PROTO_FQN: &'static str = "buf.validate.BytesRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod bytes_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::bytes_rules::WellKnown; +} +/// EnumRules describe the rules applied to `enum` values. +#[derive(Clone, PartialEq, Default)] +pub struct EnumRules { + /// `const` requires the field value to exactly match the specified enum value. + /// If the field value doesn't match, an error message is generated. + /// + /// ```proto,ignore + /// enum MyEnum { + /// MY_ENUM_UNSPECIFIED = 0; + /// MY_ENUM_VALUE1 = 1; + /// MY_ENUM_VALUE2 = 2; + /// } + /// + /// message MyMessage { + /// // The field `value` must be exactly MY_ENUM_VALUE1. + /// MyEnum value = 1 [(buf.validate.field).enum.const = 1]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::core::option::Option, + /// `defined_only` requires the field value to be one of the defined values for + /// this enum, failing on any undefined value. + /// + /// ```proto,ignore + /// enum MyEnum { + /// MY_ENUM_UNSPECIFIED = 0; + /// MY_ENUM_VALUE1 = 1; + /// MY_ENUM_VALUE2 = 2; + /// } + /// + /// message MyMessage { + /// // The field `value` must be a defined value of MyEnum. + /// MyEnum value = 1 [(buf.validate.field).enum.defined_only = true]; + /// } + /// ``` + /// + /// Field 2: `defined_only` + pub defined_only: ::core::option::Option, + /// `in` requires the field value to be equal to one of the + /// specified enum values. If the field value doesn't match any of the + /// specified values, an error message is generated. + /// + /// ```proto,ignore + /// enum MyEnum { + /// MY_ENUM_UNSPECIFIED = 0; + /// MY_ENUM_VALUE1 = 1; + /// MY_ENUM_VALUE2 = 2; + /// } + /// + /// message MyMessage { + /// // The field `value` must be equal to one of the specified values. + /// MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}]; + /// } + /// ``` + /// + /// Field 3: `in` + pub r#in: ::buffa::alloc::vec::Vec, + /// `not_in` requires the field value to be not equal to any of the + /// specified enum values. If the field value matches one of the specified + /// values, an error message is generated. + /// + /// ```proto,ignore + /// enum MyEnum { + /// MY_ENUM_UNSPECIFIED = 0; + /// MY_ENUM_VALUE1 = 1; + /// MY_ENUM_VALUE2 = 2; + /// } + /// + /// message MyMessage { + /// // The field `value` must not be equal to any of the specified values. + /// MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}]; + /// } + /// ``` + /// + /// Field 4: `not_in` + pub not_in: ::buffa::alloc::vec::Vec, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// enum MyEnum { + /// MY_ENUM_UNSPECIFIED = 0; + /// MY_ENUM_VALUE1 = 1; + /// MY_ENUM_VALUE2 = 2; + /// } + /// + /// message MyMessage { + /// (buf.validate.field).enum.example = 1, + /// (buf.validate.field).enum.example = 2 + /// } + /// ``` + /// + /// Field 5: `example` + pub example: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for EnumRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("EnumRules") + .field("const", &self.r#const) + .field("defined_only", &self.defined_only) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .finish() + } +} +impl EnumRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.EnumRules"; +} +::buffa::impl_default_instance!(EnumRules); +impl ::buffa::MessageName for EnumRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "EnumRules"; + const FULL_NAME: &'static str = "buf.validate.EnumRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.EnumRules"; +} +impl ::buffa::Message for EnumRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.r#const { + size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64; + } + if self.defined_only.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + for v in &self.example { + size += 1u64 + ::buffa::types::int32_encoded_len(*v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.r#const { + ::buffa::types::put_int32_field(1u32, v, buf); + } + if let Some(v) = self.defined_only { + ::buffa::types::put_bool_field(2u32, v, buf); + } + for v in &self.r#in { + ::buffa::types::put_int32_field(3u32, *v, buf); + } + for v in &self.not_in { + ::buffa::types::put_int32_field(4u32, *v, buf); + } + for v in &self.example { + ::buffa::types::put_int32_field(5u32, *v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.r#const = ::core::option::Option::Some( + ::buffa::types::decode_int32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.defined_only = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 3u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.r#in, + len, + )?; + buf.advance(len); + } else { + self.r#in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.r#in + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.r#in.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 4u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.not_in, + len, + )?; + buf.advance(len); + } else { + self.not_in.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.not_in + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.not_in.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + 5u32 => { + if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited { + let len = ::buffa::encoding::decode_varint(buf)?; + let len = usize::try_from(len) + .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?; + if buf.remaining() < len { + return ::core::result::Result::Err( + ::buffa::DecodeError::UnexpectedEof, + ); + } + if buf.chunk().len() >= len { + ::buffa::types::extend_packed_int32( + &buf.chunk()[..len], + &mut self.example, + len, + )?; + buf.advance(len); + } else { + self.example.reserve(len); + let mut limited = buf.take(len); + while limited.has_remaining() { + self.example + .push(::buffa::types::decode_int32_packed(&mut limited)?); + } + let leftover = limited.remaining(); + if leftover > 0 { + limited.advance(leftover); + } + } + } else if tag.wire_type() == ::buffa::encoding::WireType::Varint { + self.example.push(::buffa::types::decode_int32(buf)?); + } else { + return ::core::result::Result::Err( + ::buffa::encoding::wire_type_mismatch( + tag, + ::buffa::encoding::WireType::LengthDelimited, + ), + ); + } + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::core::option::Option::None; + self.defined_only = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for EnumRules { + const PROTO_FQN: &'static str = "buf.validate.EnumRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// RepeatedRules describe the rules applied to `repeated` values. +#[derive(Clone, PartialEq, Default)] +pub struct RepeatedRules { + /// `min_items` requires that this field must contain at least the specified + /// minimum number of items. + /// + /// Note that `min_items = 1` is equivalent to setting a field as `required`. + /// + /// ```proto,ignore + /// message MyRepeated { + /// // value must contain at least 2 items + /// repeated string value = 1 [(buf.validate.field).repeated.min_items = 2]; + /// } + /// ``` + /// + /// Field 1: `min_items` + pub min_items: ::core::option::Option, + /// `max_items` denotes that this field must not exceed a + /// certain number of items as the upper limit. If the field contains more + /// items than specified, an error message will be generated, requiring the + /// field to maintain no more than the specified number of items. + /// + /// ```proto,ignore + /// message MyRepeated { + /// // value must contain no more than 3 item(s) + /// repeated string value = 1 [(buf.validate.field).repeated.max_items = 3]; + /// } + /// ``` + /// + /// Field 2: `max_items` + pub max_items: ::core::option::Option, + /// `unique` indicates that all elements in this field must + /// be unique. This rule is strictly applicable to scalar and enum + /// types, with message types not being supported. + /// + /// ```proto,ignore + /// message MyRepeated { + /// // repeated value must contain unique items + /// repeated string value = 1 [(buf.validate.field).repeated.unique = true]; + /// } + /// ``` + /// + /// Field 3: `unique` + pub unique: ::core::option::Option, + /// `items` details the rules to be applied to each item + /// in the field. Even for repeated message fields, validation is executed + /// against each item unless `ignore` is specified. + /// + /// ```proto,ignore + /// message MyRepeated { + /// // The items in the field `value` must follow the specified rules. + /// repeated string value = 1 [(buf.validate.field).repeated.items = { + /// string: { + /// min_len: 3 + /// max_len: 10 + /// } + /// }]; + /// } + /// ``` + /// + /// Note that the `required` rule does not apply. Repeated items + /// cannot be unset. + /// + /// Field 4: `items` + pub items: ::buffa::MessageField>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for RepeatedRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("RepeatedRules") + .field("min_items", &self.min_items) + .field("max_items", &self.max_items) + .field("unique", &self.unique) + .field("items", &self.items) + .finish() + } +} +impl RepeatedRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.RepeatedRules"; +} +::buffa::impl_default_instance!(RepeatedRules); +impl ::buffa::MessageName for RepeatedRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "RepeatedRules"; + const FULL_NAME: &'static str = "buf.validate.RepeatedRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.RepeatedRules"; +} +impl ::buffa::Message for RepeatedRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.min_items { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.max_items { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if self.unique.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + if self.items.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.items.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.min_items { + ::buffa::types::put_uint64_field(1u32, v, buf); + } + if let Some(v) = self.max_items { + ::buffa::types::put_uint64_field(2u32, v, buf); + } + if let Some(v) = self.unique { + ::buffa::types::put_bool_field(3u32, v, buf); + } + if self.items.is_set() { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + self.items.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.min_items = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.max_items = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.unique = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.items.get_or_insert_default(), + buf, + ctx, + )?; + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.min_items = ::core::option::Option::None; + self.max_items = ::core::option::Option::None; + self.unique = ::core::option::Option::None; + self.items = ::buffa::MessageField::none(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for RepeatedRules { + const PROTO_FQN: &'static str = "buf.validate.RepeatedRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// MapRules describe the rules applied to `map` values. +#[derive(Clone, PartialEq, Default)] +pub struct MapRules { + /// Specifies the minimum number of key-value pairs allowed. If the field has + /// fewer key-value pairs than specified, an error message is generated. + /// + /// ```proto,ignore + /// message MyMap { + /// // The field `value` must have at least 2 key-value pairs. + /// map value = 1 [(buf.validate.field).map.min_pairs = 2]; + /// } + /// ``` + /// + /// Field 1: `min_pairs` + pub min_pairs: ::core::option::Option, + /// Specifies the maximum number of key-value pairs allowed. If the field has + /// more key-value pairs than specified, an error message is generated. + /// + /// ```proto,ignore + /// message MyMap { + /// // The field `value` must have at most 3 key-value pairs. + /// map value = 1 [(buf.validate.field).map.max_pairs = 3]; + /// } + /// ``` + /// + /// Field 2: `max_pairs` + pub max_pairs: ::core::option::Option, + /// Specifies the rules to be applied to each key in the field. + /// + /// ```proto,ignore + /// message MyMap { + /// // The keys in the field `value` must follow the specified rules. + /// map value = 1 [(buf.validate.field).map.keys = { + /// string: { + /// min_len: 3 + /// max_len: 10 + /// } + /// }]; + /// } + /// ``` + /// + /// Note that the `required` rule does not apply. Map keys cannot be unset. + /// + /// Field 4: `keys` + pub keys: ::buffa::MessageField>, + /// Specifies the rules to be applied to the value of each key in the + /// field. Message values will still have their validations evaluated unless + /// `ignore` is specified. + /// + /// ```proto,ignore + /// message MyMap { + /// // The values in the field `value` must follow the specified rules. + /// map value = 1 [(buf.validate.field).map.values = { + /// string: { + /// min_len: 5 + /// max_len: 20 + /// } + /// }]; + /// } + /// ``` + /// Note that the `required` rule does not apply. Map values cannot be unset. + /// + /// Field 5: `values` + pub values: ::buffa::MessageField>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for MapRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("MapRules") + .field("min_pairs", &self.min_pairs) + .field("max_pairs", &self.max_pairs) + .field("keys", &self.keys) + .field("values", &self.values) + .finish() + } +} +impl MapRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MapRules"; +} +::buffa::impl_default_instance!(MapRules); +impl ::buffa::MessageName for MapRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "MapRules"; + const FULL_NAME: &'static str = "buf.validate.MapRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.MapRules"; +} +impl ::buffa::Message for MapRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.min_pairs { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if let Some(v) = self.max_pairs { + size += 1u64 + ::buffa::types::uint64_encoded_len(v) as u64; + } + if self.keys.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.keys.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + if self.values.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.values.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.min_pairs { + ::buffa::types::put_uint64_field(1u32, v, buf); + } + if let Some(v) = self.max_pairs { + ::buffa::types::put_uint64_field(2u32, v, buf); + } + if self.keys.is_set() { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + self.keys.write_to(__cache, buf); + } + if self.values.is_set() { + ::buffa::types::put_len_delimited_header( + 5u32, + u64::from(__cache.consume_next()), + buf, + ); + self.values.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.min_pairs = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.max_pairs = ::core::option::Option::Some( + ::buffa::types::decode_uint64(buf)?, + ); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.keys.get_or_insert_default(), + buf, + ctx, + )?; + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.values.get_or_insert_default(), + buf, + ctx, + )?; + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.min_pairs = ::core::option::Option::None; + self.max_pairs = ::core::option::Option::None; + self.keys = ::buffa::MessageField::none(); + self.values = ::buffa::MessageField::none(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for MapRules { + const PROTO_FQN: &'static str = "buf.validate.MapRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type. +#[derive(Clone, PartialEq, Default)] +pub struct AnyRules { + /// `in` requires the field's `type_url` to be equal to one of the + /// specified values. If it doesn't match any of the specified values, an error + /// message is generated. + /// + /// ```proto,ignore + /// message MyAny { + /// // The `value` field must have a `type_url` equal to one of the specified values. + /// google.protobuf.Any value = 1 [(buf.validate.field).any = { + /// in: ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"] + /// }]; + /// } + /// ``` + /// + /// Field 2: `in` + pub r#in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `not_in` requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. + /// + /// ```proto,ignore + /// message MyAny { + /// // The `value` field must not have a `type_url` equal to any of the specified values. + /// google.protobuf.Any value = 1 [(buf.validate.field).any = { + /// not_in: ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"] + /// }]; + /// } + /// ``` + /// + /// Field 3: `not_in` + pub not_in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for AnyRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("AnyRules") + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .finish() + } +} +impl AnyRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.AnyRules"; +} +::buffa::impl_default_instance!(AnyRules); +impl ::buffa::MessageName for AnyRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "AnyRules"; + const FULL_NAME: &'static str = "buf.validate.AnyRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.AnyRules"; +} +impl ::buffa::Message for AnyRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.r#in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.r#in { + ::buffa::types::put_string_field(2u32, v, buf); + } + for v in &self.not_in { + ::buffa::types::put_string_field(3u32, v, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.r#in.push(__elem); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.not_in.push(__elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#in.clear(); + self.not_in.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for AnyRules { + const PROTO_FQN: &'static str = "buf.validate.AnyRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type. +#[derive(Clone, PartialEq, Default)] +pub struct DurationRules { + /// `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly. + /// If the field's value deviates from the specified value, an error message + /// will be generated. + /// + /// ```proto,ignore + /// message MyDuration { + /// // value must equal 5s + /// google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"]; + /// } + /// ``` + /// + /// Field 2: `const` + pub r#const: ::buffa::MessageField< + ::buffa_types::google::protobuf::Duration, + ::buffa::Inline<::buffa_types::google::protobuf::Duration>, + >, + /// `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type. + /// If the field's value doesn't correspond to any of the specified values, + /// an error message will be generated. + /// + /// ```proto,ignore + /// message MyDuration { + /// // must be in list [1s, 2s, 3s] + /// google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; + /// } + /// ``` + /// + /// Field 7: `in` + pub r#in: ::buffa::alloc::vec::Vec<::buffa_types::google::protobuf::Duration>, + /// `not_in` denotes that the field must not be equal to + /// any of the specified values of the `google.protobuf.Duration` type. + /// If the field's value matches any of these values, an error message will be + /// generated. + /// + /// ```proto,ignore + /// message MyDuration { + /// // value must not be in list [1s, 2s, 3s] + /// google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]]; + /// } + /// ``` + /// + /// Field 8: `not_in` + pub not_in: ::buffa::alloc::vec::Vec<::buffa_types::google::protobuf::Duration>, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyDuration { + /// google.protobuf.Duration value = 1 [ + /// (buf.validate.field).duration.example = { seconds: 1 }, + /// (buf.validate.field).duration.example = { seconds: 2 }, + /// ]; + /// } + /// ``` + /// + /// Field 9: `example` + pub example: ::buffa::alloc::vec::Vec<::buffa_types::google::protobuf::Duration>, + pub less_than: ::core::option::Option<__buffa::oneof::duration_rules::LessThan>, + pub greater_than: ::core::option::Option< + __buffa::oneof::duration_rules::GreaterThan, + >, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for DurationRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DurationRules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl DurationRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.DurationRules"; +} +::buffa::impl_default_instance!(DurationRules); +impl ::buffa::MessageName for DurationRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "DurationRules"; + const FULL_NAME: &'static str = "buf.validate.DurationRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.DurationRules"; +} +impl ::buffa::Message for DurationRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.r#const.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::duration_rules::LessThan::Lt(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::duration_rules::LessThan::Lte(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::duration_rules::GreaterThan::Gt(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::duration_rules::GreaterThan::Gte(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + } + } + for v in &self.r#in { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.not_in { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.example { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if self.r#const.is_set() { + ::buffa::types::put_len_delimited_header( + 2u32, + u64::from(__cache.consume_next()), + buf, + ); + self.r#const.write_to(__cache, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::duration_rules::LessThan::Lt(x) => { + ::buffa::types::put_len_delimited_header( + 3u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::duration_rules::LessThan::Lte(x) => { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::duration_rules::GreaterThan::Gt(x) => { + ::buffa::types::put_len_delimited_header( + 5u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::duration_rules::GreaterThan::Gte(x) => { + ::buffa::types::put_len_delimited_header( + 6u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + } + } + for v in &self.r#in { + ::buffa::types::put_len_delimited_header( + 7u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + for v in &self.not_in { + ::buffa::types::put_len_delimited_header( + 8u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + for v in &self.example { + ::buffa::types::put_len_delimited_header( + 9u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.r#const.get_or_insert_default(), + buf, + ctx, + )?; + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::duration_rules::LessThan::Lt(ref mut existing), + ) = self.less_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::duration_rules::LessThan::Lt( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::duration_rules::LessThan::Lte(ref mut existing), + ) = self.less_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::duration_rules::LessThan::Lte( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::duration_rules::GreaterThan::Gt(ref mut existing), + ) = self.greater_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::duration_rules::GreaterThan::Gt( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::duration_rules::GreaterThan::Gte(ref mut existing), + ) = self.greater_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::duration_rules::GreaterThan::Gte( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.r#in.push(elem); + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.not_in.push(elem); + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.example.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::buffa::MessageField::none(); + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for DurationRules { + const PROTO_FQN: &'static str = "buf.validate.DurationRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod duration_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::duration_rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::duration_rules::GreaterThan; +} +/// FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type. +#[derive(Clone, PartialEq, Default)] +pub struct FieldMaskRules { + /// `const` dictates that the field must match the specified value of the `google.protobuf.FieldMask` type exactly. + /// If the field's value deviates from the specified value, an error message + /// will be generated. + /// + /// ```proto,ignore + /// message MyFieldMask { + /// // value must equal ["a"] + /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask.const = { + /// paths: ["a"] + /// }]; + /// } + /// ``` + /// + /// Field 1: `const` + pub r#const: ::buffa::MessageField< + ::buffa_types::google::protobuf::FieldMask, + ::buffa::Inline<::buffa_types::google::protobuf::FieldMask>, + >, + /// `in` requires the field value to only contain paths matching specified + /// values or their subpaths. + /// If any of the field value's paths doesn't match the rule, + /// an error message is generated. + /// See: + /// + /// ```proto,ignore + /// message MyFieldMask { + /// // The `value` FieldMask must only contain paths listed in `in`. + /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + /// in: ["a", "b", "c.a"] + /// }]; + /// } + /// ``` + /// + /// Field 2: `in` + pub r#in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `not_in` requires the field value to not contain paths matching specified + /// values or their subpaths. + /// If any of the field value's paths matches the rule, + /// an error message is generated. + /// See: + /// + /// ```proto,ignore + /// message MyFieldMask { + /// // The `value` FieldMask shall not contain paths listed in `not_in`. + /// google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + /// not_in: ["forbidden", "immutable", "c.a"] + /// }]; + /// } + /// ``` + /// + /// Field 3: `not_in` + pub not_in: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyFieldMask { + /// google.protobuf.FieldMask value = 1 [ + /// (buf.validate.field).field_mask.example = { paths: ["a", "b"] }, + /// (buf.validate.field).field_mask.example = { paths: ["c.a", "d"] }, + /// ]; + /// } + /// ``` + /// + /// Field 4: `example` + pub example: ::buffa::alloc::vec::Vec<::buffa_types::google::protobuf::FieldMask>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for FieldMaskRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FieldMaskRules") + .field("const", &self.r#const) + .field("in", &self.r#in) + .field("not_in", &self.not_in) + .field("example", &self.example) + .finish() + } +} +impl FieldMaskRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldMaskRules"; +} +::buffa::impl_default_instance!(FieldMaskRules); +impl ::buffa::MessageName for FieldMaskRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "FieldMaskRules"; + const FULL_NAME: &'static str = "buf.validate.FieldMaskRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldMaskRules"; +} +impl ::buffa::Message for FieldMaskRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.r#const.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.r#in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + for v in &self.not_in { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + for v in &self.example { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if self.r#const.is_set() { + ::buffa::types::put_len_delimited_header( + 1u32, + u64::from(__cache.consume_next()), + buf, + ); + self.r#const.write_to(__cache, buf); + } + for v in &self.r#in { + ::buffa::types::put_string_field(2u32, v, buf); + } + for v in &self.not_in { + ::buffa::types::put_string_field(3u32, v, buf); + } + for v in &self.example { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.r#const.get_or_insert_default(), + buf, + ctx, + )?; + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.r#in.push(__elem); + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let __elem = ::buffa::types::decode_string(buf)?; + ctx.register_element_memory( + ::buffa::__private::element_footprint(&__elem), + )?; + self.not_in.push(__elem); + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.example.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::buffa::MessageField::none(); + self.r#in.clear(); + self.not_in.clear(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for FieldMaskRules { + const PROTO_FQN: &'static str = "buf.validate.FieldMaskRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type. +#[derive(Clone, PartialEq, Default)] +pub struct TimestampRules { + /// `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated. + /// + /// ```proto,ignore + /// message MyTimestamp { + /// // value must equal 2023-05-03T10:00:00Z + /// google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}]; + /// } + /// ``` + /// + /// Field 2: `const` + pub r#const: ::buffa::MessageField< + ::buffa_types::google::protobuf::Timestamp, + ::buffa::Inline<::buffa_types::google::protobuf::Timestamp>, + >, + /// `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated. + /// + /// ```proto,ignore + /// message MyTimestamp { + /// // must be within 1 hour of now + /// google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; + /// } + /// ``` + /// + /// Field 9: `within` + pub within: ::buffa::MessageField< + ::buffa_types::google::protobuf::Duration, + ::buffa::Inline<::buffa_types::google::protobuf::Duration>, + >, + /// `example` specifies values that the field may have. These values SHOULD + /// conform to other rules. `example` values will not impact validation + /// but may be used as helpful guidance on how to populate the given field. + /// + /// ```proto,ignore + /// message MyTimestamp { + /// google.protobuf.Timestamp value = 1 [ + /// (buf.validate.field).timestamp.example = { seconds: 1672444800 }, + /// (buf.validate.field).timestamp.example = { seconds: 1672531200 }, + /// ]; + /// } + /// ``` + /// + /// Field 10: `example` + pub example: ::buffa::alloc::vec::Vec<::buffa_types::google::protobuf::Timestamp>, + pub less_than: ::core::option::Option<__buffa::oneof::timestamp_rules::LessThan>, + pub greater_than: ::core::option::Option< + __buffa::oneof::timestamp_rules::GreaterThan, + >, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for TimestampRules { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("TimestampRules") + .field("const", &self.r#const) + .field("within", &self.within) + .field("example", &self.example) + .field("less_than", &self.less_than) + .field("greater_than", &self.greater_than) + .finish() + } +} +impl TimestampRules { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.TimestampRules"; +} +::buffa::impl_default_instance!(TimestampRules); +impl ::buffa::MessageName for TimestampRules { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "TimestampRules"; + const FULL_NAME: &'static str = "buf.validate.TimestampRules"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.TimestampRules"; +} +impl ::buffa::Message for TimestampRules { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if self.r#const.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.r#const.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::timestamp_rules::LessThan::Lt(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::timestamp_rules::LessThan::Lte(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::timestamp_rules::LessThan::LtNow(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::timestamp_rules::GreaterThan::Gt(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::timestamp_rules::GreaterThan::Gte(x) => { + let __slot = __cache.reserve(); + let inner = x.compute_size(__cache); + __cache.set(__slot, inner); + size + += 1u64 + ::buffa::encoding::varint_len(inner as u64) as u64 + + inner as u64; + } + __buffa::oneof::timestamp_rules::GreaterThan::GtNow(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + } + } + if self.within.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.within.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + for v in &self.example { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if self.r#const.is_set() { + ::buffa::types::put_len_delimited_header( + 2u32, + u64::from(__cache.consume_next()), + buf, + ); + self.r#const.write_to(__cache, buf); + } + if let ::core::option::Option::Some(ref v) = self.less_than { + match v { + __buffa::oneof::timestamp_rules::LessThan::Lt(x) => { + ::buffa::types::put_len_delimited_header( + 3u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::timestamp_rules::LessThan::Lte(x) => { + ::buffa::types::put_len_delimited_header( + 4u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::timestamp_rules::LessThan::LtNow(x) => { + ::buffa::types::put_bool_field(7u32, *x, buf); + } + } + } + if let ::core::option::Option::Some(ref v) = self.greater_than { + match v { + __buffa::oneof::timestamp_rules::GreaterThan::Gt(x) => { + ::buffa::types::put_len_delimited_header( + 5u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::timestamp_rules::GreaterThan::Gte(x) => { + ::buffa::types::put_len_delimited_header( + 6u32, + u64::from(__cache.consume_next()), + buf, + ); + x.write_to(__cache, buf); + } + __buffa::oneof::timestamp_rules::GreaterThan::GtNow(x) => { + ::buffa::types::put_bool_field(8u32, *x, buf); + } + } + } + if self.within.is_set() { + ::buffa::types::put_len_delimited_header( + 9u32, + u64::from(__cache.consume_next()), + buf, + ); + self.within.write_to(__cache, buf); + } + for v in &self.example { + ::buffa::types::put_len_delimited_header( + 10u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.r#const.get_or_insert_default(), + buf, + ctx, + )?; + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::LessThan::Lt(ref mut existing), + ) = self.less_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::LessThan::Lt( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::LessThan::Lte(ref mut existing), + ) = self.less_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::LessThan::Lte( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.less_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::LessThan::LtNow( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::GreaterThan::Gt(ref mut existing), + ) = self.greater_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::GreaterThan::Gt( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + if let ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::GreaterThan::Gte(ref mut existing), + ) = self.greater_than + { + ::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?; + } else { + let mut val = ::core::default::Default::default(); + ::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::GreaterThan::Gte( + ::buffa::alloc::boxed::Box::new(val), + ), + ); + } + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.greater_than = ::core::option::Option::Some( + __buffa::oneof::timestamp_rules::GreaterThan::GtNow( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.within.get_or_insert_default(), + buf, + ctx, + )?; + } + 10u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.example.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.r#const = ::buffa::MessageField::none(); + self.less_than = ::core::option::Option::None; + self.greater_than = ::core::option::Option::None; + self.within = ::buffa::MessageField::none(); + self.example.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for TimestampRules { + const PROTO_FQN: &'static str = "buf.validate.TimestampRules"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod timestamp_rules { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::timestamp_rules::LessThan; + #[doc(inline)] + pub use super::__buffa::oneof::timestamp_rules::GreaterThan; +} +/// `Violations` is a collection of `Violation` messages. This message type is returned by +/// Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules. +/// Each individual violation is represented by a `Violation` message. +#[derive(Clone, PartialEq, Default)] +pub struct Violations { + /// `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected. + /// + /// Field 1: `violations` + pub violations: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Violations { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Violations").field("violations", &self.violations).finish() + } +} +impl Violations { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Violations"; +} +::buffa::impl_default_instance!(Violations); +impl ::buffa::MessageName for Violations { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Violations"; + const FULL_NAME: &'static str = "buf.validate.Violations"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Violations"; +} +impl ::buffa::Message for Violations { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.violations { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.violations { + ::buffa::types::put_len_delimited_header( + 1u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.violations.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.violations.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Violations { + const PROTO_FQN: &'static str = "buf.validate.Violations"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// `Violation` represents a single instance where a validation rule, expressed +/// as a `Rule`, was not met. It provides information about the field that +/// caused the violation, the specific rule that wasn't fulfilled, and a +/// human-readable error message. +/// +/// For example, consider the following message: +/// +/// ```proto,ignore +/// message User { +/// int32 age = 1 [(buf.validate.field).cel = { +/// id: "user.age", +/// expression: "this < 18 ? 'User must be at least 18 years old' : ''", +/// }]; +/// } +/// ``` +/// +/// It could produce the following violation: +/// +/// ```json,ignore +/// { +/// "ruleId": "user.age", +/// "message": "User must be at least 18 years old", +/// "field": { +/// "elements": [ +/// { +/// "fieldNumber": 1, +/// "fieldName": "age", +/// "fieldType": "TYPE_INT32" +/// } +/// ] +/// }, +/// "rule": { +/// "elements": [ +/// { +/// "fieldNumber": 23, +/// "fieldName": "cel", +/// "fieldType": "TYPE_MESSAGE", +/// "index": "0" +/// } +/// ] +/// } +/// } +/// ``` +#[derive(Clone, PartialEq, Default)] +pub struct Violation { + /// `field` is a machine-readable path to the field that failed validation. + /// This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + /// + /// For example, consider the following message: + /// + /// ```proto,ignore + /// message Message { + /// bool a = 1 [(buf.validate.field).required = true]; + /// } + /// ``` + /// + /// It could produce the following violation: + /// + /// ```textproto,ignore + /// violation { + /// field { element { field_number: 1, field_name: "a", field_type: 8 } } + /// ... + /// } + /// ``` + /// + /// Field 5: `field` + pub field: ::buffa::MessageField>, + /// `rule` is a machine-readable path that points to the specific rule that failed validation. + /// This will be a nested field starting from the FieldRules of the field that failed validation. + /// For custom rules, this will provide the path of the rule, e.g. `cel[0]`. + /// + /// For example, consider the following message: + /// + /// ```proto,ignore + /// message Message { + /// bool a = 1 [(buf.validate.field).required = true]; + /// bool b = 2 [(buf.validate.field).cel = { + /// id: "custom_rule", + /// expression: "!this ? 'b must be true': ''" + /// }] + /// } + /// ``` + /// + /// It could produce the following violations: + /// + /// ```textproto,ignore + /// violation { + /// rule { element { field_number: 25, field_name: "required", field_type: 8 } } + /// ... + /// } + /// violation { + /// rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + /// ... + /// } + /// ``` + /// + /// Field 6: `rule` + pub rule: ::buffa::MessageField>, + /// `rule_id` is the unique identifier of the `Rule` that was not fulfilled. + /// This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated. + /// + /// Field 2: `rule_id` + pub rule_id: ::core::option::Option<::buffa::alloc::string::String>, + /// `message` is a human-readable error message that describes the nature of the violation. + /// This can be the default error message from the violated `Rule`, or it can be a custom message that gives more context about the violation. + /// + /// Field 3: `message` + pub message: ::core::option::Option<::buffa::alloc::string::String>, + /// `for_key` indicates whether the violation was caused by a map key, rather than a value. + /// + /// Field 4: `for_key` + pub for_key: ::core::option::Option, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for Violation { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Violation") + .field("field", &self.field) + .field("rule", &self.rule) + .field("rule_id", &self.rule_id) + .field("message", &self.message) + .field("for_key", &self.for_key) + .finish() + } +} +impl Violation { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Violation"; +} +::buffa::impl_default_instance!(Violation); +impl ::buffa::MessageName for Violation { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "Violation"; + const FULL_NAME: &'static str = "buf.validate.Violation"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.Violation"; +} +impl ::buffa::Message for Violation { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(ref v) = self.rule_id { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.message { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if self.for_key.is_some() { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + if self.field.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.field.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + if self.rule.is_set() { + let __slot = __cache.reserve(); + let inner_size = self.rule.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(ref v) = self.rule_id { + ::buffa::types::put_string_field(2u32, v, buf); + } + if let Some(ref v) = self.message { + ::buffa::types::put_string_field(3u32, v, buf); + } + if let Some(v) = self.for_key { + ::buffa::types::put_bool_field(4u32, v, buf); + } + if self.field.is_set() { + ::buffa::types::put_len_delimited_header( + 5u32, + u64::from(__cache.consume_next()), + buf, + ); + self.field.write_to(__cache, buf); + } + if self.rule.is_set() { + ::buffa::types::put_len_delimited_header( + 6u32, + u64::from(__cache.consume_next()), + buf, + ); + self.rule.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.rule_id.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self.message.get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.for_key = ::core::option::Option::Some( + ::buffa::types::decode_bool(buf)?, + ); + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.field.get_or_insert_default(), + buf, + ctx, + )?; + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::Message::merge_length_delimited( + self.rule.get_or_insert_default(), + buf, + ctx, + )?; + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.rule_id = ::core::option::Option::None; + self.message = ::core::option::Option::None; + self.for_key = ::core::option::Option::None; + self.field = ::buffa::MessageField::none(); + self.rule = ::buffa::MessageField::none(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for Violation { + const PROTO_FQN: &'static str = "buf.validate.Violation"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// `FieldPath` provides a path to a nested protobuf field. +/// +/// This message provides enough information to render a dotted field path even without protobuf descriptors. +/// It also provides enough information to resolve a nested field through unknown wire data. +#[derive(Clone, PartialEq, Default)] +pub struct FieldPath { + /// `elements` contains each element of the path, starting from the root and recursing downward. + /// + /// Field 1: `elements` + pub elements: ::buffa::alloc::vec::Vec, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for FieldPath { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FieldPath").field("elements", &self.elements).finish() + } +} +impl FieldPath { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldPath"; +} +::buffa::impl_default_instance!(FieldPath); +impl ::buffa::MessageName for FieldPath { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "FieldPath"; + const FULL_NAME: &'static str = "buf.validate.FieldPath"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldPath"; +} +impl ::buffa::Message for FieldPath { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + for v in &self.elements { + let __slot = __cache.reserve(); + let inner_size = v.compute_size(__cache); + __cache.set(__slot, inner_size); + size + += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64 + + inner_size as u64; + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + __cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + for v in &self.elements { + ::buffa::types::put_len_delimited_header( + 1u32, + u64::from(__cache.consume_next()), + buf, + ); + v.write_to(__cache, buf); + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + let mut elem = ::core::default::Default::default(); + ctx.register_element_memory( + ::buffa::__private::element_footprint(&elem), + )?; + ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?; + self.elements.push(elem); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.elements.clear(); + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for FieldPath { + const PROTO_FQN: &'static str = "buf.validate.FieldPath"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +/// `FieldPathElement` provides enough information to nest through a single protobuf field. +/// +/// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. +/// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. +/// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. +#[derive(Clone, PartialEq, Default)] +pub struct FieldPathElement { + /// `field_number` is the field number this path element refers to. + /// + /// Field 1: `field_number` + pub field_number: ::core::option::Option, + /// `field_name` contains the field name this path element refers to. + /// This can be used to display a human-readable path even if the field number is unknown. + /// + /// Field 2: `field_name` + pub field_name: ::core::option::Option<::buffa::alloc::string::String>, + /// `field_type` specifies the type of this field. When using reflection, this value is not needed. + /// + /// This value is provided to make it possible to traverse unknown fields through wire data. + /// When traversing wire data, be mindful of both packed\[1\] and delimited\[2\] encoding schemes. + /// + /// \[1\]: + /// \[2\]: + /// + /// N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and + /// can be explicitly used in Protocol Buffers 2023 Edition. + /// + /// Field 3: `field_type` + pub field_type: ::core::option::Option< + ::buffa_descriptor::generated::descriptor::field_descriptor_proto::Type, + >, + /// `key_type` specifies the map key type of this field. This value is useful when traversing + /// unknown fields through wire data: specifically, it allows handling the differences between + /// different integer encodings. + /// + /// Field 4: `key_type` + pub key_type: ::core::option::Option< + ::buffa_descriptor::generated::descriptor::field_descriptor_proto::Type, + >, + /// `value_type` specifies map value type of this field. This is useful if you want to display a + /// value inside unknown fields through wire data. + /// + /// Field 5: `value_type` + pub value_type: ::core::option::Option< + ::buffa_descriptor::generated::descriptor::field_descriptor_proto::Type, + >, + pub subscript: ::core::option::Option<__buffa::oneof::field_path_element::Subscript>, + #[doc(hidden)] + pub __buffa_unknown_fields: ::buffa::UnknownFields, +} +impl ::core::fmt::Debug for FieldPathElement { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FieldPathElement") + .field("field_number", &self.field_number) + .field("field_name", &self.field_name) + .field("field_type", &self.field_type) + .field("key_type", &self.key_type) + .field("value_type", &self.value_type) + .field("subscript", &self.subscript) + .finish() + } +} +impl FieldPathElement { + /// Protobuf type URL for this message, for use with `Any::pack` and + /// `Any::unpack_if`. + /// + /// Format: `type.googleapis.com/` + pub const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldPathElement"; +} +::buffa::impl_default_instance!(FieldPathElement); +impl ::buffa::MessageName for FieldPathElement { + const PACKAGE: &'static str = "buf.validate"; + const NAME: &'static str = "FieldPathElement"; + const FULL_NAME: &'static str = "buf.validate.FieldPathElement"; + const TYPE_URL: &'static str = "type.googleapis.com/buf.validate.FieldPathElement"; +} +impl ::buffa::Message for FieldPathElement { + /// Returns the total encoded size in bytes. + /// + /// Accumulates in `u64` (which cannot overflow for in-memory + /// data) and saturates to `u32` at return, so a message whose + /// encoded size exceeds the 2 GiB protobuf limit yields a value + /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry + /// points reject, never a silently wrapped size. + #[allow(clippy::let_and_return)] + fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + let mut size = 0u64; + if let Some(v) = self.field_number { + size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64; + } + if let Some(ref v) = self.field_name { + size += 1u64 + ::buffa::types::string_encoded_len(v) as u64; + } + if let Some(ref v) = self.field_type { + size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; + } + if let Some(ref v) = self.key_type { + size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; + } + if let Some(ref v) = self.value_type { + size += 1u64 + ::buffa::types::int32_encoded_len(v.to_i32()) as u64; + } + if let ::core::option::Option::Some(ref v) = self.subscript { + match v { + __buffa::oneof::field_path_element::Subscript::Index(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + __buffa::oneof::field_path_element::Subscript::BoolKey(_x) => { + size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64; + } + __buffa::oneof::field_path_element::Subscript::IntKey(v) => { + size += 1u64 + ::buffa::types::int64_encoded_len(*v) as u64; + } + __buffa::oneof::field_path_element::Subscript::UintKey(v) => { + size += 1u64 + ::buffa::types::uint64_encoded_len(*v) as u64; + } + __buffa::oneof::field_path_element::Subscript::StringKey(x) => { + size += 1u64 + ::buffa::types::string_encoded_len(x) as u64; + } + } + } + size += self.__buffa_unknown_fields.encoded_len() as u64; + ::buffa::saturate_size(size) + } + fn write_to( + &self, + _cache: &mut ::buffa::SizeCache, + buf: &mut impl ::buffa::EncodeSink, + ) { + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + if let Some(v) = self.field_number { + ::buffa::types::put_int32_field(1u32, v, buf); + } + if let Some(ref v) = self.field_name { + ::buffa::types::put_string_field(2u32, v, buf); + } + if let Some(ref v) = self.field_type { + ::buffa::types::put_int32_field(3u32, v.to_i32(), buf); + } + if let Some(ref v) = self.key_type { + ::buffa::types::put_int32_field(4u32, v.to_i32(), buf); + } + if let Some(ref v) = self.value_type { + ::buffa::types::put_int32_field(5u32, v.to_i32(), buf); + } + if let ::core::option::Option::Some(ref v) = self.subscript { + match v { + __buffa::oneof::field_path_element::Subscript::Index(x) => { + ::buffa::types::put_uint64_field(6u32, *x, buf); + } + __buffa::oneof::field_path_element::Subscript::BoolKey(x) => { + ::buffa::types::put_bool_field(7u32, *x, buf); + } + __buffa::oneof::field_path_element::Subscript::IntKey(x) => { + ::buffa::types::put_int64_field(8u32, *x, buf); + } + __buffa::oneof::field_path_element::Subscript::UintKey(x) => { + ::buffa::types::put_uint64_field(9u32, *x, buf); + } + __buffa::oneof::field_path_element::Subscript::StringKey(x) => { + ::buffa::types::put_string_field(10u32, x, buf); + } + } + } + self.__buffa_unknown_fields.write_to(buf); + } + fn merge_field( + &mut self, + tag: ::buffa::encoding::Tag, + buf: &mut impl ::buffa::bytes::Buf, + ctx: ::buffa::DecodeContext<'_>, + ) -> ::core::result::Result<(), ::buffa::DecodeError> { + #[allow(unused_imports)] + use ::buffa::bytes::Buf as _; + #[allow(unused_imports)] + use ::buffa::Enumeration as _; + match tag.field_number() { + 1u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.field_number = ::core::option::Option::Some( + ::buffa::types::decode_int32(buf)?, + ); + } + 2u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + ::buffa::types::merge_string( + self + .field_name + .get_or_insert_with(::buffa::alloc::string::String::new), + buf, + )?; + } + 3u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + let __raw = ::buffa::types::decode_int32(buf)?; + if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32( + __raw, + ) { + self.field_type = ::core::option::Option::Some(__v); + } else { + ctx.register_unknown_field()?; + self.__buffa_unknown_fields + .push(::buffa::UnknownField { + number: 3u32, + data: ::buffa::UnknownFieldData::Varint(__raw as u64), + }); + } + } + 4u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + let __raw = ::buffa::types::decode_int32(buf)?; + if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32( + __raw, + ) { + self.key_type = ::core::option::Option::Some(__v); + } else { + ctx.register_unknown_field()?; + self.__buffa_unknown_fields + .push(::buffa::UnknownField { + number: 4u32, + data: ::buffa::UnknownFieldData::Varint(__raw as u64), + }); + } + } + 5u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + let __raw = ::buffa::types::decode_int32(buf)?; + if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32( + __raw, + ) { + self.value_type = ::core::option::Option::Some(__v); + } else { + ctx.register_unknown_field()?; + self.__buffa_unknown_fields + .push(::buffa::UnknownField { + number: 5u32, + data: ::buffa::UnknownFieldData::Varint(__raw as u64), + }); + } + } + 6u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.subscript = ::core::option::Option::Some( + __buffa::oneof::field_path_element::Subscript::Index( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 7u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.subscript = ::core::option::Option::Some( + __buffa::oneof::field_path_element::Subscript::BoolKey( + ::buffa::types::decode_bool(buf)?, + ), + ); + } + 8u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.subscript = ::core::option::Option::Some( + __buffa::oneof::field_path_element::Subscript::IntKey( + ::buffa::types::decode_int64(buf)?, + ), + ); + } + 9u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::Varint, + )?; + self.subscript = ::core::option::Option::Some( + __buffa::oneof::field_path_element::Subscript::UintKey( + ::buffa::types::decode_uint64(buf)?, + ), + ); + } + 10u32 => { + ::buffa::encoding::check_wire_type( + tag, + ::buffa::encoding::WireType::LengthDelimited, + )?; + self.subscript = ::core::option::Option::Some( + __buffa::oneof::field_path_element::Subscript::StringKey( + ::buffa::types::decode_string(buf)?, + ), + ); + } + _ => { + self.__buffa_unknown_fields + .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?); + } + } + ::core::result::Result::Ok(()) + } + fn clear(&mut self) { + self.field_number = ::core::option::Option::None; + self.field_name = ::core::option::Option::None; + self.field_type = ::core::option::Option::None; + self.key_type = ::core::option::Option::None; + self.value_type = ::core::option::Option::None; + self.subscript = ::core::option::Option::None; + self.__buffa_unknown_fields.clear(); + } +} +impl ::buffa::ExtensionSet for FieldPathElement { + const PROTO_FQN: &'static str = "buf.validate.FieldPathElement"; + fn unknown_fields(&self) -> &::buffa::UnknownFields { + &self.__buffa_unknown_fields + } + fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields { + &mut self.__buffa_unknown_fields + } +} +pub mod field_path_element { + #[allow(unused_imports)] + use super::*; + #[doc(inline)] + pub use super::__buffa::oneof::field_path_element::Subscript; +} diff --git a/crates/protovalidate/src/lib.rs b/crates/protovalidate/src/lib.rs new file mode 100644 index 00000000..688bccd5 --- /dev/null +++ b/crates/protovalidate/src/lib.rs @@ -0,0 +1,94 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Protocol Buffer message validation with [protovalidate]. +//! +//! Validation rules are written in `.proto` files with the `buf.validate` +//! extensions. This crate evaluates them against messages, supporting the +//! full rule set including custom CEL expressions. The standard rules are +//! evaluated in Rust; custom CEL expressions are compiled and evaluated +//! by [cel-cpp]. The `cel` feature, on by default, brings cel-cpp in, +//! and with it RE2 as the engine for `pattern` rules, the same one CEL's +//! `matches()` uses. A schema without custom rules can disable it, +//! removing the need to compile any C++; patterns then go through the +//! `regex` crate instead, with perl classes restricted to ASCII-only like +//! RE2. +//! +//! # Usage +//! +//! A [`Validator`] caches compiled rules and is thread-safe; create one and +//! share it. Descriptors are registered serialized, and a message is read in +//! place through a [`Runtime`](protobuf::Runtime) the caller implements over +//! its own Protobuf runtime. Register descriptors up front, then validate +//! messages as they arrive. +//! +//! ```ignore +//! use protovalidate::{Error, Validator}; +//! +//! let mut validator = Validator::::new(); +//! validator.add_file_descriptor_bytes(&file_descriptor_proto)?; +//! +//! match validator.validate_message(type_name, &message, false) { +//! Ok(()) => { /* valid */ } +//! Err(Error::Validation(e)) => { +//! // The message failed to evaluate against rules in the schema. +//! // e.violations() is a serialized buf.validate.Violations describing +//! // each failure. +//! } +//! // Validation itself failed: unknown type, rules that do not compile +//! // or evaluate. +//! Err(e) => return Err(e.into()), +//! } +//! ``` +//! +//! Without the `cel` feature, a custom CEL rule is reported as +//! [`Error::Compilation`] when its message type is first validated. +//! +//! A read of the message fails with the runtime's own error type, +//! [`Runtime::Error`](protobuf::Runtime::Error), which comes back as +//! [`Error::Read`]; a native runtime uses [`Infallible`](std::convert::Infallible). +//! +//! [protovalidate]: https://buf.build/docs/protovalidate/ +//! [cel-cpp]: https://github.com/google/cel-cpp + +// protovalidate-deps contains unsafe shims into C++ code, leaving this crate +// as fully safe. Notably, with the cel feature disabled, no unsafe code is +// accessible. +#![forbid(unsafe_code)] + +mod cel; +mod descriptors; +pub mod protobuf; +mod rules; + +#[allow( + non_camel_case_types, + dead_code, + unused_imports, + unused_qualifications, + clippy::pedantic, + clippy::derivable_impls, + clippy::enum_variant_names, + clippy::match_single_binding +)] +mod validate { + //! Generated types for `buf/validate/validate.proto`. + include!("gen/buf.validate.mod.rs"); +} + +mod error; +mod validator; + +pub use error::{DescriptorError, Error, ValidationError}; +pub use validator::Validator; diff --git a/crates/protovalidate/src/protobuf/field.rs b/crates/protovalidate/src/protobuf/field.rs new file mode 100644 index 00000000..f159dcb7 --- /dev/null +++ b/crates/protovalidate/src/protobuf/field.rs @@ -0,0 +1,215 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! What the validator tells a runtime about a field it asks for. + +use std::borrow::Cow; +use std::fmt; + +use buffa::editions::FieldPresence; +use buffa_descriptor::{FieldDescriptor, FieldKind, ScalarType, SingularKind}; + +use super::Runtime; + +/// A field of the message being validated, as the validator describes it +/// when asking a [`Message`](super::Message) for it. +/// +/// The description is resolved from the descriptors registered with the +/// validator, and provided to a runtime. +pub struct Field { + number: u32, + name: Cow<'static, str>, + kind: Kind, + message_type: Option, + has_presence: bool, +} + +impl Clone for Field { + fn clone(&self) -> Self { + Self { + number: self.number, + name: self.name.clone(), + kind: self.kind, + message_type: self.message_type.clone(), + has_presence: self.has_presence, + } + } +} + +impl fmt::Debug for Field { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Field") + .field("number", &self.number) + .field("name", &self.name) + .field("kind", &self.kind) + .field("has_presence", &self.has_presence) + .finish_non_exhaustive() + } +} + +impl PartialEq for Field +where + R::MessageType: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.number == other.number + && self.name == other.name + && self.kind == other.kind + && self.message_type == other.message_type + && self.has_presence == other.has_presence + } +} + +impl Eq for Field where R::MessageType: Eq {} + +impl Field { + pub(crate) fn from_descriptor( + field: &FieldDescriptor, + message_type: Option, + ) -> Self { + let kind = match field.kind() { + FieldKind::Singular(value) => Kind::Singular(singular(value)), + FieldKind::List(element) => Kind::List(singular(element)), + FieldKind::Map { key, value } => Kind::Map { + key: scalar(key), + value: singular(value), + }, + }; + Self { + number: field.number(), + name: Cow::Owned(field.name().to_owned()), + kind, + message_type, + has_presence: matches!(kind, Kind::Singular(_)) + && field.presence() != FieldPresence::Implicit, + } + } + + /// A field of a well-known type, which the rules read directly. The + /// well-known types are proto3, so they do not track presence. + pub(crate) const fn well_known(number: u32, name: &'static str, kind: Kind) -> Self { + Self { + number, + name: Cow::Borrowed(name), + kind, + message_type: None, + has_presence: false, + } + } + + /// The field number. + #[must_use] + pub fn number(&self) -> u32 { + self.number + } + + /// The field's name in the `.proto` source. + #[must_use] + pub fn name(&self) -> &str { + &self.name + } + + /// How the field holds its values. + #[must_use] + pub fn kind(&self) -> Kind { + self.kind + } + + /// The resolved type of the messages this field holds, whether as a + /// single value, as list elements or as map values. `None` if the field + /// does not hold messages. + #[must_use] + pub fn message_type(&self) -> Option<&R::MessageType> { + self.message_type.as_ref() + } + + /// Whether the field tracks presence, as a singular field that is + /// `optional`, a oneof member, or a message does. Only such a field is + /// asked [`Message::has`](super::Message::has); any other field counts + /// as set when it is not its type's default. + #[must_use] + pub fn has_presence(&self) -> bool { + self.has_presence + } +} + +/// How a field holds its values. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Kind { + /// One value. + Singular(Singular), + /// A repeated field. + List(Singular), + /// A map field. + Map { key: Scalar, value: Singular }, +} + +/// The type of one value, whether of a singular field, a repeated element +/// or a map value. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Singular { + Scalar(Scalar), + /// An enum, read as its number. + Enum, + /// A message, of the type [`Field::message_type`] names. + Message, +} + +/// A Protobuf scalar type. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Scalar { + Bool, + Int32, + Int64, + Uint32, + Uint64, + Sint32, + Sint64, + Fixed32, + Fixed64, + Sfixed32, + Sfixed64, + Float, + Double, + String, + Bytes, +} + +fn singular(kind: SingularKind) -> Singular { + match kind { + SingularKind::Scalar(scalar_type) => Singular::Scalar(scalar(scalar_type)), + SingularKind::Enum(_) => Singular::Enum, + SingularKind::Message(_) => Singular::Message, + } +} + +fn scalar(scalar: ScalarType) -> Scalar { + match scalar { + ScalarType::Bool => Scalar::Bool, + ScalarType::Int32 => Scalar::Int32, + ScalarType::Int64 => Scalar::Int64, + ScalarType::Uint32 => Scalar::Uint32, + ScalarType::Uint64 => Scalar::Uint64, + ScalarType::Sint32 => Scalar::Sint32, + ScalarType::Sint64 => Scalar::Sint64, + ScalarType::Fixed32 => Scalar::Fixed32, + ScalarType::Fixed64 => Scalar::Fixed64, + ScalarType::Sfixed32 => Scalar::Sfixed32, + ScalarType::Sfixed64 => Scalar::Sfixed64, + ScalarType::Float => Scalar::Float, + ScalarType::Double => Scalar::Double, + ScalarType::String => Scalar::String, + ScalarType::Bytes => Scalar::Bytes, + } +} diff --git a/crates/protovalidate/src/protobuf/mod.rs b/crates/protovalidate/src/protobuf/mod.rs new file mode 100644 index 00000000..ff8d33bb --- /dev/null +++ b/crates/protovalidate/src/protobuf/mod.rs @@ -0,0 +1,239 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! How the validator reads messages, independently of the runtime that +//! holds them. +//! +//! A [`Runtime`] names the views a runtime gives out for a message, a +//! repeated field and a map, and those views implement [`Message`], +//! [`List`] and [`Map`]. Validation is generic over the runtime, so a +//! message is read in place without copying, except when it must be +//! encoded for CEL. +//! +//! A runtime plugs in by implementing these and calling +//! [`Validator::validate_message`](crate::Validator::validate_message). +//! Each field the validator asks for is described by a [`Field`], resolved +//! from the descriptors registered with the validator. +//! +//! A read fails with the runtime's own [`Runtime::Error`], which ends the +//! validation and reaches the caller as [`Error::Read`](crate::Error::Read). +//! A native runtime whose reads cannot fail should use [`Infallible`]. +//! +//! [`Infallible`]: std::convert::Infallible + +use std::borrow::Cow; +use std::ops::ControlFlow; + +mod field; + +pub use field::{Field, Kind, Scalar, Singular}; + +/// A Protobuf runtime adapter to read from a message during validation. +pub trait Runtime: Sized { + /// What a read fails with. + type Error; + /// Whatever the runtime needs in order to read a message of one type, + /// such as which attribute holds each field. + type MessageType: Clone; + /// A message. + type Message<'a>: Message; + /// A repeated field's elements. + type List<'a>: List; + /// A map field's entries. + type Map<'a>: Map; +} + +/// The runtime's side of one validation. It provides the message to +/// validate and looks up message types by name. +pub trait Reader { + /// Looks up the message type named `full_name`, which is fully + /// qualified and has no leading dot. + /// + /// # Errors + /// + /// The runtime does not know the type. + fn resolve(&self, full_name: &str) -> Result; + + /// Returns the message to validate. `message_type` is the resolved type + /// of that message. + /// + /// # Errors + /// + /// The runtime could not read the message as that type. + fn message<'a>(&'a self, message_type: &'a R::MessageType) -> Result, R::Error>; +} + +/// A field's value, borrowed from the message that holds it. +/// +/// Numbers are widened to their equivalent CEL types. +#[non_exhaustive] +pub enum Val<'a, R: Runtime> { + Bool(bool), + Int(i64), + Uint(u64), + Double(f64), + Enum(i32), + String(Cow<'a, str>), + Bytes(Cow<'a, [u8]>), + Message(R::Message<'a>), + List(R::List<'a>), + Map(R::Map<'a>), +} + +/// A message being validated. +pub trait Message { + /// Whether the field is set. Asked only of a field that + /// [tracks presence](Field::has_presence). + /// + /// # Errors + /// + /// The runtime could not tell. + fn has(&self, field: &Field) -> Result; + + /// The field's value, or its type's default when it is not set. `None` + /// when the message has no such field, as when its runtime knows an + /// older schema than the validator. The returned value may borrow from + /// `field`: a nested message keeps a reference to the message type + /// stored there. + /// + /// # Errors + /// + /// The runtime could not read the field. + fn get<'f>(&'f self, field: &'f Field) -> Result>, R::Error>; + + /// The serialized message, which the CEL runtime parses when a rule + /// binds the message, or one of its repeated or map fields, to `this`. + /// + /// # Errors + /// + /// The runtime could not serialize the message. + fn encode(&self) -> Result, R::Error>; +} + +/// A repeated field. +// A length that may fail to be read has no `is_empty` to pair with. +#[expect(clippy::len_without_is_empty)] +pub trait List { + /// The number of elements. + /// + /// # Errors + /// + /// The runtime could not count them. + fn len(&self) -> Result; + + /// The element at `index`, `None` past the end. + /// + /// # Errors + /// + /// The runtime could not read the element. + fn get(&self, index: usize) -> Result>, R::Error>; +} + +/// A map field. +// As for `List`. +#[expect(clippy::len_without_is_empty)] +pub trait Map { + /// The number of entries. + /// + /// # Errors + /// + /// The runtime could not count them. + fn len(&self) -> Result; + + /// Visits each entry, as key then value, until `f` breaks, returning + /// what it broke with. A key has one of the scalar types Protobuf + /// allows for map keys. + /// + /// # Errors + /// + /// The runtime could not read an entry, which stops the visit. + fn for_each(&self, f: F) -> Result, R::Error> + where + F: FnMut(Val<'_, R>, Val<'_, R>) -> ControlFlow; +} + +/// A runtime for tests that never read a message. +#[cfg(test)] +pub(crate) mod testing { + use std::convert::Infallible; + use std::ops::ControlFlow; + + use super::{Field, List, Map, Message, Reader, Runtime, Val}; + + /// A runtime whose message types carry no information. It serves as + /// its own reader. + pub(crate) struct Untyped; + + impl Runtime for Untyped { + type Error = Infallible; + type MessageType = (); + type Message<'a> = Unread; + type List<'a> = Unread; + type Map<'a> = Unread; + } + + impl Reader for Untyped { + fn resolve(&self, _full_name: &str) -> Result<(), Infallible> { + Ok(()) + } + + fn message<'a>(&'a self, _message_type: &'a ()) -> Result { + Ok(Unread) + } + } + + /// A message, list or map that the test never reads. + pub(crate) struct Unread; + + impl Message for Unread { + fn has(&self, _field: &Field) -> Result { + unreachable!("the test does not read a message") + } + + fn get<'f>( + &'f self, + _field: &'f Field, + ) -> Result>, Infallible> { + unreachable!("the test does not read a message") + } + + #[expect(unreachable_code, reason = "the hidden type must be named")] + fn encode(&self) -> Result, Infallible> { + Ok::<&[u8], _>(unreachable!("the test does not read a message")) + } + } + + impl List for Unread { + fn len(&self) -> Result { + unreachable!("the test does not read a list") + } + + fn get(&self, _index: usize) -> Result>, Infallible> { + unreachable!("the test does not read a list") + } + } + + impl Map for Unread { + fn len(&self) -> Result { + unreachable!("the test does not read a map") + } + + fn for_each(&self, _f: F) -> Result, Infallible> + where + F: FnMut(Val<'_, Untyped>, Val<'_, Untyped>) -> ControlFlow, + { + unreachable!("the test does not read a map") + } + } +} diff --git a/crates/protovalidate/src/rules/build.rs b/crates/protovalidate/src/rules/build.rs new file mode 100644 index 00000000..02c1424e --- /dev/null +++ b/crates/protovalidate/src/rules/build.rs @@ -0,0 +1,1132 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Building validators from a message type's `buf.validate` options. +//! +//! Standard rules are checked natively where possible, with custom rules or +//! unknown predefined rules compiled as CEL programs. The structural rules +//! are checked by the validator directly. A message or field whose rules do not +//! compile is kept as the error, reported when validation reaches it. + +use std::collections::{HashMap, HashSet}; +use std::fmt::{self, Display, Write as _}; +use std::sync::Arc; + +use buffa::editions::FieldPresence; +use buffa_descriptor::generated::descriptor::field_descriptor_proto::Type; +use buffa_descriptor::reflect::{DynamicMessage, ReflectMessage as _, ValueRef}; +use buffa_descriptor::{ + EnumIndex, FieldDescriptor, FieldKind as DescriptorKind, MessageDescriptor, MessageIndex, + SingularKind, +}; + +use super::standard::build::Placement; +use super::standard::{self, Checks}; +use super::{ + CelPrograms, CelRule, FieldKind, FieldValidator, ItemValidator, MessageOneof, MessageValidator, + OneofRequired, ValidatorCache, ValueValidator, +}; +use crate::cel::{Env, Expression}; +use crate::descriptors::{self, Descriptors}; +use crate::protobuf::{Field, Reader, Runtime}; +use crate::validate::__buffa::oneof::field_path_element::Subscript; +use crate::validate::__buffa::oneof::field_rules::Type as RulesType; +use crate::validate::{FieldPathElement, FieldRules, Ignore, MessageOneofRule, Rule}; + +/// Compiles the rules of message types. +pub(crate) struct Builder<'a, R: Runtime> { + descriptors: &'a Descriptors, + env: &'a mut Env, + /// The resolved type of every message these rules refer to. + types: HashMap, +} + +/// Returns every message type reachable from `root`, including `root` +/// itself, that has no rules in `known` yet. +fn closure( + descriptors: &Descriptors, + root: MessageIndex, + known: &ValidatorCache, +) -> HashSet { + let pool = &descriptors.pool; + let mut closure = HashSet::new(); + let mut pending = vec![root]; + while let Some(idx) = pending.pop() { + if known.contains_key(&idx) || !closure.insert(idx) { + continue; + } + for field in pool.message(idx).fields() { + if let Some(nested) = descriptors::message_type(field) { + pending.push(nested); + } + } + } + closure +} + +/// Resolves every message type that the rules of `root`, or of a type +/// reachable from it, refer to. Types that `known` already has are copied +/// from there; the rest are looked up through `reader`. +/// +/// # Errors +/// +/// The reader did not know one of the types. +pub(crate) fn resolve( + descriptors: &Descriptors, + root: MessageIndex, + known: &ValidatorCache, + reader: &dyn Reader, +) -> Result, R::Error> { + let pool = &descriptors.pool; + let mut types = HashMap::new(); + for idx in closure(descriptors, root, known) { + let referenced = pool + .message(idx) + .fields() + .iter() + .filter_map(descriptors::message_type); + for idx in std::iter::once(idx).chain(referenced) { + if types.contains_key(&idx) { + continue; + } + let message_type = match known.get(&idx) { + Some(Ok(validator)) => validator.message_type.clone(), + _ => reader.resolve(pool.message(idx).full_name())?, + }; + types.insert(idx, message_type); + } + } + Ok(types) +} + +/// The value a set of rules applies to. +struct Target<'a> { + /// The field's kind. An item of a container is singular. + kind: DescriptorKind, + /// The value's `FieldDescriptorProto.Type`, for type checks and path + /// elements. + ty: Type, + /// The field's presence. + presence: FieldPresence, + /// The value's full name, as compile errors name it. + name: TargetName<'a>, +} + +/// How compile errors name a target: a field by its full name, and a map's +/// keys and values as the `key` and `value` fields of its entry type. +#[derive(Clone, Copy)] +struct TargetName<'a> { + message: &'a MessageDescriptor, + field: &'a FieldDescriptor, + /// For a map's keys or values, `key` or `value`. + entry: Option<&'static str>, +} + +impl Display for TargetName<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}.", self.message.full_name())?; + match self.entry { + None => f.write_str(self.field.name()), + Some(part) => write!(f, "{}.{part}", MapEntryName(self.field.name())), + } + } +} + +/// The name of a map field's synthesized entry message: the field name in +/// upper camel case, then `Entry`, as the Protobuf compiler forms it. +struct MapEntryName<'a>(&'a str); + +impl Display for MapEntryName<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let mut upper = true; + for c in self.0.chars() { + if c == '_' { + upper = true; + } else if upper { + c.to_uppercase().try_for_each(|c| f.write_char(c))?; + upper = false; + } else { + f.write_char(c)?; + } + } + f.write_str("Entry") + } +} + +impl<'a> Target<'a> { + fn field(message: &'a MessageDescriptor, field: &'a FieldDescriptor) -> Self { + Self { + kind: field.kind(), + ty: descriptors::proto_type(field), + presence: field.presence(), + name: TargetName { + message, + field, + entry: None, + }, + } + } + + /// One list element or map key or value. + fn item(kind: SingularKind, name: TargetName<'a>) -> Self { + Self { + kind: DescriptorKind::Singular(kind), + ty: singular_type(kind), + presence: FieldPresence::Implicit, + name, + } + } + + /// What one value is. + fn value(&self) -> SingularKind { + match self.kind { + DescriptorKind::Singular(kind) | DescriptorKind::List(kind) => kind, + DescriptorKind::Map { value, .. } => value, + } + } + + fn is_singular(&self) -> bool { + matches!(self.kind, DescriptorKind::Singular(_)) + } + + /// The message type of a singular message field, whose rules are + /// evaluated after the parent's. + fn nested(&self) -> Option { + match self.kind { + DescriptorKind::Singular(SingularKind::Message(nested)) => Some(nested), + _ => None, + } + } + + /// Whether rules with the given `ignore` skip an unset value. + fn ignore_empty(&self, ignore: Option) -> bool { + ignore == Some(Ignore::IGNORE_IF_ZERO_VALUE) + || (self.is_singular() && self.presence != FieldPresence::Implicit) + } +} + +/// The CEL rules of one field or message, before compilation. +struct CelExpressions { + rules: Vec, + /// The rules message that `rules` is bound to while predefined rules + /// run, as its full name and serialized bytes. + bound: Option<(String, Vec)>, +} + +impl CelExpressions { + fn new() -> Self { + Self { + rules: Vec::new(), + bound: None, + } + } + + fn push(&mut self, rule: Rule, rule_field_number: i32, rule_path: Vec) { + self.rules.push(CelRule { + id: rule.id.unwrap_or_default(), + message: rule.message.unwrap_or_default(), + expression: rule.expression.unwrap_or_default(), + rule_field_number, + rule_path, + }); + } +} + +/// The custom rules of a field or message. A bare expression is its own +/// id, and has no message. +fn custom_rules( + cel_expression: Vec, + cel: Vec, + expression_path: impl Fn(usize) -> Vec, + rule_path: impl Fn(usize) -> Vec, +) -> CelExpressions { + let mut expressions = CelExpressions::new(); + for (index, expression) in cel_expression.into_iter().enumerate() { + expressions.rules.push(CelRule { + id: expression.clone(), + message: String::new(), + expression, + rule_field_number: 0, + rule_path: expression_path(index), + }); + } + for (index, rule) in cel.into_iter().enumerate() { + expressions.push(rule, 0, rule_path(index)); + } + expressions +} + +fn indexed(mut element: FieldPathElement, index: usize) -> FieldPathElement { + element.subscript = Some(Subscript::Index(index as u64)); + element +} + +/// `prefix` followed by `elements`. +fn path( + prefix: &[&FieldPathElement], + elements: impl IntoIterator, +) -> Vec { + prefix + .iter() + .map(|element| (*element).clone()) + .chain(elements) + .collect() +} + +fn singular_type(kind: SingularKind) -> Type { + match kind { + SingularKind::Scalar(scalar) => descriptors::scalar_type(scalar), + SingularKind::Enum(_) => Type::TYPE_ENUM, + SingularKind::Message(_) => Type::TYPE_MESSAGE, + } +} + +/// The path element for a map field's entries, which carries the key and +/// value types alongside the field. +fn entry_element(field: &FieldDescriptor) -> FieldPathElement { + let mut element = descriptors::path_element(field); + if let DescriptorKind::Map { key, value } = field.kind() { + element.key_type = Some(descriptors::scalar_type(key)); + element.value_type = Some(singular_type(value)); + } + element +} + +/// The message type of a field's values, whether the field holds them +/// directly or in its items. +fn nested_type(field: &FieldValidator) -> Option { + let items = match &field.kind { + FieldKind::List { items } => items.as_deref(), + FieldKind::Map { values, .. } => values.as_deref(), + FieldKind::Singular => None, + }; + field + .value + .nested + .or_else(|| items.and_then(|items| items.value.nested)) +} + +/// Whether the rules are a scalar type's, which also apply to the type's +/// wrapper message. +fn is_scalar_rules(rules: &RulesType) -> bool { + !matches!( + rules, + RulesType::Repeated(_) + | RulesType::Map(_) + | RulesType::Any(_) + | RulesType::Duration(_) + | RulesType::FieldMask(_) + | RulesType::Timestamp(_) + ) +} + +/// The `FieldRules` field whose rules apply to values of a well-known +/// message type: its own for `Any`, `Duration`, `FieldMask` and +/// `Timestamp`, and the wrapped scalar's for a wrapper. `None` for any +/// other message type, which takes no standard rules. +fn well_known_rules(type_name: &str) -> Option<&'static str> { + Some(match type_name { + descriptors::ANY => "any", + descriptors::DURATION => "duration", + descriptors::FIELD_MASK => "field_mask", + descriptors::TIMESTAMP => "timestamp", + _ => return wrapper_rules(type_name), + }) +} + +/// The `FieldRules` field for the scalar a wrapper message holds, or +/// `None` for a message that is not a wrapper. +fn wrapper_rules(type_name: &str) -> Option<&'static str> { + Some(match type_name { + "google.protobuf.BoolValue" => "bool", + "google.protobuf.BytesValue" => "bytes", + "google.protobuf.DoubleValue" => "double", + "google.protobuf.FloatValue" => "float", + "google.protobuf.Int32Value" => "int32", + "google.protobuf.Int64Value" => "int64", + "google.protobuf.StringValue" => "string", + "google.protobuf.UInt32Value" => "uint32", + "google.protobuf.UInt64Value" => "uint64", + _ => return None, + }) +} + +/// The name of the `FieldRules` field holding the rules, for messages. +fn rules_name(rules: &RulesType) -> &'static str { + match rules { + RulesType::Float(_) => "float", + RulesType::Double(_) => "double", + RulesType::Int32(_) => "int32", + RulesType::Int64(_) => "int64", + RulesType::Uint32(_) => "uint32", + RulesType::Uint64(_) => "uint64", + RulesType::Sint32(_) => "sint32", + RulesType::Sint64(_) => "sint64", + RulesType::Fixed32(_) => "fixed32", + RulesType::Fixed64(_) => "fixed64", + RulesType::Sfixed32(_) => "sfixed32", + RulesType::Sfixed64(_) => "sfixed64", + RulesType::Bool(_) => "bool", + RulesType::String(_) => "string", + RulesType::Bytes(_) => "bytes", + RulesType::Enum(_) => "enum", + RulesType::Repeated(_) => "repeated", + RulesType::Map(_) => "map", + RulesType::Any(_) => "any", + RulesType::Duration(_) => "duration", + RulesType::FieldMask(_) => "field_mask", + RulesType::Timestamp(_) => "timestamp", + } +} + +impl<'a, R: Runtime> Builder<'a, R> { + /// Creates a builder. `types` holds the resolved type of every message + /// the rules will refer to. + pub(crate) fn new( + descriptors: &'a Descriptors, + env: &'a mut Env, + types: HashMap, + ) -> Self { + Self { + descriptors, + env, + types, + } + } + + /// Compiles the rules of `root` and of every message type reachable + /// from it, adding them to `out`. Types already in `known` are skipped. + pub(crate) fn build_closure( + &mut self, + root: MessageIndex, + known: &ValidatorCache, + out: &mut ValidatorCache, + ) { + // The reference is copied out of `self`, so the loop below can + // still take `&mut self`. + let descriptors: &'a Descriptors = self.descriptors; + let pool = &descriptors.pool; + let mut built: HashMap, String>> = HashMap::new(); + for idx in closure(descriptors, root, known) { + built.insert(idx, self.build_message(idx)); + } + + // A field whose message type did not compile does not compile either. + let mut failures = Vec::new(); + for (&idx, validator) in &built { + let Ok(validator) = validator else { + continue; + }; + for (position, field) in validator.fields.iter().enumerate() { + let Ok(compiled) = field else { + continue; + }; + let Some(nested) = nested_type(compiled) else { + continue; + }; + let error = match known.get(&nested) { + Some(validator) => validator.as_ref().err(), + None => built + .get(&nested) + .and_then(|validator| validator.as_ref().err()), + }; + let Some(error) = error else { + continue; + }; + failures.push(( + idx, + position, + format!( + "failed to compile embedded type {} for {}.{}: {error}", + pool.message(nested).full_name(), + pool.message(idx).full_name(), + compiled.field.name() + ), + )); + } + } + for (idx, position, error) in failures { + if let Some(Ok(validator)) = built.get_mut(&idx) { + validator.fields[position] = Err(error); + } + } + out.extend( + built + .into_iter() + .map(|(idx, validator)| (idx, validator.map(Arc::new))), + ); + } + + /// The resolved type of a message, which [`resolve`] found before any + /// rules were built. + fn resolved(&self, idx: MessageIndex) -> R::MessageType { + self.types + .get(&idx) + .unwrap_or_else(|| { + panic!( + "the message type {} was not resolved before the rules referring to it were built", + self.descriptors.pool.message(idx).full_name() + ) + }) + .clone() + } + + /// Describes `field` for the runtime, including the resolved type of + /// the messages it holds. + fn field(&self, field: &FieldDescriptor) -> Field { + let message_type = descriptors::message_type(field).map(|idx| self.resolved(idx)); + Field::from_descriptor(field, message_type) + } + + fn build_message(&mut self, idx: MessageIndex) -> Result, String> { + let pool = &*self.descriptors.pool; + let message = pool.message(idx); + let (custom, oneof_rules) = match descriptors::message_rules(message) { + Some(rules) => ( + Some(custom_rules( + rules.cel_expression, + rules.cel, + |_| Vec::new(), + |_| Vec::new(), + )), + rules.oneof, + ), + None => (None, Vec::new()), + }; + let MessageLevel { + oneofs: message_oneofs, + members, + } = self.message_oneofs(message, &oneof_rules)?; + let cel = match custom { + Some(custom) => self.compile(custom)?, + None => None, + }; + + let mut fields = Vec::new(); + for field in message.fields() { + let rules = descriptors::field_rules(field); + // A message-typed field runs its own rules and that of the message type itself. + if rules.is_none() && descriptors::message_type(field).is_none() { + continue; + } + let mut rules = rules.unwrap_or_default(); + // A member of a message oneof is only validated when set, unless + // it says otherwise. + if rules.ignore.is_none() && members.contains(field.name()) { + rules.ignore = Some(Ignore::IGNORE_IF_ZERO_VALUE); + } + if let Some(validator) = self.build_field(message, field, rules).transpose() { + fields.push(validator); + } + } + + Ok(MessageValidator { + message_type: self.resolved(idx), + cel, + message_oneofs, + oneofs: self.required_oneofs(message), + fields, + }) + } + + /// The oneof declarations marked `required`. + fn required_oneofs(&self, message: &MessageDescriptor) -> Vec> { + message + .oneofs() + .iter() + .filter(|oneof| { + descriptors::oneof_rules(oneof).is_some_and(|rules| rules.required.unwrap_or(false)) + }) + .map(|oneof| OneofRequired { + element: descriptors::oneof_path_element(oneof.name()), + members: oneof + .field_indices() + .iter() + .filter_map(|&index| message.fields().get(usize::from(index))) + .map(|field| self.field(field)) + .collect(), + }) + .collect() + } + + /// The `(buf.validate.message).oneof` rules, and the fields they name. + fn message_oneofs<'m>( + &self, + message: &'m MessageDescriptor, + rules: &'m [MessageOneofRule], + ) -> Result, String> { + let mut oneofs = Vec::new(); + let mut members = HashSet::new(); + for oneof in rules { + if oneof.fields.is_empty() { + return Err(format!( + "at least one field must be specified in oneof rule for the message {}", + message.full_name() + )); + } + let mut seen = HashSet::new(); + let mut fields = Vec::with_capacity(oneof.fields.len()); + for name in &oneof.fields { + if !seen.insert(name.as_str()) { + return Err(format!( + "duplicate {name} in oneof rule for the message {}", + message.full_name() + )); + } + let Some(field) = message.field_by_name(name) else { + return Err(format!( + "field {name} not found in message {}", + message.full_name() + )); + }; + fields.push(self.field(field)); + } + oneofs.push(MessageOneof { + fields, + names: oneof.fields.join(", "), + required: oneof.required.unwrap_or(false), + }); + members.extend(oneof.fields.iter().map(String::as_str)); + } + Ok(MessageLevel { oneofs, members }) + } + + /// The validator of a field, or `None` when its rules say to always + /// ignore it. + fn build_field( + &mut self, + message: &MessageDescriptor, + field: &FieldDescriptor, + rules: FieldRules, + ) -> Result>, String> { + if rules.ignore == Some(Ignore::IGNORE_ALWAYS) { + return Ok(None); + } + let target = Target::field(message, field); + let required = rules.required.unwrap_or(false); + let ignore_empty = target.ignore_empty(rules.ignore); + let (value, remaining) = self.build_value(&target, rules, &[])?; + let kind = self.build_kind(field, &target, remaining)?; + Ok(Some(FieldValidator { + field: self.field(field), + element: descriptors::path_element(field), + required, + ignore_empty, + value, + kind, + })) + } + + /// The validators of the items inside a container field. `remaining` + /// is what is left of the field's standard rules once its own checks + /// were taken from them, which for a container is the rules of its + /// items. + fn build_kind( + &mut self, + field: &FieldDescriptor, + target: &Target<'_>, + remaining: Option, + ) -> Result, String> { + let schema = &self.descriptors.schema; + match target.kind { + DescriptorKind::Singular(_) => Ok(FieldKind::Singular), + DescriptorKind::List(element) => { + let items = match remaining { + Some(RulesType::Repeated(mut repeated)) => repeated.items.take(), + _ => None, + }; + let prefix = [&schema.repeated, &schema.repeated_items]; + let item = Target::item(element, target.name); + Ok(FieldKind::List { + items: self.build_item(&item, items, &prefix).map_err(|error| { + format!( + "failed to compile items rules for repeated {}: {error}", + target.name + ) + })?, + }) + } + DescriptorKind::Map { key, value } => { + let (keys, values) = match remaining { + Some(RulesType::Map(mut map)) => (map.keys.take(), map.values.take()), + _ => (None, None), + }; + let keys_prefix = [&schema.map, &schema.map_keys]; + let values_prefix = [&schema.map, &schema.map_values]; + let entry = |part| TargetName { + entry: Some(part), + ..target.name + }; + let key_target = Target::item(SingularKind::Scalar(key), entry("key")); + let value_target = Target::item(value, entry("value")); + Ok(FieldKind::Map { + element: entry_element(field), + keys: self + .build_item(&key_target, keys, &keys_prefix) + .map_err(|error| { + format!( + "failed to compile key rules for map {}: {error}", + target.name + ) + })?, + values: self + .build_item(&value_target, values, &values_prefix) + .map_err(|error| { + format!( + "failed to compile value rules for map {}: {error}", + target.name + ) + })?, + }) + } + } + } + + /// The validator of a container's items. + fn build_item( + &mut self, + target: &Target<'_>, + rules: Option, + prefix: &[&FieldPathElement], + ) -> Result>>, String> { + let Some(rules) = rules else { + return Ok(target.nested().map(|nested| { + Box::new(ItemValidator { + ignore_empty: false, + value: ValueValidator { + nested: Some(nested), + ..ValueValidator::default() + }, + }) + })); + }; + if rules.ignore == Some(Ignore::IGNORE_ALWAYS) { + return Ok(None); + } + let ignore_empty = target.ignore_empty(rules.ignore); + // An item is not a container, so nothing of its standard rules + // remains once its checks are taken. + let (value, _) = self.build_value(target, rules, prefix)?; + Ok(Some(Box::new(ItemValidator { + ignore_empty, + value, + }))) + } + + /// The rules of one value. `prefix` is prepended to their rule paths. + /// Also returns what is left of the standard rules message once the + /// native checks took their fields from it; see [`Self::build_kind`]. + fn build_value( + &mut self, + target: &Target<'_>, + rules: FieldRules, + prefix: &[&FieldPathElement], + ) -> Result<(ValueValidator, Option), String> { + let schema = &self.descriptors.schema; + let custom = custom_rules( + rules.cel_expression, + rules.cel, + |index| path(prefix, [indexed(schema.cel_expression.clone(), index)]), + |index| path(prefix, [indexed(schema.cel.clone(), index)]), + ); + let mut value = ValueValidator { + custom: self.compile(custom)?, + ..ValueValidator::default() + }; + + let mut predefined = CelExpressions::new(); + let remaining = match rules.r#type { + Some(standard) => { + Some(self.standard_rules(target, standard, prefix, &mut value, &mut predefined)?) + } + None => None, + }; + value.predefined = self.compile(predefined)?; + + // A message value's own type is validated after its rules. A + // container field's messages are its items', validated there. + value.nested = target.nested(); + Ok((value, remaining)) + } + + /// The standard rules set in a `FieldRules`, after checking that they + /// are the rules for the value's type. Returns what is left of them + /// once the native checks took their fields. + fn standard_rules( + &mut self, + target: &Target<'_>, + standard: RulesType, + prefix: &[&FieldPathElement], + value: &mut ValueValidator, + predefined: &mut CelExpressions, + ) -> Result { + let got = rules_name(&standard); + match self.expected_rules(target) { + Some(expected) if expected == got => {} + Some(expected) => { + return Err(format!( + "expected rule \"buf.validate.FieldRules.{expected}\", \ + got \"buf.validate.FieldRules.{got}\" on field \"{}\"", + target.name + )); + } + None => { + return Err(format!( + "mismatched message rules, \"buf.validate.FieldRules.{got}\" \ + is not a valid rule for field \"{}\"", + target.name + )); + } + } + let enum_ = if is_scalar_rules(&standard) { + value.wrapper = self + .message(target) + .and_then(|wrapper| wrapper.field(1)) + .map(|field| self.field(field)); + match target.kind { + DescriptorKind::Singular(SingularKind::Enum(idx)) => Some(idx), + _ => None, + } + } else { + if let (RulesType::Repeated(rules), DescriptorKind::List(SingularKind::Message(_))) = + (&standard, target.kind) + && rules.unique == Some(true) + { + // `unique()` compares scalars. Wrapper elements stand for + // the scalars they hold, as they do for every other rule, + // and are compared through their `value` field. Any other + // message element would fail every validation. + let wrapper = self + .message(target) + .filter(|message| wrapper_rules(message.full_name()).is_some()) + .and_then(|wrapper| wrapper.field(1)); + let Some(wrapper) = wrapper else { + return Err("repeated.unique is not supported for message items".to_owned()); + }; + value.wrapper = Some(self.field(wrapper)); + } + None + }; + let (checks, remaining) = self.standard_checks(got, standard, prefix, enum_, predefined)?; + value.checks = checks; + Ok(remaining) + } + + /// The message type of a target's values, if they are messages. + fn message(&self, target: &Target<'_>) -> Option<&MessageDescriptor> { + match target.value() { + SingularKind::Message(idx) => Some(self.descriptors.pool.message(idx)), + _ => None, + } + } + + /// The `FieldRules` field whose rules apply to the target: `repeated` + /// and `map` for the containers, whose elements' rules go under + /// `items`, `keys` and `values`; the scalar type's for a scalar, an + /// enum or a wrapper; the well-known type's for the others that have + /// one. `None` for a message type that takes no standard rules. + fn expected_rules(&self, target: &Target<'_>) -> Option<&'static str> { + match target.kind { + DescriptorKind::List(_) => Some("repeated"), + DescriptorKind::Map { .. } => Some("map"), + DescriptorKind::Singular(SingularKind::Message(idx)) => { + well_known_rules(self.descriptors.pool.message(idx).full_name()) + } + DescriptorKind::Singular(_) => Some(descriptors::type_name(target.ty)), + } + } + + /// The checks of every rule field set in the rules message. + /// + /// A rule field with a native check is removed from the message as its + /// check is built. Any rule field still set afterwards, which is an + /// extension or a field without a native check, is evaluated with its + /// predefined CEL expression instead. That runs after the native + /// checks, with `rules` bound to the rules message and `rule` to the + /// field. What remains of the message is returned with the checks. + fn standard_checks( + &self, + type_field: &'static str, + standard: RulesType, + prefix: &[&FieldPathElement], + enum_: Option, + predefined: &mut CelExpressions, + ) -> Result<(Checks, RulesType), String> { + let pool = &self.descriptors.pool; + let (rules, mut remaining) = self.dynamic_rules(type_field, standard); + let idx = rules.message_index(); + let message = rules.message_descriptor(); + let full_name = message.full_name(); + if !rules.unknown_fields().is_empty() { + return Err(format!("unknown rules in {full_name}")); + } + let type_element = self.descriptors.schema.type_element(pool, type_field); + let rule_path = |element: FieldPathElement| path(prefix, [type_element.clone(), element]); + let rule_field_path = |number: u32| { + let field = message + .field(number) + .unwrap_or_else(|| panic!("{full_name} has a field {number}")); + rule_path(descriptors::path_element(field)) + }; + + let checks = standard::build::checks( + type_field, + &mut remaining, + &Placement { + path: &rule_field_path, + r#enum: enum_, + }, + )?; + + let (unchecked, remaining) = self.dynamic_rules(type_field, remaining); + unchecked.for_each_set(&mut |field, _value| { + // `example` documents the field; its rule is `true`. + if field.name() == "example" { + return; + } + let element = match pool.extension_for(idx, field.number()) { + Some(extension) if message.field(field.number()).is_none() => { + descriptors::extension_path_element(extension) + } + _ => descriptors::path_element(field), + }; + let Some(option) = descriptors::predefined_rules(field) else { + return; + }; + let number = descriptors::field_number(field.number()); + for rule in option.cel { + predefined.push(rule, number, rule_path(element.clone())); + } + }); + predefined.bound = Some((full_name.to_owned(), rules.encode_to_vec())); + Ok((checks, remaining)) + } + + /// The rules message set in `standard`, as a dynamic message, with + /// `standard` handed back. + fn dynamic_rules(&self, type_field: &str, standard: RulesType) -> (DynamicMessage, RulesType) { + let pool = &self.descriptors.pool; + let field_rules = FieldRules { + r#type: Some(standard), + ..Default::default() + }; + let dynamic = DynamicMessage::from_message( + &field_rules, + Arc::clone(pool), + self.descriptors.schema.field_rules, + ); + let field = dynamic + .message_descriptor() + .field_by_name(type_field) + .unwrap_or_else(|| panic!("FieldRules.{type_field} exists")); + let rules = match dynamic.get(field) { + ValueRef::Message(rules) => rules.to_dynamic(), + _ => unreachable!("FieldRules.{type_field} holds a message"), + }; + let Some(standard) = field_rules.r#type else { + unreachable!("the rules were just put in FieldRules.{type_field}") + }; + (rules, standard) + } + + fn compile(&mut self, expressions: CelExpressions) -> Result, String> { + if expressions.rules.is_empty() { + return Ok(None); + } + let bound = expressions + .bound + .as_ref() + .map(|(name, bytes)| (name.as_str(), bytes.as_slice())); + let to_compile: Vec> = expressions + .rules + .iter() + .map(|rule| Expression { + expression: &rule.expression, + rule_field_number: rule.rule_field_number, + }) + .collect(); + let program = match self.env.compile(bound, &to_compile) { + Ok(program) => program, + Err(error) => { + // The engine compiles the expressions together and names + // none in its error, so find the one at fault. + let culprit = + expressions + .rules + .iter() + .zip(&to_compile) + .find_map(|(rule, expression)| { + self.env + .compile(bound, std::slice::from_ref(expression)) + .err() + .map(|error| (rule.id.as_str(), error)) + }); + return Err(match culprit { + Some((id, error)) => { + format!("failed to compile expression {id}: {}", error.message()) + } + None => error.message().to_owned(), + }); + } + }; + Ok(Some(CelPrograms { + program, + rules: expressions.rules, + })) + } +} + +/// A message's oneof rules, and the fields they name. +struct MessageLevel<'m, R: Runtime> { + oneofs: Vec>, + members: HashSet<&'m str>, +} + +#[cfg(all(test, feature = "cel"))] +mod tests { + use buffa::{ExtensionSet as _, UnknownField, UnknownFieldData}; + use buffa_descriptor::generated::descriptor::field_descriptor_proto::{Label, Type}; + use buffa_descriptor::generated::descriptor::{ + DescriptorProto, FieldDescriptorProto, FieldOptions, FileDescriptorProto, FileDescriptorSet, + }; + + use super::Builder; + use crate::cel::{ScalarValue, This, Value}; + use crate::descriptors::{self, Descriptors}; + use crate::protobuf::testing::Untyped; + use crate::rules::ValidatorCache; + use crate::rules::standard::Checks; + use crate::validate::__buffa::oneof::field_rules::Type as RulesType; + use crate::validate::{FIELD, FieldRules, PREDEFINED, PredefinedRules, Rule, StringRules}; + use crate::validator::cel_env; + + fn schema_with_test_len() -> FileDescriptorSet { + let mut set = descriptors::base_file_set(); + let validate = set + .file + .iter_mut() + .find(|file| file.name.as_deref() == Some("buf/validate/validate.proto")) + .expect("validate.proto is in the embedded set"); + let string_rules = validate + .message_type + .iter_mut() + .find(|message| message.name.as_deref() == Some("StringRules")) + .expect("StringRules is in validate.proto"); + let mut options = FieldOptions::default(); + options.set_extension( + &PREDEFINED, + PredefinedRules { + cel: vec![Rule { + id: Some("string.test_len".to_owned()), + message: Some("must be test_len long".to_owned()), + expression: Some("size(this) == rule".to_owned()), + ..Default::default() + }], + ..Default::default() + }, + ); + string_rules.field.push(FieldDescriptorProto { + name: Some("test_len".to_owned()), + number: Some(999), + label: Some(Label::LABEL_OPTIONAL), + r#type: Some(Type::TYPE_UINT64), + options: Some(options).into(), + ..Default::default() + }); + + let mut string = StringRules::default(); + string.unknown_fields_mut().push(UnknownField { + number: 999, + data: UnknownFieldData::Varint(3), + }); + let mut options = FieldOptions::default(); + options.set_extension( + &FIELD, + FieldRules { + r#type: Some(RulesType::String(Box::new(string))), + ..Default::default() + }, + ); + set.file.push(FileDescriptorProto { + name: Some("test.proto".to_owned()), + package: Some("test".to_owned()), + dependency: vec!["buf/validate/validate.proto".to_owned()], + message_type: vec![DescriptorProto { + name: Some("Message".to_owned()), + field: vec![FieldDescriptorProto { + name: Some("s".to_owned()), + number: Some(1), + label: Some(Label::LABEL_OPTIONAL), + r#type: Some(Type::TYPE_STRING), + options: Some(options).into(), + ..Default::default() + }], + ..Default::default() + }], + syntax: Some("proto3".to_owned()), + ..Default::default() + }); + set + } + + #[test] + fn unknown_standard_rule_falls_back_to_predefined_cel() { + let set = schema_with_test_len(); + let mut env = cel_env(&set); + let descriptors = Descriptors::from_set(set); + let index = descriptors + .pool + .message_index("test.Message") + .expect("test.Message is in the pool"); + let known = ValidatorCache::::default(); + let mut out = ValidatorCache::default(); + let types = + super::resolve(&descriptors, index, &known, &Untyped).expect("every type resolves"); + Builder::new(&descriptors, &mut env, types).build_closure(index, &known, &mut out); + + let validator = out[&index].as_ref().expect("the message compiles"); + let field = validator.fields[0].as_ref().expect("the field compiles"); + assert!( + matches!(&field.value.checks, Checks::String(checks) if checks.is_empty()), + "no native check covers test_len" + ); + let predefined = field + .value + .predefined + .as_ref() + .expect("test_len is checked by its predefined CEL"); + assert_eq!(predefined.rules.len(), 1); + assert_eq!(predefined.rules[0].id, "string.test_len"); + assert_eq!(predefined.rules[0].message, "must be test_len long"); + let rule_path: Vec<&str> = predefined.rules[0] + .rule_path + .iter() + .filter_map(|element| element.field_name.as_deref()) + .collect(); + assert_eq!(rule_path, ["string", "test_len"]); + // `rule` is bound to the rule's value, 3. + assert!(matches!( + predefined + .program + .eval(0, This::Scalar(ScalarValue::String("abc"))), + Ok(Value::Bool(true)) + )); + assert!(matches!( + predefined + .program + .eval(0, This::Scalar(ScalarValue::String("ab"))), + Ok(Value::Bool(false)) + )); + } +} diff --git a/crates/protovalidate/src/rules/eval.rs b/crates/protovalidate/src/rules/eval.rs new file mode 100644 index 00000000..be659baf --- /dev/null +++ b/crates/protovalidate/src/rules/eval.rs @@ -0,0 +1,1034 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Walking a message with its validators. +//! +//! A [`Walk`] is one validation. The validators drive it, each reading its +//! part of the message through the runtime. A violation records the field +//! path the walk is at and the rule path compiled into the check. Anything +//! that ends the walk early, a read failing or the first violation when +//! failing fast, propagates as an [`Abort`] through `?`. + +use std::borrow::Cow; +use std::cell::OnceCell; +use std::marker::PhantomData; +use std::ops::ControlFlow; +use std::sync::{PoisonError, RwLock}; + +use buffa_descriptor::{DescriptorPool, MessageIndex}; + +use super::standard::{ + Check, Checks, Duration, EnumTest, ListTest, MapTest, Test, Timestamp, UniqueKey, + has_duplicates, total_nanos, +}; +use super::{ + CelPrograms, FieldKind, FieldValidator, ItemValidator, MessageOneof, MessageValidator, + OneofRequired, ValidatorCache, ValueValidator, +}; +use crate::Error; +use crate::cel::{self, Env, Frame, ScalarValue, This, Value}; +use crate::descriptors::{self, Descriptors, Schema, wkt}; +use crate::protobuf::{ + Field, Kind, List as _, Map as _, Message as _, Runtime, Scalar, Singular, Val, +}; +use crate::validate::__buffa::oneof::field_path_element::Subscript; +use crate::validate::{FieldPath, FieldPathElement, Violation}; + +/// Why the walk stopped before the end of the message. +pub(crate) enum Abort { + Error(Error), + /// A violation was found while failing fast. + FailFast, +} + +impl From> for Abort { + fn from(error: Error) -> Self { + Self::Error(error) + } +} + +/// How the CEL backend's errors map to the validator's. +impl From for Abort { + fn from(error: cel::Error) -> Self { + Self::Error(match error { + cel::Error::Runtime(message) => Error::Evaluation(message), + cel::Error::Argument(message) => Error::Argument(message), + cel::Error::Compilation(message) | cel::Error::Unexpected(message) => { + Error::Unexpected(message) + } + }) + } +} + +/// Converts the result of reading the message into the walk's result. +trait Read { + fn read(self) -> Result>; +} + +impl Read for Result { + fn read(self) -> Result> { + self.map_err(|error| Abort::Error(Error::Read(error))) + } +} + +/// One element of the walk's current field path. +struct PathElement<'a> { + element: &'a FieldPathElement, + subscript: Option, +} + +/// The violations found so far, and where the walk is. +pub(crate) struct Violations<'a> { + fail_fast: bool, + /// The field path from the root to the value being validated. + path: Vec>, + /// Whether the value being validated is a map key. + for_key: bool, + list: Vec, +} + +impl Violations<'_> { + fn new(fail_fast: bool) -> Self { + Self { + fail_fast, + path: Vec::new(), + for_key: false, + list: Vec::new(), + } + } + + /// Records a violation at the current path. When failing fast, the + /// walk stops here. + fn push( + &mut self, + id: &str, + message: String, + rule_path: &[FieldPathElement], + ) -> Result<(), Abort> { + let field_path = |elements: Vec| { + (!elements.is_empty()).then(|| FieldPath { + elements, + ..Default::default() + }) + }; + let field = self + .path + .iter() + .map(|at| { + let mut element = at.element.clone(); + element.subscript.clone_from(&at.subscript); + element + }) + .collect(); + self.list.push(Violation { + field: field_path(field).into(), + rule: field_path(rule_path.to_vec()).into(), + rule_id: Some(id.to_owned()), + message: Some(message), + for_key: self.for_key.then_some(true), + ..Default::default() + }); + if self.fail_fast { + Err(Abort::FailFast) + } else { + Ok(()) + } + } + + /// Sets the subscript of the container field the walk is at to the + /// item being validated. + fn subscript(&mut self, subscript: Option) { + if let Some(at) = self.path.last_mut() { + at.subscript = subscript; + } + } + + /// Sets the subscript of the walk's current container field in every + /// violation recorded since index `recorded`. The subscript is only + /// computed if there is such a violation. + fn subscript_since(&mut self, recorded: usize, subscript: impl FnOnce() -> Option) { + let (Some(depth), Some(violations)) = ( + self.path.len().checked_sub(1), + self.list + .get_mut(recorded..) + .filter(|list| !list.is_empty()), + ) else { + return; + }; + let subscript = subscript(); + for violation in violations { + if let Some(element) = violation + .field + .as_option_mut() + .and_then(|field| field.elements.get_mut(depth)) + { + element.subscript.clone_from(&subscript); + } + } + } +} + +/// One validation. +pub(crate) struct Walk<'a, R: Runtime> { + pool: &'a DescriptorPool, + schema: &'a Schema, + env: &'a RwLock, + validators: &'a ValidatorCache, + out: Violations<'a>, + runtime: PhantomData, +} + +impl<'a, R: Runtime> Walk<'a, R> { + pub(crate) fn new( + descriptors: &'a Descriptors, + env: &'a RwLock, + validators: &'a ValidatorCache, + fail_fast: bool, + ) -> Self { + Self { + pool: &descriptors.pool, + schema: &descriptors.schema, + env, + validators, + out: Violations::new(fail_fast), + runtime: PhantomData, + } + } + + /// Validates `message`, of type `type_name`, returning the violations. + /// The message is serialized, for CEL, only if a rule needs it. + pub(crate) fn validate( + mut self, + validator: &'a MessageValidator, + message: &R::Message<'_>, + type_name: &str, + ) -> Result, Error> { + let frame = CelFrame::new(self.env, type_name, message); + match validator.validate(&mut self, message, &frame) { + Ok(()) | Err(Abort::FailFast) => Ok(self.out.list), + Err(Abort::Error(error)) => Err(error), + } + } + + /// Runs `f` with `element` appended to the field path. + fn at( + &mut self, + element: &'a FieldPathElement, + f: impl FnOnce(&mut Self) -> Result>, + ) -> Result> { + self.out.path.push(PathElement { + element, + subscript: element.subscript.clone(), + }); + let result = f(self); + self.out.path.pop(); + result + } + + /// Runs `f` validating a map key. + fn for_key( + &mut self, + f: impl FnOnce(&mut Self) -> Result>, + ) -> Result> { + self.out.for_key = true; + let result = f(self); + self.out.for_key = false; + result + } + + /// The validator of a message type reachable from the root, or why + /// its rules did not compile. + fn validator(&self, index: MessageIndex) -> Result<&'a MessageValidator, Abort> { + let validators = self.validators; + match validators.get(&index) { + Some(Ok(validator)) => Ok(validator), + Some(Err(error)) => Err(Error::Compilation(error.clone()).into()), + None => Err(Error::Unexpected(format!( + "rules not loaded for message: {}", + self.pool.message(index).full_name() + )) + .into()), + } + } +} + +/// A message as CEL sees it, parsed on first use. +/// +/// Frames nest on the stack the way the walk does, so one outlives every +/// program run against it. +pub(crate) struct CelFrame<'a, 'm, R: Runtime> { + env: &'a RwLock, + type_name: &'a str, + message: &'a R::Message<'m>, + parsed: OnceCell, +} + +impl<'a, 'm, R: Runtime> CelFrame<'a, 'm, R> { + fn new(env: &'a RwLock, type_name: &'a str, message: &'a R::Message<'m>) -> Self { + Self { + env, + type_name, + message, + parsed: OnceCell::new(), + } + } + + /// The parsed message. + fn parsed(&self) -> Result<&Frame, Abort> { + if let Some(frame) = self.parsed.get() { + return Ok(frame); + } + let bytes = self.message.encode().read()?; + let frame = self + .env + .read() + .unwrap_or_else(PoisonError::into_inner) + .frame(self.type_name, bytes.as_ref())?; + Ok(self.parsed.get_or_init(|| frame)) + } +} + +/// Where a value's CEL rules get `this` from. +enum CelBind<'v, 'a, 'm, R: Runtime> { + /// A field of the frame's message. + Field(&'v CelFrame<'a, 'm, R>, &'v Field), + /// One element, key or map value, of this kind. + Item(Singular), +} + +// Only references: copied freely, whatever the runtime is. +impl Clone for CelBind<'_, '_, '_, R> { + fn clone(&self) -> Self { + *self + } +} + +impl Copy for CelBind<'_, '_, '_, R> {} + +impl MessageValidator { + fn validate<'a>( + &'a self, + walk: &mut Walk<'a, R>, + message: &R::Message<'_>, + frame: &CelFrame<'_, '_, R>, + ) -> Result<(), Abort> { + if let Some(cel) = &self.cel { + cel.run(This::Message(frame.parsed()?), &mut walk.out)?; + } + for oneof in &self.message_oneofs { + oneof.check(walk, message)?; + } + for oneof in &self.oneofs { + oneof.check(walk, message)?; + } + for field in &self.fields { + let field = field + .as_ref() + .map_err(|error| Error::Compilation(error.clone()))?; + field.validate(walk, message, frame)?; + } + Ok(()) + } +} + +impl CelPrograms { + /// Runs each expression against `this`, recording its failures as + /// violations. An expression passes by producing `true` or an empty + /// string. `false` fails with the rule's own message, and a non-empty + /// string fails with that string as the message. + fn run(&self, this: This<'_>, out: &mut Violations<'_>) -> Result<(), Abort> { + for (index, meta) in self.rules.iter().enumerate() { + let value = self.program.eval(index, this).map_err(|error| { + Error::Evaluation(format!("error evaluating {}: {}", meta.id, error.message())) + })?; + let message = match value { + Value::Bool(true) => continue, + Value::Bool(false) if meta.message.is_empty() => { + format!("\"{}\" returned false", meta.expression) + } + Value::Bool(false) => meta.message.clone(), + Value::String(text) if text.is_empty() => continue, + Value::String(text) => text, + Value::Other => { + return Err(Error::Evaluation(format!( + "expression {} outputs an unexpected type, wanted either bool or string", + meta.id + )) + .into()); + } + }; + out.push(&meta.id, message, &meta.rule_path)?; + } + Ok(()) + } +} + +impl MessageOneof { + fn check( + &self, + walk: &mut Walk<'_, R>, + message: &R::Message<'_>, + ) -> Result<(), Abort> { + let mut set = 0; + for field in &self.fields { + if has::(message, field)? { + set += 1; + } + } + if set > 1 { + let message = format!("only one of {} can be set", self.names); + walk.out.push("message.oneof", message, &[])?; + } + if self.required && set == 0 { + let message = format!("one of {} must be set", self.names); + walk.out.push("message.oneof", message, &[])?; + } + Ok(()) + } +} + +impl OneofRequired { + fn check<'a>( + &'a self, + walk: &mut Walk<'a, R>, + message: &R::Message<'_>, + ) -> Result<(), Abort> { + for member in &self.members { + if has::(message, member)? { + return Ok(()); + } + } + walk.at(&self.element, |walk| { + walk.out.push( + "required", + "exactly one field is required in oneof".to_owned(), + &[], + ) + }) + } +} + +impl FieldValidator { + /// Validates one field. + fn validate<'a>( + &'a self, + walk: &mut Walk<'a, R>, + message: &R::Message<'_>, + frame: &CelFrame<'_, '_, R>, + ) -> Result<(), Abort> { + let value = message.get(&self.field).read()?; + let set = if self.field.has_presence() { + message.has(&self.field).read()? + } else { + is_set::(value.as_ref())? + }; + if !set { + if self.required { + let required = std::slice::from_ref(&walk.schema.required); + return walk.at(&self.element, |walk| { + walk.out + .push("required", "value is required".to_owned(), required) + }); + } + if self.ignore_empty { + return Ok(()); + } + } + + walk.at(&self.element, |walk| { + self.value + .validate(walk, value.as_ref(), CelBind::Field(frame, &self.field)) + })?; + + match (&self.kind, &value, self.field.kind()) { + ( + FieldKind::List { items: Some(items) }, + Some(Val::List(list)), + Kind::List(element), + ) => walk.at(&self.element, |walk| { + items.validate_list(walk, list, element) + }), + ( + FieldKind::Map { + element, + keys, + values, + }, + Some(Val::Map(map)), + Kind::Map { key, value: entry }, + ) => walk.at(element, |walk| { + let entries = Entries { + key: Singular::Scalar(key), + value: entry, + keys: keys.as_deref(), + values: values.as_deref(), + }; + validate_map(walk, map, &entries) + }), + _ => Ok(()), + } + } +} + +impl ItemValidator { + /// Validates each element of a list, of kind `element`, subscripted by + /// its index. + fn validate_list( + &self, + walk: &mut Walk<'_, R>, + list: &R::List<'_>, + element: Singular, + ) -> Result<(), Abort> { + let len = list.len().read()?; + for index in 0..len { + let Some(item) = list.get(index).read()? else { + continue; + }; + if self.ignore_empty && is_empty_item::(&item)? { + continue; + } + walk.out.subscript(Some(Subscript::Index(index as u64))); + self.value + .validate(walk, Some(&item), CelBind::Item(element))?; + } + Ok(()) + } +} + +/// A map field's entries, and their validators. +struct Entries<'a, R: Runtime> { + key: Singular, + value: Singular, + keys: Option<&'a ItemValidator>, + values: Option<&'a ItemValidator>, +} + +/// Validates each entry of a map, subscripted by its key. +fn validate_map( + walk: &mut Walk<'_, R>, + map: &R::Map<'_>, + entries: &Entries<'_, R>, +) -> Result<(), Abort> { + let visited = map + .for_each( + |key, value| match validate_entry(walk, entries, &key, &value) { + Ok(()) => ControlFlow::Continue(()), + Err(abort) => ControlFlow::Break(abort), + }, + ) + .read()?; + visited.break_value().map_or(Ok(()), Err) +} + +fn validate_entry( + walk: &mut Walk<'_, R>, + entries: &Entries<'_, R>, + key: &Val<'_, R>, + value: &Val<'_, R>, +) -> Result<(), Abort> { + let recorded = walk.out.list.len(); + let result = validate_entry_values(walk, entries, key, value); + walk.out.subscript_since(recorded, || key_subscript(key)); + result +} + +fn validate_entry_values( + walk: &mut Walk<'_, R>, + entries: &Entries<'_, R>, + key: &Val<'_, R>, + value: &Val<'_, R>, +) -> Result<(), Abort> { + if let Some(keys) = entries.keys + && !(keys.ignore_empty && is_empty_item::(key)?) + { + walk.for_key(|walk| { + keys.value + .validate(walk, Some(key), CelBind::Item(entries.key)) + })?; + } + if let Some(values) = entries.values + && !(values.ignore_empty && is_empty_item::(value)?) + { + values + .value + .validate(walk, Some(value), CelBind::Item(entries.value))?; + } + Ok(()) +} + +impl ValueValidator { + /// Validates one value, then the message it holds. + fn validate( + &self, + walk: &mut Walk<'_, R>, + value: Option<&Val<'_, R>>, + bind: CelBind<'_, '_, '_, R>, + ) -> Result<(), Abort> { + let sub = match value { + Some(Val::Message(sub)) => Some(sub), + _ => None, + }; + // A message value is bound to `this`, and validated, through a + // frame of its own, parsed at most once. + let nested = match (sub, self.nested) { + (Some(sub), Some(index)) => { + let type_name = walk.pool.message(index).full_name(); + Some(( + walk.validator(index)?, + CelFrame::new(walk.env, type_name, sub), + )) + } + _ => None, + }; + let child = nested.as_ref().map(|(_, child)| child); + + if let Some(custom) = &self.custom { + custom.run(cel_this(value, bind, child)?, &mut walk.out)?; + } + self.checks.check(walk, value, self.wrapper.as_ref())?; + if let Some(predefined) = &self.predefined { + predefined.run(cel_this(value, bind, child)?, &mut walk.out)?; + } + if let (Some(sub), Some((validator, child))) = (sub, &nested) { + validator.validate(walk, sub, child)?; + } + Ok(()) + } +} + +/// What `this` is bound to: a scalar value directly, and a message, list +/// or map through the parsed frame it lives in. +fn cel_this<'v, R: Runtime>( + value: Option<&'v Val<'_, R>>, + bind: CelBind<'v, '_, '_, R>, + child: Option<&'v CelFrame<'_, '_, R>>, +) -> Result, Abort> { + let kind = match bind { + CelBind::Field(_, field) => match field.kind() { + Kind::Singular(kind) => kind, + Kind::List(_) | Kind::Map { .. } => Singular::Message, + }, + CelBind::Item(kind) => kind, + }; + if let Some(scalar) = cel_scalar(value, kind) { + return Ok(This::Scalar(scalar)); + } + match (bind, child) { + (CelBind::Field(frame, field), _) => Ok(This::Field( + frame.parsed()?, + descriptors::field_number(field.number()), + )), + (CelBind::Item(_), Some(child)) => Ok(This::Message(child.parsed()?)), + (CelBind::Item(_), None) => { + Err(Error::Unexpected("no message to bind this to".to_owned()).into()) + } + } +} + +impl Checks { + /// Runs the standard checks against a value. A wrapper message is + /// checked through its `value` field, matching how CEL unboxes wrappers. + /// For a list of wrappers, `wrapper` is the elements' `value` field. + fn check( + &self, + walk: &mut Walk<'_, R>, + value: Option<&Val<'_, R>>, + wrapper: Option<&Field>, + ) -> Result<(), Abort> { + match (wrapper, value) { + (Some(wrapper), Some(Val::Message(message))) => { + let unboxed = message.get(wrapper).read()?; + self.check_value(walk, unboxed.as_ref(), None) + } + (Some(wrapper), Some(Val::List(_))) => self.check_value(walk, value, Some(wrapper)), + (Some(_), _) => self.check_value(walk, None, None), + (None, value) => self.check_value(walk, value, None), + } + } + + /// `element_wrapper` is the `value` field of a list's wrapper elements, + /// which `unique` compares through. + fn check_value( + &self, + walk: &mut Walk<'_, R>, + value: Option<&Val<'_, R>>, + element_wrapper: Option<&Field>, + ) -> Result<(), Abort> { + let pool = walk.pool; + let out = &mut walk.out; + match self { + Self::None => Ok(()), + Self::Bool(checks) => run(checks, &bool_of(value)?, out), + Self::Int(checks) => run(checks, &int_of(value)?, out), + Self::Uint(checks) => run(checks, &uint_of(value)?, out), + Self::Double(checks) => run(checks, &double_of(value)?, out), + Self::String(checks) => run(checks, str_of(value)?, out), + Self::Bytes(checks) => run(checks, bytes_of(value)?, out), + Self::Duration(checks) => run(checks, &Duration(nanos_of(value)?), out), + Self::Timestamp(checks) => run(checks, &Timestamp(nanos_of(value)?), out), + Self::FieldMask(checks) => with_paths(value, |paths| run(checks, paths, out))?, + Self::Any(checks) => { + let field = wkt::any_type_url(); + let type_url = match value { + Some(Val::Message(any)) => any.get(&field).read()?, + None => None, + Some(other) => return Err(mismatch("an Any", other)), + }; + let type_url = match &type_url { + Some(Val::String(url)) => url.as_ref(), + _ => "", + }; + run(checks, type_url, out) + } + Self::Enum(checks) => { + let number = enum_of(value)?; + run_with(checks, out, |test| { + Ok(match test { + EnumTest::Cmp(cmp) => evaluate(cmp, &i64::from(number))?, + EnumTest::DefinedOnly(index) => { + pool.enumeration(*index).value(number).is_none() + } + }) + }) + } + Self::List(checks) => { + let list = match value { + Some(Val::List(list)) => Some(list), + None => None, + Some(other) => return Err(mismatch("a list", other)), + }; + let len = match list { + Some(list) => list.len().read()?, + None => 0, + }; + run_with(checks, out, |test| { + Ok(match (test, list) { + (ListTest::MinItems(n), _) => (len as u64) < *n, + (ListTest::MaxItems(n), _) => len as u64 > *n, + (ListTest::Unique, Some(list)) => { + has_duplicate_items::(list, len, element_wrapper)? + } + (ListTest::Unique, None) => false, + }) + }) + } + Self::Map(checks) => { + let len = match value { + Some(Val::Map(map)) => map.len().read()?, + None => 0, + Some(other) => return Err(mismatch("a map", other)), + }; + run_with(checks, out, |test| { + Ok(match test { + MapTest::MinPairs(n) => (len as u64) < *n, + MapTest::MaxPairs(n) => len as u64 > *n, + }) + }) + } + } + } +} + +/// Runs checks of one type against the value they test. +fn run(checks: &[Check], value: &V, out: &mut Violations<'_>) -> Result<(), Abort> +where + T: Test, + V: ?Sized, +{ + run_with(checks, out, |test| evaluate(test, value)) +} + +/// Runs checks whose test needs more than the value, recording a violation +/// for each one `fails` reports. +fn run_with( + checks: &[Check], + out: &mut Violations<'_>, + mut fails: impl FnMut(&T) -> Result>, +) -> Result<(), Abort> { + for check in checks { + if fails(&check.test)? { + out.push(&check.id, check.message.clone(), &check.rule_path)?; + } + } + Ok(()) +} + +/// Whether a test fails, or why it could not be evaluated. +fn evaluate(test: &T, value: &V) -> Result> +where + T: Test, + V: ?Sized, +{ + test.fails(value) + .map_err(|message| Error::Evaluation(message).into()) +} + +/// Whether a field is set. +fn has(message: &R::Message<'_>, field: &Field) -> Result> { + if field.has_presence() { + return message.has(field).read(); + } + is_set::(message.get(field).read()?.as_ref()) +} + +/// Whether a field that does not track presence is set. A double is +/// compared by its bits, so a negative zero counts as set, since it +/// serializes. `None` is a field the message does not have at all. +fn is_set(value: Option<&Val<'_, R>>) -> Result> { + Ok(match value { + None => false, + Some(Val::Bool(b)) => *b, + Some(Val::Int(i)) => *i != 0, + Some(Val::Uint(u)) => *u != 0, + Some(Val::Double(f)) => f.to_bits() != 0, + Some(Val::Enum(e)) => *e != 0, + Some(Val::String(s)) => !s.is_empty(), + Some(Val::Bytes(b)) => !b.is_empty(), + Some(Val::Message(_)) => true, + Some(Val::List(list)) => list.len().read()? != 0, + Some(Val::Map(map)) => map.len().read()? != 0, + }) +} + +/// Whether a repeated element or map value is its type's zero value, as +/// `IGNORE_IF_ZERO_VALUE` defines it. +fn is_empty_item(value: &Val<'_, R>) -> Result> { + Ok(match value { + Val::Bool(b) => !b, + Val::Int(i) => *i == 0, + Val::Uint(u) => *u == 0, + Val::Double(f) => *f == 0.0, + Val::Enum(e) => *e == 0, + Val::String(s) => s.is_empty(), + Val::Bytes(b) => b.is_empty(), + Val::Message(message) => message.encode().read()?.as_ref().is_empty(), + Val::List(_) | Val::Map(_) => false, + }) +} + +/// The subscript for a map entry, which is its key. +fn key_subscript(key: &Val<'_, R>) -> Option { + match key { + Val::Bool(b) => Some(Subscript::BoolKey(*b)), + Val::Int(i) => Some(Subscript::IntKey(*i)), + Val::Uint(u) => Some(Subscript::UintKey(*u)), + Val::String(s) => Some(Subscript::StringKey(s.to_string())), + Val::Double(_) + | Val::Enum(_) + | Val::Bytes(_) + | Val::Message(_) + | Val::List(_) + | Val::Map(_) => None, + } +} + +/// The CEL scalar for a value of `kind`, or the type's zero when the +/// message does not have the field. `None` when the kind is a message. +fn cel_scalar<'v, R: Runtime>( + value: Option<&'v Val<'_, R>>, + kind: Singular, +) -> Option> { + Some(match value { + Some(Val::Bool(b)) => ScalarValue::Bool(*b), + Some(Val::Int(i)) => ScalarValue::Int(*i), + Some(Val::Uint(u)) => ScalarValue::Uint(*u), + Some(Val::Double(f)) => ScalarValue::Double(*f), + Some(Val::Enum(e)) => ScalarValue::Int(i64::from(*e)), + Some(Val::String(s)) => ScalarValue::String(s), + Some(Val::Bytes(b)) => ScalarValue::Bytes(b), + Some(Val::Message(_) | Val::List(_) | Val::Map(_)) | None => match kind { + Singular::Scalar(Scalar::Bool) => ScalarValue::Bool(false), + Singular::Scalar( + Scalar::Int32 + | Scalar::Int64 + | Scalar::Sint32 + | Scalar::Sint64 + | Scalar::Sfixed32 + | Scalar::Sfixed64, + ) + | Singular::Enum => ScalarValue::Int(0), + Singular::Scalar( + Scalar::Uint32 | Scalar::Uint64 | Scalar::Fixed32 | Scalar::Fixed64, + ) => ScalarValue::Uint(0), + Singular::Scalar(Scalar::Float | Scalar::Double) => ScalarValue::Double(0.0), + Singular::Scalar(Scalar::String) => ScalarValue::String(""), + Singular::Scalar(Scalar::Bytes) => ScalarValue::Bytes(&[]), + Singular::Message => return None, + }, + }) +} + +// The typed reads of a value the checks test. `None` is a field the +// message does not have at all, which reads as the type's default. Any +// other type is a runtime handing out a value its descriptor does not +// declare. + +fn mismatch(expected: &str, got: &Val<'_, R>) -> Abort { + let got = match got { + Val::Bool(_) => "a bool", + Val::Int(_) => "an int", + Val::Uint(_) => "a uint", + Val::Double(_) => "a double", + Val::Enum(_) => "an enum", + Val::String(_) => "a string", + Val::Bytes(_) => "bytes", + Val::Message(_) => "a message", + Val::List(_) => "a list", + Val::Map(_) => "a map", + }; + Error::Unexpected(format!("expected {expected}, the runtime read {got}")).into() +} + +fn bool_of(value: Option<&Val<'_, R>>) -> Result> { + match value { + None => Ok(false), + Some(Val::Bool(b)) => Ok(*b), + Some(other) => Err(mismatch("a bool", other)), + } +} + +fn int_of(value: Option<&Val<'_, R>>) -> Result> { + match value { + None => Ok(0), + Some(Val::Int(i)) => Ok(*i), + Some(Val::Enum(e)) => Ok(i64::from(*e)), + Some(other) => Err(mismatch("an int", other)), + } +} + +fn uint_of(value: Option<&Val<'_, R>>) -> Result> { + match value { + None => Ok(0), + Some(Val::Uint(u)) => Ok(*u), + Some(other) => Err(mismatch("a uint", other)), + } +} + +fn double_of(value: Option<&Val<'_, R>>) -> Result> { + match value { + None => Ok(0.0), + Some(Val::Double(f)) => Ok(*f), + Some(other) => Err(mismatch("a double", other)), + } +} + +fn enum_of(value: Option<&Val<'_, R>>) -> Result> { + match value { + None => Ok(0), + Some(Val::Enum(e)) => Ok(*e), + Some(other) => Err(mismatch("an enum", other)), + } +} + +fn str_of<'v, R: Runtime>(value: Option<&'v Val<'_, R>>) -> Result<&'v str, Abort> { + match value { + None => Ok(""), + Some(Val::String(s)) => Ok(s), + Some(other) => Err(mismatch("a string", other)), + } +} + +fn bytes_of<'v, R: Runtime>(value: Option<&'v Val<'_, R>>) -> Result<&'v [u8], Abort> { + match value { + None => Ok(&[]), + Some(Val::Bytes(b)) => Ok(b), + Some(other) => Err(mismatch("bytes", other)), + } +} + +/// The `seconds` and `nanos` of a `Duration` or `Timestamp` message +/// combined into nanoseconds. Zero for a missing message. +fn nanos_of(value: Option<&Val<'_, R>>) -> Result> { + let message = match value { + None => return Ok(0), + Some(Val::Message(message)) => message, + Some(other) => return Err(mismatch("a message", other)), + }; + let seconds = match message.get(&wkt::seconds()).read()? { + Some(Val::Int(seconds)) => seconds, + _ => 0, + }; + let nanos = match message.get(&wkt::nanos()).read()? { + Some(Val::Int(nanos)) => nanos, + _ => 0, + }; + Ok(total_nanos(seconds, nanos)) +} + +/// Runs `f` on the `paths` of a `FieldMask` message, none for a missing +/// message. +fn with_paths( + value: Option<&Val<'_, R>>, + f: impl FnOnce(&[Cow<'_, str>]) -> T, +) -> Result> { + let message = match value { + None => return Ok(f(&[])), + Some(Val::Message(message)) => message, + Some(other) => return Err(mismatch("a message", other)), + }; + let field = wkt::field_mask_paths(); + let Some(Val::List(list)) = message.get(&field).read()? else { + return Ok(f(&[])); + }; + let mut paths = Vec::new(); + for index in 0..list.len().read()? { + if let Some(Val::String(path)) = list.get(index).read()? { + paths.push(path); + } + } + Ok(f(&paths)) +} + +/// Whether a list has two elements that `unique()` considers equal. +/// Wrapper elements are compared by the scalar in their `wrapper` field. +fn has_duplicate_items( + list: &R::List<'_>, + len: usize, + wrapper: Option<&Field>, +) -> Result> { + let mut items = Vec::with_capacity(len); + for index in 0..len { + if let Some(item) = list.get(index).read()? { + items.push(item); + } + } + let Some(wrapper) = wrapper else { + return Ok(has_duplicates(items.iter().map(unique_key))); + }; + let mut unboxed = Vec::with_capacity(items.len()); + for item in &items { + match item { + Val::Message(message) => unboxed.push(message.get(wrapper).read()?), + other => return Err(mismatch("a wrapper message", other)), + } + } + Ok(has_duplicates( + unboxed + .iter() + .map(|value| value.as_ref().and_then(unique_key)), + )) +} + +fn unique_key<'a, R: Runtime>(value: &'a Val<'_, R>) -> Option> { + match value { + Val::Bool(b) => Some(UniqueKey::Bool(*b)), + Val::Int(i) => Some(UniqueKey::Int(*i)), + Val::Enum(e) => Some(UniqueKey::Int(i64::from(*e))), + Val::Uint(u) => Some(UniqueKey::Uint(*u)), + Val::Double(f) => UniqueKey::double(*f), + Val::String(s) => Some(UniqueKey::Str(s)), + Val::Bytes(b) => Some(UniqueKey::Bytes(b)), + Val::Message(_) | Val::List(_) | Val::Map(_) => None, + } +} diff --git a/crates/protovalidate/src/rules/mod.rs b/crates/protovalidate/src/rules/mod.rs new file mode 100644 index 00000000..a9310006 --- /dev/null +++ b/crates/protovalidate/src/rules/mod.rs @@ -0,0 +1,152 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Compiled validation rules, and their evaluation against messages. +//! +//! [`build`] turns the `buf.validate` options of a message type into a +//! [`MessageValidator`]. A message or field whose rules do not compile is +//! the error instead, reported when the walk reaches it. [`eval`] walks a +//! message with the validators, reading it through a +//! [`Runtime`](crate::protobuf::Runtime). + +pub(crate) mod build; +pub(crate) mod eval; +pub(crate) mod standard; + +use std::collections::HashMap; +use std::sync::Arc; + +use buffa_descriptor::MessageIndex; + +use crate::cel; +use crate::protobuf::{Field, Runtime}; +use crate::validate::FieldPathElement; +use standard::Checks; + +/// A CEL expression, and what it reports when it fails. +pub(crate) struct CelRule { + pub id: String, + pub message: String, + pub expression: String, + /// The field of the rules message `rule` is bound to while the + /// expression runs, or 0 for none. + pub rule_field_number: i32, + /// The rule path, from `FieldRules` down: `[FieldRules.cel[i]]` for a + /// custom rule, `[FieldRules.string, (pkg.rule)]` for a predefined one, + /// empty for a message-level one. + pub rule_path: Vec, +} + +/// CEL expressions compiled together, evaluated against one `this`. +pub(crate) struct CelPrograms { + pub program: cel::Program, + pub rules: Vec, +} + +/// A message type's validator, or why its rules did not compile. +pub(crate) type Built = Result>, String>; + +/// The compiled rules of every message type validated so far. +pub(crate) type ValidatorCache = HashMap, foldhash::fast::RandomState>; + +/// The rules of one message type. A message-typed field's messages are +/// evaluated inside that field, after its own rules. +pub(crate) struct MessageValidator { + /// The resolved type of this message. + pub message_type: R::MessageType, + pub cel: Option, + pub message_oneofs: Vec>, + pub oneofs: Vec>, + /// The fields with rules, or why a field's rules did not compile. + pub fields: Vec, String>>, +} + +/// A `(buf.validate.message).oneof` rule. +pub(crate) struct MessageOneof { + pub fields: Vec>, + /// The member names joined with `, `, as the violation message prints them. + pub names: String, + pub required: bool, +} + +/// A `(buf.validate.oneof).required` rule. +pub(crate) struct OneofRequired { + pub element: FieldPathElement, + pub members: Vec>, +} + +/// The rules of one field. +pub(crate) struct FieldValidator { + pub field: Field, + pub element: FieldPathElement, + pub required: bool, + /// Whether to skip the rules when the field is not set. + pub ignore_empty: bool, + /// The rules of the field's own value. For a container, that is the + /// whole list or map. + pub value: ValueValidator, + pub kind: FieldKind, +} + +/// How a field holds its values, and the validators of the values inside a +/// container. +pub(crate) enum FieldKind { + Singular, + List { + items: Option>>, + }, + Map { + /// The field's path element with the key and value types filled in. + /// Per-entry violations add the key as its subscript. + element: FieldPathElement, + keys: Option>>, + values: Option>>, + }, +} + +/// The rules of the elements of a repeated field, or the keys or values of +/// a map. +pub(crate) struct ItemValidator { + /// Whether to skip an item that is its type's zero value. + pub ignore_empty: bool, + pub value: ValueValidator, +} + +/// The rules of one value. +pub(crate) struct ValueValidator { + /// The `(buf.validate.field).cel` and `.cel_expression` rules. + pub custom: Option, + /// The native rule checks. + pub checks: Checks, + /// The field to validate for wrapper types. + pub wrapper: Option>, + /// The predefined CEL of the standard rules for which we do not have + /// native rule implementations. + pub predefined: Option, + /// The message type of the value, whose own rules are evaluated after + /// these. + pub nested: Option, +} + +impl Default for ValueValidator { + fn default() -> Self { + Self { + custom: None, + checks: Checks::default(), + wrapper: None, + predefined: None, + nested: None, + } + } +} diff --git a/crates/protovalidate/src/rules/standard/build/misc.rs b/crates/protovalidate/src/rules/standard/build/misc.rs new file mode 100644 index 00000000..425969ba --- /dev/null +++ b/crates/protovalidate/src/rules/standard/build/misc.rs @@ -0,0 +1,313 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The bool, enum, bytes, repeated, map, field mask and any rules. + +use std::mem; + +use buffa_descriptor::EnumIndex; + +use super::{Unplaced, regex}; +use crate::rules::standard::format::{Hex, List, Text}; +use crate::rules::standard::{AnyTest, BytesTest, Cmp, EnumTest, FieldMaskTest, ListTest, MapTest}; +use crate::validate::__buffa::oneof; +use crate::validate::{ + AnyRules, BoolRules, BytesRules, EnumRules, FieldMaskRules, MapRules, RepeatedRules, +}; + +pub(super) fn bool_checks<'a>(prefix: &'a str, r: &mut BoolRules) -> Unplaced<'a, bool> { + let mut checks = Unplaced::new(prefix); + if let Some(c) = r.r#const.take() { + checks.push(1, "const", format!("must equal {c}"), c); + } + checks +} + +/// The enum checks. `defined_only` is checked against the values of +/// `enum_`, the field's enum type, which the type check has already +/// confirmed. +pub(super) fn enum_checks<'a>( + prefix: &'a str, + r: &mut EnumRules, + enum_: Option, +) -> Unplaced<'a, EnumTest> { + let ints = |list: Vec| list.into_iter().map(i64::from).collect::>(); + let mut checks = Unplaced::new(prefix); + if let Some(c) = r.r#const.take() { + checks.push( + 1, + "const", + format!("must equal {c}"), + EnumTest::Cmp(Cmp::Const(i64::from(c))), + ); + } + if let (Some(true), Some(enum_)) = (r.defined_only.take(), enum_) { + checks.push( + 2, + "defined_only", + "value must be one of the defined enum values".to_owned(), + EnumTest::DefinedOnly(enum_), + ); + } + if !r.r#in.is_empty() { + let list = ints(mem::take(&mut r.r#in)); + checks.push( + 3, + "in", + format!("must be in list {}", List(&list)), + EnumTest::Cmp(Cmp::In(list)), + ); + } + if !r.not_in.is_empty() { + let list = ints(mem::take(&mut r.not_in)); + checks.push( + 4, + "not_in", + format!("must not be in list {}", List(&list)), + EnumTest::Cmp(Cmp::NotIn(list)), + ); + } + checks +} + +pub(super) fn bytes_checks<'a>( + prefix: &'a str, + r: &mut BytesRules, +) -> Result, String> { + let mut checks = Unplaced::new(prefix); + if let Some(c) = r.r#const.take() { + checks.push( + 1, + "const", + format!("must be {}", Hex(&c)), + BytesTest::Const(c), + ); + } + if let Some(n) = r.len.take() { + checks.push(13, "len", format!("must be {n} bytes"), BytesTest::Len(n)); + } + if let Some(n) = r.min_len.take() { + checks.push( + 2, + "min_len", + format!("must be at least {n} bytes"), + BytesTest::MinLen(n), + ); + } + if let Some(n) = r.max_len.take() { + checks.push( + 3, + "max_len", + format!("must be at most {n} bytes"), + BytesTest::MaxLen(n), + ); + } + if let Some(p) = r.pattern.take() { + let compiled = regex(prefix, &p)?; + checks.push( + 4, + "pattern", + format!("must match regex pattern `{p}`"), + BytesTest::Pattern(compiled), + ); + } + if let Some(p) = r.prefix.take() { + checks.push( + 5, + "prefix", + format!("does not have prefix {}", Hex(&p)), + BytesTest::Prefix(p), + ); + } + if let Some(p) = r.suffix.take() { + checks.push( + 6, + "suffix", + format!("does not have suffix {}", Hex(&p)), + BytesTest::Suffix(p), + ); + } + if let Some(p) = r.contains.take() { + checks.push( + 7, + "contains", + format!("does not contain {}", Hex(&p)), + BytesTest::Contains(p), + ); + } + if !r.r#in.is_empty() { + let list = mem::take(&mut r.r#in); + checks.push( + 8, + "in", + format!( + "must be in list {}", + List(list.iter().map(|bytes| Text(bytes))) + ), + BytesTest::In(list), + ); + } + if !r.not_in.is_empty() { + let list = mem::take(&mut r.not_in); + checks.push( + 9, + "not_in", + format!( + "must not be in list {}", + List(list.iter().map(|bytes| Text(bytes))) + ), + BytesTest::NotIn(list), + ); + } + if let Some(format) = r.well_known.take() { + bytes_format_checks(&mut checks, &format); + } + Ok(checks) +} + +/// The checks of a bytes format rule, which only look at the length: +/// the format check and its `_empty` companion. A format set to false +/// adds nothing. +fn bytes_format_checks( + checks: &mut Unplaced<'_, BytesTest>, + format: &oneof::bytes_rules::WellKnown, +) { + use oneof::bytes_rules::WellKnown as Wk; + let (number, suffix, what, test) = match format { + Wk::Ip(true) => (10, "ip", "IP address", BytesTest::Ip), + Wk::Ipv4(true) => (11, "ipv4", "IPv4 address", BytesTest::Ipv4), + Wk::Ipv6(true) => (12, "ipv6", "IPv6 address", BytesTest::Ipv6), + Wk::Uuid(true) => (15, "uuid", "UUID", BytesTest::Uuid), + Wk::Ip(false) | Wk::Ipv4(false) | Wk::Ipv6(false) | Wk::Uuid(false) => return, + }; + checks.push(number, suffix, format!("must be a valid {what}"), test); + checks.push( + number, + format_args!("{suffix}_empty"), + format!("value is empty, which is not a valid {what}"), + BytesTest::Empty, + ); +} + +pub(super) fn repeated_checks<'a>( + prefix: &'a str, + r: &mut RepeatedRules, +) -> Unplaced<'a, ListTest> { + let mut checks = Unplaced::new(prefix); + if let Some(n) = r.min_items.take() { + checks.push( + 1, + "min_items", + format!("must contain at least {n} item(s)"), + ListTest::MinItems(n), + ); + } + if let Some(n) = r.max_items.take() { + checks.push( + 2, + "max_items", + format!("must contain no more than {n} item(s)"), + ListTest::MaxItems(n), + ); + } + if r.unique.take() == Some(true) { + checks.push( + 3, + "unique", + "repeated value must contain unique items".to_owned(), + ListTest::Unique, + ); + } + // `items` holds the elements' rules, built on their own. + checks +} + +pub(super) fn map_checks<'a>(prefix: &'a str, r: &mut MapRules) -> Unplaced<'a, MapTest> { + let mut checks = Unplaced::new(prefix); + if let Some(n) = r.min_pairs.take() { + checks.push( + 1, + "min_pairs", + format!("map must be at least {n} entries"), + MapTest::MinPairs(n), + ); + } + if let Some(n) = r.max_pairs.take() { + checks.push( + 2, + "max_pairs", + format!("map must be at most {n} entries"), + MapTest::MaxPairs(n), + ); + } + // `keys` and `values` hold the entries' rules, built on their own. + checks +} + +pub(super) fn field_mask_checks<'a>( + prefix: &'a str, + r: &mut FieldMaskRules, +) -> Unplaced<'a, FieldMaskTest> { + let mut checks = Unplaced::new(prefix); + if let Some(c) = r.r#const.take() { + checks.push( + 1, + "const", + format!("must equal paths {}", List(&c.paths)), + FieldMaskTest::Const(c.paths), + ); + } + if !r.r#in.is_empty() { + let list = mem::take(&mut r.r#in); + checks.push( + 2, + "in", + format!("must only contain paths in {}", List(&list)), + FieldMaskTest::In(list), + ); + } + if !r.not_in.is_empty() { + let list = mem::take(&mut r.not_in); + checks.push( + 3, + "not_in", + format!("must not contain any paths in {}", List(&list)), + FieldMaskTest::NotIn(list), + ); + } + checks +} + +/// The any checks, on the `type_url`. `in` applies only when it lists +/// something. +pub(super) fn any_checks<'a>(prefix: &'a str, r: &mut AnyRules) -> Unplaced<'a, AnyTest> { + let mut checks = Unplaced::new(prefix); + if !r.r#in.is_empty() { + checks.push( + 2, + "in", + "type URL must be in the allow list".to_owned(), + AnyTest::In(mem::take(&mut r.r#in)), + ); + } + if !r.not_in.is_empty() { + checks.push( + 3, + "not_in", + "type URL must not be in the block list".to_owned(), + AnyTest::NotIn(mem::take(&mut r.not_in)), + ); + } + checks +} diff --git a/crates/protovalidate/src/rules/standard/build/mod.rs b/crates/protovalidate/src/rules/standard/build/mod.rs new file mode 100644 index 00000000..78e83659 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/build/mod.rs @@ -0,0 +1,499 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Building the checks of one rules message. +//! +//! [`checks`] takes a rules message and returns the checks that +//! `validate.proto` attaches to the rule fields it has native checks for, +//! typed by the rules message. There is usually one check per field, two +//! for the well-known string formats with their `_empty` companion, and +//! one for a pair of bounds, which together spell out a range. The fields +//! it reads are removed from the message, so whatever remains has no +//! native check and is left to its predefined CEL. The messages are +//! formatted here from the rule values, as the CEL expressions would +//! format them. This module has the comparison rules; [`string`] and +//! [`misc`] have the rest. + +mod misc; +mod string; + +use std::fmt::Display; +use std::mem; + +use buffa_descriptor::EnumIndex; +use buffa_types::google::protobuf::{Duration as DurationPb, Timestamp as TimestampPb}; + +use super::format::{Double, Duration, List, Timestamp, total_nanos}; +use super::{Check, Checks, Cmp, DoubleTest, MaybeNan, NowTest, Regex, TimestampTest}; +use crate::validate::__buffa::oneof; +use crate::validate::__buffa::oneof::field_rules::Type as RulesType; +use crate::validate::FieldPathElement; +use crate::validate::TimestampRules; + +/// A check without its rule path, which is added once the rule field it +/// comes from is known. +pub(crate) struct Native { + pub id: String, + pub message: String, + pub test: T, +} + +impl Native { + fn new(prefix: &str, suffix: impl Display, message: String, test: T) -> Self { + Self { + id: format!("{prefix}.{suffix}"), + message, + test, + } + } + + fn map(self, f: impl FnOnce(T) -> U) -> Native { + Native { + id: self.id, + message: self.message, + test: f(self.test), + } + } +} + +/// The checks of one rules message as they are collected, each with the +/// number of the rule field it comes from, before their rule paths are +/// known. `prefix` is the type in the rule ids, such as `string`. +pub(crate) struct Unplaced<'a, T> { + prefix: &'a str, + checks: Vec<(u32, Native)>, +} + +impl<'a, T> Unplaced<'a, T> { + fn new(prefix: &'a str) -> Self { + Self { + prefix, + checks: Vec::new(), + } + } + + /// Adds the check of rule field `number`, with id `prefix.suffix`. + fn push(&mut self, number: u32, suffix: impl Display, message: String, test: T) { + self.checks + .push((number, Native::new(self.prefix, suffix, message, test))); + } + + fn extend(&mut self, other: Self) { + self.checks.extend(other.checks); + } + + fn map(self, f: impl Fn(T) -> U) -> Unplaced<'a, U> { + Unplaced { + prefix: self.prefix, + checks: self + .checks + .into_iter() + .map(|(number, native)| (number, native.map(&f))) + .collect(), + } + } +} + +/// How the checks of a rules message are placed. +pub(crate) struct Placement<'a> { + /// The rule path of a rule field, by its number in the rules message. + pub path: &'a dyn Fn(u32) -> Vec, + /// For enum rules, the enum the values belong to. + pub r#enum: Option, +} + +impl Placement<'_> { + fn place(&self, unplaced: Unplaced<'_, T>) -> Vec> { + unplaced + .checks + .into_iter() + .map(|(number, native)| Check { + id: native.id, + message: native.message, + rule_path: (self.path)(number), + test: native.test, + }) + .collect() + } +} + +/// The comparison rules of a numeric, duration or timestamp rules message, +/// with the values already in the type they are compared in. +struct Bounds { + r#const: Option, + lt: Option, + lte: Option, + gt: Option, + gte: Option, + r#in: Vec, + not_in: Vec, +} + +/// One bound of a range, with the words the rule's message and id use for +/// it. +struct Side { + value: T, + name: &'static str, + words: &'static str, + /// The rule field's number. + number: u32, + inclusive: bool, +} + +/// Takes the [`Bounds`] out of a rules message whose `less_than` and +/// `greater_than` oneofs live in `$module`; `$const`, `$in` and `$not_in` +/// take the fields outside the oneofs, whose shape varies by message, the +/// lists as iterators of their values. A message without lists leaves +/// them out. +macro_rules! bounds { + ($rules:expr, $module:ident, $convert:expr, $const:expr, $in:expr, $not_in:expr) => {{ + let convert = $convert; + let (lt, lte) = match $rules.less_than.take() { + Some(oneof::$module::LessThan::Lt(v)) => (Some(convert(&v)), None), + Some(oneof::$module::LessThan::Lte(v)) => (None, Some(convert(&v))), + _ => (None, None), + }; + let (gt, gte) = match $rules.greater_than.take() { + Some(oneof::$module::GreaterThan::Gt(v)) => (Some(convert(&v)), None), + Some(oneof::$module::GreaterThan::Gte(v)) => (None, Some(convert(&v))), + _ => (None, None), + }; + Bounds { + r#const: $const.map(|v| convert(&v)), + lt, + lte, + gt, + gte, + r#in: $in.into_iter().map(|v| convert(&v)).collect(), + not_in: $not_in.into_iter().map(|v| convert(&v)).collect(), + } + }}; + ($rules:expr, $module:ident, $convert:expr, $const:expr) => { + bounds!( + $rules, + $module, + $convert, + $const, + ::std::iter::empty(), + ::std::iter::empty() + ) + }; +} + +/// The [`bounds!`] of a numeric rules message, whose `const`, `in` and +/// `not_in` are plain fields. +macro_rules! numeric_bounds { + ($rules:expr, $module:ident, $convert:expr) => { + bounds!( + $rules, + $module, + $convert, + $rules.r#const.take(), + mem::take(&mut $rules.r#in), + mem::take(&mut $rules.not_in) + ) + }; +} + +impl Bounds { + /// The comparison checks. `first` is the field number of `const`; `lt`, + /// `lte`, `gt`, `gte`, `in` and `not_in` follow it in that order in + /// every rules message. + fn checks(self, prefix: &str, first: u32) -> Unplaced<'_, Cmp> { + let mut checks = Unplaced::new(prefix); + if let Some(c) = self.r#const { + checks.push(first, "const", format!("must equal {c}"), Cmp::Const(c)); + } + checks.checks.extend(self.bound(prefix, first)); + if !self.r#in.is_empty() { + checks.push( + first + 5, + "in", + format!("must be in list {}", List(&self.r#in)), + Cmp::In(self.r#in), + ); + } + if !self.not_in.is_empty() { + checks.push( + first + 6, + "not_in", + format!("must not be in list {}", List(&self.not_in)), + Cmp::NotIn(self.not_in), + ); + } + checks + } + + /// The bound check. A lower or upper bound alone is checked on its own. + /// Two together are checked as a range, reported on the lower one: the + /// values between them when the bounds are in order, the values outside + /// them when the upper is below the lower. None for bounds that do not + /// order, which is NaN. + fn bound(&self, prefix: &str, first: u32) -> Option<(u32, Native>)> { + let side = |value, name, words, number, inclusive| Side { + value, + name, + words, + number: first + number, + inclusive, + }; + let upper = match (self.lt, self.lte) { + (Some(lt), _) => Some(side(lt, "lt", "less than", 1, false)), + (None, Some(lte)) => Some(side(lte, "lte", "less than or equal to", 2, true)), + (None, None) => None, + }; + let lower = match (self.gt, self.gte) { + (Some(gt), _) => Some(side(gt, "gt", "greater than", 3, false)), + (None, Some(gte)) => Some(side(gte, "gte", "greater than or equal to", 4, true)), + (None, None) => None, + }; + let (lower, upper) = match (lower, upper) { + (None, None) => return None, + (Some(lower), None) => { + let cmp = if lower.inclusive { + Cmp::Gte(lower.value) + } else { + Cmp::Gt(lower.value) + }; + let message = format!("must be {} {}", lower.words, lower.value); + return Some((lower.number, Native::new(prefix, lower.name, message, cmp))); + } + (None, Some(upper)) => { + let cmp = if upper.inclusive { + Cmp::Lte(upper.value) + } else { + Cmp::Lt(upper.value) + }; + let message = format!("must be {} {}", upper.words, upper.value); + return Some((upper.number, Native::new(prefix, upper.name, message, cmp))); + } + (Some(lower), Some(upper)) => (lower, upper), + }; + let (lo, hi) = (lower.value, upper.value); + let (tail, conjunction, cmp) = if hi >= lo { + ( + "", + "and", + match (lower.inclusive, upper.inclusive) { + (false, false) => Cmp::GtLt { gt: lo, lt: hi }, + (false, true) => Cmp::GtLte { gt: lo, lte: hi }, + (true, false) => Cmp::GteLt { gte: lo, lt: hi }, + (true, true) => Cmp::GteLte { gte: lo, lte: hi }, + }, + ) + } else if hi < lo { + ( + "_exclusive", + "or", + match (lower.inclusive, upper.inclusive) { + (false, false) => Cmp::GtLtExclusive { gt: lo, lt: hi }, + (false, true) => Cmp::GtLteExclusive { gt: lo, lte: hi }, + (true, false) => Cmp::GteLtExclusive { gte: lo, lt: hi }, + (true, true) => Cmp::GteLteExclusive { gte: lo, lte: hi }, + }, + ) + } else { + return None; + }; + let message = format!( + "must be {} {lo} {conjunction} {} {hi}", + lower.words, upper.words + ); + Some(( + lower.number, + Native::new( + prefix, + format_args!("{}_{}{tail}", lower.name, upper.name), + message, + cmp, + ), + )) + } +} + +fn duration(d: &DurationPb) -> Duration { + Duration(total_nanos(d.seconds, i64::from(d.nanos))) +} + +fn timestamp(t: &TimestampPb) -> Timestamp { + Timestamp(total_nanos(t.seconds, i64::from(t.nanos))) +} + +/// Rejects a timestamp rule value outside the range a `Timestamp` allows. +fn check_timestamp(t: &TimestampPb) -> Result<(), String> { + if (0..=999_999_999).contains(&t.nanos) && timestamp(t).in_range() { + Ok(()) + } else { + Err(format!( + "timestamp rule value out of range: seconds {} nanos {} is not between {} and {}", + t.seconds, + t.nanos, + Timestamp::MIN, + Timestamp::MAX + )) + } +} + +/// Compiles the pattern of the `pattern` rule of `prefix`, such as +/// `string`. +pub(super) fn regex(prefix: &str, pattern: &str) -> Result { + Regex::new(pattern) + .map_err(|error| format!("failed to compile program {prefix}.pattern: {error}")) +} + +/// The placed checks of an integer rules message holding `$narrow` values, +/// compared as `$wide`: the type CEL widens the integer to, which every +/// comparison and range shares. +macro_rules! integer_checks { + ($variant:ident, $at:expr, $prefix:expr, $rules:expr, $module:ident, $narrow:ty => $wide:ty) => { + Checks::$variant($at.place( + numeric_bounds!($rules, $module, |v: &$narrow| <$wide>::from(*v)).checks($prefix, 1), + )) + }; +} + +/// The native checks of the rule fields set in `rules`, placed by `at`, in +/// the order `validate.proto` declares the fields. The fields read are +/// removed from `rules`. `prefix` is the type in the rule ids, such as +/// `string`. Fails for a rule that cannot be compiled, such as an invalid +/// regex. +pub(crate) fn checks( + prefix: &str, + rules: &mut RulesType, + at: &Placement<'_>, +) -> Result { + Ok(match rules { + RulesType::Float(r) => { + let bounds = numeric_bounds!(r, float_rules, |v: &f32| Double(f64::from(*v))); + Checks::Double(at.place(floating(prefix, bounds, r.finite.take()))) + } + RulesType::Double(r) => { + let bounds = numeric_bounds!(r, double_rules, |v: &f64| Double(*v)); + Checks::Double(at.place(floating(prefix, bounds, r.finite.take()))) + } + RulesType::Int32(r) => integer_checks!(Int, at, prefix, r, int32rules, i32 => i64), + RulesType::Int64(r) => integer_checks!(Int, at, prefix, r, int64rules, i64 => i64), + RulesType::Uint32(r) => integer_checks!(Uint, at, prefix, r, u_int32rules, u32 => u64), + RulesType::Uint64(r) => integer_checks!(Uint, at, prefix, r, u_int64rules, u64 => u64), + RulesType::Sint32(r) => integer_checks!(Int, at, prefix, r, s_int32rules, i32 => i64), + RulesType::Sint64(r) => integer_checks!(Int, at, prefix, r, s_int64rules, i64 => i64), + RulesType::Fixed32(r) => integer_checks!(Uint, at, prefix, r, fixed32rules, u32 => u64), + RulesType::Fixed64(r) => integer_checks!(Uint, at, prefix, r, fixed64rules, u64 => u64), + RulesType::Sfixed32(r) => integer_checks!(Int, at, prefix, r, s_fixed32rules, i32 => i64), + RulesType::Sfixed64(r) => integer_checks!(Int, at, prefix, r, s_fixed64rules, i64 => i64), + RulesType::Duration(r) => Checks::Duration( + at.place( + bounds!( + r, + duration_rules, + duration, + r.r#const.take(), + mem::take(&mut r.r#in), + mem::take(&mut r.not_in) + ) + .checks(prefix, 2), + ), + ), + RulesType::Timestamp(r) => Checks::Timestamp(at.place(timestamp_checks(prefix, r)?)), + RulesType::Bool(r) => Checks::Bool(at.place(misc::bool_checks(prefix, r))), + RulesType::Enum(r) => Checks::Enum(at.place(misc::enum_checks(prefix, r, at.r#enum))), + RulesType::String(r) => Checks::String(at.place(string::checks(prefix, r)?)), + RulesType::Bytes(r) => Checks::Bytes(at.place(misc::bytes_checks(prefix, r)?)), + RulesType::Repeated(r) => Checks::List(at.place(misc::repeated_checks(prefix, r))), + RulesType::Map(r) => Checks::Map(at.place(misc::map_checks(prefix, r))), + RulesType::FieldMask(r) => Checks::FieldMask(at.place(misc::field_mask_checks(prefix, r))), + RulesType::Any(r) => Checks::Any(at.place(misc::any_checks(prefix, r))), + }) +} + +/// The checks of a float or double rules message, which add `finite` to +/// the comparisons. +fn floating( + prefix: &str, + bounds: Bounds, + finite: Option, +) -> Unplaced<'_, DoubleTest> { + let mut checks = bounds.checks(prefix, 1).map(DoubleTest::Cmp); + if finite == Some(true) { + checks.push(8, "finite", "must be finite".to_owned(), DoubleTest::Finite); + } + checks +} + +/// The checks of a timestamp rules message. `lt_now` and `gt_now` take the +/// place of a bound in their oneofs, and are checked after the bounds, in +/// the order `validate.proto` declares them. Fails for a value outside the +/// range a `Timestamp` allows. +fn timestamp_checks<'a>( + prefix: &'a str, + r: &mut TimestampRules, +) -> Result, String> { + use oneof::timestamp_rules::{GreaterThan, LessThan}; + let values = [ + r.r#const.as_option(), + match &r.less_than { + Some(LessThan::Lt(v) | LessThan::Lte(v)) => Some(v), + _ => None, + }, + match &r.greater_than { + Some(GreaterThan::Gt(v) | GreaterThan::Gte(v)) => Some(v), + _ => None, + }, + ]; + values.into_iter().flatten().try_for_each(check_timestamp)?; + + let mut checks = Unplaced::new(prefix); + let lt_now = match r.less_than { + Some(LessThan::LtNow(lt_now)) => { + r.less_than = None; + lt_now + } + _ => false, + }; + let gt_now = match r.greater_than { + Some(GreaterThan::GtNow(gt_now)) => { + r.greater_than = None; + gt_now + } + _ => false, + }; + let bounds = bounds!(r, timestamp_rules, timestamp, r.r#const.take()); + checks.extend(bounds.checks(prefix, 2).map(TimestampTest::Cmp)); + if lt_now { + checks.push( + 7, + "lt_now", + "must be less than now".to_owned(), + TimestampTest::Now(NowTest::LtNow), + ); + } + if gt_now { + checks.push( + 8, + "gt_now", + "must be greater than now".to_owned(), + TimestampTest::Now(NowTest::GtNow), + ); + } + if let Some(within) = r.within.take() { + let within = duration(&within); + checks.push( + 9, + "within", + format!("must be within {within} of now"), + TimestampTest::Now(NowTest::Within(within)), + ); + } + Ok(checks) +} diff --git a/crates/protovalidate/src/rules/standard/build/string.rs b/crates/protovalidate/src/rules/standard/build/string.rs new file mode 100644 index 00000000..dc8e21fa --- /dev/null +++ b/crates/protovalidate/src/rules/standard/build/string.rs @@ -0,0 +1,280 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The string rules. + +use std::mem; + +use super::{Unplaced, regex}; +use crate::rules::standard::format::List; +use crate::rules::standard::{StrTest, WellKnown}; +use crate::validate::__buffa::oneof; +use crate::validate::{KnownRegex, StringRules}; + +pub(super) fn checks<'a>( + prefix: &'a str, + r: &mut StringRules, +) -> Result, String> { + let mut checks = Unplaced::new(prefix); + if let Some(c) = r.r#const.take() { + checks.push(1, "const", format!("must equal `{c}`"), StrTest::Const(c)); + } + length_checks(&mut checks, r); + if let Some(p) = r.pattern.take() { + let compiled = regex(prefix, &p)?; + checks.push( + 6, + "pattern", + format!("does not match regex pattern `{p}`"), + StrTest::Pattern(compiled), + ); + } + substring_checks(&mut checks, r); + if !r.r#in.is_empty() { + let list = mem::take(&mut r.r#in); + checks.push( + 10, + "in", + format!("must be in list {}", List(&list)), + StrTest::In(list), + ); + } + if !r.not_in.is_empty() { + let list = mem::take(&mut r.not_in); + checks.push( + 11, + "not_in", + format!("must not be in list {}", List(&list)), + StrTest::NotIn(list), + ); + } + // `strict` qualifies `well_known_regex`, and is read with it. + let strict = r.strict.take().unwrap_or(true); + if let Some(rule) = r.well_known.take() { + well_known_checks(&mut checks, &rule, strict); + } + Ok(checks) +} + +/// The length rules. +fn length_checks(checks: &mut Unplaced<'_, StrTest>, r: &mut StringRules) { + if let Some(n) = r.len.take() { + checks.push( + 19, + "len", + format!("must be {n} characters"), + StrTest::Len(n), + ); + } + if let Some(n) = r.min_len.take() { + checks.push( + 2, + "min_len", + format!("must be at least {n} characters"), + StrTest::MinLen(n), + ); + } + if let Some(n) = r.max_len.take() { + checks.push( + 3, + "max_len", + format!("must be at most {n} characters"), + StrTest::MaxLen(n), + ); + } + if let Some(n) = r.len_bytes.take() { + checks.push( + 20, + "len_bytes", + format!("must be {n} bytes"), + StrTest::LenBytes(n), + ); + } + if let Some(n) = r.min_bytes.take() { + checks.push( + 4, + "min_bytes", + format!("must be at least {n} bytes"), + StrTest::MinBytes(n), + ); + } + if let Some(n) = r.max_bytes.take() { + checks.push( + 5, + "max_bytes", + format!("must be at most {n} bytes"), + StrTest::MaxBytes(n), + ); + } +} + +/// The substring rules. +fn substring_checks(checks: &mut Unplaced<'_, StrTest>, r: &mut StringRules) { + if let Some(p) = r.prefix.take() { + checks.push( + 7, + "prefix", + format!("does not have prefix `{p}`"), + StrTest::Prefix(p), + ); + } + if let Some(p) = r.suffix.take() { + checks.push( + 8, + "suffix", + format!("does not have suffix `{p}`"), + StrTest::Suffix(p), + ); + } + if let Some(p) = r.contains.take() { + checks.push( + 9, + "contains", + format!("does not contain substring `{p}`"), + StrTest::Contains(p), + ); + } + if let Some(p) = r.not_contains.take() { + checks.push( + 23, + "not_contains", + format!("contains substring `{p}`"), + StrTest::NotContains(p), + ); + } +} + +/// The checks of a well-known format rule: the format check itself, and +/// for a format that lets an empty string through, an `_empty` companion +/// naming what an empty string is not. +fn well_known_checks( + checks: &mut Unplaced<'_, StrTest>, + rule: &oneof::string_rules::WellKnown, + strict: bool, +) { + let Some((number, suffix, what, format)) = well_known_format(rule, strict) else { + return; + }; + let allows_empty = format.allows_empty(); + // The one companion whose message says it differently. + let empty = match format { + WellKnown::HostAndPort => "host and port pair", + _ => what, + }; + checks.push( + number, + suffix, + format!("must be a valid {what}"), + StrTest::WellKnown(format), + ); + if allows_empty { + checks.push( + number, + format_args!("{suffix}_empty"), + format!("value is empty, which is not a valid {empty}"), + StrTest::Empty, + ); + } +} + +/// An enabled well-known format rule: its field number, rule id suffix, +/// what a value must be, and the format. +type Format = (u32, &'static str, &'static str, WellKnown); + +/// The [`Format`] of a well-known format rule, `None` for a format flag set +/// to false or a `well_known_regex` naming no format. +fn well_known_format(rule: &oneof::string_rules::WellKnown, strict: bool) -> Option { + use oneof::string_rules::WellKnown as Wk; + let (enabled, number, suffix, what, format) = match rule { + Wk::Email(b) => (*b, 12, "email", "email address", WellKnown::Email), + Wk::Hostname(b) => (*b, 13, "hostname", "hostname", WellKnown::Hostname), + Wk::Ip(b) => (*b, 14, "ip", "IP address", WellKnown::Ip), + Wk::Ipv4(b) => (*b, 15, "ipv4", "IPv4 address", WellKnown::Ipv4), + Wk::Ipv6(b) => (*b, 16, "ipv6", "IPv6 address", WellKnown::Ipv6), + Wk::Uri(b) => (*b, 17, "uri", "URI", WellKnown::Uri), + Wk::UriRef(b) => (*b, 18, "uri_ref", "URI Reference", WellKnown::UriRef), + Wk::Address(b) => ( + *b, + 21, + "address", + "hostname, or ip address", + WellKnown::Address, + ), + Wk::Uuid(b) => (*b, 22, "uuid", "UUID", WellKnown::Uuid), + Wk::WellKnownRegex(regex) => { + let (suffix, what, format) = match regex { + KnownRegex::KNOWN_REGEX_HTTP_HEADER_NAME => ( + "well_known_regex.header_name", + "HTTP header name", + WellKnown::HeaderName { strict }, + ), + KnownRegex::KNOWN_REGEX_HTTP_HEADER_VALUE => ( + "well_known_regex.header_value", + "HTTP header value", + WellKnown::HeaderValue { strict }, + ), + KnownRegex::KNOWN_REGEX_UNSPECIFIED => return None, + }; + (true, 24, suffix, what, format) + } + Wk::IpWithPrefixlen(b) => ( + *b, + 26, + "ip_with_prefixlen", + "IP prefix", + WellKnown::IpWithPrefixlen, + ), + Wk::Ipv4WithPrefixlen(b) => ( + *b, + 27, + "ipv4_with_prefixlen", + "IPv4 address with prefix length", + WellKnown::Ipv4WithPrefixlen, + ), + Wk::Ipv6WithPrefixlen(b) => ( + *b, + 28, + "ipv6_with_prefixlen", + "IPv6 address with prefix length", + WellKnown::Ipv6WithPrefixlen, + ), + Wk::IpPrefix(b) => (*b, 29, "ip_prefix", "IP prefix", WellKnown::IpPrefix), + Wk::Ipv4Prefix(b) => (*b, 30, "ipv4_prefix", "IPv4 prefix", WellKnown::Ipv4Prefix), + Wk::Ipv6Prefix(b) => (*b, 31, "ipv6_prefix", "IPv6 prefix", WellKnown::Ipv6Prefix), + Wk::HostAndPort(b) => ( + *b, + 32, + "host_and_port", + "host (hostname or IP address) and port pair", + WellKnown::HostAndPort, + ), + Wk::Tuuid(b) => (*b, 33, "tuuid", "trimmed UUID", WellKnown::Tuuid), + Wk::Ulid(b) => (*b, 35, "ulid", "ULID", WellKnown::Ulid), + Wk::ProtobufFqn(b) => ( + *b, + 37, + "protobuf_fqn", + "fully-qualified Protobuf name", + WellKnown::ProtobufFqn, + ), + Wk::ProtobufDotFqn(b) => ( + *b, + 38, + "protobuf_dot_fqn", + "fully-qualified Protobuf name with a leading dot", + WellKnown::ProtobufDotFqn, + ), + }; + enabled.then_some((number, suffix, what, format)) +} diff --git a/crates/protovalidate/src/rules/standard/format.rs b/crates/protovalidate/src/rules/standard/format.rs new file mode 100644 index 00000000..32a86de1 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/format.rs @@ -0,0 +1,245 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! How rule values print in violation messages. +//! +//! The standard rules' messages are `format()` calls in `validate.proto`, so +//! a message quotes the rule's value the way CEL's `%s` and `%x` print it: +//! decimal integers, lists in brackets, durations as seconds with an `s`, +//! timestamps in RFC 3339. Integers, strings and doubles print through +//! [`Display`], timestamps through jiff; the types here cover the rest. +//! Doubles print in the shortest round-trip form, infinities as `Infinity` +//! and `-Infinity`, and fractions of a second with the digits they need. + +use std::fmt::{self, Display}; + +const NANOS_PER_SECOND: i128 = 1_000_000_000; + +/// The `seconds` and `nanos` a `Duration` or `Timestamp` message carries, +/// combined into nanoseconds. `nanos` is an `int32`, taken as the runtime +/// widens it. +pub(crate) fn total_nanos(seconds: i64, nanos: i64) -> i128 { + i128::from(seconds) * NANOS_PER_SECOND + i128::from(nanos) +} + +/// A `google.protobuf.Duration`, as nanoseconds. +#[derive(Clone, Copy, PartialEq, PartialOrd)] +pub(crate) struct Duration(pub i128); + +/// A `google.protobuf.Timestamp`, as nanoseconds since the Unix epoch. +#[derive(Clone, Copy, PartialEq, PartialOrd)] +pub(crate) struct Timestamp(pub i128); + +impl Timestamp { + /// `0001-01-01T00:00:00Z`, the earliest value a `Timestamp` may hold. + pub(crate) const MIN: Self = Self(-62_135_596_800 * NANOS_PER_SECOND); + /// `9999-12-31T23:59:59.999999999Z`, the latest. + pub(crate) const MAX: Self = Self(253_402_300_799 * NANOS_PER_SECOND + 999_999_999); + + /// Whether the value is in the range `google.protobuf.Timestamp` allows. + pub(crate) fn in_range(self) -> bool { + (Self::MIN..=Self::MAX).contains(&self) + } +} + +/// A `double` or `float` rule value, compared as an `f64`. +#[derive(Clone, Copy, PartialEq, PartialOrd)] +pub(crate) struct Double(pub f64); + +/// Bytes as `%s` prints them: as text, with what is not UTF-8 replaced. +#[derive(Clone, Copy)] +pub(crate) struct Text<'a>(pub &'a [u8]); + +/// Bytes as `%x` prints them: lowercase hex. +#[derive(Clone, Copy)] +pub(crate) struct Hex<'a>(pub &'a [u8]); + +/// A list as `%s` prints it: the elements, comma separated, in brackets. +pub(crate) struct List(pub I); + +/// A fraction of a second, in the digits it needs; nothing for zero. +fn fraction(f: &mut fmt::Formatter<'_>, mut nanos: u128) -> fmt::Result { + if nanos == 0 { + return Ok(()); + } + let mut width = 9; + while nanos.is_multiple_of(10) { + nanos /= 10; + width -= 1; + } + write!(f, ".{nanos:0width$}") +} + +/// `1.5s`, `-0.000001s`, `0s`. +impl Display for Duration { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.0 < 0 { + f.write_str("-")?; + } + let magnitude = self.0.unsigned_abs(); + let nanos_per_second = NANOS_PER_SECOND.unsigned_abs(); + write!(f, "{}", magnitude / nanos_per_second)?; + fraction(f, magnitude % nanos_per_second)?; + f.write_str("s") + } +} + +/// RFC 3339 in UTC, with the fractional digits the value needs. A value +/// outside the range a `Timestamp` allows prints as seconds since the +/// epoch. +/// +/// The value is added to the epoch as a civil date-time rather than made a +/// `jiff::Timestamp`, whose range stops a day short of `9999-12-31`. +impl Display for Timestamp { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let civil = if self.in_range() { + let seconds = self.0.div_euclid(NANOS_PER_SECOND); + let nanos = self.0.rem_euclid(NANOS_PER_SECOND); + i64::try_from(seconds) + .ok() + .zip(i64::try_from(nanos).ok()) + .and_then(|(seconds, nanos)| { + let span = jiff::Span::new() + .try_seconds(seconds) + .ok()? + .try_nanoseconds(nanos) + .ok()?; + jiff::civil::date(1970, 1, 1) + .at(0, 0, 0, 0) + .checked_add(span) + .ok() + }) + } else { + None + }; + match civil { + Some(civil) => write!(f, "{civil}Z"), + None => write!(f, "{} since the epoch", Duration(self.0)), + } + } +} + +/// As `%s` prints a double: `Infinity`, `-Infinity`, or the shortest form +/// that reads back to the value. +impl Display for Double { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.0.is_infinite() { + f.write_str(if self.0 > 0.0 { + "Infinity" + } else { + "-Infinity" + }) + } else { + write!(f, "{}", self.0) + } + } +} + +impl Display for Text<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&String::from_utf8_lossy(self.0)) + } +} + +impl Display for Hex<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.iter().try_for_each(|byte| write!(f, "{byte:02x}")) + } +} + +impl Display for List +where + I: IntoIterator + Clone, + I::Item: Display, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("[")?; + for (index, item) in self.0.clone().into_iter().enumerate() { + if index > 0 { + f.write_str(", ")?; + } + write!(f, "{item}")?; + } + f.write_str("]") + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn durations() { + assert_eq!(Duration(0).to_string(), "0s"); + assert_eq!(Duration(3 * NANOS_PER_SECOND).to_string(), "3s"); + assert_eq!(Duration(1_000).to_string(), "0.000001s"); + assert_eq!(Duration(1_500_000_000).to_string(), "1.5s"); + assert_eq!(Duration(-1_000_000).to_string(), "-0.001s"); + assert_eq!(Duration(1).to_string(), "0.000000001s"); + } + + #[test] + fn timestamps() { + assert_eq!(Timestamp(0).to_string(), "1970-01-01T00:00:00Z"); + assert_eq!( + Timestamp(1_500_000_000).to_string(), + "1970-01-01T00:00:01.5Z" + ); + assert_eq!( + Timestamp(1_700_000_000 * NANOS_PER_SECOND).to_string(), + "2023-11-14T22:13:20Z" + ); + assert_eq!( + Timestamp(-NANOS_PER_SECOND).to_string(), + "1969-12-31T23:59:59Z" + ); + assert_eq!(Timestamp::MIN.to_string(), "0001-01-01T00:00:00Z"); + assert_eq!(Timestamp::MAX.to_string(), "9999-12-31T23:59:59.999999999Z"); + // One nanosecond past the range: never handed to jiff. + assert!(!Timestamp(Timestamp::MAX.0 + 1).in_range()); + assert_eq!( + Timestamp(Timestamp::MAX.0 + 1).to_string(), + "253402300800s since the epoch" + ); + assert!(!Timestamp(Timestamp::MIN.0 - 1).in_range()); + } + + #[test] + fn doubles() { + assert_eq!(Double(1.5).to_string(), "1.5"); + assert_eq!(Double(123.0).to_string(), "123"); + assert_eq!(Double(1e21).to_string(), "1000000000000000000000"); + assert_eq!(Double(f64::INFINITY).to_string(), "Infinity"); + assert_eq!(Double(f64::NEG_INFINITY).to_string(), "-Infinity"); + assert_eq!(Double(f64::NAN).to_string(), "NaN"); + assert_eq!( + List([f64::INFINITY, 1e21].map(Double)).to_string(), + "[Infinity, 1000000000000000000000]" + ); + } + + #[test] + fn lists_and_bytes() { + assert_eq!(List(&[1i64, 2]).to_string(), "[1, 2]"); + assert_eq!(List(&[] as &[i64]).to_string(), "[]"); + assert_eq!(List(&["foo", "bar"]).to_string(), "[foo, bar]"); + assert_eq!(List([456.789, 123.0]).to_string(), "[456.789, 123]"); + assert_eq!( + List([b"a".as_slice(), b"b"].map(Text)).to_string(), + "[a, b]" + ); + assert_eq!(Hex(b"bar").to_string(), "626172"); + assert_eq!(Hex(&[0x99]).to_string(), "99"); + } +} diff --git a/crates/protovalidate/src/rules/standard/mod.rs b/crates/protovalidate/src/rules/standard/mod.rs new file mode 100644 index 00000000..8946e509 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/mod.rs @@ -0,0 +1,533 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The standard rules, evaluated natively. +//! +//! `validate.proto` defines every standard rule as a CEL expression over +//! `this` and `rules`, with a message formatted from the rule's value. A +//! [`Check`] is one such expression compiled ahead of time. The rules +//! message is known when the field's rules are built, so the message is +//! formatted then, and only the [`Test`] against the value is left for +//! validation. Checks report the same rule ids, messages and rule paths as +//! the CEL expressions, and run in the same order. +//! +//! The tests here are over plain values. Reading those values out of a +//! message is the walk's job, in [`eval`](super::eval). + +pub(crate) mod build; +mod format; +mod regex; +pub(crate) mod wellknown; + +use std::borrow::Cow; +use std::collections::HashSet; +use std::time::SystemTime; + +use buffa_descriptor::EnumIndex; + +use crate::validate::FieldPathElement; +pub(crate) use format::{Double, Duration, Timestamp, total_nanos}; +pub(crate) use regex::Regex; + +/// One standard rule against one value. +pub(crate) struct Check { + /// The rule id, such as `int32.gt_lt`. + pub id: String, + pub message: String, + /// The rule path, from `FieldRules` down: `[FieldRules.int32, + /// Int32Rules.gt]`, or `[FieldRules.repeated, RepeatedRules.items, + /// FieldRules.int32, Int32Rules.gt]` for an element. + pub rule_path: Vec, + pub test: T, +} + +/// What a check tests a value for. +pub(crate) trait Test { + /// Whether `value` breaks the rule, or why it could not be checked. + fn fails(&self, value: &V) -> Result; +} + +/// The checks of a `FieldRules`, grouped by the rules message it sets. Each +/// variant holds its checks in evaluation order, typed by the value they +/// test. +#[derive(Default)] +pub(crate) enum Checks { + /// No rules message is set. + #[default] + None, + Bool(Vec>), + Int(Vec>>), + Uint(Vec>>), + Double(Vec>), + String(Vec>), + Bytes(Vec>), + Enum(Vec>), + List(Vec>), + Map(Vec>), + Duration(Vec>>), + Timestamp(Vec>), + FieldMask(Vec>), + Any(Vec>), +} + +/// A comparison against the rule's values. The range variants are the +/// combinations that `validate.proto` defines for a `gt` or `gte` rule when +/// a `lt` or `lte` is also set. +pub(crate) enum Cmp { + Const(T), + Lt(T), + Lte(T), + Gt(T), + Gte(T), + /// `gt < lt`: the value must be strictly inside. + GtLt { + gt: T, + lt: T, + }, + /// `lt < gt`: the value must be strictly outside `lt..=gt`. + GtLtExclusive { + gt: T, + lt: T, + }, + GtLte { + gt: T, + lte: T, + }, + GtLteExclusive { + gt: T, + lte: T, + }, + GteLt { + gte: T, + lt: T, + }, + GteLtExclusive { + gte: T, + lt: T, + }, + GteLte { + gte: T, + lte: T, + }, + GteLteExclusive { + gte: T, + lte: T, + }, + In(Vec), + NotIn(Vec), +} + +/// Values that fail every comparison rule, such as NaN. +pub(crate) trait MaybeNan { + fn is_nan(&self) -> bool { + false + } +} + +impl MaybeNan for i64 {} +impl MaybeNan for u64 {} +impl MaybeNan for Duration {} +impl MaybeNan for Timestamp {} +impl MaybeNan for Double { + fn is_nan(&self) -> bool { + f64::is_nan(self.0) + } +} + +impl Test for Cmp { + fn fails(&self, value: &T) -> Result { + if value.is_nan() { + // NaN is not equal to, in, or ordered against anything: every + // rule fails except `not_in`, which it trivially satisfies. + return Ok(!matches!(self, Self::NotIn(_))); + } + Ok(match self { + Self::Const(c) => value != c, + Self::Lt(lt) => value >= lt, + Self::Lte(lte) => value > lte, + Self::Gt(gt) => value <= gt, + Self::Gte(gte) => value < gte, + Self::GtLt { gt, lt } => value >= lt || value <= gt, + Self::GtLtExclusive { gt, lt } => lt <= value && value <= gt, + Self::GtLte { gt, lte } => value > lte || value <= gt, + Self::GtLteExclusive { gt, lte } => lte < value && value <= gt, + Self::GteLt { gte, lt } => value >= lt || value < gte, + Self::GteLtExclusive { gte, lt } => lt <= value && value < gte, + Self::GteLte { gte, lte } => value > lte || value < gte, + Self::GteLteExclusive { gte, lte } => lte < value && value < gte, + Self::In(list) => !list.contains(value), + Self::NotIn(list) => list.contains(value), + }) + } +} + +/// The float and double rules. +pub(crate) enum DoubleTest { + Cmp(Cmp), + Finite, +} + +impl Test for DoubleTest { + fn fails(&self, value: &f64) -> Result { + match self { + Self::Cmp(cmp) => cmp.fails(&Double(*value)), + Self::Finite => Ok(!value.is_finite()), + } + } +} + +/// `bool.const`. +impl Test for bool { + fn fails(&self, value: &bool) -> Result { + Ok(value != self) + } +} + +pub(crate) enum StrTest { + Const(String), + /// In Unicode code points, as CEL's `size()` counts them. + Len(u64), + MinLen(u64), + MaxLen(u64), + LenBytes(u64), + MinBytes(u64), + MaxBytes(u64), + Pattern(Regex), + Prefix(String), + Suffix(String), + Contains(String), + NotContains(String), + In(Vec), + NotIn(Vec), + WellKnown(WellKnown), + /// The `_empty` companion of a well-known format. The format rule + /// accepts an empty string; this rule rejects it. + Empty, +} + +/// A well-known string format. +pub(crate) enum WellKnown { + Email, + Hostname, + Ip, + Ipv4, + Ipv6, + Uri, + UriRef, + Address, + Uuid, + Tuuid, + IpWithPrefixlen, + Ipv4WithPrefixlen, + Ipv6WithPrefixlen, + IpPrefix, + Ipv4Prefix, + Ipv6Prefix, + HostAndPort, + Ulid, + ProtobufFqn, + ProtobufDotFqn, + HeaderName { strict: bool }, + HeaderValue { strict: bool }, +} + +impl WellKnown { + /// Whether the format lets an empty string through, leaving it to the + /// `_empty` companion check. A URI reference and a header value do not. + pub(crate) fn allows_empty(&self) -> bool { + !matches!(self, Self::UriRef | Self::HeaderValue { .. }) + } + + fn fails(&self, s: &str) -> bool { + if s.is_empty() && self.allows_empty() { + return false; + } + !match self { + Self::Email => wellknown::is_email(s), + Self::Hostname => wellknown::is_hostname(s), + Self::Ip => wellknown::is_ip(s), + Self::Ipv4 => wellknown::is_ipv4(s), + Self::Ipv6 => wellknown::is_ipv6(s), + Self::Uri => wellknown::is_uri(s), + Self::Address => wellknown::is_hostname(s) || wellknown::is_ip(s), + Self::Uuid => wellknown::is_uuid(s), + Self::Tuuid => wellknown::is_tuuid(s), + Self::IpWithPrefixlen => wellknown::is_ip_prefix(s, false), + Self::Ipv4WithPrefixlen => wellknown::is_ipv4_prefix(s, false), + Self::Ipv6WithPrefixlen => wellknown::is_ipv6_prefix(s, false), + Self::IpPrefix => wellknown::is_ip_prefix(s, true), + Self::Ipv4Prefix => wellknown::is_ipv4_prefix(s, true), + Self::Ipv6Prefix => wellknown::is_ipv6_prefix(s, true), + Self::HostAndPort => wellknown::is_host_and_port(s, true), + Self::Ulid => wellknown::is_ulid(s), + Self::ProtobufFqn => wellknown::is_protobuf_fqn(s), + Self::ProtobufDotFqn => wellknown::is_protobuf_dot_fqn(s), + Self::HeaderName { strict } => wellknown::is_header_name(s, *strict), + Self::UriRef => wellknown::is_uri_ref(s), + Self::HeaderValue { strict } => wellknown::is_header_value(s, *strict), + } + } +} + +impl Test for StrTest { + fn fails(&self, s: &str) -> Result { + Ok(match self { + Self::Const(c) => s != c, + Self::Len(n) => chars(s) != *n, + Self::MinLen(n) => chars(s) < *n, + Self::MaxLen(n) => chars(s) > *n, + Self::LenBytes(n) => s.len() as u64 != *n, + Self::MinBytes(n) => (s.len() as u64) < *n, + Self::MaxBytes(n) => s.len() as u64 > *n, + Self::Pattern(regex) => !regex.is_match(s), + Self::Prefix(p) => !s.starts_with(p.as_str()), + Self::Suffix(p) => !s.ends_with(p.as_str()), + Self::Contains(p) => !s.contains(p.as_str()), + Self::NotContains(p) => s.contains(p.as_str()), + Self::In(list) => !list.iter().any(|item| item == s), + Self::NotIn(list) => list.iter().any(|item| item == s), + Self::WellKnown(format) => format.fails(s), + Self::Empty => s.is_empty(), + }) + } +} + +fn chars(s: &str) -> u64 { + s.chars().count() as u64 +} + +pub(crate) enum BytesTest { + Const(Vec), + Len(u64), + MinLen(u64), + MaxLen(u64), + /// Matched against the bytes decoded as UTF-8, as CEL's `string(this)` + /// would give. + Pattern(Regex), + Prefix(Vec), + Suffix(Vec), + Contains(Vec), + In(Vec>), + NotIn(Vec>), + /// 4 or 16 bytes, or none. + Ip, + Ipv4, + Ipv6, + /// 16 bytes, or none. + Uuid, + /// The `_empty` companion of the formats above. + Empty, +} + +impl Test<[u8]> for BytesTest { + /// Bytes that are not UTF-8 cannot be matched against a pattern, + /// because CEL's `string()` fails on them. + fn fails(&self, b: &[u8]) -> Result { + Ok(match self { + Self::Const(c) => b != c.as_slice(), + Self::Len(n) => b.len() as u64 != *n, + Self::MinLen(n) => (b.len() as u64) < *n, + Self::MaxLen(n) => b.len() as u64 > *n, + Self::Pattern(regex) => match std::str::from_utf8(b) { + Ok(s) => !regex.is_match(s), + Err(_) => return Err("must be valid UTF-8 to apply regexp".to_owned()), + }, + Self::Prefix(p) => !b.starts_with(p), + Self::Suffix(p) => !b.ends_with(p), + Self::Contains(p) => !contains(b, p), + Self::In(list) => !list.iter().any(|item| item == b), + Self::NotIn(list) => list.iter().any(|item| item == b), + Self::Ip => !matches!(b.len(), 0 | 4 | 16), + Self::Ipv4 => !matches!(b.len(), 0 | 4), + Self::Ipv6 => !matches!(b.len(), 0 | 16), + Self::Uuid => !matches!(b.len(), 0 | 16), + Self::Empty => b.is_empty(), + }) + } +} + +fn contains(haystack: &[u8], needle: &[u8]) -> bool { + needle.is_empty() + || haystack + .windows(needle.len()) + .any(|window| window == needle) +} + +/// The enum rules. +pub(crate) enum EnumTest { + Cmp(Cmp), + DefinedOnly(EnumIndex), +} + +/// The repeated rules, which the walk evaluates over the list. +pub(crate) enum ListTest { + MinItems(u64), + MaxItems(u64), + Unique, +} + +/// The map rules, which the walk evaluates over the map. +pub(crate) enum MapTest { + MinPairs(u64), + MaxPairs(u64), +} + +/// The `any` rules, on the `type_url`. +pub(crate) enum AnyTest { + In(Vec), + NotIn(Vec), +} + +impl Test for AnyTest { + fn fails(&self, type_url: &str) -> Result { + Ok(match self { + Self::In(list) => !list.iter().any(|allowed| allowed == type_url), + Self::NotIn(list) => list.iter().any(|blocked| blocked == type_url), + }) + } +} + +/// The timestamp rules. +pub(crate) enum TimestampTest { + Cmp(Cmp), + Now(NowTest), +} + +pub(crate) enum NowTest { + LtNow, + GtNow, + Within(Duration), +} + +impl Test for TimestampTest { + fn fails(&self, value: &Timestamp) -> Result { + let test = match self { + Self::Cmp(cmp) => return cmp.fails(value), + Self::Now(test) => test, + }; + let now = now(); + Ok(match test { + NowTest::LtNow => *value > now, + NowTest::GtNow => *value < now, + NowTest::Within(within) => value.0 < now.0 - within.0 || value.0 > now.0 + within.0, + }) + } +} + +fn now() -> Timestamp { + let nanos = match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { + Ok(since) => i128::try_from(since.as_nanos()).unwrap_or(i128::MAX), + Err(before) => -i128::try_from(before.duration().as_nanos()).unwrap_or(i128::MAX), + }; + Timestamp(nanos) +} + +pub(crate) enum FieldMaskTest { + Const(Vec), + /// Every path must be in the list, or below a path in it. + In(Vec), + NotIn(Vec), +} + +fn covered(paths: &[String], path: &str) -> bool { + paths.iter().any(|allowed| { + allowed == path + || path + .strip_prefix(allowed.as_str()) + .is_some_and(|rest| rest.starts_with('.')) + }) +} + +impl Test<[Cow<'_, str>]> for FieldMaskTest { + fn fails(&self, paths: &[Cow<'_, str>]) -> Result { + Ok(match self { + Self::Const(c) => paths != c.as_slice(), + Self::In(list) => !paths.iter().all(|path| covered(list, path)), + Self::NotIn(list) => paths.iter().any(|path| covered(list, path)), + }) + } +} + +/// A list element as `unique()` compares it, by type and value. Signed +/// zeros are equal, and NaN is never equal to anything. +#[derive(PartialEq, Eq, Hash)] +pub(crate) enum UniqueKey<'a> { + Bool(bool), + Int(i64), + Uint(u64), + Double(u64), + Str(&'a str), + Bytes(&'a [u8]), +} + +impl UniqueKey<'_> { + /// The key of a double, or `None` for NaN, which never duplicates + /// anything. + pub(crate) fn double(value: f64) -> Option { + if value.is_nan() { + return None; + } + Some(Self::Double(if value == 0.0 { 0 } else { value.to_bits() })) + } +} + +/// How many keys [`has_duplicates`] compares pairwise before it switches +/// to hashing. +const PAIRWISE_KEYS: usize = 16; + +/// Whether any key occurs twice. Elements without a key never count as +/// duplicates. +pub(crate) fn has_duplicates<'a>(keys: impl IntoIterator>>) -> bool { + let mut keys = keys.into_iter().flatten(); + let mut first: [Option>; PAIRWISE_KEYS] = [const { None }; PAIRWISE_KEYS]; + for (len, key) in keys.by_ref().enumerate() { + if first[..len].iter().any(|seen| seen.as_ref() == Some(&key)) { + return true; + } + if len == PAIRWISE_KEYS { + let mut seen: HashSet<_, foldhash::fast::RandomState> = + first.iter_mut().filter_map(Option::take).collect(); + seen.insert(key); + return keys.any(|key| !seen.insert(key)); + } + first[len] = Some(key); + } + false +} + +#[cfg(test)] +mod tests { + use super::{PAIRWISE_KEYS, UniqueKey, has_duplicates}; + + fn ints(values: impl IntoIterator) -> Vec>> { + values + .into_iter() + .map(|value| Some(UniqueKey::Int(value))) + .collect() + } + + #[test] + fn duplicates_compared_pairwise() { + assert!(!has_duplicates(ints(0..3))); + assert!(has_duplicates(ints([1, 2, 1]))); + assert!(!has_duplicates([None, None, Some(UniqueKey::Str("a"))])); + } + + #[test] + fn duplicates_hashed() { + let len = i64::try_from(PAIRWISE_KEYS).unwrap() + 4; + assert!(!has_duplicates(ints(0..len))); + assert!(has_duplicates(ints((0..len).chain([len - 1])))); + } +} diff --git a/crates/protovalidate/src/rules/standard/regex.rs b/crates/protovalidate/src/rules/standard/regex.rs new file mode 100644 index 00000000..6c75a97d --- /dev/null +++ b/crates/protovalidate/src/rules/standard/regex.rs @@ -0,0 +1,174 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The regular expression engine behind `pattern` rules and the well-known +//! string formats. +//! +//! With the `cel` feature this is RE2, through cel-cpp, so a `pattern` +//! rule and a `matches()` call in a custom rule use the same engine. +//! Without it, the `regex` crate is used, after [`ascii_classes`] rewrites +//! the Perl classes to the ASCII sets RE2 uses. The remaining differences +//! from RE2 are that `\Q...\E` is not supported, repeat counts are not +//! capped at 1000, and more `\p{...}` names are accepted. + +#[cfg(feature = "cel")] +type Inner = protovalidate_deps::Regex; +#[cfg(not(feature = "cel"))] +type Inner = regex::Regex; + +/// A compiled pattern. +#[derive(Debug)] +pub(crate) struct Regex(Inner); + +impl Regex { + /// Compiles `pattern`, or returns the engine's message for one it + /// rejects. + pub(crate) fn new(pattern: &str) -> Result { + #[cfg(not(feature = "cel"))] + let pattern = &ascii_classes(pattern); + Inner::new(pattern) + .map(Self) + .map_err(|error| error.to_string()) + } + + /// Whether `text` contains a match. + pub(crate) fn is_match(&self, text: &str) -> bool { + self.0.is_match(text) + } +} + +/// Rewrites `\d`, `\w`, `\s`, `\b` and their negations to the ASCII sets +/// RE2 uses. In the `regex` crate they match Unicode. `\s` is written out +/// as a class because the crate's ASCII `\s` includes vertical tab and +/// RE2's does not. Inside a bracket class the set is inserted directly, +/// or as a nested class when negated. +/// +/// The pattern is scanned, not parsed. The scan handles escapes, so `\\d` +/// stays a backslash followed by `d`, and bracket depth, so a `]` directly +/// after `[` or `[^` is treated as a literal. Everything else is copied +/// through, so a pattern the crate rejects is still rejected afterwards. +#[cfg(any(not(feature = "cel"), test))] +fn ascii_classes(pattern: &str) -> String { + let mut out = String::with_capacity(pattern.len()); + let mut chars = pattern.chars().peekable(); + let mut depth = 0usize; + // A `]` directly after `[` or `[^` is a literal, not the end of the + // class. + let mut class_start = false; + while let Some(c) = chars.next() { + match c { + '\\' => { + class_start = false; + let Some(escaped) = chars.next() else { + out.push('\\'); + break; + }; + let in_class = depth > 0; + let replacement = match (escaped, in_class) { + ('d', false) => "[0-9]", + ('d', true) => "0-9", + ('D', _) => "[^0-9]", + ('w', false) => "[0-9A-Za-z_]", + ('w', true) => "0-9A-Za-z_", + ('W', _) => "[^0-9A-Za-z_]", + ('s', false) => "[\\t\\n\\f\\r ]", + ('s', true) => "\\t\\n\\f\\r ", + ('S', _) => "[^\\t\\n\\f\\r ]", + ('b', false) => "(?-u:\\b)", + ('B', false) => "(?-u:\\B)", + _ => { + out.push('\\'); + out.push(escaped); + continue; + } + }; + out.push_str(replacement); + } + '[' => { + depth += 1; + out.push('['); + if chars.peek() == Some(&'^') { + chars.next(); + out.push('^'); + } + class_start = true; + } + ']' if class_start => { + out.push(']'); + class_start = false; + } + ']' => { + depth = depth.saturating_sub(1); + out.push(']'); + } + _ => { + class_start = false; + out.push(c); + } + } + } + out +} + +#[cfg(test)] +mod tests { + use super::ascii_classes; + + #[test] + fn rewrites_perl_classes() { + assert_eq!(ascii_classes(r"^\d+$"), "^[0-9]+$"); + assert_eq!( + ascii_classes(r"\D\w\W\S"), + "[^0-9][0-9A-Za-z_][^0-9A-Za-z_][^\\t\\n\\f\\r ]" + ); + assert_eq!(ascii_classes(r"\bfoo\B"), r"(?-u:\b)foo(?-u:\B)"); + assert_eq!(ascii_classes(r"\s"), "[\\t\\n\\f\\r ]"); + } + + #[test] + fn splices_into_classes() { + assert_eq!(ascii_classes(r"[\d-]"), "[0-9-]"); + assert_eq!(ascii_classes(r"[^\w\s]"), "[^0-9A-Za-z_\\t\\n\\f\\r ]"); + assert_eq!(ascii_classes(r"[a\D]"), "[a[^0-9]]"); + assert_eq!(ascii_classes(r"[[:alpha:]\d]"), "[[:alpha:]0-9]"); + assert_eq!(ascii_classes(r"[[:alpha:]]\d"), "[[:alpha:]][0-9]"); + } + + #[test] + fn leaves_the_rest_alone() { + assert_eq!(ascii_classes(r"\\d"), r"\\d"); + assert_eq!(ascii_classes(r"[]\d]"), "[]0-9]"); + assert_eq!(ascii_classes(r"[^]\d]"), "[^]0-9]"); + assert_eq!(ascii_classes(r"[\b]"), r"[\b]"); + assert_eq!(ascii_classes(r"\p{Greek}\x41é"), r"\p{Greek}\x41é"); + assert_eq!(ascii_classes(r"a\"), r"a\"); + } + + #[test] + fn matches_like_re2() { + let re = |p: &str| regex::Regex::new(&ascii_classes(p)).expect("valid"); + assert!(re(r"^\d+$").is_match("123")); + assert!(!re(r"^\d+$").is_match("١٢٣")); + assert!(!re(r"^\w+$").is_match("héllo")); + assert!(re(r"^[^\d]$").is_match("Ù£")); + assert!(re(r"^[a\D]$").is_match("Ù£")); + assert!(re(r"\bfoo\b").is_match("üfoo")); + assert!(!re(r"^\s$").is_match("\u{a0}")); + assert!(!re(r"^\s$").is_match("\u{b}")); + assert!(re(r"^.$").is_match("é")); + assert!(re(r"^[^a]$").is_match("é")); + assert!(re(r"(?i)σ").is_match("Σ")); + assert!(re(r"(?i)\w").is_match("\u{212a}")); + } +} diff --git a/crates/protovalidate/src/rules/standard/wellknown/host.rs b/crates/protovalidate/src/rules/standard/wellknown/host.rs new file mode 100644 index 00000000..5758474f --- /dev/null +++ b/crates/protovalidate/src/rules/standard/wellknown/host.rs @@ -0,0 +1,175 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Hostnames, email addresses and host-and-port pairs. + +use std::sync::LazyLock; + +use crate::rules::standard::Regex; + +use super::ip::{is_ipv4, is_ipv6}; + +/// Returns whether the string is a valid hostname, for example +/// `foo.example.com`. +/// +/// A valid hostname follows the rules below: +/// - The name consists of one or more labels, separated by a dot (`.`). +/// - Each label can be 1 to 63 alphanumeric characters. +/// - A label can contain hyphens (`-`), but must not start or end with a hyphen. +/// - The right-most label must not be digits only. +/// - The name can have a trailing dot, for example `foo.example.com.`. +/// - The name can be 253 characters at most, excluding the optional trailing dot. +pub(crate) fn is_hostname(s: &str) -> bool { + if s.is_empty() { + return false; + } + // The limit excludes the trailing dot, so strip it before measuring. + let s = s.strip_suffix('.').unwrap_or(s); + if s.len() > 253 { + return false; + } + let mut all_digits = false; + for part in s.split('.') { + all_digits = true; + let bytes = part.as_bytes(); + if bytes.is_empty() + || bytes.len() > 63 + || bytes[0] == b'-' + || bytes[bytes.len() - 1] == b'-' + { + return false; + } + for &b in bytes { + if !b.is_ascii_alphanumeric() && b != b'-' { + return false; + } + all_digits = all_digits && b.is_ascii_digit(); + } + } + !all_digits +} + +/// Returns whether val is an email address, for example "foo@example.com". +/// +/// Conforms to the definition for a valid email address from the HTML standard. +/// Note that this standard willfully deviates from RFC 5322, which allows many +/// unexpected forms of email addresses and will easily match a typographical +/// error. +pub(crate) fn is_email(s: &str) -> bool { + static EMAIL: LazyLock = LazyLock::new(|| { + // See https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address + Regex::new( + r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$", + ) + .expect("the email pattern is valid") + }); + EMAIL.is_match(s) +} + +/// Returns whether the string is a valid port for [`is_host_and_port`]. +fn is_port(s: &str) -> bool { + let bytes = s.as_bytes(); + if bytes.is_empty() || (bytes.len() > 1 && bytes[0] == b'0') { + return false; + } + if !bytes.iter().all(u8::is_ascii_digit) { + return false; + } + s.parse::().is_ok_and(|port| port <= 65_535) +} + +/// Returns whether the string is a valid host/port pair, for example +/// `example.com:8080`. +/// +/// If the argument `port_required` is true, the port is required. If the +/// argument is false, the port is optional. +/// +/// The host can be one of: +/// - An IPv4 address in dotted decimal format, for example `192.168.0.1`. +/// - An IPv6 address enclosed in square brackets, for example `[::1]`. +/// - A hostname, for example `example.com`. +/// +/// The port is separated by a colon. It must be non-empty, with a decimal +/// number in the range of 0-65535, inclusive. +pub(crate) fn is_host_and_port(s: &str, port_required: bool) -> bool { + if s.is_empty() { + return false; + } + let split = s.rfind(':'); + if s.starts_with('[') { + let Some(end) = s.rfind(']') else { + return false; + }; + let after_end = end + 1; + if after_end == s.len() { + // No port. + return !port_required && is_ipv6(&s[1..end]); + } + if Some(after_end) == split { + return is_ipv6(&s[1..end]) && is_port(&s[after_end + 1..]); + } + return false; + } + let Some(split) = split else { + return !port_required && (is_hostname(s) || is_ipv4(s)); + }; + let (host, port) = (&s[..split], &s[split + 1..]); + (is_hostname(host) || is_ipv4(host)) && is_port(port) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn hostnames() { + assert!(is_hostname("example.com")); + assert!(is_hostname("example.com.")); + assert!(is_hostname("a-b.c")); + assert!(is_hostname("123.example")); + assert!(!is_hostname("example..com")); + assert!(!is_hostname("-example.com")); + assert!(!is_hostname("example.com..")); + assert!(!is_hostname("192.168.0.1")); + assert!(!is_hostname("")); + assert!(!is_hostname(".")); + assert!(!is_hostname("exa_mple.com")); + } + + #[test] + fn emails() { + assert!(is_email("foo@example.com")); + assert!(is_email("a.b+c@sub.example.com")); + assert!(!is_email("foo@")); + assert!(!is_email("@example.com")); + assert!(!is_email("foo@-example.com")); + assert!(!is_email("foo@example..com")); + assert!(!is_email("foo bar@example.com")); + assert!(!is_email("foo@exa_mple.com")); + } + + #[test] + fn host_and_port() { + assert!(is_host_and_port("example.com:80", true)); + assert!(is_host_and_port("192.168.0.1:8080", true)); + assert!(is_host_and_port("[::1]:443", true)); + assert!(!is_host_and_port("example.com", true)); + assert!(is_host_and_port("example.com", false)); + assert!(is_host_and_port("[::1]", false)); + assert!(!is_host_and_port("example.com:0080", true)); + assert!(!is_host_and_port("example.com:65536", true)); + assert!(!is_host_and_port("::1:443", true)); + assert!(!is_host_and_port("", false)); + } +} diff --git a/crates/protovalidate/src/rules/standard/wellknown/ip.rs b/crates/protovalidate/src/rules/standard/wellknown/ip.rs new file mode 100644 index 00000000..52584074 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/wellknown/ip.rs @@ -0,0 +1,162 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! IPv4 and IPv6 addresses and prefixes, with the zone ID an IPv6 address +//! may carry and, for `strict` prefixes, host bits that must be zero. + +use std::net::{Ipv4Addr, Ipv6Addr}; + +/// Returns whether the string is an IPv4 address in the dotted decimal format, +/// for example `192.168.5.21`. +pub(crate) fn is_ipv4(s: &str) -> bool { + s.parse::().is_ok() +} + +/// Returns whether the string is an IPv6 address in its text representation +/// following RFC 4291, for example `::1` or `2001:0DB8:ABCD:0012::0`, with an +/// optional zone ID following RFC 4007, for example `fe80::a%en1`. +/// +/// There is no definition for the character set allowed in the zone +/// identifier. RFC 4007 permits basically any non-null string. +pub(crate) fn is_ipv6(s: &str) -> bool { + let (address, zone) = match s.split_once('%') { + Some((address, zone)) => (address, Some(zone)), + None => (s, None), + }; + if zone.is_some_and(|zone| zone.is_empty() || zone.contains('\0')) { + return false; + } + address.parse::().is_ok() +} + +/// Returns whether the string is an IPv4 or IPv6 address. +/// +/// IPv4 addresses are expected in the dotted decimal format, for example +/// `192.168.5.21`. IPv6 addresses are expected in their text representation, +/// for example `::1`, or `2001:0DB8:ABCD:0012::0`. +/// +/// Both formats are well-defined in the internet standard RFC 3986. Zone +/// identifiers for IPv6 addresses (for example `fe80::a%en1`) are supported. +pub(crate) fn is_ip(s: &str) -> bool { + is_ipv4(s) || is_ipv6(s) +} + +/// Parses the length of a prefix of an address of `bits` bits: decimal digits +/// with no sign and no leading zero, at most `bits`. +fn prefix_length(s: &str, bits: u32) -> Option { + if s.is_empty() || !s.bytes().all(|b| b.is_ascii_digit()) || (s.len() > 1 && s.starts_with('0')) + { + return None; + } + s.parse::().ok().filter(|&length| length <= bits) +} + +/// Returns whether the string is a valid IPv4 address prefix, optionally +/// requiring the host portion to be all zeros. See [`is_ip_prefix`]. +pub(crate) fn is_ipv4_prefix(s: &str, strict: bool) -> bool { + let Some((address, length)) = s.split_once('/') else { + return false; + }; + let (Ok(address), Some(length)) = (address.parse::(), prefix_length(length, 32)) + else { + return false; + }; + let host_mask = u32::MAX.checked_shr(length).unwrap_or(0); + !strict || u32::from(address) & host_mask == 0 +} + +/// Returns whether the string is a valid IPv6 address prefix following RFC +/// 4291, optionally requiring the host portion to be all zeros. A zone ID is +/// not permitted. See [`is_ip_prefix`]. +pub(crate) fn is_ipv6_prefix(s: &str, strict: bool) -> bool { + let Some((address, length)) = s.split_once('/') else { + return false; + }; + let (Ok(address), Some(length)) = (address.parse::(), prefix_length(length, 128)) + else { + return false; + }; + let host_mask = u128::MAX.checked_shr(length).unwrap_or(0); + !strict || u128::from(address) & host_mask == 0 +} + +/// Returns whether the string is a valid IP with prefix length, optionally +/// requiring the host portion to be all zeros. +/// +/// An address prefix divides an IP address into a network portion, and a host +/// portion. The prefix length specifies how many bits the network portion has. +/// For example, the IPv6 prefix `2001:db8:abcd:0012::0/64` designates the +/// left-most 64 bits as the network prefix. The range of the network is 2**64 +/// addresses, from `2001:db8:abcd:0012::0` to +/// `2001:db8:abcd:0012:ffff:ffff:ffff:ffff`. +/// +/// An address prefix may include a specific host address, for example +/// `2001:db8:abcd:0012::1f/64`. With `strict` = true, this is not permitted. +/// The host portion must be all zeros, as in `2001:db8:abcd:0012::0/64`. +/// +/// The same principle applies to IPv4 addresses. `192.168.1.0/24` designates +/// the first 24 bits of the 32-bit IPv4 as the network prefix. +pub(crate) fn is_ip_prefix(s: &str, strict: bool) -> bool { + is_ipv4_prefix(s, strict) || is_ipv6_prefix(s, strict) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn ipv4() { + assert!(is_ipv4("192.168.0.1")); + assert!(is_ipv4("0.0.0.0")); + assert!(is_ipv4("255.255.255.255")); + assert!(!is_ipv4("256.0.0.1")); + assert!(!is_ipv4("01.0.0.1")); + assert!(!is_ipv4("1.2.3")); + assert!(!is_ipv4("1.2.3.4.5")); + assert!(!is_ipv4("")); + } + + #[test] + fn ipv6() { + assert!(is_ipv6("::")); + assert!(is_ipv6("::1")); + assert!(is_ipv6("2001:db8::1")); + assert!(is_ipv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334")); + assert!(is_ipv6("::ffff:192.168.0.1")); + assert!(is_ipv6("fe80::1%eth0")); + assert!(!is_ipv6("fe80::1%")); + assert!(!is_ipv6(":::")); + assert!(!is_ipv6("1::2::3")); + assert!(!is_ipv6("2001:db8:1:2:3:4:5:6:7")); + assert!(!is_ipv6(":1")); + assert!(!is_ipv6("1:")); + } + + #[test] + fn prefixes() { + assert!(is_ipv4_prefix("192.168.0.0/16", true)); + assert!(!is_ipv4_prefix("192.168.0.1/16", true)); + assert!(is_ipv4_prefix("192.168.0.1/16", false)); + assert!(!is_ipv4_prefix("192.168.0.0/33", false)); + assert!(!is_ipv4_prefix("192.168.0.0/08", false)); + assert!(!is_ipv4_prefix("192.168.0.0/+8", false)); + assert!(is_ipv4_prefix("0.0.0.0/0", true)); + assert!(is_ipv6_prefix("2001:db8::/32", true)); + assert!(!is_ipv6_prefix("2001:db8::1/32", true)); + assert!(is_ipv6_prefix("::/0", true)); + assert!(is_ipv6_prefix("::1/128", true)); + assert!(!is_ipv6_prefix("2001:db8::/129", false)); + assert!(!is_ip_prefix("2001:db8::", false)); + } +} diff --git a/crates/protovalidate/src/rules/standard/wellknown/mod.rs b/crates/protovalidate/src/rules/standard/wellknown/mod.rs new file mode 100644 index 00000000..dbaf44b1 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/wellknown/mod.rs @@ -0,0 +1,31 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The well-known string formats: what protovalidate's CEL functions +//! (`isEmail`, `isHostname`, `isIp`, `isIpPrefix`, `isUri`, `isUriRef`, +//! `isHostAndPort`) and the regex-defined formats (UUID, ULID, Protobuf +//! names, HTTP header names and values) accept. + +mod host; +mod ip; +mod text; +mod uri; + +pub(crate) use host::{is_email, is_host_and_port, is_hostname}; +pub(crate) use ip::{is_ip, is_ip_prefix, is_ipv4, is_ipv4_prefix, is_ipv6, is_ipv6_prefix}; +pub(crate) use text::{ + is_header_name, is_header_value, is_protobuf_dot_fqn, is_protobuf_fqn, is_tuuid, is_ulid, + is_uuid, +}; +pub(crate) use uri::{is_uri, is_uri_ref}; diff --git a/crates/protovalidate/src/rules/standard/wellknown/text.rs b/crates/protovalidate/src/rules/standard/wellknown/text.rs new file mode 100644 index 00000000..72eacd22 --- /dev/null +++ b/crates/protovalidate/src/rules/standard/wellknown/text.rs @@ -0,0 +1,138 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The formats `validate.proto` defines with a regular expression: UUIDs, +//! ULIDs, Protobuf names and HTTP header names and values. + +use std::sync::LazyLock; + +use crate::rules::standard::Regex; + +macro_rules! pattern { + ($name:ident, $pattern:literal) => { + static $name: LazyLock = LazyLock::new(|| { + Regex::new($pattern).expect(concat!("`", stringify!($name), "` is a valid pattern")) + }); + }; +} + +pattern!( + UUID, + r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" +); +pattern!(TUUID, r"^[0-9a-fA-F]{32}$"); +pattern!(ULID, r"^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$"); +pattern!( + PROTOBUF_FQN, + r"^[A-Za-z_][A-Za-z_0-9]*(\.[A-Za-z_][A-Za-z_0-9]*)*$" +); +pattern!( + PROTOBUF_DOT_FQN, + r"^\.[A-Za-z_][A-Za-z_0-9]*(\.[A-Za-z_][A-Za-z_0-9]*)*$" +); +// RFC 7230's token, with a leading colon allowed for HTTP/2 pseudo-headers. +pattern!(HEADER_NAME_STRICT, r"^:?[0-9a-zA-Z!#$%&'*+-.^_|~\x60]+$"); +pattern!(HEADER_NAME_LOOSE, r"^[^\x00\x0A\x0D]+$"); +// Everything but the control characters other than tab. +pattern!(HEADER_VALUE_STRICT, r"^[^\x00-\x08\x0A-\x1F\x7F]*$"); +pattern!(HEADER_VALUE_LOOSE, r"^[^\x00\x0A\x0D]*$"); + +pub(crate) fn is_uuid(s: &str) -> bool { + UUID.is_match(s) +} + +pub(crate) fn is_tuuid(s: &str) -> bool { + TUUID.is_match(s) +} + +pub(crate) fn is_ulid(s: &str) -> bool { + ULID.is_match(s) +} + +pub(crate) fn is_protobuf_fqn(s: &str) -> bool { + PROTOBUF_FQN.is_match(s) +} + +pub(crate) fn is_protobuf_dot_fqn(s: &str) -> bool { + PROTOBUF_DOT_FQN.is_match(s) +} + +/// An HTTP header name; loose only excludes NUL, LF and CR. +pub(crate) fn is_header_name(s: &str, strict: bool) -> bool { + if strict { + HEADER_NAME_STRICT.is_match(s) + } else { + HEADER_NAME_LOOSE.is_match(s) + } +} + +/// An HTTP header value; loose only excludes NUL, LF and CR. +pub(crate) fn is_header_value(s: &str, strict: bool) -> bool { + if strict { + HEADER_VALUE_STRICT.is_match(s) + } else { + HEADER_VALUE_LOOSE.is_match(s) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn uuids() { + assert!(is_uuid("123e4567-e89b-12d3-a456-426614174000")); + assert!(is_uuid("123E4567-E89B-12D3-A456-426614174000")); + assert!(!is_uuid("123e4567e89b12d3a456426614174000")); + assert!(!is_uuid("123e4567-e89b-12d3-a456-42661417400g")); + assert!(is_tuuid("123e4567e89b12d3a456426614174000")); + assert!(!is_tuuid("123e4567-e89b-12d3-a456-426614174000")); + } + + #[test] + fn ulids() { + assert!(is_ulid("01ARZ3NDEKTSV4RRFFQ69G5FAV")); + assert!(is_ulid("01arz3ndektsv4rrffq69g5fav")); + assert!(!is_ulid("81ARZ3NDEKTSV4RRFFQ69G5FAV")); + assert!(!is_ulid("01ARZ3NDEKTSV4RRFFQ69G5FAI")); + assert!(!is_ulid("01ARZ3NDEKTSV4RRFFQ69G5FA")); + } + + #[test] + fn protobuf_names() { + assert!(is_protobuf_fqn("foo.bar.Baz")); + assert!(is_protobuf_fqn("_x1")); + assert!(!is_protobuf_fqn("foo..Baz")); + assert!(!is_protobuf_fqn("1foo")); + assert!(!is_protobuf_fqn(".foo")); + assert!(is_protobuf_dot_fqn(".foo.Bar")); + assert!(!is_protobuf_dot_fqn("foo.Bar")); + } + + #[test] + fn headers() { + assert!(is_header_name("Content-Type", true)); + assert!(is_header_name(":authority", true)); + assert!(!is_header_name("Content Type", true)); + assert!(is_header_name("Content Type", false)); + assert!(!is_header_name("Content\nType", false)); + assert!(!is_header_name("", true)); + assert!(is_header_value("text/html; charset=utf-8", true)); + assert!(is_header_value("tab\tok", true)); + assert!(is_header_value("", true)); + assert!(!is_header_value("bad\x7f", true)); + assert!(is_header_value("bad\x7f", false)); + assert!(!is_header_value("bad\r", false)); + } +} diff --git a/crates/protovalidate/src/rules/standard/wellknown/uri.rs b/crates/protovalidate/src/rules/standard/wellknown/uri.rs new file mode 100644 index 00000000..b0653abf --- /dev/null +++ b/crates/protovalidate/src/rules/standard/wellknown/uri.rs @@ -0,0 +1,145 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! URIs and URI references per RFC 3986, with two additions: an IPv6 +//! literal may carry an RFC 6874 zone ID, `[fe80::1%25eth0]`, and the +//! percent-encoded octets of a host name or zone ID must form valid UTF-8. + +use std::borrow::Cow; + +use iri_string::types::{UriReferenceStr, UriStr}; +use percent_encoding::percent_decode_str; + +/// Whether the percent-encoded octets of `text`, whose triplets are already +/// known to be well-formed, decode to UTF-8. +fn decodes_to_utf8(text: &str) -> bool { + percent_decode_str(text).decode_utf8().is_ok() +} + +fn is_unreserved(b: u8) -> bool { + b.is_ascii_alphanumeric() || matches!(b, b'-' | b'_' | b'.' | b'~') +} + +/// The rule from RFC 6874, with the encoded octets valid UTF-8: +/// +/// ```text +/// ZoneID = 1*( unreserved / pct-encoded ) +/// ``` +fn is_zone_id(zone: &str) -> bool { + let mut rest = zone.as_bytes(); + if rest.is_empty() { + return false; + } + while let Some(&b) = rest.first() { + rest = match b { + b'%' if rest.len() >= 3 && rest[1..3].iter().all(u8::is_ascii_hexdigit) => &rest[3..], + _ if is_unreserved(b) => &rest[1..], + _ => return false, + }; + } + decodes_to_utf8(zone) +} + +/// `s` with the zone ID of its IPv6 literal removed, for RFC 3986's grammar, +/// once the zone ID has been checked; `None` for a bad zone ID. +/// +/// A raw `[` is only legal in an IP literal, so the first one is the host's +/// if the URI is valid at all, and taking a zone ID out of a `[...]` anywhere +/// else changes nothing about the string being rejected. +fn without_zone_id(s: &str) -> Option> { + let Some(open) = s.find('[') else { + return Some(Cow::Borrowed(s)); + }; + let close = open + s[open..].find(']')?; + let Some((address, zone)) = s[open + 1..close].split_once("%25") else { + return Some(Cow::Borrowed(s)); + }; + is_zone_id(zone).then(|| Cow::Owned(format!("{}{address}{}", &s[..=open], &s[close..]))) +} + +/// A registered name's percent-encoded octets must be UTF-8; IP literals +/// are in brackets. +fn is_host_utf8(host: &str) -> bool { + host.starts_with('[') || decodes_to_utf8(host) +} + +/// Returns whether the string is a URI, for example +/// `https://example.com/foo/bar?baz=quux#frag`. +/// +/// URI is defined in the internet standard RFC 3986. +/// Zone Identifiers in IPv6 address literals are supported (RFC 6874). +pub(crate) fn is_uri(s: &str) -> bool { + let Some(s) = without_zone_id(s) else { + return false; + }; + UriStr::new(&s).is_ok_and(|uri| { + uri.authority_components() + .is_none_or(|authority| is_host_utf8(authority.host())) + }) +} + +/// Returns whether the string is a URI Reference - a URI such as +/// `https://example.com/foo/bar?baz=quux#frag`, or a Relative Reference such +/// as `./foo/bar?query`. +/// +/// URI, URI Reference, and Relative Reference are defined in the internet +/// standard RFC 3986. Zone Identifiers in IPv6 address literals are supported +/// (RFC 6874). +pub(crate) fn is_uri_ref(s: &str) -> bool { + let Some(s) = without_zone_id(s) else { + return false; + }; + UriReferenceStr::new(&s).is_ok_and(|uri| { + uri.authority_components() + .is_none_or(|authority| is_host_utf8(authority.host())) + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn uris() { + assert!(is_uri("https://example.com")); + assert!(is_uri("https://user:pw@example.com:8080/a/b?c=d#e")); + assert!(is_uri("mailto:someone@example.com")); + assert!(is_uri("urn:isbn:0451450523")); + assert!(is_uri("http://[2001:db8::1]/")); + assert!(is_uri("http://[fe80::1%25eth0]/")); + assert!(is_uri("http://[fe80::1%25foo%c3%96]/")); + assert!(is_uri("http://[v1.fe80::a+en1]/")); + assert!(is_uri("http://ex%C3%A4mple.com/")); + assert!(!is_uri("http://ex%C3mple.com/")); + assert!(!is_uri("http://[fe80::1%25]/")); + assert!(!is_uri("http://[fe80::1%25a%c3]/")); + assert!(!is_uri("http://[fe80::1%eth0]/")); + assert!(!is_uri("example.com")); + assert!(!is_uri("http://example.com/a b")); + assert!(!is_uri("")); + assert!(!is_uri("1http://example.com")); + } + + #[test] + fn uri_refs() { + assert!(is_uri_ref("https://example.com")); + assert!(is_uri_ref("/relative/path?x=y")); + assert!(is_uri_ref("relative/path")); + assert!(is_uri_ref("//example.com/path")); + assert!(is_uri_ref("")); + assert!(is_uri_ref("#frag")); + assert!(!is_uri_ref("a:b:c/ d")); + assert!(!is_uri_ref("%")); + } +} diff --git a/crates/protovalidate/src/validator.rs b/crates/protovalidate/src/validator.rs new file mode 100644 index 00000000..c2d048b4 --- /dev/null +++ b/crates/protovalidate/src/validator.rs @@ -0,0 +1,234 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::fmt; +use std::sync::{Arc, PoisonError, RwLock}; + +use buffa::Message as _; +use buffa_descriptor::MessageIndex; +use buffa_descriptor::generated::descriptor::{FileDescriptorProto, FileDescriptorSet}; + +use crate::cel; +use crate::descriptors::{self, Descriptors}; +use crate::protobuf::{Reader, Runtime}; +use crate::rules::ValidatorCache; +use crate::rules::build::{self, Builder}; +use crate::rules::eval::Walk; +use crate::validate::{Violation as ViolationPb, Violations}; +use crate::{DescriptorError, Error, ValidationError}; + +/// The violations as a serialized `buf.validate.Violations`. +fn encode_violations(violations: Vec) -> Vec { + Violations { + violations, + ..Default::default() + } + .encode_to_vec() +} + +/// Appended to a panic that only a broken build can reach. +const BUILD_BUG: &str = "this is a bug in protovalidate, please report it"; + +/// A CEL environment with the files of `set` registered. +pub(crate) fn cel_env(set: &FileDescriptorSet) -> cel::Env { + let mut env = cel::new_env().unwrap_or_else(|error| { + panic!("could not initialize the CEL runtime: {error}; {BUILD_BUG}") + }); + for file in &set.file { + env.add_file(&file.encode_to_vec()).unwrap_or_else(|error| { + panic!("could not register the buf.validate schema: {error}; {BUILD_BUG}") + }); + } + env +} + +/// Validates Protobuf messages against the rules in their descriptors. +/// Messages are read through the runtime `R`. +pub struct Validator { + descriptors: Descriptors, + /// Locked only for calls into CEL, notably it is never locked around + /// Runtime invocations which may switch threads and reenter. + env: RwLock, + /// Replaced as a whole whenever rules are built. + cache: RwLock>>, +} + +impl fmt::Debug for Validator { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Validator").finish_non_exhaustive() + } +} + +impl Default for Validator { + fn default() -> Self { + Self::new() + } +} + +impl Validator { + /// Creates a validator. + /// + /// Use `add_*` methods to register file descriptors for the messages you will validate. + #[must_use] + pub fn new() -> Self { + let base = descriptors::base_file_set(); + let env = cel_env(&base); + Self { + descriptors: Descriptors::from_set(base), + env: RwLock::new(env), + cache: RwLock::new(Arc::new(ValidatorCache::default())), + } + } + + /// Registers a serialized `google.protobuf.FileDescriptorProto`. + /// + /// A file's imports must be registered before the file itself. Adding a + /// file whose name is already known is a no-op, so descriptors + /// may be re-added freely. + /// + /// # Errors + /// + /// Fails if the bytes do not parse, the file is invalid, or one of its + /// imports has not been registered. + pub fn add_file_descriptor_bytes(&mut self, file: &[u8]) -> Result<(), DescriptorError> { + let proto: FileDescriptorProto = descriptors::decode(file).map_err(DescriptorError::new)?; + let set = FileDescriptorSet { + file: vec![proto], + ..Default::default() + }; + self.descriptors + .add_file_set(set) + .map_err(DescriptorError::new)?; + // Not atomic since the file is in the validator's pool before the CEL + // pool takes it. The only conceivable case the two pools would differ is when + // passing manually crafted descriptors not created by protoc, buf, etc. + // Even then, the error is returned here, and a rule reaching a type the CEL pool lacks + // fails with "unknown message type" rather than running against the wrong schema. + self.env + .get_mut() + .unwrap_or_else(PoisonError::into_inner) + .add_file(file) + .map_err(|error| DescriptorError::new(error.to_string()))?; + Ok(()) + } + + /// Validates a message read in place through a [`Runtime`]. + /// + /// `type_name` is the fully-qualified message type, without a leading + /// dot. Its descriptor must already be registered. The message is + /// serialized, through + /// [`Message::encode`](crate::protobuf::Message::encode), only if a CEL + /// rule binds the message itself, a repeated field or a map to `this`. + /// With `fail_fast` validation stops at the first violation, rather than + /// accumulating them all. + /// + /// # Errors + /// + /// A message that breaks its rules returns [`Error::Validation`], + /// carrying the violations as a serialized `buf.validate.Violations`. + /// The other variants mean validation itself failed: the runtime could + /// not read the message ([`Error::Read`]), an unknown type or + /// unparsable payload ([`Error::Argument`]), rules that do not compile + /// ([`Error::Compilation`]), or a rule failing to evaluate + /// ([`Error::Evaluation`]). + pub fn validate_message( + &self, + type_name: &str, + reader: &dyn Reader, + fail_fast: bool, + ) -> Result<(), Error> { + let violations = self.run(type_name, reader, fail_fast)?; + if violations.is_empty() { + return Ok(()); + } + Err(Error::Validation(ValidationError::new(encode_violations( + violations, + )))) + } + + fn run( + &self, + type_name: &str, + reader: &dyn Reader, + fail_fast: bool, + ) -> Result, Error> { + let index = self.message_index(type_name)?; + let validators = self.validators(index, reader)?; + // `validators` either found `index` in the cache or just built it, + // so the lookup cannot miss. + let validator = validators[&index] + .as_ref() + .map_err(|error| Error::Compilation(error.clone()))?; + let message = reader + .message(&validator.message_type) + .map_err(Error::Read)?; + let walk = Walk::::new(&self.descriptors, &self.env, &validators, fail_fast); + walk.validate(validator, &message, type_name) + } + + fn message_index(&self, type_name: &str) -> Result> { + self.descriptors + .pool + .message_index(type_name) + .ok_or_else(|| Error::Argument(format!("unknown message type: {type_name}"))) + } + + /// Returns the cache, first building the rules of `index` and of every + /// type reachable from it if they are missing. + fn validators( + &self, + index: MessageIndex, + reader: &dyn Reader, + ) -> Result>, Error> { + let known = self.snapshot(); + if known.contains_key(&index) { + return Ok(known); + } + let types = + build::resolve(&self.descriptors, index, &known, reader).map_err(Error::Read)?; + // The rules are built against the snapshot rather than under the + // cache lock, so other validations are not held up while they + // compile. Two threads that build the same type at once both merge + // their result, and the later one wins. + let mut built = ValidatorCache::default(); + { + let mut env = self.env.write().unwrap_or_else(PoisonError::into_inner); + Builder::new(&self.descriptors, &mut env, types) + .build_closure(index, &known, &mut built); + } + let mut cache = self.cache.write().unwrap_or_else(PoisonError::into_inner); + let mut validators = ValidatorCache::clone(&cache); + validators.extend(built); + *cache = Arc::new(validators); + Ok(Arc::clone(&cache)) + } + + fn snapshot(&self) -> Arc> { + Arc::clone(&self.cache.read().unwrap_or_else(PoisonError::into_inner)) + } +} + +#[cfg(test)] +mod tests { + use super::Validator; + use crate::protobuf::testing::Untyped; + + #[test] + fn message_without_rules_is_not_read() { + let validator = Validator::::new(); + validator + .validate_message("buf.validate.FieldPathElement", &Untyped, false) + .expect("a message without rules is valid"); + } +} diff --git a/poe_tasks.toml b/poe_tasks.toml index 8f940b55..f7448149 100644 --- a/poe_tasks.toml +++ b/poe_tasks.toml @@ -100,8 +100,8 @@ sequence = [ [tasks.format-rust] help = "Format native extension code" sequence = [ - { cmd = "cargo clippy --fix --allow-dirty" }, - { cmd = "cargo fmt" }, + { cmd = "cargo clippy --workspace --all-targets --fix --allow-dirty" }, + { cmd = "cargo fmt --all" }, ] [tasks.format-toml] @@ -133,8 +133,12 @@ sequence = [ [tasks.lint-rust] help = "Lint native extension code" sequence = [ - { cmd = "cargo clippy" }, - { cmd = "cargo fmt --check" }, + { cmd = "cargo clippy --workspace --all-targets -- -D warnings" }, + # The validator on its own, without the CEL backend, so the rules that never + # need it keep compiling without it. Scoped to the one package: across the + # workspace the extension's own `cel` feature would be unified back in. + { cmd = "cargo clippy -p protovalidate --all-targets --no-default-features -- -D warnings" }, + { cmd = "cargo fmt --all --check" }, ] [tasks.lint-python] @@ -154,4 +158,19 @@ sequence = [ [tasks.test] help = "Run unit tests" +sequence = [ + "test-python", + "test-rust", +] + +[tasks.test-python] +help = "Run the Python test suite" cmd = "pytest" + +[tasks.test-rust] +help = "Run the native crates' unit tests" +# The validator crates only: a test binary for the extension itself would link +# libpython, which the extension module never does. The release profile is the +# one the extension is built with, so the compiled C++ is shared rather than +# built a second time in debug. +cmd = "cargo test --release -p protovalidate -p protovalidate-deps" diff --git a/protovalidate/__init__.py b/protovalidate/__init__.py index d9699781..f767a8a1 100644 --- a/protovalidate/__init__.py +++ b/protovalidate/__init__.py @@ -14,7 +14,7 @@ """The semantic validation library for Protobuf in Python. -Validation is performed by protovalidate-cc, compiled into the +Validation is performed by the protovalidate Rust crate, compiled into the ``protovalidate._protovalidate`` extension module. Apart from ``ValidationError``, which PyO3 cannot define while ``abi3`` is enabled, everything here is implemented natively and re-exported at the path it has diff --git a/protovalidate/_protovalidate.pyi b/protovalidate/_protovalidate.pyi index 5a34dc48..3c9f0ffc 100644 --- a/protovalidate/_protovalidate.pyi +++ b/protovalidate/_protovalidate.pyi @@ -28,7 +28,8 @@ class Validator: """Validate Protobuf messages against static rules. Both protobuf-py messages and legacy google.protobuf messages are - accepted; either is handed to the native engine in serialized form. + accepted; either is validated in place, and only serialized if a custom + CEL rule needs a message, list or map as a value. Each validator instance caches internal state generated from the static rules, so reusing the same instance for multiple validations @@ -38,8 +39,9 @@ class Validator: """Create a new validator. Parameters: - registry: An optional Registry used to resolve custom - predefined-rule extensions. If omitted, only standard rules are applied. + registry: An optional Registry whose files declaring extensions are + registered up front, so predefined rules defined in files the + validated messages do not import are still found. """ def collect_violations( self, /, message: Message2[Any] | Message, *, fail_fast: bool = False diff --git a/scripts/extract/versions.json b/scripts/extract/versions.json index 65837d5a..01ee9051 100644 --- a/scripts/extract/versions.json +++ b/scripts/extract/versions.json @@ -1,16 +1,20 @@ { "_comment": [ - "Edit version and run scripts/extract_native_sources.py to update the native extension." + "Edit the pins here and run `poe generate-vendored` to regenerate the C++", + "build inputs of the protovalidate-deps crate: the cel-cpp closure the CEL", + "shim links. The protovalidate schema and conformance release the native", + "extension targets is PROTOVALIDATE_VERSION in test/versions.py." ], - "protovalidate_cc": { - "comment": ["1.2.0 not released yet so target unreleased commit"], - "archive": "https://github.com/bufbuild/protovalidate-cc/archive/{ref}.tar.gz", - "ref": "dbc6dfe6855491a62da4fa2ced46ff2163f13d11", - "sha256": "4ed5feee2e64c7484c9bb49e37808ab381adec63d752c152ea9573e74f497e97" + "cel_cpp": { + "archive": "https://github.com/google/cel-cpp/archive/{ref}.tar.gz", + "ref": "v0.15.0", + "sha256": "095e560911ce84cefb886ad9540ca961fd6d7879de441a864e877e6e5f132b02" }, "module_overrides": { - "_comment": ["Use newer cel-cpp for Windows compatibility."], - "cel-cpp": "0.15.0" + "_comment": [ + "Registry module versions to force over what cel-cpp's MODULE.bazel", + "resolves, as `\"name\": \"version\"` entries." + ] }, "bazel": { "java_runtime_version": "remotejdk_17" diff --git a/scripts/extract_native_sources.py b/scripts/extract_native_sources.py index c7e7ca65..480ff0c5 100755 --- a/scripts/extract_native_sources.py +++ b/scripts/extract_native_sources.py @@ -13,23 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Regenerate the C++ build inputs for the native extension. +"""Regenerate the C++ build inputs of the protovalidate-deps crate. -To bump the targeted protovalidate-cc version, edit scripts/extract/versions.json -and run this script: it moves the third_party/ submodules to match and rewrites -everything derived from them. It requires Bazel - it is only used during the bump -and not during normal builds. +The crate compiles cel-cpp and the C++ libraries it builds on, plus the CEL +shim, so this script produces exactly the cel-cpp closure the shim links. + +To bump cel-cpp, edit scripts/extract/versions.json and run this script: it +moves the third_party/ submodules to match and rewrites everything derived from +them. It requires Bazel - it is only used during the bump and not during normal +builds. What it does: -1. Fetches protovalidate-cc at the pinned ref and overrides transitive dependency +1. Fetches cel-cpp at the pinned ref and overrides transitive dependency versions as needed. -2. Builds a probe binary from the extension's real shim - (crates/protovalidate-rs/shim) plus a trivial main. Compiling the shim - validates it against the pinned versions; the binary's link anchors the - closure below. +2. Builds a probe binary inside that workspace from the crate's real shim + (crates/protovalidate-deps/shim, protovalidate's CEL functions included) + plus a trivial main. Compiling the shim validates it against the pinned + versions; the binary's link anchors the closure below. 3. Reads the probe's *link* closure to decide which C++ source files the - extension needs. We need to actually build a binary instead of using + crate needs. We need to actually build a binary instead of using a deps() query since that includes tooling/test dependencies and doesn't reflect the actual source we use / need to vendor, only the dependency graph. 4. Checks the third_party/ submodules out at the versions bazel resolved, so @@ -44,7 +47,7 @@ would require protoc and a JVM at build time. The action graph also contains actions that do not compile sources of the -extension -- exec-configuration tooling like protoc, and `parse_headers` +crate -- exec-configuration tooling like protoc, and `parse_headers` header-validation compiles. Nothing filters them explicitly: selection is driven by what the probe's link actually consumed, so they fall out. """ @@ -66,7 +69,7 @@ REPO_ROOT = Path(__file__).resolve().parent.parent CONFIG_PATH = REPO_ROOT / "scripts" / "extract" / "versions.json" WORK_DIR = REPO_ROOT / ".tmp" / "native-extract" -CRATE = REPO_ROOT / "crates" / "protovalidate-rs" +CRATE = REPO_ROOT / "crates" / "protovalidate-deps" class Repo(typing.NamedTuple): @@ -104,10 +107,10 @@ class Repo(typing.NamedTuple): prefix="runtime/Cpp", include_roots=("runtime/Cpp/runtime/src",), ), - "cel-cpp+": Repo("celcpp", "cel-cpp", tag="v{version}"), "cel-spec+": Repo("celcpp", None), - "protovalidate+": Repo("protovalidate", None), - "_main": Repo("protovalidate", "protovalidate-cc"), + # cel-cpp itself is the extraction workspace, checked out at the ref + # versions.json pins rather than resolved from the registry. + "_main": Repo("celcpp", "cel-cpp"), } # Registry module name -> bazel repo name, for driving the submodules. MODULE_TO_REPO = { @@ -115,23 +118,74 @@ class Repo(typing.NamedTuple): "protobuf": "protobuf+", "re2": "re2+", "antlr4-cpp-runtime": "antlr4-cpp-runtime+", - "cel-cpp": "cel-cpp+", } REPO_TO_MODULE = {repo: module for module, repo in MODULE_TO_REPO.items()} -# protovalidate doesn't use protobuf input/output streams (only bytes) so we -# skip vendoring zlib. If we didn't do this, zlib would still be stripped from -# the final binary since it's unused so this saves us some vendoring for free, -# but means we have one additional define to disable zlib support that upstream +# The shim doesn't use protobuf input/output streams (only bytes) so we skip +# vendoring zlib. If we didn't do this, zlib would still be stripped from the +# final binary since it's unused so this saves us some vendoring for free, but +# means we have one additional define to disable zlib support that upstream # does not. SKIP_REPOS = {"zlib+"} + +def canonical(repo: str) -> str: + """A canonical repo name in the spelling REPOS uses. + + Bazel 7 writes canonical names as `abseil-cpp~`, Bazel 8 and later as + `abseil-cpp+`; the workspace's .bazelversion decides which one the action + graph carries. + """ + return f"{repo[:-1]}+" if repo.endswith("~") else repo + + +def repo_spec(repo: str) -> Repo | None: + return REPOS.get(canonical(repo)) + + +def skipped(repo: str) -> bool: + """Whether a repo is deliberately left out of the vendored set.""" + return canonical(repo) in SKIP_REPOS + + VENDOR_HEADER_SUFFIXES = (".h", ".hpp", ".inc", ".def") +# Modules whose resolved version is worth reporting at the end of a run. +REPORTED_MODULES = ("abseil-cpp", "protobuf", "re2", "antlr4-cpp-runtime", "cel-spec") + # A ref pinned by commit rather than by tag. COMMIT_SHA = re.compile(r"[0-9a-f]{40}") # The probe package this script injects into the extraction workspace. -PROBE_PACKAGE = "pv_extract" +PROBE_PACKAGE = "cel_extract" + +# The bazel targets the shim compiles against: the parts of cel-cpp, protobuf, +# abseil and RE2 it and protovalidate's CEL functions use. +PROBE_DEPS = ( + "//eval/public:activation", + "//eval/public:builtin_func_registrar", + "//eval/public:cel_expr_builder_factory", + "//eval/public:cel_expression", + "//eval/public:cel_function_adapter", + "//eval/public:cel_function_registry", + "//eval/public:cel_options", + "//eval/public:cel_value", + "//eval/public:string_extension_func_registrar", + "//eval/public/containers:container_backed_map_impl", + "//eval/public/containers:field_access", + "//eval/public/containers:field_backed_list_impl", + "//eval/public/containers:field_backed_map_impl", + "//eval/public/structs:cel_proto_descriptor_pool_builder", + "//eval/public/structs:cel_proto_wrapper", + "//internal:re2_options", + "//parser", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_protobuf//:protobuf", + "@com_googlesource_code_re2//:re2", +) def copy_file(src: Path, dst: Path) -> None: @@ -175,6 +229,9 @@ def __init__(self, text: str) -> None: self._artifacts = {a["id"]: a for a in data.get("artifacts", [])} self._fragments = {f["id"]: f for f in data.get("pathFragments", [])} self._depsets = {s["id"]: s for s in data.get("depSetOfFiles", [])} + self._tree_artifacts = [ + a["id"] for a in data.get("artifacts", []) if a.get("isTreeArtifact") + ] def path(self, artifact_id: int) -> str: parts: list[str] = [] @@ -187,6 +244,15 @@ def path(self, artifact_id: int) -> str: fragment_id = fragment["parentId"] return "/".join(reversed(parts)) + def tree_artifact_paths(self) -> set[str]: + """The paths of every directory output in the graph. + + What is inside one is an action's private staging (an ANTLR run's raw + output, say); the files that matter are copied out of it by later + actions. + """ + return {self.path(a) for a in self._tree_artifacts} + def expand(self, depset_ids: list[int]) -> set[int]: found: set[int] = set() seen: set[int] = set() @@ -230,7 +296,7 @@ def fetch_source_archive(spec: dict, destination: Path) -> None: if not expected: print(f" note: no sha256 pinned; archive digest is {digest}") - print(f"unpacking protovalidate-cc {spec['ref']}") + print(f"unpacking cel-cpp {spec['ref']}") destination.mkdir(parents=True, exist_ok=True) with tarfile.open(archive) as tar: members = tar.getmembers() @@ -253,42 +319,45 @@ def fetch_source_archive(spec: dict, destination: Path) -> None: def prepare_workspace(config: dict) -> Path: - """Fetch protovalidate-cc at the pinned ref and apply our overrides.""" - pvcc = config["protovalidate_cc"] - work = WORK_DIR / "protovalidate-cc" + """Fetch cel-cpp at the pinned ref and apply our overrides.""" + celcpp = config["cel_cpp"] + work = WORK_DIR / "cel-cpp" stamp = work / ".extract-ref" - if work.exists() and stamp.exists() and stamp.read_text().strip() == pvcc["ref"]: - print(f"reusing existing source tree at {work} ({pvcc['ref']})") + if work.exists() and stamp.exists() and stamp.read_text().strip() == celcpp["ref"]: + print(f"reusing existing source tree at {work} ({celcpp['ref']})") else: if work.exists(): shutil.rmtree(work) - fetch_source_archive(pvcc, work) - stamp.write_text(pvcc["ref"] + "\n") + fetch_source_archive(celcpp, work) + stamp.write_text(celcpp["ref"] + "\n") - module = work / "MODULE.bazel" - text = module.read_text() - marker = "# --- protovalidate-python extraction overrides ---" + apply_module_overrides(config, work) + write_probe_package(work) + return work + + +def apply_module_overrides(config: dict, work: Path) -> None: + """Rewrites cel-cpp's MODULE.bazel with the version overrides we want. + + Any overrides a previous run wrote are replaced, or removed when there + are none now, so a reused workspace never keeps a stale override. + """ overrides = [ f'single_version_override(\n module_name = "{name}",\n version = "{version}",\n)' for name, version in config["module_overrides"].items() if not name.startswith("_") ] - updated = ( - text.partition(marker)[0].rstrip("\n") - + "\n\n" - + marker - + "\n" - + "\n".join(overrides) - + "\n" - ) + module = work / "MODULE.bazel" + text = module.read_text() + marker = "# --- protovalidate-python extraction overrides ---" + updated = text.partition(marker)[0].rstrip("\n") + "\n" + if overrides: + updated += "\n" + marker + "\n" + "\n".join(overrides) + "\n" if updated != text: module.write_text(updated) # The lock pins the old resolution; drop it so bazel re-resolves with our overrides. (work / "MODULE.bazel.lock").unlink(missing_ok=True) - write_probe_package(work) - return work - def bazel_flags(config: dict) -> list[str]: """Configuration flags for every bazel build/aquery the extraction runs.""" @@ -297,13 +366,13 @@ def bazel_flags(config: dict) -> list[str]: "--incompatible_strict_action_env", # Java needed to generate cel parser with ANTLR f"--java_runtime_version={config['bazel']['java_runtime_version']}", - # protovalidate-cc and cel-cpp, etc can have different versions, and - # Bazel warns for this but it's fine to take the highest and not warn. + # Overrides can move a dependency past what cel-cpp's MODULE.bazel asks + # for, and Bazel warns for this but it's fine to take the highest and + # not warn. "--check_direct_dependencies=off", ] if sys.platform == "darwin": - # Flags needed for macOS builds of protovalidate-cc, which should be - # upstreamed there eventually. + # Flags needed for macOS builds of cel-cpp outside its own .bazelrc. flags += [ "--repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1", "--macos_minimum_os=10.15", @@ -313,23 +382,33 @@ def bazel_flags(config: dict) -> list[str]: def write_probe_package(work: Path) -> None: + """Writes the probe package: the crate's real shim plus a trivial main.""" probe = work / PROBE_PACKAGE if probe.exists(): shutil.rmtree(probe) probe.mkdir() - shim_dir = CRATE / "shim" - for name in ("pv_shim.h", "pv_shim.cc"): - shutil.copy(shim_dir / name, probe / name) + # The shim keeps its layout, so its includes resolve as they do in the + # crate's own build. + shutil.copytree(CRATE / "shim", probe, dirs_exist_ok=True) # The main only has to make the binary linkable. The vendored set comes # from the link action's inputs -- every dep archive, target-level -- so - # nothing needs to reference the shim's symbols; pv_shim.cc being a src - # is what compile-checks the shim against the pins. + # nothing needs to reference the shim's symbols; the shim being compiled + # is what checks it against the pins. (probe / "probe_main.cc").write_text("int main() { return 0; }\n") + deps = "".join(f' "{dep}",\n' for dep in PROBE_DEPS) (probe / "BUILD").write_text( + "cc_library(\n" + ' name = "shim",\n' + ' srcs = glob(["**/*.cc"], exclude = ["probe_main.cc"]),\n' + ' hdrs = glob(["**/*.h"]),\n' + ' includes = ["."],\n' + f" deps = [\n{deps} ],\n" + ")\n" + "\n" "cc_binary(\n" ' name = "probe",\n' - ' srcs = ["pv_shim.cc", "pv_shim.h", "probe_main.cc"],\n' - ' deps = ["//buf/validate:validator"],\n' + ' srcs = ["probe_main.cc"],\n' + ' deps = [":shim"],\n' ")\n" ) @@ -340,9 +419,20 @@ def build_probe(work: Path, flags: list[str]) -> None: run(["bazel", "build", *flags, f"//{PROBE_PACKAGE}:probe"], cwd=work) -def collect_link_closure( - work: Path, flags: list[str] -) -> tuple[dict[str, set[str]], dict[str, set[str]]]: +class Closure(typing.NamedTuple): + """What the probe's link pulled in, split by where it came from.""" + + # Upstream C++ sources, keyed by canonical bazel repo name. + sources: dict[str, set[str]] + # Bazel-generated C++ sources, keyed the same way. + generated: dict[str, set[str]] + # Directories actions fill as a whole. What is inside one is an action's + # private staging (an ANTLR run's raw output, say), and the files that + # matter are copied out of it by later actions. + tree_artifacts: set[str] + + +def collect_link_closure(work: Path, flags: list[str]) -> Closure: """Maps the probe's link inputs back to the source files that fed them. This is 3 steps: @@ -352,7 +442,10 @@ def collect_link_closure( - Find the source file that produced the .o file """ probe = f"//{PROBE_PACKAGE}:probe" - expr = f'mnemonic("CppLink|CppArchive|CppCompile", deps({probe}))' + # Every action, not just the C++ ones: the directory outputs that mark + # staging come from other kinds (the ANTLR run), and the compile, link and + # archive actions are picked out below by mnemonic. + expr = f"deps({probe})" graph = Aquery( run( ["bazel", "aquery", *flags, "--output=jsonproto", expr], @@ -402,7 +495,7 @@ def collect_link_closure( for obj in needed: source = object_to_source[obj] repo = bazel_repo(source) - if repo in SKIP_REPOS: + if skipped(repo): continue if repo == "_main" and source.startswith(f"{PROBE_PACKAGE}/"): continue # the shim and probe main are not vendored sources @@ -411,7 +504,7 @@ def collect_link_closure( else: sources[repo].add(source) - return sources, generated + return Closure(sources, generated, graph.tree_artifact_paths()) def bazel_repo(source: str) -> str: @@ -530,12 +623,10 @@ def collect_platform_sources( return found -def vendor( - work: Path, sources: dict[str, set[str]], generated: dict[str, set[str]] -) -> None: +def vendor(work: Path, closure: Closure) -> None: """Regenerates the checked-in generated sources and the filelists. - Upstream sources are not copied: they are git submodules under each crate's + Upstream sources are not copied: they are git submodules under the crate's third_party/, so all that is recorded for them is which C++ source files to compile. """ @@ -544,16 +635,16 @@ def vendor( ) filelists: dict[str, list[str]] = collections.defaultdict(list) - platform_sources = collect_platform_sources(work, sources) - record_sources(sources, platform_sources, filelists) - written = vendor_generated(execroot, generated, filelists) + platform_sources = collect_platform_sources(work, closure.sources) + record_sources(closure.sources, platform_sources, filelists) + written = vendor_generated(execroot, closure, filelists) prune_generated(written) write_filelists(filelists) def submodule_path(repo: str, rel: str) -> str: """Crate-relative path of an upstream source file.""" - spec = REPOS[repo] + spec = REPOS[canonical(repo)] parts = ["third_party", spec.submodule] if spec.prefix: parts.append(spec.prefix) @@ -569,7 +660,7 @@ def record_sources( """Records upstream C++ source files as paths into the submodules.""" missing: list[str] = [] for repo, files in sorted(sources.items()): - spec = REPOS.get(repo) + spec = repo_spec(repo) if spec is None: print(f" warning: no mapping for repo {repo}, skipping", file=sys.stderr) continue @@ -627,11 +718,16 @@ def _visibility_normalized(text: bytes) -> bytes: def vendor_generated( - execroot: Path, generated: dict[str, set[str]], filelists: dict[str, list[str]] + execroot: Path, closure: Closure, filelists: dict[str, list[str]] ) -> set[Path]: """Copies bazel-generated sources into the crate's gen/.""" + + def staged(source: str) -> bool: + """Whether a path is inside a directory output, i.e. action staging.""" + return any(source.startswith(f"{tree}/") for tree in closure.tree_artifacts) + merged: dict[str, set[str]] = collections.defaultdict(set) - for repo, files in generated.items(): + for repo, files in closure.generated.items(): merged[repo] |= files for path in (execroot / "bazel-out").rglob("*"): if path.suffix not in VENDOR_HEADER_SUFFIXES or not path.is_file(): @@ -639,22 +735,24 @@ def vendor_generated( source = str(path.relative_to(execroot)) if "-exec" in source.split("/")[1]: continue + # Files inside a directory output are an action's staging, not sources + # of their own. + if staged(source): + continue merged[bazel_repo(source)].add(source) written: set[Path] = set() for repo, files in sorted(merged.items()): - if repo in SKIP_REPOS: + if skipped(repo): continue - spec = REPOS.get(repo) + spec = repo_spec(repo) if spec is None: print(f" warning: no mapping for generated repo {repo}", file=sys.stderr) continue gen_dir = CRATE / "gen" for source in sorted(files): - dest = generated_destination(source) - # A genrule that re-stages its inputs leaves them under its own - # output directory, so the repo tree reappears inside the path. - if "external/" in dest: + if staged(source): continue + dest = generated_destination(source) payload = (execroot / source).read_bytes() existing = upstream_copy(spec, dest) if existing is not None: @@ -697,7 +795,7 @@ def write_filelists(filelists: dict[str, list[str]]) -> None: path.parent.mkdir(parents=True, exist_ok=True) content = ( "# Generated by scripts/extract_native_sources.py -- do not edit.\n" - "# C++ sources the extension compiles, relative to this crate's directory.\n" + "# C++ sources the crate compiles, relative to this crate's directory.\n" "# A `windows:`/`linux:`/`macos:` prefix compiles a file on that OS only.\n" + "\n".join(sorted(files)) + "\n" @@ -720,30 +818,6 @@ def module_versions(work: Path) -> dict[str, dict[str, str]]: return versions -def check_protovalidate_version(versions: dict) -> None: - """Fails if the linked protovalidate differs from what we target.""" - resolved = versions.get("protovalidate", {}).get("version") - targeted = None - versions_py = REPO_ROOT / "test" / "versions.py" - if versions_py.exists(): - for line in versions_py.read_text().splitlines(): - if line.startswith("PROTOVALIDATE_VERSION"): - # The line reads `= os.getenv("PROTOVALIDATE_VERSION", "v1.2.0")`, - # so pick out the version literal rather than a quoted position. - found = re.search(r'"v?(\d+\.\d+\.\d+[^"]*)"', line) - if found: - targeted = found.group(1) - break - if resolved and targeted and resolved != targeted: - message = ( - f"linked protovalidate is {resolved} but this package targets " - f"{targeted} (test/versions.py). Violation messages would differ " - f"from what conformance tests. Pin a protovalidate-cc ref that " - f"targets {targeted}, or move test/versions.py with it." - ) - raise SystemExit(message) - - def git(path: Path, *args: str, check: bool = True) -> str: """Runs a read-only git command in `path`, quietly.""" result = subprocess.run( @@ -760,7 +834,7 @@ def git(path: Path, *args: str, check: bool = True) -> str: def wanted_ref(repo: str, spec: Repo, versions: dict, config: dict) -> str | None: """The upstream ref to move a submodule to to match a Bazel dependency version.""" if repo == "_main": - return config["protovalidate_cc"]["ref"] + return config["cel_cpp"]["ref"] module = REPO_TO_MODULE.get(repo) resolved = versions.get(module, {}).get("version") if module else None if not resolved: @@ -841,20 +915,19 @@ def main() -> None: work = prepare_workspace(config) build_flags = bazel_flags(config) build_probe(work, build_flags) - sources, generated = collect_link_closure(work, build_flags) + closure = collect_link_closure(work, build_flags) versions = module_versions(work) - check_protovalidate_version(versions) def destination(repo: str) -> str: - spec = REPOS.get(repo) + spec = repo_spec(repo) return spec.library if spec else "??" print("\nC++ source files:") total = 0 - for repo, files in sorted(sources.items(), key=lambda kv: -len(kv[1])): + for repo, files in sorted(closure.sources.items(), key=lambda kv: -len(kv[1])): print(f" {repo:24s} {len(files):4d} -> {destination(repo)}") total += len(files) - for repo, files in sorted(generated.items()): + for repo, files in sorted(closure.generated.items()): print(f" {repo + ' (generated)':24s} {len(files):4d} -> {destination(repo)}") total += len(files) print(f" {'TOTAL':24s} {total:4d}") @@ -862,22 +935,15 @@ def destination(repo: str) -> str: sync_submodules(versions, config) print("\nwriting generated sources and filelists") - vendor(work, sources, generated) + vendor(work, closure) print("\nresolved module versions:") + print(f" {'cel-cpp':22s} {config['cel_cpp']['ref']} (pinned)") for name, info in sorted(versions.items()): - if name in ( - "abseil-cpp", - "protobuf", - "re2", - "antlr4-cpp-runtime", - "cel-cpp", - "cel-spec", - "protovalidate", - ): + if name in REPORTED_MODULES: print(f" {name:22s} {info['version']}") - print("\nnext: cargo test, then the conformance suite") + print("\nnext: poe test, then the conformance suite") if __name__ == "__main__": diff --git a/scripts/generate_protovalidate.py b/scripts/generate_protovalidate.py index 97276fab..c1ed84bd 100644 --- a/scripts/generate_protovalidate.py +++ b/scripts/generate_protovalidate.py @@ -43,6 +43,25 @@ def main() -> None: subprocess.run(["buf", "export", protovalidate_path, "-o", protos_dir], check=True) subprocess.run(["buf", "generate"], cwd=repo, check=True) + # The schema the native validator seeds its descriptor pool with, so the + # rule extensions can be read from any registered file. Source info is + # left out: it is a third of the size and nothing reads it. + descriptor_set = ( + repo / "crates" / "protovalidate" / "src" / "gen" / "buf.validate.binpb" + ) + subprocess.run( + [ + "buf", + "build", + "--as-file-descriptor-set", + "--exclude-source-info", + "-o", + descriptor_set, + ], + cwd=repo, + check=True, + ) + subprocess.run( ["buf", "export", protovalidate_testing_path, "-o", repo / "test" / "proto"], check=True, diff --git a/src/constants.rs b/src/constants.rs index e4d1e254..924d3a01 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -14,9 +14,6 @@ //! Interned strings, and the Python types the bindings reach for. -use std::ops::Deref; -use std::sync::Arc; - use pyo3::prelude::*; use pyo3::sync::PyOnceLock; use pyo3::types::{PyString, PyType}; @@ -31,6 +28,8 @@ pub(crate) struct Types { pub(crate) field_options: Py, /// The class `protobuf.wkt.MessageOptions`. pub(crate) message_options: Py, + /// The class `protobuf.Registry`. + pub(crate) registry: Py, } /// Extension objects used to read rules out of descriptor options. @@ -41,13 +40,20 @@ pub(crate) struct Extensions { pub(crate) message: Py, } -pub(crate) struct ConstantsInner { +/// Interned strings, shared by every call site. +pub(crate) struct Constants { /// The string `DESCRIPTOR`. pub(crate) descriptor_upper: Py, + /// The string `FindMessageTypeByName`. + pub(crate) find_message_type_by_name: Py, /// The string `GetOptions`. pub(crate) get_options: Py, + /// The string `HasField`. + pub(crate) has_field: Py, /// The string `SerializeToString`. pub(crate) serialize_to_string: Py, + /// The string `add`. + pub(crate) add: Py, /// The string `dependencies`. pub(crate) dependencies: Py, /// The string `desc`. @@ -76,14 +82,24 @@ pub(crate) struct ConstantsInner { pub(crate) from_binary: Py, /// The string `full_name`. pub(crate) full_name: Py, + /// The string `items`. + pub(crate) items: Py, + /// The string `local_name`. + pub(crate) local_name: Py, /// The string `message`. pub(crate) message: Py, /// The string `name`. pub(crate) name: Py, /// The string `number`. pub(crate) number: Py, + /// The string `oneof`. + pub(crate) oneof: Py, /// The string `options`. pub(crate) options: Py, + /// The string `pool`. + pub(crate) pool: Py, + /// The string `_present`. + pub(crate) present: Py, /// The string `proto`. pub(crate) proto: Py, /// The string `rule`. @@ -104,54 +120,54 @@ pub(crate) struct ConstantsInner { pub(crate) violations: Py, } -/// Cheaply cloneable handle to the interned objects. -#[derive(Clone)] -pub(crate) struct Constants { - inner: Arc, -} - -/// Static constants that can be cached per process. impl Constants { - pub(crate) fn get(py: Python<'_>) -> Self { + /// The process-wide constants, interned on first use. + pub(crate) fn get(py: Python<'_>) -> &'static Self { static INSTANCE: PyOnceLock = PyOnceLock::new(); - INSTANCE.get_or_init(py, || Self::new(py)).clone() + INSTANCE.get_or_init(py, || Self::new(py)) } fn new(py: Python<'_>) -> Self { Self { - inner: Arc::new(ConstantsInner { - descriptor_upper: PyString::intern(py, "DESCRIPTOR").unbind(), - get_options: PyString::intern(py, "GetOptions").unbind(), - serialize_to_string: PyString::intern(py, "SerializeToString").unbind(), - dependencies: PyString::intern(py, "dependencies").unbind(), - desc: PyString::intern(py, "desc").unbind(), - elements: PyString::intern(py, "elements").unbind(), - extensions: PyString::intern(py, "extensions").unbind(), - field: PyString::intern(py, "field").unbind(), - field_name: PyString::intern(py, "field_name").unbind(), - field_number: PyString::intern(py, "field_number").unbind(), - fields: PyString::intern(py, "fields").unbind(), - fields_by_name: PyString::intern(py, "fields_by_name").unbind(), - fields_by_number: PyString::intern(py, "fields_by_number").unbind(), - file: PyString::intern(py, "file").unbind(), - for_key: PyString::intern(py, "for_key").unbind(), - from_binary: PyString::intern(py, "from_binary").unbind(), - full_name: PyString::intern(py, "full_name").unbind(), - message: PyString::intern(py, "message").unbind(), - name: PyString::intern(py, "name").unbind(), - number: PyString::intern(py, "number").unbind(), - options: PyString::intern(py, "options").unbind(), - proto: PyString::intern(py, "proto").unbind(), - rule: PyString::intern(py, "rule").unbind(), - rule_id: PyString::intern(py, "rule_id").unbind(), - serialized_pb: PyString::intern(py, "serialized_pb").unbind(), - subscript: PyString::intern(py, "subscript").unbind(), - to_binary: PyString::intern(py, "to_binary").unbind(), - type_name: PyString::intern(py, "type_name").unbind(), - value: PyString::intern(py, "value").unbind(), - violations: PyString::intern(py, "violations").unbind(), - }), + descriptor_upper: PyString::intern(py, "DESCRIPTOR").unbind(), + find_message_type_by_name: PyString::intern(py, "FindMessageTypeByName").unbind(), + get_options: PyString::intern(py, "GetOptions").unbind(), + has_field: PyString::intern(py, "HasField").unbind(), + serialize_to_string: PyString::intern(py, "SerializeToString").unbind(), + add: PyString::intern(py, "add").unbind(), + dependencies: PyString::intern(py, "dependencies").unbind(), + desc: PyString::intern(py, "desc").unbind(), + elements: PyString::intern(py, "elements").unbind(), + extensions: PyString::intern(py, "extensions").unbind(), + field: PyString::intern(py, "field").unbind(), + field_name: PyString::intern(py, "field_name").unbind(), + field_number: PyString::intern(py, "field_number").unbind(), + fields: PyString::intern(py, "fields").unbind(), + fields_by_name: PyString::intern(py, "fields_by_name").unbind(), + fields_by_number: PyString::intern(py, "fields_by_number").unbind(), + file: PyString::intern(py, "file").unbind(), + for_key: PyString::intern(py, "for_key").unbind(), + from_binary: PyString::intern(py, "from_binary").unbind(), + full_name: PyString::intern(py, "full_name").unbind(), + items: PyString::intern(py, "items").unbind(), + local_name: PyString::intern(py, "local_name").unbind(), + message: PyString::intern(py, "message").unbind(), + name: PyString::intern(py, "name").unbind(), + number: PyString::intern(py, "number").unbind(), + oneof: PyString::intern(py, "oneof").unbind(), + options: PyString::intern(py, "options").unbind(), + pool: PyString::intern(py, "pool").unbind(), + present: PyString::intern(py, "_present").unbind(), + proto: PyString::intern(py, "proto").unbind(), + rule: PyString::intern(py, "rule").unbind(), + rule_id: PyString::intern(py, "rule_id").unbind(), + serialized_pb: PyString::intern(py, "serialized_pb").unbind(), + subscript: PyString::intern(py, "subscript").unbind(), + to_binary: PyString::intern(py, "to_binary").unbind(), + type_name: PyString::intern(py, "type_name").unbind(), + value: PyString::intern(py, "value").unbind(), + violations: PyString::intern(py, "violations").unbind(), } } } @@ -165,6 +181,7 @@ pub(crate) struct Imports { impl Imports { pub(crate) fn resolve(py: Python<'_>) -> PyResult { let validate = py.import("protovalidate._gen.buf.validate.validate_pb")?; + let protobuf = py.import("protobuf")?; let wkt = py.import("protobuf.wkt")?; Ok(Self { types: Types { @@ -181,6 +198,10 @@ impl Imports { .getattr("MessageOptions")? .cast_into::()? .unbind(), + registry: protobuf + .getattr("Registry")? + .cast_into::()? + .unbind(), }, extensions: Extensions { field: validate.getattr("ext_field")?.unbind(), @@ -189,11 +210,3 @@ impl Imports { }) } } - -impl Deref for Constants { - type Target = ConstantsInner; - - fn deref(&self) -> &Self::Target { - &self.inner - } -} diff --git a/src/lib.rs b/src/lib.rs index e3e4047e..37b52a19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,89 +12,118 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Python bindings for protovalidate-cc. +//! Python bindings for the `protovalidate` crate. mod constants; mod hints; -mod proto; +mod runtime; +mod view; mod violation; use std::collections::HashSet; -use std::sync::{Arc, RwLock}; +use std::sync::{Arc, PoisonError, RwLock}; -use pyo3::exceptions::{PyException, PyRuntimeError, PyValueError}; +use pyo3::exceptions::{PyException, PyValueError}; use pyo3::import_exception; use pyo3::prelude::*; -use pyo3::sync::RwLockExt; +use pyo3::sync::{PyOnceLock, RwLockExt}; use pyo3::types::{PyBytes, PyList, PyString}; -use protovalidate::{Engine, PvError}; +use protovalidate::{DescriptorError, Error}; use constants::{Constants, Imports}; use hints::{PbMessage, PbRegistry, ViolationList}; -use proto::{ProtoAdapter, ProtoRuntime}; +use runtime::{ProtoAdapter, ProtoRuntime}; +use view::{Ctx, PyRuntime, TypeSource}; + +/// The core validator for messages of one Python runtime. +type Core = protovalidate::Validator; import_exception!(protovalidate._errors, ValidationError); import_exception!(protovalidate._errors, CompilationError); import_exception!(protovalidate._errors, EvaluationError); -fn to_py_err(error: PvError) -> PyErr { +/// Maps a failure of validation itself; `Error::Validation` is handled by +/// the caller, as it is a result rather than a failure. +fn to_py_err(error: Error>) -> PyErr { match error { - PvError::Compilation(message) => CompilationError::new_err(message), - PvError::Evaluation(message) => EvaluationError::new_err(message), - PvError::Argument(message) => PyValueError::new_err(message), + // The Python error raised while the message was being read, as it + // was raised. + Error::Read(error) => *error, + Error::Compilation(message) => CompilationError::new_err(message), + Error::Evaluation(message) => EvaluationError::new_err(message), + Error::Argument(message) => PyValueError::new_err(message), // Neither a compilation nor an evaluation failure; a plain Exception // keeps it out of both buckets rather than mislabelling it. - PvError::Unexpected(message) => PyException::new_err(message), - PvError::Unknown(code, message) => { - PyException::new_err(format!("unknown status {code}: {message}")) - } + Error::Unexpected(message) => PyException::new_err(message), + other => PyException::new_err(other.to_string()), } } +fn descriptor_err(error: &DescriptorError) -> PyErr { + PyValueError::new_err(error.to_string()) +} + /// Validate Protobuf messages against static rules. /// /// Both protobuf-py messages and legacy google.protobuf messages are -/// accepted; either is handed to the native engine in serialized form. +/// accepted; either is validated in place, and only serialized if a custom +/// CEL rule needs a message, list or map as a value. /// /// Each validator instance caches internal state generated from the static /// rules, so reusing the same instance for multiple validations /// significantly improves performance. #[pyclass(module = "protovalidate._protovalidate", frozen)] struct Validator { - /// Engine isn't thread-safe when adding descriptors. Since this only happens when - /// warming up, we use a `RwLock` to allow the steady state to have no blocking. - engine: RwLock, - /// Descriptor files already added to the pool, by name. Mutated together - /// with the engine, under both write locks; see `register`. - registered: RwLock>, - /// Interned strings, shared by every call site. - constants: Constants, + /// One engine per Python runtime. Compiled rules record how to read + /// each message type's fields, and that differs between the two + /// runtimes, so they cannot share an engine. + engines: [PyOnceLock; 2], + /// The files from the constructor's `registry` argument that declare + /// extensions. They are registered with each engine when it is created. + preregistered: Vec>, + constants: &'static Constants, /// Python types and extensions. imports: Arc, } +/// The core validator and registration state for one Python runtime. +struct Engine { + /// Adding descriptors needs exclusive access and happens only while + /// warming up; a `RwLock` leaves the steady state unblocked. + core: RwLock, + /// Descriptor files already added to the pool, by name. Mutated together + /// with the core, under both write locks; see `register`. + registered: RwLock>, + /// For protobuf-py, a `Registry` holding every registered file, used to + /// look up message types by name. `None` for google.protobuf, whose + /// types are looked up in the descriptor pool of the message being + /// validated. + registry: Option>, +} + #[pymethods] impl Validator { /// Create a new validator. /// /// Parameters: - /// registry: An optional Registry used to resolve custom - /// predefined-rule extensions. If omitted, only standard rules are applied. + /// registry: An optional Registry whose files declaring extensions are + /// registered up front, so predefined rules defined in files the + /// validated messages do not import are still found. #[new] #[pyo3(signature = (registry = None))] fn new(py: Python<'_>, registry: Option>) -> PyResult { - let engine = Engine::new().map_err(PyRuntimeError::new_err)?; - let validator = Self { - engine: RwLock::new(engine), - registered: RwLock::new(HashSet::new()), - constants: Constants::get(py), - imports: Arc::new(Imports::resolve(py)?), + let constants = Constants::get(py); + let preregistered = match registry { + Some(registry) => collect_registry(®istry.0, constants)?, + None => Vec::new(), }; - if let Some(registry) = registry { - validator.add_registry(py, ®istry.0)?; - } - Ok(validator) + Ok(Self { + engines: [PyOnceLock::new(), PyOnceLock::new()], + preregistered, + constants, + imports: Arc::new(Imports::resolve(py)?), + }) } /// Validate the given message against the static rules defined in the message's descriptor. @@ -168,87 +197,153 @@ impl Validator { message: PbMessage<'_, 'py>, fail_fast: bool, ) -> PyResult<(ProtoAdapter, ViolationList<'py>)> { - let adapter = ProtoAdapter::resolve(&message.0, &self.constants)?; + let adapter = ProtoAdapter::resolve(&message.0, self.constants)?; + let engine = self.engine(py, adapter.runtime)?; let file = adapter.descriptor(py).getattr(&self.constants.file)?; - self.register(py, &file, &adapter)?; - - let type_name = adapter.type_name(py, &self.constants)?; - let payload = adapter.runtime.payload(&message.0, &self.constants)?; + engine.register(py, adapter.runtime, &file, self.constants)?; - let Some(serialized) = - self.evaluate(py, type_name.to_str()?, payload.as_bytes(), fail_fast)? + let type_name = adapter.type_name(py, self.constants)?; + let Some(serialized) = self.evaluate( + py, + engine, + &adapter, + type_name.to_str()?, + &message.0, + fail_fast, + )? else { - // `descriptor` keeps the adapter borrowed for `'py`, so hand the - // caller a cheap reference clone rather than the local. - return Ok((adapter.clone_ref(py), ViolationList(PyList::empty(py)))); + return Ok((adapter, ViolationList(PyList::empty(py)))); }; let violations = violation::build_violations( py, &serialized, &message.0, &adapter, - &self.constants, + self.constants, &self.imports, ) .map(ViolationList)?; - Ok((adapter.clone_ref(py), violations)) + Ok((adapter, violations)) } - /// Registers every descriptor file a registry contributes. - fn add_registry(&self, py: Python<'_>, registry: &Bound<'_, PyAny>) -> PyResult<()> { - let mut registered = self.registered.write_py_attached(py).unwrap(); - let mut engine = self.engine.write_py_attached(py).unwrap(); - collect_registry(registry, &self.constants, &mut registered, &mut |bytes| { - engine.add_file(bytes.as_bytes()).map_err(to_py_err) + + /// Returns the engine for `runtime`. + fn engine(&self, py: Python<'_>, runtime: ProtoRuntime) -> PyResult<&Engine> { + let slot = match runtime { + ProtoRuntime::ProtobufPy => 0, + ProtoRuntime::Google => 1, + }; + self.engines[slot].get_or_try_init(py, || { + Engine::new( + py, + runtime, + &self.preregistered, + self.constants, + &self.imports, + ) }) } - /// Registers a descriptor file and its imports, skipping known ones. + /// Validates the message in place, returning serialized violations, or + /// `None` when the message is valid. + /// + /// Reading the message calls into Python, so the interpreter stays + /// attached throughout; the core lock is taken with the + /// interpreter-aware variant so a registration waiting on it cannot + /// deadlock with a validation that Python has preempted. + fn evaluate<'py>( + &self, + py: Python<'py>, + engine: &Engine, + adapter: &ProtoAdapter, + type_name: &str, + message: &Bound<'py, PyAny>, + fail_fast: bool, + ) -> PyResult>> { + let core = engine + .core + .read_py_attached(py) + .unwrap_or_else(PoisonError::into_inner); + let registry = engine.registry.as_ref().map(|registry| registry.bind(py)); + let source = match registry { + Some(registry) => TypeSource::Registry(registry), + None => TypeSource::Descriptor(adapter.descriptor(py)), + }; + let ctx = Ctx::new(py, adapter.runtime, self.constants, message, source); + match core.validate_message(type_name, &ctx, fail_fast) { + Ok(()) => Ok(None), + Err(Error::Validation(error)) => Ok(Some(PyBytes::new(py, error.violations()))), + Err(error) => Err(to_py_err(error)), + } + } +} + +impl Engine { + /// Creates the engine for `runtime` and registers the protobuf-py + /// `DescFile`s in `preregistered` with it. + fn new( + py: Python<'_>, + runtime: ProtoRuntime, + preregistered: &[Py], + constants: &Constants, + imports: &Imports, + ) -> PyResult { + let registry = match runtime { + ProtoRuntime::ProtobufPy => Some(imports.types.registry.bind(py).call0()?.unbind()), + ProtoRuntime::Google => None, + }; + let engine = Self { + core: RwLock::new(Core::new()), + registered: RwLock::new(HashSet::new()), + registry, + }; + for file in preregistered { + engine.register(py, ProtoRuntime::ProtobufPy, file.bind(py), constants)?; + } + Ok(engine) + } + + /// Registers `file`, a descriptor file of `runtime`, together with its + /// imports. Files already registered are skipped. fn register( &self, py: Python<'_>, + runtime: ProtoRuntime, file: &Bound<'_, PyAny>, - adapter: &ProtoAdapter, + constants: &Constants, ) -> PyResult<()> { - let name_attr = file.getattr(&self.constants.name)?; + let name_attr = file.getattr(&constants.name)?; let name = name_attr.cast::()?.to_str()?; - if self.is_registered(py, name) { + if self + .registered + .read_py_attached(py) + .unwrap_or_else(PoisonError::into_inner) + .contains(name) + { return Ok(()); } // Registration is rare (once per file), so holding the write locks // across the collection walk costs little. - let mut registered = self.registered.write_py_attached(py).unwrap(); - let mut engine = self.engine.write_py_attached(py).unwrap(); - adapter - .runtime - .collect_files(file, &self.constants, &mut registered, &mut |bytes| { - engine.add_file(bytes.as_bytes()).map_err(to_py_err) - }) - } - - fn is_registered(&self, py: Python<'_>, name: &str) -> bool { - self.registered.read_py_attached(py).unwrap().contains(name) - } - - /// Runs validation over serialized bytes, returning serialized violations, - /// or `None` when the message is valid. - fn evaluate<'py>( - &self, - py: Python<'py>, - type_name: &str, - payload: &[u8], - fail_fast: bool, - ) -> PyResult>> { - let violations = py - .detach(|| { - let engine = self.engine.read().unwrap(); - engine.validate(type_name, payload, fail_fast) - }) - .map_err(to_py_err)?; - Ok(violations.map(|buffer| PyBytes::new(py, buffer.as_slice()))) + let mut registered = self + .registered + .write_py_attached(py) + .unwrap_or_else(PoisonError::into_inner); + let mut core = self + .core + .write_py_attached(py) + .unwrap_or_else(PoisonError::into_inner); + let registry = self.registry.as_ref().map(|registry| registry.bind(py)); + runtime.collect_files(file, constants, &mut registered, &mut |file, bytes| { + core.add_file_descriptor_bytes(bytes.as_bytes()) + .map_err(|error| descriptor_err(&error))?; + if let Some(registry) = registry { + registry.call_method1(&constants.add, (file,))?; + } + Ok(()) + }) } } -/// Collects every file in a registry that declares extensions. +/// Returns the `DescFile`s in `registry` that declare extensions. /// /// Predefined-rule extensions may live in files nothing being validated /// imports, in which case the lazy walk over message imports would never reach @@ -257,9 +352,8 @@ impl Validator { fn collect_registry( registry: &Bound<'_, PyAny>, constants: &Constants, - registered: &mut HashSet, - add: &mut dyn FnMut(&Bound<'_, PyBytes>) -> PyResult<()>, -) -> PyResult<()> { +) -> PyResult>> { + let mut files = Vec::new(); for descriptor in registry.try_iter()? { let descriptor = descriptor?; let Ok(extensions) = descriptor.getattr(&constants.extensions) else { @@ -273,9 +367,9 @@ fn collect_registry( let file = descriptor .getattr(&constants.file) .unwrap_or_else(|_| descriptor.clone()); - ProtoRuntime::ProtobufPy.collect_files(&file, constants, registered, add)?; + files.push(file.unbind()); } - Ok(()) + Ok(files) } /// The native protovalidate engine. diff --git a/src/proto.rs b/src/runtime.rs similarity index 53% rename from src/proto.rs rename to src/runtime.rs index 6ff2df5d..5893a0ac 100644 --- a/src/proto.rs +++ b/src/runtime.rs @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! The adapter over the two Python Protobuf runtimes. Everything that must be -//! asked differently of protobuf-py and google.protobuf -- descriptors, type -//! names, serialization, field access -- goes through [`ProtoAdapter`], so the -//! rest of the crate is runtime-agnostic. +//! Adapters on the two Python Protobuf runtimes. use std::collections::HashSet; +use protovalidate::protobuf::{Kind, Singular}; +use pyo3::Borrowed; use pyo3::exceptions::PyTypeError; use pyo3::prelude::*; -use pyo3::types::{PyBytes, PyString, PyType}; +use pyo3::types::iter::BoundDictIterator; +use pyo3::types::{PyBytes, PyDict, PyIterator, PyList, PyString, PyType}; use crate::constants::Constants; /// Which Python protobuf runtime a message comes from. -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum ProtoRuntime { /// protobuf-py: message classes carry a `desc` classmethod. ProtobufPy, @@ -61,8 +61,8 @@ impl ProtoAdapter { } /// The descriptor this adapter was resolved from. - pub(crate) fn descriptor<'py>(&'py self, py: Python<'py>) -> &'py Bound<'py, PyAny> { - self.descriptor.bind(py) + pub(crate) fn descriptor<'py>(&self, py: Python<'py>) -> Borrowed<'_, 'py, PyAny> { + self.descriptor.bind_borrowed(py) } pub(crate) fn clone_ref(&self, py: Python<'_>) -> Self { @@ -154,9 +154,68 @@ impl ProtoAdapter { } } +/// Where a message class stores one field. +pub(crate) struct FieldInfo { + pub(crate) number: u32, + /// The attribute holding the value: the proto name for google.protobuf, + /// the Python-local name for protobuf-py. + attr: Py, + /// For a protobuf-py field in a oneof, the oneof's attribute and the + /// field's proto name, which is how the `Oneof` value identifies the + /// set field. + oneof: Option<(Py, Py)>, +} + +impl FieldInfo { + /// The field's value, `None` when it is not set and the runtime has no + /// default object for it. + pub(crate) fn fetch<'py>( + &self, + message: &Bound<'py, PyAny>, + constants: &Constants, + ) -> PyResult>> { + if let Some((oneof, name)) = &self.oneof { + let selected = message.getattr(oneof)?; + if selected.is_none() { + return Ok(None); + } + if !selected.getattr(&constants.field)?.eq(name)? { + return Ok(None); + } + return Ok(Some(selected.getattr(&constants.value)?)); + } + let value = message.getattr(&self.attr)?; + Ok((!value.is_none()).then_some(value)) + } +} + +/// A callback that registers one descriptor file, given the file object +/// and its serialized `FileDescriptorProto`. +pub(crate) type AddFile<'a> = + dyn FnMut(&Bound<'_, PyAny>, &Bound<'_, PyBytes>) -> PyResult<()> + 'a; + +/// The entries of a map field, in the runtime's order. +pub(crate) enum MapEntries<'py> { + /// A protobuf-py `dict`. + Dict(BoundDictIterator<'py>), + /// The `items()` of a google.protobuf map container. + Items(Bound<'py, PyIterator>), +} + +impl<'py> Iterator for MapEntries<'py> { + type Item = PyResult<(Bound<'py, PyAny>, Bound<'py, PyAny>)>; + + fn next(&mut self) -> Option { + match self { + Self::Dict(entries) => entries.next().map(Ok), + Self::Items(entries) => entries.next().map(|entry| entry?.extract()), + } + } +} + impl ProtoRuntime { /// The serialized message. - pub(crate) fn payload<'py>( + pub(crate) fn serialize<'py>( self, message: &Bound<'py, PyAny>, constants: &Constants, @@ -171,25 +230,20 @@ impl ProtoRuntime { .map_err(Into::into) } - /// Adds a descriptor file and its imports to the engine, imports first. - /// - /// The shim adds descriptors with `BuildFile`, which resolves dependencies - /// eagerly, so a file's imports have to be added before the file itself; - /// the recursion order preserves that. `registered` doubles as the walk's - /// visited set; a file is recorded only once `add` has accepted it. + /// Registers a descriptor file and, before it, its imports, by passing + /// each file and its serialized descriptor to `add`. pub(crate) fn collect_files( self, file: &Bound<'_, PyAny>, constants: &Constants, registered: &mut HashSet, - add: &mut dyn FnMut(&Bound<'_, PyBytes>) -> PyResult<()>, + add: &mut AddFile<'_>, ) -> PyResult<()> { let name_attr = file.getattr(&constants.name)?; let name = name_attr.cast::()?.to_str()?; if registered.contains(name) { return Ok(()); } - let name = name.to_owned(); for dependency in file.getattr(&constants.dependencies)?.try_iter()? { self.collect_files(&dependency?, constants, registered, add)?; } @@ -201,8 +255,8 @@ impl ProtoRuntime { // `serialized_pb` is already a serialized FileDescriptorProto Self::Google => file.getattr(&constants.serialized_pb)?.cast_into()?, }; - add(&bytes)?; - registered.insert(name); + add(file, &bytes)?; + registered.insert(name.to_owned()); Ok(()) } @@ -231,19 +285,115 @@ impl ProtoRuntime { } } - /// Reads a field's value off a message. - pub(crate) fn read_field<'py>( + /// Returns how to read each field of the message type that + /// `descriptor` describes. + pub(crate) fn fields( self, - message: &Bound<'py, PyAny>, - field: &Bound<'py, PyAny>, + py: Python<'_>, + descriptor: &Bound<'_, PyAny>, constants: &Constants, - ) -> PyResult> { + ) -> PyResult> { + let mut fields = Vec::new(); + for field in descriptor.getattr(&constants.fields)?.try_iter()? { + fields.push(self.field_info(py, &field?, constants)?); + } + Ok(fields) + } + + /// Where a message class stores the field `field` describes. + pub(crate) fn field_info( + self, + py: Python<'_>, + field: &Bound<'_, PyAny>, + constants: &Constants, + ) -> PyResult { + let intern = |name: Bound<'_, PyAny>| -> PyResult> { + let name = name.cast_into::()?; + Ok(PyString::intern(py, name.to_str()?).unbind()) + }; + let number = field.getattr(&constants.number)?.extract()?; + Ok(match self { + Self::Google => FieldInfo { + number, + attr: intern(field.getattr(&constants.name)?)?, + oneof: None, + }, + Self::ProtobufPy => { + // Only a singular value has a `oneof`, and it is `None` for + // a proto3 `optional` field, whose synthetic oneof + // protobuf-py does not surface: such a field is stored like + // any other. + let oneof = match field.getattr(&constants.value)?.getattr(&constants.oneof) { + Ok(oneof) if !oneof.is_none() => Some(( + intern(oneof.getattr(&constants.local_name)?)?, + intern(field.getattr(&constants.name)?)?, + )), + _ => None, + }; + FieldInfo { + number, + attr: intern(field.getattr(&constants.local_name)?)?, + oneof, + } + } + }) + } + + /// Whether a field that tracks presence is set. + pub(crate) fn is_set( + self, + message: &Bound<'_, PyAny>, + field: &FieldInfo, + kind: Kind, + fetched: impl FnOnce() -> PyResult, + constants: &Constants, + ) -> PyResult { + match self { + // google.protobuf tracks it: `HasField`. + Self::Google => message + .call_method1(&constants.has_field, (&field.attr,))? + .extract(), + // protobuf-py: a oneof member is set when the oneof selects it, + // a message field when it is not `None`, and any other field + // when it is in the message's `_present` set. + Self::ProtobufPy + if field.oneof.is_some() || matches!(kind, Kind::Singular(Singular::Message)) => + { + fetched() + } + Self::ProtobufPy => message.getattr(&constants.present)?.contains(field.number), + } + } + + /// Appends the elements of a repeated field to `items`. The field is a + /// `list` for protobuf-py and a repeated container for + /// google.protobuf, which creates a new element object on every access. + pub(crate) fn list_items( + self, + object: &Bound<'_, PyAny>, + items: &mut Vec>, + ) -> PyResult<()> { match self { - Self::ProtobufPy => message.get_item(field), + Self::ProtobufPy => items.extend(object.cast::()?.iter().map(Bound::unbind)), Self::Google => { - let name = field.getattr(&constants.name)?; - message.getattr(name.cast_into::()?) + for item in object.try_iter()? { + items.push(item?.unbind()); + } } } + Ok(()) + } + + /// The entries of a map field: a `dict` for protobuf-py, a map container + /// for google.protobuf. + pub(crate) fn map_entries<'py>( + self, + object: &Bound<'py, PyAny>, + constants: &Constants, + ) -> PyResult> { + Ok(match self { + Self::ProtobufPy => MapEntries::Dict(object.cast::()?.iter()), + Self::Google => MapEntries::Items(object.call_method0(&constants.items)?.try_iter()?), + }) } } diff --git a/src/view.rs b/src/view.rs new file mode 100644 index 00000000..83abb3b7 --- /dev/null +++ b/src/view.rs @@ -0,0 +1,457 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! The validator's view of a live Python message. +//! +//! [`PyRuntime`] implements the `protovalidate` reflection traits over +//! protobuf-py and google.protobuf message objects, so a message is +//! validated in place. + +use std::cell::{OnceCell, RefCell}; +use std::ops::ControlFlow; +use std::sync::Arc; + +use protovalidate::protobuf::{ + Field, Kind, List, Map, Message, Reader, Runtime, Scalar, Singular, Val, +}; +use pyo3::Borrowed; +use pyo3::exceptions::{PyTypeError, PyValueError}; +use pyo3::prelude::*; +use pyo3::types::{PyBytes, PyString}; + +use crate::constants::Constants; +use crate::runtime::{FieldInfo, ProtoRuntime}; + +/// The Python error a read raised. +type ReadError = Box; + +/// The Python runtimes, as the validator reads them. +pub(crate) struct PyRuntime; + +impl Runtime for PyRuntime { + type Error = ReadError; + type MessageType = Arc; + type Message<'a> = MessageView<'a>; + type List<'a> = ListView<'a>; + type Map<'a> = MapView<'a>; +} + +/// Describes how to read each field of one message type from its Python +/// objects. +pub(crate) struct TypeInfo { + /// Sorted by field number. + fields: Vec, +} + +impl TypeInfo { + fn build(ctx: &Ctx<'_>, descriptor: &Bound<'_, PyAny>) -> PyResult { + let mut fields = ctx.runtime.fields(ctx.py, descriptor, ctx.constants)?; + fields.sort_by_key(|field| field.number); + Ok(Self { fields }) + } + + fn find(&self, number: u32) -> Option<(usize, &FieldInfo)> { + let slot = self + .fields + .binary_search_by_key(&number, |field| field.number) + .ok()?; + Some((slot, &self.fields[slot])) + } +} + +/// Where message types are looked up by name. +pub(crate) enum TypeSource<'py> { + /// For protobuf-py, a `Registry` containing every registered file. + Registry(&'py Bound<'py, PyAny>), + /// For google.protobuf, the descriptor of the message being validated. + /// Its pool contains every type reachable from that message. + Descriptor(Borrowed<'py, 'py, PyAny>), +} + +/// The field values a view has fetched, indexed like its type's field list. +type Values = Box<[OnceCell>>]>; + +/// The state of one validation: the message being validated, and what +/// every view needs besides its own object. +pub(crate) struct Ctx<'py> { + py: Python<'py>, + runtime: ProtoRuntime, + constants: &'py Constants, + message: &'py Bound<'py, PyAny>, + source: TypeSource<'py>, + /// Value buffers returned by dropped views, for later views to reuse. + free_values: RefCell>, + /// Element buffers returned by dropped list views, likewise. + free_items: RefCell>>>, +} + +impl<'py> Ctx<'py> { + pub(crate) fn new( + py: Python<'py>, + runtime: ProtoRuntime, + constants: &'py Constants, + message: &'py Bound<'py, PyAny>, + source: TypeSource<'py>, + ) -> Self { + Self { + py, + runtime, + constants, + message, + source, + free_values: RefCell::new(Vec::new()), + free_items: RefCell::new(Vec::new()), + } + } + + /// Returns an empty value buffer with at least `len` slots, reusing a + /// returned one when possible. + fn take_values(&self, len: usize) -> Values { + if len == 0 { + return Values::default(); + } + let mut free = self.free_values.borrow_mut(); + match free.iter().rposition(|values| values.len() >= len) { + Some(found) => free.swap_remove(found), + None => std::iter::repeat_with(OnceCell::new).take(len).collect(), + } + } +} + +impl Reader for Ctx<'_> { + fn resolve(&self, full_name: &str) -> Result, ReadError> { + let descriptor = match self.source { + TypeSource::Registry(registry) => { + let descriptor = registry.call_method1(&self.constants.message, (full_name,))?; + if descriptor.is_none() { + return Err(Box::new(PyValueError::new_err(format!( + "message type {full_name} is not in the registry" + )))); + } + descriptor + } + TypeSource::Descriptor(descriptor) => descriptor + .getattr(&self.constants.file)? + .getattr(&self.constants.pool)? + .call_method1(&self.constants.find_message_type_by_name, (full_name,))?, + }; + Ok(Arc::new(TypeInfo::build(self, &descriptor)?)) + } + + fn message<'a>( + &'a self, + message_type: &'a Arc, + ) -> Result, ReadError> { + Ok(MessageView::new(self, Some((self.message, message_type)))) + } +} + +/// A message, read through its Python object. +pub(crate) struct MessageView<'a> { + ctx: &'a Ctx<'a>, + /// The object, and how to read its fields. `None` for a protobuf-py + /// message field that is not set, which reads as a message with + /// nothing set. + object: Option<(&'a Bound<'a, PyAny>, &'a TypeInfo)>, + /// Field values already fetched, by position in the type's fields, so a + /// value is read once and borrowed from for as long as the view lives. + /// When the view is dropped, the buffer is emptied and returned to the + /// context. + values: Values, +} + +impl<'a> MessageView<'a> { + fn new(ctx: &'a Ctx<'a>, object: Option<(&'a Bound<'a, PyAny>, &'a TypeInfo)>) -> Self { + let values = object.map_or(0, |(_, info)| info.fields.len()); + Self { + ctx, + object, + values: ctx.take_values(values), + } + } + + /// The field's value, `None` when it is not set and the runtime has no + /// default object for it. + fn value( + &self, + object: &Bound<'a, PyAny>, + slot: usize, + field: &FieldInfo, + ) -> PyResult>> { + let cell = &self.values[slot]; + if cell.get().is_none() { + let fetched = field.fetch(object, self.ctx.constants)?; + let _ = cell.set(fetched.map(Bound::unbind)); + } + Ok(cell + .get() + .and_then(Option::as_ref) + .map(|value| value.bind(self.ctx.py))) + } +} + +impl Drop for MessageView<'_> { + fn drop(&mut self) { + for cell in &mut self.values { + cell.take(); + } + let values = std::mem::take(&mut self.values); + if !values.is_empty() { + self.ctx.free_values.borrow_mut().push(values); + } + } +} + +impl Message for MessageView<'_> { + fn encode(&self) -> Result, ReadError> { + // An unset message reads as one with nothing set, which encodes to + // nothing. + Ok(match self.object { + Some((object, _)) => self.ctx.runtime.serialize(object, self.ctx.constants)?, + None => PyBytes::new(self.ctx.py, &[]), + }) + } + + fn has(&self, field: &Field) -> Result { + let Some((object, info)) = self.object else { + return Ok(false); + }; + let Some((slot, stored)) = info.find(field.number()) else { + return Ok(false); + }; + Ok(self.ctx.runtime.is_set( + object, + stored, + field.kind(), + || Ok(self.value(object, slot, stored)?.is_some()), + self.ctx.constants, + )?) + } + + fn get<'f>( + &'f self, + field: &'f Field, + ) -> Result>, ReadError> { + let message_type = field.message_type().map(Arc::as_ref); + let Some((object, info)) = self.object else { + // Nothing is set: every field reads as its default. + return Ok(Some(convert(self.ctx, field.kind(), None, message_type)?)); + }; + let Some((slot, stored)) = info.find(field.number()) else { + return Ok(None); + }; + Ok(Some(convert( + self.ctx, + field.kind(), + self.value(object, slot, stored)?, + message_type, + )?)) + } +} + +/// A field's value as the validator sees it; the default when `value` is +/// `None`. +fn convert<'a>( + ctx: &'a Ctx<'a>, + kind: Kind, + value: Option<&'a Bound<'a, PyAny>>, + message_type: Option<&'a TypeInfo>, +) -> PyResult> { + Ok(match kind { + Kind::Singular(kind) => singular(ctx, kind, value, message_type)?, + Kind::List(element) => Val::List(ListView { + ctx, + element, + object: value, + message_type, + items: OnceCell::new(), + }), + Kind::Map { + key, + value: element, + } => Val::Map(MapView { + ctx, + key, + element, + object: value, + message_type, + }), + }) +} + +fn singular<'a>( + ctx: &'a Ctx<'a>, + kind: Singular, + value: Option<&'a Bound<'a, PyAny>>, + message_type: Option<&'a TypeInfo>, +) -> PyResult> { + Ok(match kind { + Singular::Message => { + let object = match (value, message_type) { + (Some(value), Some(info)) => Some((value, info)), + (Some(_), None) => { + return Err(PyTypeError::new_err( + "a message field was read without its message type", + )); + } + (None, _) => None, + }; + Val::Message(MessageView::new(ctx, object)) + } + Singular::Enum => Val::Enum(match value { + Some(value) => value.extract::()?, + None => 0, + }), + Singular::Scalar(scalar) => match value { + Some(value) => scalar_value(scalar, value)?, + None => default(scalar), + }, + }) +} + +fn scalar_value<'a>(scalar: Scalar, value: &'a Bound<'a, PyAny>) -> PyResult> { + Ok(match scalar { + Scalar::Bool => Val::Bool(value.extract()?), + Scalar::Int32 + | Scalar::Int64 + | Scalar::Sint32 + | Scalar::Sint64 + | Scalar::Sfixed32 + | Scalar::Sfixed64 => Val::Int(value.extract()?), + Scalar::Uint32 | Scalar::Uint64 | Scalar::Fixed32 | Scalar::Fixed64 => { + Val::Uint(value.extract()?) + } + Scalar::Float | Scalar::Double => Val::Double(value.extract()?), + Scalar::String => Val::String(value.cast::()?.to_str()?.into()), + Scalar::Bytes => Val::Bytes(value.cast::()?.as_bytes().into()), + }) +} + +fn default<'a>(scalar: Scalar) -> Val<'a, PyRuntime> { + match scalar { + Scalar::Bool => Val::Bool(false), + Scalar::Int32 + | Scalar::Int64 + | Scalar::Sint32 + | Scalar::Sint64 + | Scalar::Sfixed32 + | Scalar::Sfixed64 => Val::Int(0), + Scalar::Uint32 | Scalar::Uint64 | Scalar::Fixed32 | Scalar::Fixed64 => Val::Uint(0), + Scalar::Float | Scalar::Double => Val::Double(0.0), + Scalar::String => Val::String("".into()), + Scalar::Bytes => Val::Bytes((&[][..]).into()), + } +} + +/// A repeated field. +pub(crate) struct ListView<'a> { + ctx: &'a Ctx<'a>, + element: Singular, + /// `None` for an unset field, which is empty. + object: Option<&'a Bound<'a, PyAny>>, + /// The elements' type, if they are messages. + message_type: Option<&'a TypeInfo>, + /// The elements, fetched all at once on first access and held here for + /// values to borrow from. + items: OnceCell>>, +} + +impl ListView<'_> { + fn items(&self) -> PyResult<&[Py]> { + if let Some(items) = self.items.get() { + return Ok(items); + } + let mut items = Vec::new(); + if let Some(object) = self.object { + items = self.ctx.free_items.borrow_mut().pop().unwrap_or_default(); + self.ctx.runtime.list_items(object, &mut items)?; + } + Ok(self.items.get_or_init(|| items)) + } +} + +impl Drop for ListView<'_> { + fn drop(&mut self) { + let Some(mut items) = self.items.take() else { + return; + }; + items.clear(); + if items.capacity() > 0 { + self.ctx.free_items.borrow_mut().push(items); + } + } +} + +impl List for ListView<'_> { + fn len(&self) -> Result { + Ok(match (self.items.get(), self.object) { + (Some(items), _) => items.len(), + (None, Some(object)) => object.len()?, + (None, None) => 0, + }) + } + + fn get(&self, index: usize) -> Result>, ReadError> { + let Some(item) = self.items()?.get(index) else { + return Ok(None); + }; + let item = item.bind(self.ctx.py); + Ok(Some(singular( + self.ctx, + self.element, + Some(item), + self.message_type, + )?)) + } +} + +/// A map field. +pub(crate) struct MapView<'a> { + ctx: &'a Ctx<'a>, + key: Scalar, + element: Singular, + /// `None` for an unset field, which is empty. + object: Option<&'a Bound<'a, PyAny>>, + /// The values' type, if they are messages. + message_type: Option<&'a TypeInfo>, +} + +impl Map for MapView<'_> { + fn len(&self) -> Result { + Ok(match self.object { + Some(object) => object.len()?, + None => 0, + }) + } + + fn for_each(&self, mut f: F) -> Result, ReadError> + where + F: FnMut(Val<'_, PyRuntime>, Val<'_, PyRuntime>) -> ControlFlow, + { + let Some(object) = self.object else { + return Ok(ControlFlow::Continue(())); + }; + for entry in self.ctx.runtime.map_entries(object, self.ctx.constants)? { + let (k, v) = entry?; + let flow = f( + scalar_value(self.key, &k)?, + singular(self.ctx, self.element, Some(&v), self.message_type)?, + ); + if flow.is_break() { + return Ok(flow); + } + } + Ok(ControlFlow::Continue(())) + } +} diff --git a/src/violation.rs b/src/violation.rs index 4e86c537..375a35b6 100644 --- a/src/violation.rs +++ b/src/violation.rs @@ -25,7 +25,7 @@ use pyo3::types::{PyBytes, PyDict, PyList, PyString}; use crate::constants::{Constants, Imports}; use crate::hints::{PbFieldPath, ViolationProto}; -use crate::proto::ProtoAdapter; +use crate::runtime::ProtoAdapter; /// The recovered values, resolved together because the rule walk needs the /// leaf field found by the field walk. @@ -34,8 +34,8 @@ struct Values { rule: Py, } -/// Where an engine-produced violation came from, kept for lazy resolution -/// of a violation field value. +/// The validation an engine-produced violation came from, shared by its +/// violations for the lazy resolution of their values. struct Origin { message: Py, adapter: ProtoAdapter, @@ -48,25 +48,16 @@ pub struct Violation { /// The `buf.validate.Violation` form of this violation. proto: Py, /// `None` for hand-built violations, which have nothing to resolve from. - origin: Option, + origin: Option>, values: PyOnceLock, } impl Violation { /// Wraps a violation the engine produced, deferring value resolution. - pub(crate) fn deferred( - proto: Py, - message: Py, - adapter: ProtoAdapter, - imports: Arc, - ) -> Self { + fn deferred(proto: Py, origin: Arc) -> Self { Self { proto, - origin: Some(Origin { - message, - adapter, - imports, - }), + origin: Some(origin), values: PyOnceLock::new(), } } @@ -75,13 +66,12 @@ impl Violation { fn values(&self, py: Python<'_>) -> PyResult<&Values> { self.values.get_or_try_init(py, || match &self.origin { Some(origin) => { - let constants = Constants::get(py); let (field, rule) = resolve_values( py, self.proto.bind(py), origin.message.bind(py), &origin.adapter, - &constants, + Constants::get(py), &origin.imports, )?; Ok(Values { field, rule }) @@ -216,7 +206,8 @@ fn step_element<'py>( let Some(field) = hop.find_field(py, element, constants)? else { return Ok(None); }; - let Ok(value) = hop.runtime.read_field(current, &field, constants) else { + let info = hop.runtime.field_info(py, &field, constants)?; + let Ok(Some(value)) = info.fetch(current, constants) else { return Ok(None); }; Ok(Some((value, field))) @@ -299,7 +290,7 @@ fn resolve_rule_value<'py>( } else { rules_of( py, - adapter.descriptor(py), + &adapter.descriptor(py), adapter, constants, imports, @@ -360,10 +351,10 @@ fn rules_of<'py>( Ok(options.get_item(extension.bind(py)).ok()) } -/// Turns the serialized `buf.validate.Violations` from C++ into wrappers. +/// Turns the validator's serialized `buf.validate.Violations` into wrappers. /// -/// No value resolution happens here: each wrapper keeps the proto the C++ side -/// produced together with the message it came from, and `field_value` and +/// No value resolution happens here: each wrapper keeps the proto the +/// validator produced together with the message it came from, and `field_value` and /// `rule_value` are recovered from the paths on first access. Raising a /// `ValidationError` or reading `rule_id` never pays for path walking. pub fn build_violations<'py>( @@ -383,15 +374,15 @@ pub fn build_violations<'py>( let violations = parsed .getattr(&constants.violations)? .cast_into::()?; + let origin = Arc::new(Origin { + message: message.clone().unbind(), + adapter: adapter.clone_ref(py), + imports: Arc::clone(imports), + }); PyList::new( py, - violations.iter().map(|violation| { - Violation::deferred( - violation.unbind(), - message.clone().unbind(), - adapter.clone_ref(py), - Arc::clone(imports), - ) - }), + violations + .iter() + .map(|violation| Violation::deferred(violation.unbind(), Arc::clone(&origin))), ) } diff --git a/test/_models.py b/test/_models.py index a1f67c64..d7293fcf 100644 --- a/test/_models.py +++ b/test/_models.py @@ -58,9 +58,9 @@ # pulled in more of that module than is worth carrying; `ipaddress` agrees with # them on whether a host is an address, which is all it is used for here. # -# The live implementations are now C++ inside protovalidate-cc and cannot be -# called from Python, so unlike the rest of this file these can drift from what -# the validator does. If the benchmark ever disagrees with it on a hostname or +# The live implementations are now Rust inside the native extension and cannot +# be called from Python, so unlike the rest of this file these can drift from +# what the validator does. If the benchmark ever disagrees with it on a hostname or # host_and_port case, suspect these first. # Lifted verbatim from the removed `protovalidate/_funcs.py`. EMAIL_PATTERN = ( diff --git a/test/gen/tests/example/v1/end_to_end_pb.py b/test/gen/tests/example/v1/end_to_end_pb.py new file mode 100644 index 00000000..e8269bc6 --- /dev/null +++ b/test/gen/tests/example/v1/end_to_end_pb.py @@ -0,0 +1,1204 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated from tests/example/v1/end_to_end.proto. DO NOT EDIT. +# Generated by protoc-gen-py v0.1.1 with parameter "". +# ruff: noqa: PGH004 +# ruff: noqa +# fmt: off + +from __future__ import annotations + +from typing import Literal, TYPE_CHECKING, TypeAlias + +from protobuf import Enum, Message +from protobuf._codegen import file_desc + +from ....buf.validate import validate_pb + +if TYPE_CHECKING: + from protobuf import DescFile + + +_Int32GtFields: TypeAlias = Literal["value"] + +class Int32Gt(Message[_Int32GtFields]): + """ + ```proto + message tests.example.v1.Int32Gt + ``` + + Attributes: + value: + ```proto + int32 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_Int32ConstFields: TypeAlias = Literal["value"] + +class Int32Const(Message[_Int32ConstFields]): + """ + ```proto + message tests.example.v1.Int32Const + ``` + + Attributes: + value: + ```proto + int32 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_Int32InFields: TypeAlias = Literal["value"] + +class Int32In(Message[_Int32InFields]): + """ + ```proto + message tests.example.v1.Int32In + ``` + + Attributes: + value: + ```proto + int32 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_Int32NotInFields: TypeAlias = Literal["value"] + +class Int32NotIn(Message[_Int32NotInFields]): + """ + ```proto + message tests.example.v1.Int32NotIn + ``` + + Attributes: + value: + ```proto + int32 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_Int32GtLtFields: TypeAlias = Literal["value"] + +class Int32GtLt(Message[_Int32GtLtFields]): + """ + ```proto + message tests.example.v1.Int32GtLt + ``` + + Attributes: + value: + ```proto + int32 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_Uint64GteFields: TypeAlias = Literal["value"] + +class Uint64Gte(Message[_Uint64GteFields]): + """ + ```proto + message tests.example.v1.Uint64Gte + ``` + + Attributes: + value: + ```proto + uint64 value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: int = 0, + ) -> None: + pass + + value: int + +_DoubleLtFields: TypeAlias = Literal["value"] + +class DoubleLt(Message[_DoubleLtFields]): + """ + ```proto + message tests.example.v1.DoubleLt + ``` + + Attributes: + value: + ```proto + double value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: float = 0, + ) -> None: + pass + + value: float + +_StringMinLenFields: TypeAlias = Literal["value"] + +class StringMinLen(Message[_StringMinLenFields]): + """ + ```proto + message tests.example.v1.StringMinLen + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringMinBytesFields: TypeAlias = Literal["value"] + +class StringMinBytes(Message[_StringMinBytesFields]): + """ + ```proto + message tests.example.v1.StringMinBytes + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringPrefixFields: TypeAlias = Literal["value"] + +class StringPrefix(Message[_StringPrefixFields]): + """ + ```proto + message tests.example.v1.StringPrefix + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringSuffixFields: TypeAlias = Literal["value"] + +class StringSuffix(Message[_StringSuffixFields]): + """ + ```proto + message tests.example.v1.StringSuffix + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringContainsFields: TypeAlias = Literal["value"] + +class StringContains(Message[_StringContainsFields]): + """ + ```proto + message tests.example.v1.StringContains + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringNotContainsFields: TypeAlias = Literal["value"] + +class StringNotContains(Message[_StringNotContainsFields]): + """ + ```proto + message tests.example.v1.StringNotContains + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringConstFields: TypeAlias = Literal["value"] + +class StringConst(Message[_StringConstFields]): + """ + ```proto + message tests.example.v1.StringConst + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringInFields: TypeAlias = Literal["value"] + +class StringIn(Message[_StringInFields]): + """ + ```proto + message tests.example.v1.StringIn + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringNotInFields: TypeAlias = Literal["value"] + +class StringNotIn(Message[_StringNotInFields]): + """ + ```proto + message tests.example.v1.StringNotIn + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringPatternFields: TypeAlias = Literal["value"] + +class StringPattern(Message[_StringPatternFields]): + """ + ```proto + message tests.example.v1.StringPattern + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringEmailFields: TypeAlias = Literal["value"] + +class StringEmail(Message[_StringEmailFields]): + """ + ```proto + message tests.example.v1.StringEmail + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringUuidFields: TypeAlias = Literal["value"] + +class StringUuid(Message[_StringUuidFields]): + """ + ```proto + message tests.example.v1.StringUuid + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_StringHeaderNameFields: TypeAlias = Literal["value"] + +class StringHeaderName(Message[_StringHeaderNameFields]): + """ + ```proto + message tests.example.v1.StringHeaderName + ``` + + Attributes: + value: + ```proto + string value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: str = "", + ) -> None: + pass + + value: str + +_BoolConstFields: TypeAlias = Literal["value"] + +class BoolConst(Message[_BoolConstFields]): + """ + ```proto + message tests.example.v1.BoolConst + ``` + + Attributes: + value: + ```proto + bool value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bool = False, + ) -> None: + pass + + value: bool + +_BytesConstFields: TypeAlias = Literal["value"] + +class BytesConst(Message[_BytesConstFields]): + """ + ```proto + message tests.example.v1.BytesConst + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_BytesInFields: TypeAlias = Literal["value"] + +class BytesIn(Message[_BytesInFields]): + """ + ```proto + message tests.example.v1.BytesIn + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_BytesNotInFields: TypeAlias = Literal["value"] + +class BytesNotIn(Message[_BytesNotInFields]): + """ + ```proto + message tests.example.v1.BytesNotIn + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_BytesMinLenFields: TypeAlias = Literal["value"] + +class BytesMinLen(Message[_BytesMinLenFields]): + """ + ```proto + message tests.example.v1.BytesMinLen + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_BytesPrefixFields: TypeAlias = Literal["value"] + +class BytesPrefix(Message[_BytesPrefixFields]): + """ + ```proto + message tests.example.v1.BytesPrefix + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_BytesIpFields: TypeAlias = Literal["value"] + +class BytesIp(Message[_BytesIpFields]): + """ + ```proto + message tests.example.v1.BytesIp + ``` + + Attributes: + value: + ```proto + bytes value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: bytes = b"", + ) -> None: + pass + + value: bytes + +_RepeatedMinItemsFields: TypeAlias = Literal["value"] + +class RepeatedMinItems(Message[_RepeatedMinItemsFields]): + """ + ```proto + message tests.example.v1.RepeatedMinItems + ``` + + Attributes: + value: + ```proto + repeated int32 value = 1 [packed = true]; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: list[int] | None = None, + ) -> None: + pass + + value: list[int] + +_RepeatedMaxItemsFields: TypeAlias = Literal["value"] + +class RepeatedMaxItems(Message[_RepeatedMaxItemsFields]): + """ + ```proto + message tests.example.v1.RepeatedMaxItems + ``` + + Attributes: + value: + ```proto + repeated int32 value = 1 [packed = true]; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: list[int] | None = None, + ) -> None: + pass + + value: list[int] + +_RepeatedUniqueFields: TypeAlias = Literal["value"] + +class RepeatedUnique(Message[_RepeatedUniqueFields]): + """ + ```proto + message tests.example.v1.RepeatedUnique + ``` + + Attributes: + value: + ```proto + repeated int32 value = 1 [packed = true]; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: list[int] | None = None, + ) -> None: + pass + + value: list[int] + +_RepeatedUniqueItemsFields: TypeAlias = Literal["value"] + +class RepeatedUniqueItems(Message[_RepeatedUniqueItemsFields]): + """ + ```proto + message tests.example.v1.RepeatedUniqueItems + ``` + + Attributes: + value: + ```proto + repeated int32 value = 1 [packed = true]; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: list[int] | None = None, + ) -> None: + pass + + value: list[int] + +_RepeatedUniqueMaxItemsFields: TypeAlias = Literal["value"] + +class RepeatedUniqueMaxItems(Message[_RepeatedUniqueMaxItemsFields]): + """ + ```proto + message tests.example.v1.RepeatedUniqueMaxItems + ``` + + Attributes: + value: + ```proto + repeated int32 value = 1 [packed = true]; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: list[int] | None = None, + ) -> None: + pass + + value: list[int] + +_MapMaxPairsFields: TypeAlias = Literal["entries"] + +class MapMaxPairs(Message[_MapMaxPairsFields]): + """ + ```proto + message tests.example.v1.MapMaxPairs + ``` + + Attributes: + entries: + ```proto + map entries = 1; + ``` + """ + + __slots__ = ("entries",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + entries: dict[str, str] | None = None, + ) -> None: + pass + + entries: dict[str, str] + +_EnumConstFields: TypeAlias = Literal["value"] + +class EnumConst(Message[_EnumConstFields]): + """ + ```proto + message tests.example.v1.EnumConst + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +_EnumInFields: TypeAlias = Literal["value"] + +class EnumIn(Message[_EnumInFields]): + """ + ```proto + message tests.example.v1.EnumIn + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +_EnumNotInFields: TypeAlias = Literal["value"] + +class EnumNotIn(Message[_EnumNotInFields]): + """ + ```proto + message tests.example.v1.EnumNotIn + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +_EnumDefinedOnlyInFields: TypeAlias = Literal["value"] + +class EnumDefinedOnlyIn(Message[_EnumDefinedOnlyInFields]): + """ + ```proto + message tests.example.v1.EnumDefinedOnlyIn + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +_EnumDefinedOnlyConstFields: TypeAlias = Literal["value"] + +class EnumDefinedOnlyConst(Message[_EnumDefinedOnlyConstFields]): + """ + ```proto + message tests.example.v1.EnumDefinedOnlyConst + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +_EnumDefinedOnlyNotInFields: TypeAlias = Literal["value"] + +class EnumDefinedOnlyNotIn(Message[_EnumDefinedOnlyNotInFields]): + """ + ```proto + message tests.example.v1.EnumDefinedOnlyNotIn + ``` + + Attributes: + value: + ```proto + tests.example.v1.Status value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Status | None = None, + ) -> None: + pass + + value: Status + +class Status(Enum): + """ + ```proto + enum tests.example.v1.Status + ``` + + Attributes: + UNSPECIFIED: + ```proto + STATUS_UNSPECIFIED = 0 + ``` + ACTIVE: + ```proto + STATUS_ACTIVE = 1 + ``` + INACTIVE: + ```proto + STATUS_INACTIVE = 2 + ``` + """ + + UNSPECIFIED = 0 + ACTIVE = 1 + INACTIVE = 2 + + +_DESC = file_desc( + b'\n!tests/example/v1/end_to_end.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto"(\n\x07Int32Gt\x12\x1d\n\x05value\x18\x01 \x01(\x05R\x05valueB\x07\xbaH\x04\x1a\x02 \x00"+\n\nInt32Const\x12\x1d\n\x05value\x18\x01 \x01(\x05R\x05valueB\x07\xbaH\x04\x1a\x02\x08\x05",\n\x07Int32In\x12!\n\x05value\x18\x01 \x01(\x05R\x05valueB\x0b\xbaH\x08\x1a\x060\x010\x020\x03"+\n\nInt32NotIn\x12\x1d\n\x05value\x18\x01 \x01(\x05R\x05valueB\x07\xbaH\x04\x1a\x028\x07",\n\tInt32GtLt\x12\x1f\n\x05value\x18\x01 \x01(\x05R\x05valueB\t\xbaH\x06\x1a\x04\x10\n \x00"*\n\tUint64Gte\x12\x1d\n\x05value\x18\x01 \x01(\x04R\x05valueB\x07\xbaH\x042\x02(\n"0\n\x08DoubleLt\x12$\n\x05value\x18\x01 \x01(\x01R\x05valueB\x0e\xbaH\x0b\x12\t\x11\x00\x00\x00\x00\x00\x00Y@"-\n\x0cStringMinLen\x12\x1d\n\x05value\x18\x01 \x01(\tR\x05valueB\x07\xbaH\x04r\x02\x10\x03"/\n\x0eStringMinBytes\x12\x1d\n\x05value\x18\x01 \x01(\tR\x05valueB\x07\xbaH\x04r\x02 \x05"2\n\x0cStringPrefix\x12"\n\x05value\x18\x01 \x01(\tR\x05valueB\x0c\xbaH\tr\x07:\x05hello"0\n\x0cStringSuffix\x12 \n\x05value\x18\x01 \x01(\tR\x05valueB\n\xbaH\x07r\x05B\x03bar"2\n\x0eStringContains\x12 \n\x05value\x18\x01 \x01(\tR\x05valueB\n\xbaH\x07r\x05J\x03mid"6\n\x11StringNotContains\x12!\n\x05value\x18\x01 \x01(\tR\x05valueB\x0b\xbaH\x08r\x06\xba\x01\x03bad"-\n\x0bStringConst\x12\x1e\n\x05value\x18\x01 \x01(\tR\x05valueB\x08\xbaH\x05r\x03\n\x01a"-\n\x08StringIn\x12!\n\x05value\x18\x01 \x01(\tR\x05valueB\x0b\xbaH\x08r\x06R\x01aR\x01b"-\n\x0bStringNotIn\x12\x1e\n\x05value\x18\x01 \x01(\tR\x05valueB\x08\xbaH\x05r\x03Z\x01z"6\n\rStringPattern\x12%\n\x05value\x18\x01 \x01(\tR\x05valueB\x0f\xbaH\x0cr\n2\x08^[a-z]+$",\n\x0bStringEmail\x12\x1d\n\x05value\x18\x01 \x01(\tR\x05valueB\x07\xbaH\x04r\x02`\x01",\n\nStringUuid\x12\x1e\n\x05value\x18\x01 \x01(\tR\x05valueB\x08\xbaH\x05r\x03\xb0\x01\x01"5\n\x10StringHeaderName\x12!\n\x05value\x18\x01 \x01(\tR\x05valueB\x0b\xbaH\x08r\x06\xc8\x01\x01\xc0\x01\x01"*\n\tBoolConst\x12\x1d\n\x05value\x18\x01 \x01(\x08R\x05valueB\x07\xbaH\x04j\x02\x08\x01",\n\nBytesConst\x12\x1e\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x08\xbaH\x05z\x03\n\x01\x01",\n\x07BytesIn\x12!\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x0b\xbaH\x08z\x06B\x01\x01B\x01\x02",\n\nBytesNotIn\x12\x1e\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x08\xbaH\x05z\x03J\x01\x07",\n\x0bBytesMinLen\x12\x1d\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x07\xbaH\x04z\x02\x10\x02"-\n\x0bBytesPrefix\x12\x1e\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x08\xbaH\x05z\x03*\x01\n"(\n\x07BytesIp\x12\x1d\n\x05value\x18\x01 \x01(\x0cR\x05valueB\x07\xbaH\x04z\x02P\x01"2\n\x10RepeatedMinItems\x12\x1e\n\x05value\x18\x01 \x03(\x05R\x05valueB\x08\xbaH\x05\x92\x01\x02\x08\x02"2\n\x10RepeatedMaxItems\x12\x1e\n\x05value\x18\x01 \x03(\x05R\x05valueB\x08\xbaH\x05\x92\x01\x02\x10\x02"0\n\x0eRepeatedUnique\x12\x1e\n\x05value\x18\x01 \x03(\x05R\x05valueB\x08\xbaH\x05\x92\x01\x02\x18\x01";\n\x13RepeatedUniqueItems\x12$\n\x05value\x18\x01 \x03(\x05R\x05valueB\x0e\xbaH\x0b\x92\x01\x08\x18\x01"\x04\x1a\x02(\x02"@\n\x16RepeatedUniqueMaxItems\x12&\n\x05value\x18\x01 \x03(\x05R\x05valueB\x10\xbaH\r\x92\x01\n\x10\x03\x18\x01"\x04\x1a\x02(\x02"\x99\x01\n\x0bMapMaxPairs\x12N\n\x07entries\x18\x01 \x03(\x0b2*.tests.example.v1.MapMaxPairs.EntriesEntryR\x07entriesB\x08\xbaH\x05\x9a\x01\x02\x10\x02\x1a:\n\x0cEntriesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01"E\n\tEnumConst\x128\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\x08\xbaH\x05\x82\x01\x02\x08\x01"D\n\x06EnumIn\x12:\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\n\xbaH\x07\x82\x01\x04\x18\x01\x18\x02"E\n\tEnumNotIn\x128\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\x08\xbaH\x05\x82\x01\x02 \x00"Q\n\x11EnumDefinedOnlyIn\x12<\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\x0c\xbaH\t\x82\x01\x06\x10\x01\x18\x01\x18\x02"R\n\x14EnumDefinedOnlyConst\x12:\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\n\xbaH\x07\x82\x01\x04\x08\x01\x10\x01"R\n\x14EnumDefinedOnlyNotIn\x12:\n\x05value\x18\x01 \x01(\x0e2\x18.tests.example.v1.StatusR\x05valueB\n\xbaH\x07\x82\x01\x04\x10\x01 \x00*H\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x11\n\rSTATUS_ACTIVE\x10\x01\x12\x13\n\x0fSTATUS_INACTIVE\x10\x02B\x87\x01\n\x14com.tests.example.v1B\rEndToEndProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3', + [ + validate_pb.desc(), + ], + { + "Int32Gt": Int32Gt, + "Int32Const": Int32Const, + "Int32In": Int32In, + "Int32NotIn": Int32NotIn, + "Int32GtLt": Int32GtLt, + "Uint64Gte": Uint64Gte, + "DoubleLt": DoubleLt, + "StringMinLen": StringMinLen, + "StringMinBytes": StringMinBytes, + "StringPrefix": StringPrefix, + "StringSuffix": StringSuffix, + "StringContains": StringContains, + "StringNotContains": StringNotContains, + "StringConst": StringConst, + "StringIn": StringIn, + "StringNotIn": StringNotIn, + "StringPattern": StringPattern, + "StringEmail": StringEmail, + "StringUuid": StringUuid, + "StringHeaderName": StringHeaderName, + "BoolConst": BoolConst, + "BytesConst": BytesConst, + "BytesIn": BytesIn, + "BytesNotIn": BytesNotIn, + "BytesMinLen": BytesMinLen, + "BytesPrefix": BytesPrefix, + "BytesIp": BytesIp, + "RepeatedMinItems": RepeatedMinItems, + "RepeatedMaxItems": RepeatedMaxItems, + "RepeatedUnique": RepeatedUnique, + "RepeatedUniqueItems": RepeatedUniqueItems, + "RepeatedUniqueMaxItems": RepeatedUniqueMaxItems, + "MapMaxPairs": MapMaxPairs, + "EnumConst": EnumConst, + "EnumIn": EnumIn, + "EnumNotIn": EnumNotIn, + "EnumDefinedOnlyIn": EnumDefinedOnlyIn, + "EnumDefinedOnlyConst": EnumDefinedOnlyConst, + "EnumDefinedOnlyNotIn": EnumDefinedOnlyNotIn, + "Status": Status, + }, +) + + +def desc() -> DescFile: + """Returns the descriptor for the file `tests/example/v1/end_to_end.proto`.""" + return _DESC diff --git a/test/gen/tests/example/v1/end_to_end_pb2.py b/test/gen/tests/example/v1/end_to_end_pb2.py new file mode 100644 index 00000000..19e51db2 --- /dev/null +++ b/test/gen/tests/example/v1/end_to_end_pb2.py @@ -0,0 +1,202 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: tests/example/v1/end_to_end.proto +# Protobuf Python Version: 5.26.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from ....buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!tests/example/v1/end_to_end.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\"(\n\x07Int32Gt\x12\x1d\n\x05value\x18\x01 \x01(\x05\x42\x07\xbaH\x04\x1a\x02 \x00R\x05value\"+\n\nInt32Const\x12\x1d\n\x05value\x18\x01 \x01(\x05\x42\x07\xbaH\x04\x1a\x02\x08\x05R\x05value\",\n\x07Int32In\x12!\n\x05value\x18\x01 \x01(\x05\x42\x0b\xbaH\x08\x1a\x06\x30\x01\x30\x02\x30\x03R\x05value\"+\n\nInt32NotIn\x12\x1d\n\x05value\x18\x01 \x01(\x05\x42\x07\xbaH\x04\x1a\x02\x38\x07R\x05value\",\n\tInt32GtLt\x12\x1f\n\x05value\x18\x01 \x01(\x05\x42\t\xbaH\x06\x1a\x04\x10\n \x00R\x05value\"*\n\tUint64Gte\x12\x1d\n\x05value\x18\x01 \x01(\x04\x42\x07\xbaH\x04\x32\x02(\nR\x05value\"0\n\x08\x44oubleLt\x12$\n\x05value\x18\x01 \x01(\x01\x42\x0e\xbaH\x0b\x12\t\x11\x00\x00\x00\x00\x00\x00Y@R\x05value\"-\n\x0cStringMinLen\x12\x1d\n\x05value\x18\x01 \x01(\tB\x07\xbaH\x04r\x02\x10\x03R\x05value\"/\n\x0eStringMinBytes\x12\x1d\n\x05value\x18\x01 \x01(\tB\x07\xbaH\x04r\x02 \x05R\x05value\"2\n\x0cStringPrefix\x12\"\n\x05value\x18\x01 \x01(\tB\x0c\xbaH\tr\x07:\x05helloR\x05value\"0\n\x0cStringSuffix\x12 \n\x05value\x18\x01 \x01(\tB\n\xbaH\x07r\x05\x42\x03\x62\x61rR\x05value\"2\n\x0eStringContains\x12 \n\x05value\x18\x01 \x01(\tB\n\xbaH\x07r\x05J\x03midR\x05value\"6\n\x11StringNotContains\x12!\n\x05value\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xba\x01\x03\x62\x61\x64R\x05value\"-\n\x0bStringConst\x12\x1e\n\x05value\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\n\x01\x61R\x05value\"-\n\x08StringIn\x12!\n\x05value\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06R\x01\x61R\x01\x62R\x05value\"-\n\x0bStringNotIn\x12\x1e\n\x05value\x18\x01 \x01(\tB\x08\xbaH\x05r\x03Z\x01zR\x05value\"6\n\rStringPattern\x12%\n\x05value\x18\x01 \x01(\tB\x0f\xbaH\x0cr\n2\x08^[a-z]+$R\x05value\",\n\x0bStringEmail\x12\x1d\n\x05value\x18\x01 \x01(\tB\x07\xbaH\x04r\x02`\x01R\x05value\",\n\nStringUuid\x12\x1e\n\x05value\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x05value\"5\n\x10StringHeaderName\x12!\n\x05value\x18\x01 \x01(\tB\x0b\xbaH\x08r\x06\xc0\x01\x01\xc8\x01\x01R\x05value\"*\n\tBoolConst\x12\x1d\n\x05value\x18\x01 \x01(\x08\x42\x07\xbaH\x04j\x02\x08\x01R\x05value\",\n\nBytesConst\x12\x1e\n\x05value\x18\x01 \x01(\x0c\x42\x08\xbaH\x05z\x03\n\x01\x01R\x05value\",\n\x07\x42ytesIn\x12!\n\x05value\x18\x01 \x01(\x0c\x42\x0b\xbaH\x08z\x06\x42\x01\x01\x42\x01\x02R\x05value\",\n\nBytesNotIn\x12\x1e\n\x05value\x18\x01 \x01(\x0c\x42\x08\xbaH\x05z\x03J\x01\x07R\x05value\",\n\x0b\x42ytesMinLen\x12\x1d\n\x05value\x18\x01 \x01(\x0c\x42\x07\xbaH\x04z\x02\x10\x02R\x05value\"-\n\x0b\x42ytesPrefix\x12\x1e\n\x05value\x18\x01 \x01(\x0c\x42\x08\xbaH\x05z\x03*\x01\nR\x05value\"(\n\x07\x42ytesIp\x12\x1d\n\x05value\x18\x01 \x01(\x0c\x42\x07\xbaH\x04z\x02P\x01R\x05value\"2\n\x10RepeatedMinItems\x12\x1e\n\x05value\x18\x01 \x03(\x05\x42\x08\xbaH\x05\x92\x01\x02\x08\x02R\x05value\"2\n\x10RepeatedMaxItems\x12\x1e\n\x05value\x18\x01 \x03(\x05\x42\x08\xbaH\x05\x92\x01\x02\x10\x02R\x05value\"0\n\x0eRepeatedUnique\x12\x1e\n\x05value\x18\x01 \x03(\x05\x42\x08\xbaH\x05\x92\x01\x02\x18\x01R\x05value\";\n\x13RepeatedUniqueItems\x12$\n\x05value\x18\x01 \x03(\x05\x42\x0e\xbaH\x0b\x92\x01\x08\x18\x01\"\x04\x1a\x02(\x02R\x05value\"@\n\x16RepeatedUniqueMaxItems\x12&\n\x05value\x18\x01 \x03(\x05\x42\x10\xbaH\r\x92\x01\n\x10\x03\x18\x01\"\x04\x1a\x02(\x02R\x05value\"\x99\x01\n\x0bMapMaxPairs\x12N\n\x07\x65ntries\x18\x01 \x03(\x0b\x32*.tests.example.v1.MapMaxPairs.EntriesEntryB\x08\xbaH\x05\x9a\x01\x02\x10\x02R\x07\x65ntries\x1a:\n\x0c\x45ntriesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"E\n\tEnumConst\x12\x38\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\x08\xbaH\x05\x82\x01\x02\x08\x01R\x05value\"D\n\x06\x45numIn\x12:\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\n\xbaH\x07\x82\x01\x04\x18\x01\x18\x02R\x05value\"E\n\tEnumNotIn\x12\x38\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\x08\xbaH\x05\x82\x01\x02 \x00R\x05value\"Q\n\x11\x45numDefinedOnlyIn\x12<\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\x0c\xbaH\t\x82\x01\x06\x10\x01\x18\x01\x18\x02R\x05value\"R\n\x14\x45numDefinedOnlyConst\x12:\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\n\xbaH\x07\x82\x01\x04\x08\x01\x10\x01R\x05value\"R\n\x14\x45numDefinedOnlyNotIn\x12:\n\x05value\x18\x01 \x01(\x0e\x32\x18.tests.example.v1.StatusB\n\xbaH\x07\x82\x01\x04\x10\x01 \x00R\x05value*H\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x11\n\rSTATUS_ACTIVE\x10\x01\x12\x13\n\x0fSTATUS_INACTIVE\x10\x02\x42\x87\x01\n\x14\x63om.tests.example.v1B\rEndToEndProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tests.example.v1.end_to_end_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\024com.tests.example.v1B\rEndToEndProtoP\001\242\002\003TEX\252\002\020Tests.Example.V1\312\002\020Tests\\Example\\V1\342\002\034Tests\\Example\\V1\\GPBMetadata\352\002\022Tests::Example::V1' + _globals['_INT32GT'].fields_by_name['value']._loaded_options = None + _globals['_INT32GT'].fields_by_name['value']._serialized_options = b'\272H\004\032\002 \000' + _globals['_INT32CONST'].fields_by_name['value']._loaded_options = None + _globals['_INT32CONST'].fields_by_name['value']._serialized_options = b'\272H\004\032\002\010\005' + _globals['_INT32IN'].fields_by_name['value']._loaded_options = None + _globals['_INT32IN'].fields_by_name['value']._serialized_options = b'\272H\010\032\0060\0010\0020\003' + _globals['_INT32NOTIN'].fields_by_name['value']._loaded_options = None + _globals['_INT32NOTIN'].fields_by_name['value']._serialized_options = b'\272H\004\032\0028\007' + _globals['_INT32GTLT'].fields_by_name['value']._loaded_options = None + _globals['_INT32GTLT'].fields_by_name['value']._serialized_options = b'\272H\006\032\004\020\n \000' + _globals['_UINT64GTE'].fields_by_name['value']._loaded_options = None + _globals['_UINT64GTE'].fields_by_name['value']._serialized_options = b'\272H\0042\002(\n' + _globals['_DOUBLELT'].fields_by_name['value']._loaded_options = None + _globals['_DOUBLELT'].fields_by_name['value']._serialized_options = b'\272H\013\022\t\021\000\000\000\000\000\000Y@' + _globals['_STRINGMINLEN'].fields_by_name['value']._loaded_options = None + _globals['_STRINGMINLEN'].fields_by_name['value']._serialized_options = b'\272H\004r\002\020\003' + _globals['_STRINGMINBYTES'].fields_by_name['value']._loaded_options = None + _globals['_STRINGMINBYTES'].fields_by_name['value']._serialized_options = b'\272H\004r\002 \005' + _globals['_STRINGPREFIX'].fields_by_name['value']._loaded_options = None + _globals['_STRINGPREFIX'].fields_by_name['value']._serialized_options = b'\272H\tr\007:\005hello' + _globals['_STRINGSUFFIX'].fields_by_name['value']._loaded_options = None + _globals['_STRINGSUFFIX'].fields_by_name['value']._serialized_options = b'\272H\007r\005B\003bar' + _globals['_STRINGCONTAINS'].fields_by_name['value']._loaded_options = None + _globals['_STRINGCONTAINS'].fields_by_name['value']._serialized_options = b'\272H\007r\005J\003mid' + _globals['_STRINGNOTCONTAINS'].fields_by_name['value']._loaded_options = None + _globals['_STRINGNOTCONTAINS'].fields_by_name['value']._serialized_options = b'\272H\010r\006\272\001\003bad' + _globals['_STRINGCONST'].fields_by_name['value']._loaded_options = None + _globals['_STRINGCONST'].fields_by_name['value']._serialized_options = b'\272H\005r\003\n\001a' + _globals['_STRINGIN'].fields_by_name['value']._loaded_options = None + _globals['_STRINGIN'].fields_by_name['value']._serialized_options = b'\272H\010r\006R\001aR\001b' + _globals['_STRINGNOTIN'].fields_by_name['value']._loaded_options = None + _globals['_STRINGNOTIN'].fields_by_name['value']._serialized_options = b'\272H\005r\003Z\001z' + _globals['_STRINGPATTERN'].fields_by_name['value']._loaded_options = None + _globals['_STRINGPATTERN'].fields_by_name['value']._serialized_options = b'\272H\014r\n2\010^[a-z]+$' + _globals['_STRINGEMAIL'].fields_by_name['value']._loaded_options = None + _globals['_STRINGEMAIL'].fields_by_name['value']._serialized_options = b'\272H\004r\002`\001' + _globals['_STRINGUUID'].fields_by_name['value']._loaded_options = None + _globals['_STRINGUUID'].fields_by_name['value']._serialized_options = b'\272H\005r\003\260\001\001' + _globals['_STRINGHEADERNAME'].fields_by_name['value']._loaded_options = None + _globals['_STRINGHEADERNAME'].fields_by_name['value']._serialized_options = b'\272H\010r\006\300\001\001\310\001\001' + _globals['_BOOLCONST'].fields_by_name['value']._loaded_options = None + _globals['_BOOLCONST'].fields_by_name['value']._serialized_options = b'\272H\004j\002\010\001' + _globals['_BYTESCONST'].fields_by_name['value']._loaded_options = None + _globals['_BYTESCONST'].fields_by_name['value']._serialized_options = b'\272H\005z\003\n\001\001' + _globals['_BYTESIN'].fields_by_name['value']._loaded_options = None + _globals['_BYTESIN'].fields_by_name['value']._serialized_options = b'\272H\010z\006B\001\001B\001\002' + _globals['_BYTESNOTIN'].fields_by_name['value']._loaded_options = None + _globals['_BYTESNOTIN'].fields_by_name['value']._serialized_options = b'\272H\005z\003J\001\007' + _globals['_BYTESMINLEN'].fields_by_name['value']._loaded_options = None + _globals['_BYTESMINLEN'].fields_by_name['value']._serialized_options = b'\272H\004z\002\020\002' + _globals['_BYTESPREFIX'].fields_by_name['value']._loaded_options = None + _globals['_BYTESPREFIX'].fields_by_name['value']._serialized_options = b'\272H\005z\003*\001\n' + _globals['_BYTESIP'].fields_by_name['value']._loaded_options = None + _globals['_BYTESIP'].fields_by_name['value']._serialized_options = b'\272H\004z\002P\001' + _globals['_REPEATEDMINITEMS'].fields_by_name['value']._loaded_options = None + _globals['_REPEATEDMINITEMS'].fields_by_name['value']._serialized_options = b'\272H\005\222\001\002\010\002' + _globals['_REPEATEDMAXITEMS'].fields_by_name['value']._loaded_options = None + _globals['_REPEATEDMAXITEMS'].fields_by_name['value']._serialized_options = b'\272H\005\222\001\002\020\002' + _globals['_REPEATEDUNIQUE'].fields_by_name['value']._loaded_options = None + _globals['_REPEATEDUNIQUE'].fields_by_name['value']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_REPEATEDUNIQUEITEMS'].fields_by_name['value']._loaded_options = None + _globals['_REPEATEDUNIQUEITEMS'].fields_by_name['value']._serialized_options = b'\272H\013\222\001\010\030\001\"\004\032\002(\002' + _globals['_REPEATEDUNIQUEMAXITEMS'].fields_by_name['value']._loaded_options = None + _globals['_REPEATEDUNIQUEMAXITEMS'].fields_by_name['value']._serialized_options = b'\272H\r\222\001\n\020\003\030\001\"\004\032\002(\002' + _globals['_MAPMAXPAIRS_ENTRIESENTRY']._loaded_options = None + _globals['_MAPMAXPAIRS_ENTRIESENTRY']._serialized_options = b'8\001' + _globals['_MAPMAXPAIRS'].fields_by_name['entries']._loaded_options = None + _globals['_MAPMAXPAIRS'].fields_by_name['entries']._serialized_options = b'\272H\005\232\001\002\020\002' + _globals['_ENUMCONST'].fields_by_name['value']._loaded_options = None + _globals['_ENUMCONST'].fields_by_name['value']._serialized_options = b'\272H\005\202\001\002\010\001' + _globals['_ENUMIN'].fields_by_name['value']._loaded_options = None + _globals['_ENUMIN'].fields_by_name['value']._serialized_options = b'\272H\007\202\001\004\030\001\030\002' + _globals['_ENUMNOTIN'].fields_by_name['value']._loaded_options = None + _globals['_ENUMNOTIN'].fields_by_name['value']._serialized_options = b'\272H\005\202\001\002 \000' + _globals['_ENUMDEFINEDONLYIN'].fields_by_name['value']._loaded_options = None + _globals['_ENUMDEFINEDONLYIN'].fields_by_name['value']._serialized_options = b'\272H\t\202\001\006\020\001\030\001\030\002' + _globals['_ENUMDEFINEDONLYCONST'].fields_by_name['value']._loaded_options = None + _globals['_ENUMDEFINEDONLYCONST'].fields_by_name['value']._serialized_options = b'\272H\007\202\001\004\010\001\020\001' + _globals['_ENUMDEFINEDONLYNOTIN'].fields_by_name['value']._loaded_options = None + _globals['_ENUMDEFINEDONLYNOTIN'].fields_by_name['value']._serialized_options = b'\272H\007\202\001\004\020\001 \000' + _globals['_STATUS']._serialized_start=2269 + _globals['_STATUS']._serialized_end=2341 + _globals['_INT32GT']._serialized_start=84 + _globals['_INT32GT']._serialized_end=124 + _globals['_INT32CONST']._serialized_start=126 + _globals['_INT32CONST']._serialized_end=169 + _globals['_INT32IN']._serialized_start=171 + _globals['_INT32IN']._serialized_end=215 + _globals['_INT32NOTIN']._serialized_start=217 + _globals['_INT32NOTIN']._serialized_end=260 + _globals['_INT32GTLT']._serialized_start=262 + _globals['_INT32GTLT']._serialized_end=306 + _globals['_UINT64GTE']._serialized_start=308 + _globals['_UINT64GTE']._serialized_end=350 + _globals['_DOUBLELT']._serialized_start=352 + _globals['_DOUBLELT']._serialized_end=400 + _globals['_STRINGMINLEN']._serialized_start=402 + _globals['_STRINGMINLEN']._serialized_end=447 + _globals['_STRINGMINBYTES']._serialized_start=449 + _globals['_STRINGMINBYTES']._serialized_end=496 + _globals['_STRINGPREFIX']._serialized_start=498 + _globals['_STRINGPREFIX']._serialized_end=548 + _globals['_STRINGSUFFIX']._serialized_start=550 + _globals['_STRINGSUFFIX']._serialized_end=598 + _globals['_STRINGCONTAINS']._serialized_start=600 + _globals['_STRINGCONTAINS']._serialized_end=650 + _globals['_STRINGNOTCONTAINS']._serialized_start=652 + _globals['_STRINGNOTCONTAINS']._serialized_end=706 + _globals['_STRINGCONST']._serialized_start=708 + _globals['_STRINGCONST']._serialized_end=753 + _globals['_STRINGIN']._serialized_start=755 + _globals['_STRINGIN']._serialized_end=800 + _globals['_STRINGNOTIN']._serialized_start=802 + _globals['_STRINGNOTIN']._serialized_end=847 + _globals['_STRINGPATTERN']._serialized_start=849 + _globals['_STRINGPATTERN']._serialized_end=903 + _globals['_STRINGEMAIL']._serialized_start=905 + _globals['_STRINGEMAIL']._serialized_end=949 + _globals['_STRINGUUID']._serialized_start=951 + _globals['_STRINGUUID']._serialized_end=995 + _globals['_STRINGHEADERNAME']._serialized_start=997 + _globals['_STRINGHEADERNAME']._serialized_end=1050 + _globals['_BOOLCONST']._serialized_start=1052 + _globals['_BOOLCONST']._serialized_end=1094 + _globals['_BYTESCONST']._serialized_start=1096 + _globals['_BYTESCONST']._serialized_end=1140 + _globals['_BYTESIN']._serialized_start=1142 + _globals['_BYTESIN']._serialized_end=1186 + _globals['_BYTESNOTIN']._serialized_start=1188 + _globals['_BYTESNOTIN']._serialized_end=1232 + _globals['_BYTESMINLEN']._serialized_start=1234 + _globals['_BYTESMINLEN']._serialized_end=1278 + _globals['_BYTESPREFIX']._serialized_start=1280 + _globals['_BYTESPREFIX']._serialized_end=1325 + _globals['_BYTESIP']._serialized_start=1327 + _globals['_BYTESIP']._serialized_end=1367 + _globals['_REPEATEDMINITEMS']._serialized_start=1369 + _globals['_REPEATEDMINITEMS']._serialized_end=1419 + _globals['_REPEATEDMAXITEMS']._serialized_start=1421 + _globals['_REPEATEDMAXITEMS']._serialized_end=1471 + _globals['_REPEATEDUNIQUE']._serialized_start=1473 + _globals['_REPEATEDUNIQUE']._serialized_end=1521 + _globals['_REPEATEDUNIQUEITEMS']._serialized_start=1523 + _globals['_REPEATEDUNIQUEITEMS']._serialized_end=1582 + _globals['_REPEATEDUNIQUEMAXITEMS']._serialized_start=1584 + _globals['_REPEATEDUNIQUEMAXITEMS']._serialized_end=1648 + _globals['_MAPMAXPAIRS']._serialized_start=1651 + _globals['_MAPMAXPAIRS']._serialized_end=1804 + _globals['_MAPMAXPAIRS_ENTRIESENTRY']._serialized_start=1746 + _globals['_MAPMAXPAIRS_ENTRIESENTRY']._serialized_end=1804 + _globals['_ENUMCONST']._serialized_start=1806 + _globals['_ENUMCONST']._serialized_end=1875 + _globals['_ENUMIN']._serialized_start=1877 + _globals['_ENUMIN']._serialized_end=1945 + _globals['_ENUMNOTIN']._serialized_start=1947 + _globals['_ENUMNOTIN']._serialized_end=2016 + _globals['_ENUMDEFINEDONLYIN']._serialized_start=2018 + _globals['_ENUMDEFINEDONLYIN']._serialized_end=2099 + _globals['_ENUMDEFINEDONLYCONST']._serialized_start=2101 + _globals['_ENUMDEFINEDONLYCONST']._serialized_end=2183 + _globals['_ENUMDEFINEDONLYNOTIN']._serialized_start=2185 + _globals['_ENUMDEFINEDONLYNOTIN']._serialized_end=2267 +# @@protoc_insertion_point(module_scope) diff --git a/test/gen/tests/example/v1/end_to_end_pb2.pyi b/test/gen/tests/example/v1/end_to_end_pb2.pyi new file mode 100644 index 00000000..b2b18d56 --- /dev/null +++ b/test/gen/tests/example/v1/end_to_end_pb2.pyi @@ -0,0 +1,271 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from ....buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class Status(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + STATUS_UNSPECIFIED: _ClassVar[Status] + STATUS_ACTIVE: _ClassVar[Status] + STATUS_INACTIVE: _ClassVar[Status] +STATUS_UNSPECIFIED: Status +STATUS_ACTIVE: Status +STATUS_INACTIVE: Status + +class Int32Gt(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class Int32Const(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class Int32In(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class Int32NotIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class Int32GtLt(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class Uint64Gte(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: int + def __init__(self, value: _Optional[int] = ...) -> None: ... + +class DoubleLt(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: float + def __init__(self, value: _Optional[float] = ...) -> None: ... + +class StringMinLen(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringMinBytes(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringPrefix(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringSuffix(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringContains(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringNotContains(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringConst(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringNotIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringPattern(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringEmail(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringUuid(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class StringHeaderName(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: str + def __init__(self, value: _Optional[str] = ...) -> None: ... + +class BoolConst(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bool + def __init__(self, value: bool = ...) -> None: ... + +class BytesConst(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class BytesIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class BytesNotIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class BytesMinLen(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class BytesPrefix(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class BytesIp(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: bytes + def __init__(self, value: _Optional[bytes] = ...) -> None: ... + +class RepeatedMinItems(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, value: _Optional[_Iterable[int]] = ...) -> None: ... + +class RepeatedMaxItems(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, value: _Optional[_Iterable[int]] = ...) -> None: ... + +class RepeatedUnique(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, value: _Optional[_Iterable[int]] = ...) -> None: ... + +class RepeatedUniqueItems(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, value: _Optional[_Iterable[int]] = ...) -> None: ... + +class RepeatedUniqueMaxItems(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, value: _Optional[_Iterable[int]] = ...) -> None: ... + +class MapMaxPairs(_message.Message): + __slots__ = ("entries",) + class EntriesEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: str + def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ... + ENTRIES_FIELD_NUMBER: _ClassVar[int] + entries: _containers.ScalarMap[str, str] + def __init__(self, entries: _Optional[_Mapping[str, str]] = ...) -> None: ... + +class EnumConst(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... + +class EnumIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... + +class EnumNotIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... + +class EnumDefinedOnlyIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... + +class EnumDefinedOnlyConst(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... + +class EnumDefinedOnlyNotIn(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: Status + def __init__(self, value: _Optional[_Union[Status, str]] = ...) -> None: ... diff --git a/test/gen/tests/example/v1/predefined_pb.py b/test/gen/tests/example/v1/predefined_pb.py new file mode 100644 index 00000000..847eeeed --- /dev/null +++ b/test/gen/tests/example/v1/predefined_pb.py @@ -0,0 +1,167 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated from tests/example/v1/predefined.proto. DO NOT EDIT. +# Generated by protoc-gen-py v0.1.1 with parameter "". +# ruff: noqa: PGH004 +# ruff: noqa +# fmt: off + +from __future__ import annotations + +from typing import Final, Literal, TYPE_CHECKING, TypeAlias + +from protobuf import Extension, Message +from protobuf._codegen import file_desc +from protobuf.wkt import FieldMask, field_mask_pb + +from ....buf.validate import validate_pb +from ....buf.validate.validate_pb import BoolRules, FieldMaskRules, Int32Rules + +if TYPE_CHECKING: + from protobuf import DescFile + + +_Issue148Fields: TypeAlias = Literal["test"] + +class Issue148(Message[_Issue148Fields]): + """ + ```proto + message tests.example.v1.Issue148 + ``` + + Attributes: + test: + ```proto + optional int32 test = 1; + ``` + """ + + __slots__ = ("test",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + test: int | None = None, + ) -> None: + pass + + test: int + +_Issue187Fields: TypeAlias = Literal["false_field", "true_field"] + +class Issue187(Message[_Issue187Fields]): + """ + ```proto + message tests.example.v1.Issue187 + ``` + + Attributes: + false_field: + ```proto + optional bool false_field = 1; + ``` + true_field: + ```proto + optional bool true_field = 2; + ``` + """ + + __slots__ = ("false_field", "true_field") + + if TYPE_CHECKING: + + def __init__( + self, + *, + false_field: bool | None = None, + true_field: bool | None = None, + ) -> None: + pass + + false_field: bool + true_field: bool + +_Issue296Fields: TypeAlias = Literal["fm"] + +class Issue296(Message[_Issue296Fields]): + """ + ```proto + message tests.example.v1.Issue296 + ``` + + Attributes: + fm: + ```proto + optional google.protobuf.FieldMask fm = 1; + ``` + """ + + __slots__ = ("fm",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + fm: FieldMask | None = None, + ) -> None: + pass + + fm: FieldMask | None + +ext_abs_not_in: Final[Extension[Int32Rules, list[int]]] = Extension() +""" +```proto +extend buf.validate.Int32Rules { repeated int32 abs_not_in = 1800 [packed = false, json_name = "[tests.example.v1.abs_not_in]"] } +``` +""" + +ext_this_equals_rule: Final[Extension[BoolRules, bool]] = Extension() +""" +```proto +extend buf.validate.BoolRules { optional bool this_equals_rule = 1800 [json_name = "[tests.example.v1.this_equals_rule]"] } +``` +""" + +ext_fm_rules_extension: Final[Extension[FieldMaskRules, FieldMask]] = Extension() +""" +```proto +extend buf.validate.FieldMaskRules { optional google.protobuf.FieldMask fm_rules_extension = 1801 [json_name = "[tests.example.v1.fm_rules_extension]"] } +``` +""" + + +_DESC = file_desc( + b'\n!tests/example/v1/predefined.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto\x1a google/protobuf/field_mask.proto"4\n\x08Issue148\x12(\n\x04test\x18\x01 \x01(\x05R\x04testB\x14\xbaH\x11\x1a\x0f\xc0p\x01\xc0p\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01"^\n\x08Issue187\x12)\n\x0bfalse_field\x18\x01 \x01(\x08R\nfalseFieldB\x08\xbaH\x05j\x03\xc0p\x00\x12\'\n\ntrue_field\x18\x02 \x01(\x08R\ttrueFieldB\x08\xbaH\x05j\x03\xc0p\x01"D\n\x08Issue296\x128\n\x02fm\x18\x01 \x01(\x0b2\x1a.google.protobuf.FieldMaskR\x02fmB\x0c\xbaH\t\xe2\x01\x06\xcap\x03\n\x01a:\xa6\x01\n\nabs_not_in\x18\x88\x0e \x03(\x05\x12\x18.buf.validate.Int32RulesR\x08absNotInBm\xc2Hj\nh\n\x10int32.abs_not_in\x12+value must not be in absolute value of list\x1a\'this in rule || this in rule.map(n, -n):\xb1\x01\n\x10this_equals_rule\x18\x88\x0e \x01(\x08\x12\x17.buf.validate.BoolRulesR\x0ethisEqualsRuleBm\xc2Hj\nh\n\x15bool.this_equals_rule\x1aOthis == rule ? \'\' : \'this = %s, rule = %s\'.format([string(this), string(rule)]):\x9b\x01\n\x12fm_rules_extension\x18\x89\x0e \x01(\x0b2\x1a.google.protobuf.FieldMask\x12\x1c.buf.validate.FieldMaskRulesR\x10fmRulesExtensionB2\xc2H/\n-\n\x1dfield_mask.fm_rules_extension\x1a\x0cthis == ruleB\x89\x01\n\x14com.tests.example.v1B\x0fPredefinedProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1', + [ + validate_pb.desc(), + field_mask_pb.desc(), + ], + { + "Issue148": Issue148, + "Issue187": Issue187, + "Issue296": Issue296, + "abs_not_in": ext_abs_not_in, + "this_equals_rule": ext_this_equals_rule, + "fm_rules_extension": ext_fm_rules_extension, + }, +) + + +def desc() -> DescFile: + """Returns the descriptor for the file `tests/example/v1/predefined.proto`.""" + return _DESC diff --git a/test/gen/tests/example/v1/predefined_pb2.py b/test/gen/tests/example/v1/predefined_pb2.py new file mode 100644 index 00000000..4dc0cb86 --- /dev/null +++ b/test/gen/tests/example/v1/predefined_pb2.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: tests/example/v1/predefined.proto +# Protobuf Python Version: 5.26.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from ....buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!tests/example/v1/predefined.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\x1a google/protobuf/field_mask.proto\"4\n\x08Issue148\x12(\n\x04test\x18\x01 \x01(\x05\x42\x14\xbaH\x11\x1a\x0f\xc0p\x01\xc0p\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01R\x04test\"^\n\x08Issue187\x12)\n\x0b\x66\x61lse_field\x18\x01 \x01(\x08\x42\x08\xbaH\x05j\x03\xc0p\x00R\nfalseField\x12\'\n\ntrue_field\x18\x02 \x01(\x08\x42\x08\xbaH\x05j\x03\xc0p\x01R\ttrueField\"D\n\x08Issue296\x12\x38\n\x02\x66m\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x0c\xbaH\t\xe2\x01\x06\xcap\x03\n\x01\x61R\x02\x66m:\xa6\x01\n\nabs_not_in\x12\x18.buf.validate.Int32Rules\x18\x88\x0e \x03(\x05\x42m\xc2Hj\nh\n\x10int32.abs_not_in\x12+value must not be in absolute value of list\x1a\'this in rule || this in rule.map(n, -n)R\x08\x61\x62sNotIn:\xb1\x01\n\x10this_equals_rule\x12\x17.buf.validate.BoolRules\x18\x88\x0e \x01(\x08\x42m\xc2Hj\nh\n\x15\x62ool.this_equals_rule\x1aOthis == rule ? \'\' : \'this = %s, rule = %s\'.format([string(this), string(rule)])R\x0ethisEqualsRule:\x9b\x01\n\x12\x66m_rules_extension\x12\x1c.buf.validate.FieldMaskRules\x18\x89\x0e \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB2\xc2H/\n-\n\x1d\x66ield_mask.fm_rules_extension\x1a\x0cthis == ruleR\x10\x66mRulesExtensionB\x89\x01\n\x14\x63om.tests.example.v1B\x0fPredefinedProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tests.example.v1.predefined_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\024com.tests.example.v1B\017PredefinedProtoP\001\242\002\003TEX\252\002\020Tests.Example.V1\312\002\020Tests\\Example\\V1\342\002\034Tests\\Example\\V1\\GPBMetadata\352\002\022Tests::Example::V1' + _globals['abs_not_in']._loaded_options = None + _globals['abs_not_in']._serialized_options = b'\302Hj\nh\n\020int32.abs_not_in\022+value must not be in absolute value of list\032\'this in rule || this in rule.map(n, -n)' + _globals['this_equals_rule']._loaded_options = None + _globals['this_equals_rule']._serialized_options = b'\302Hj\nh\n\025bool.this_equals_rule\032Othis == rule ? \'\' : \'this = %s, rule = %s\'.format([string(this), string(rule)])' + _globals['fm_rules_extension']._loaded_options = None + _globals['fm_rules_extension']._serialized_options = b'\302H/\n-\n\035field_mask.fm_rules_extension\032\014this == rule' + _globals['_ISSUE148'].fields_by_name['test']._loaded_options = None + _globals['_ISSUE148'].fields_by_name['test']._serialized_options = b'\272H\021\032\017\300p\001\300p\376\377\377\377\377\377\377\377\377\001' + _globals['_ISSUE187'].fields_by_name['false_field']._loaded_options = None + _globals['_ISSUE187'].fields_by_name['false_field']._serialized_options = b'\272H\005j\003\300p\000' + _globals['_ISSUE187'].fields_by_name['true_field']._loaded_options = None + _globals['_ISSUE187'].fields_by_name['true_field']._serialized_options = b'\272H\005j\003\300p\001' + _globals['_ISSUE296'].fields_by_name['fm']._loaded_options = None + _globals['_ISSUE296'].fields_by_name['fm']._serialized_options = b'\272H\t\342\001\006\312p\003\n\001a' + _globals['_ISSUE148']._serialized_start=118 + _globals['_ISSUE148']._serialized_end=170 + _globals['_ISSUE187']._serialized_start=172 + _globals['_ISSUE187']._serialized_end=266 + _globals['_ISSUE296']._serialized_start=268 + _globals['_ISSUE296']._serialized_end=336 +# @@protoc_insertion_point(module_scope) diff --git a/test/gen/tests/example/v1/predefined_pb2.pyi b/test/gen/tests/example/v1/predefined_pb2.pyi new file mode 100644 index 00000000..7acbb499 --- /dev/null +++ b/test/gen/tests/example/v1/predefined_pb2.pyi @@ -0,0 +1,46 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from ....buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor +ABS_NOT_IN_FIELD_NUMBER: _ClassVar[int] +abs_not_in: _descriptor.FieldDescriptor +THIS_EQUALS_RULE_FIELD_NUMBER: _ClassVar[int] +this_equals_rule: _descriptor.FieldDescriptor +FM_RULES_EXTENSION_FIELD_NUMBER: _ClassVar[int] +fm_rules_extension: _descriptor.FieldDescriptor + +class Issue148(_message.Message): + __slots__ = ("test",) + TEST_FIELD_NUMBER: _ClassVar[int] + test: int + def __init__(self, test: _Optional[int] = ...) -> None: ... + +class Issue187(_message.Message): + __slots__ = ("false_field", "true_field") + FALSE_FIELD_FIELD_NUMBER: _ClassVar[int] + TRUE_FIELD_FIELD_NUMBER: _ClassVar[int] + false_field: bool + true_field: bool + def __init__(self, false_field: bool = ..., true_field: bool = ...) -> None: ... + +class Issue296(_message.Message): + __slots__ = ("fm",) + FM_FIELD_NUMBER: _ClassVar[int] + fm: _field_mask_pb2.FieldMask + def __init__(self, fm: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... diff --git a/test/gen/tests/example/v1/rules_pb.py b/test/gen/tests/example/v1/rules_pb.py new file mode 100644 index 00000000..7f027bec --- /dev/null +++ b/test/gen/tests/example/v1/rules_pb.py @@ -0,0 +1,212 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated from tests/example/v1/rules.proto. DO NOT EDIT. +# Generated by protoc-gen-py v0.1.1 with parameter "". +# ruff: noqa: PGH004 +# ruff: noqa +# fmt: off + +from __future__ import annotations + +from typing import Literal, TYPE_CHECKING, TypeAlias + +from protobuf import Enum, Message +from protobuf._codegen import file_desc + +from ....buf.validate import validate_pb + +if TYPE_CHECKING: + from protobuf import DescFile + + +_BenchTestBytesFields: TypeAlias = Literal["b1", "b"] + +class BenchTestBytes(Message[_BenchTestBytesFields]): + """ + ```proto + message tests.example.v1.BenchTestBytes + ``` + + Attributes: + b1: + ```proto + bytes b1 = 1; + ``` + b: + ```proto + bytes b = 4; + ``` + """ + + __slots__ = ("b1", "b") + + if TYPE_CHECKING: + + def __init__( + self, + *, + b1: bytes = b"", + b: bytes = b"", + ) -> None: + pass + + b1: bytes + b: bytes + +_TestUniqueFields: TypeAlias = Literal["enums", "bytes", "strings"] + +class TestUnique(Message[_TestUniqueFields]): + """ + ```proto + message tests.example.v1.TestUnique + ``` + + Attributes: + enums: + ```proto + repeated tests.example.v1.TestEnum enums = 1 [packed = true]; + ``` + bytes: + ```proto + repeated bytes bytes = 2; + ``` + strings: + ```proto + repeated string strings = 3; + ``` + """ + + __slots__ = ("enums", "bytes", "strings") + + if TYPE_CHECKING: + + def __init__( + self, + *, + enums: list[TestEnum] | None = None, + bytes: list[bytes] | None = None, + strings: list[str] | None = None, + ) -> None: + pass + + enums: list[TestEnum] + bytes: list[bytes] + strings: list[str] + +_TestByteBrokenFields: TypeAlias = Literal["broken"] + +class TestByteBroken(Message[_TestByteBrokenFields]): + """ + ```proto + message tests.example.v1.TestByteBroken + ``` + + Attributes: + broken: + ```proto + bytes broken = 1; + ``` + """ + + __slots__ = ("broken",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + broken: bytes = b"", + ) -> None: + pass + + broken: bytes + +_MultiRuleFields: TypeAlias = Literal["many"] + +class MultiRule(Message[_MultiRuleFields]): + """ + ```proto + message tests.example.v1.MultiRule + ``` + + Attributes: + many: + ```proto + int64 many = 1; + ``` + """ + + __slots__ = ("many",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + many: int = 0, + ) -> None: + pass + + many: int + +class TestEnum(Enum): + """ + ```proto + enum tests.example.v1.TestEnum + ``` + + Attributes: + UNSPECIFIED: + ```proto + TEST_ENUM_UNSPECIFIED = 0 + ``` + VAL1: + ```proto + TEST_ENUM_VAL1 = 1 + ``` + VAL2: + ```proto + TEST_ENUM_VAL2 = 2 + ``` + VAL3: + ```proto + TEST_ENUM_VAL3 = 3 + ``` + """ + + UNSPECIFIED = 0 + VAL1 = 1 + VAL2 = 2 + VAL3 = 3 + + +_DESC = file_desc( + b'\n\x1ctests/example/v1/rules.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto"\\\n\x0eBenchTestBytes\x12%\n\x02b1\x18\x01 \x01(\x0cR\x02b1B\x15\xbaH\x12z\x10\x10\x01\x18\x04J\x0223J\x0245J\x0267\x12#\n\x01b\x18\x04 \x01(\x0cR\x01bB\x15\xbaH\x12z\x10\x10\x02\x18\x02B\x0223B\x0245B\x0267"\x8c\x01\n\nTestUnique\x12:\n\x05enums\x18\x01 \x03(\x0e2\x1a.tests.example.v1.TestEnumR\x05enumsB\x08\xbaH\x05\x92\x01\x02\x18\x01\x12\x1e\n\x05bytes\x18\x02 \x03(\x0cR\x05bytesB\x08\xbaH\x05\x92\x01\x02\x18\x01\x12"\n\x07strings\x18\x03 \x03(\tR\x07stringsB\x08\xbaH\x05\x92\x01\x02\x18\x01"5\n\x0eTestByteBroken\x12#\n\x06broken\x18\x01 \x01(\x0cR\x06brokenB\x0b\xbaH\x08z\x06\x10\x05\x18\nx\x01"*\n\tMultiRule\x12\x1d\n\x04many\x18\x01 \x01(\x03R\x04manyB\t\xbaH\x06"\x04\x08\n \x05*a\n\x08TestEnum\x12\x19\n\x15TEST_ENUM_UNSPECIFIED\x10\x00\x12\x12\n\x0eTEST_ENUM_VAL1\x10\x01\x12\x12\n\x0eTEST_ENUM_VAL2\x10\x02\x12\x12\n\x0eTEST_ENUM_VAL3\x10\x03B\x84\x01\n\x14com.tests.example.v1B\nRulesProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3', + [ + validate_pb.desc(), + ], + { + "BenchTestBytes": BenchTestBytes, + "TestUnique": TestUnique, + "TestByteBroken": TestByteBroken, + "MultiRule": MultiRule, + "TestEnum": TestEnum, + }, +) + + +def desc() -> DescFile: + """Returns the descriptor for the file `tests/example/v1/rules.proto`.""" + return _DESC diff --git a/test/gen/tests/example/v1/rules_pb2.py b/test/gen/tests/example/v1/rules_pb2.py new file mode 100644 index 00000000..ac8bd6d1 --- /dev/null +++ b/test/gen/tests/example/v1/rules_pb2.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: tests/example/v1/rules.proto +# Protobuf Python Version: 5.26.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from ....buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1ctests/example/v1/rules.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\"\\\n\x0e\x42\x65nchTestBytes\x12%\n\x02\x62\x31\x18\x01 \x01(\x0c\x42\x15\xbaH\x12z\x10\x10\x01\x18\x04J\x02\x32\x33J\x02\x34\x35J\x02\x36\x37R\x02\x62\x31\x12#\n\x01\x62\x18\x04 \x01(\x0c\x42\x15\xbaH\x12z\x10\x10\x02\x18\x02\x42\x02\x32\x33\x42\x02\x34\x35\x42\x02\x36\x37R\x01\x62\"\x8c\x01\n\nTestUnique\x12:\n\x05\x65nums\x18\x01 \x03(\x0e\x32\x1a.tests.example.v1.TestEnumB\x08\xbaH\x05\x92\x01\x02\x18\x01R\x05\x65nums\x12\x1e\n\x05\x62ytes\x18\x02 \x03(\x0c\x42\x08\xbaH\x05\x92\x01\x02\x18\x01R\x05\x62ytes\x12\"\n\x07strings\x18\x03 \x03(\tB\x08\xbaH\x05\x92\x01\x02\x18\x01R\x07strings\"5\n\x0eTestByteBroken\x12#\n\x06\x62roken\x18\x01 \x01(\x0c\x42\x0b\xbaH\x08z\x06\x10\x05\x18\nx\x01R\x06\x62roken\"*\n\tMultiRule\x12\x1d\n\x04many\x18\x01 \x01(\x03\x42\t\xbaH\x06\"\x04\x08\n \x05R\x04many*a\n\x08TestEnum\x12\x19\n\x15TEST_ENUM_UNSPECIFIED\x10\x00\x12\x12\n\x0eTEST_ENUM_VAL1\x10\x01\x12\x12\n\x0eTEST_ENUM_VAL2\x10\x02\x12\x12\n\x0eTEST_ENUM_VAL3\x10\x03\x42\x84\x01\n\x14\x63om.tests.example.v1B\nRulesProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tests.example.v1.rules_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\024com.tests.example.v1B\nRulesProtoP\001\242\002\003TEX\252\002\020Tests.Example.V1\312\002\020Tests\\Example\\V1\342\002\034Tests\\Example\\V1\\GPBMetadata\352\002\022Tests::Example::V1' + _globals['_BENCHTESTBYTES'].fields_by_name['b1']._loaded_options = None + _globals['_BENCHTESTBYTES'].fields_by_name['b1']._serialized_options = b'\272H\022z\020\020\001\030\004J\00223J\00245J\00267' + _globals['_BENCHTESTBYTES'].fields_by_name['b']._loaded_options = None + _globals['_BENCHTESTBYTES'].fields_by_name['b']._serialized_options = b'\272H\022z\020\020\002\030\002B\00223B\00245B\00267' + _globals['_TESTUNIQUE'].fields_by_name['enums']._loaded_options = None + _globals['_TESTUNIQUE'].fields_by_name['enums']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_TESTUNIQUE'].fields_by_name['bytes']._loaded_options = None + _globals['_TESTUNIQUE'].fields_by_name['bytes']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_TESTUNIQUE'].fields_by_name['strings']._loaded_options = None + _globals['_TESTUNIQUE'].fields_by_name['strings']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_TESTBYTEBROKEN'].fields_by_name['broken']._loaded_options = None + _globals['_TESTBYTEBROKEN'].fields_by_name['broken']._serialized_options = b'\272H\010z\006\020\005\030\nx\001' + _globals['_MULTIRULE'].fields_by_name['many']._loaded_options = None + _globals['_MULTIRULE'].fields_by_name['many']._serialized_options = b'\272H\006\"\004\010\n \005' + _globals['_TESTENUM']._serialized_start=415 + _globals['_TESTENUM']._serialized_end=512 + _globals['_BENCHTESTBYTES']._serialized_start=79 + _globals['_BENCHTESTBYTES']._serialized_end=171 + _globals['_TESTUNIQUE']._serialized_start=174 + _globals['_TESTUNIQUE']._serialized_end=314 + _globals['_TESTBYTEBROKEN']._serialized_start=316 + _globals['_TESTBYTEBROKEN']._serialized_end=369 + _globals['_MULTIRULE']._serialized_start=371 + _globals['_MULTIRULE']._serialized_end=413 +# @@protoc_insertion_point(module_scope) diff --git a/test/gen/tests/example/v1/rules_pb2.pyi b/test/gen/tests/example/v1/rules_pb2.pyi new file mode 100644 index 00000000..8de07354 --- /dev/null +++ b/test/gen/tests/example/v1/rules_pb2.pyi @@ -0,0 +1,62 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from ....buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class TestEnum(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + TEST_ENUM_UNSPECIFIED: _ClassVar[TestEnum] + TEST_ENUM_VAL1: _ClassVar[TestEnum] + TEST_ENUM_VAL2: _ClassVar[TestEnum] + TEST_ENUM_VAL3: _ClassVar[TestEnum] +TEST_ENUM_UNSPECIFIED: TestEnum +TEST_ENUM_VAL1: TestEnum +TEST_ENUM_VAL2: TestEnum +TEST_ENUM_VAL3: TestEnum + +class BenchTestBytes(_message.Message): + __slots__ = ("b1", "b") + B1_FIELD_NUMBER: _ClassVar[int] + B_FIELD_NUMBER: _ClassVar[int] + b1: bytes + b: bytes + def __init__(self, b1: _Optional[bytes] = ..., b: _Optional[bytes] = ...) -> None: ... + +class TestUnique(_message.Message): + __slots__ = ("enums", "bytes", "strings") + ENUMS_FIELD_NUMBER: _ClassVar[int] + BYTES_FIELD_NUMBER: _ClassVar[int] + STRINGS_FIELD_NUMBER: _ClassVar[int] + enums: _containers.RepeatedScalarFieldContainer[TestEnum] + bytes: _containers.RepeatedScalarFieldContainer[bytes] + strings: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, enums: _Optional[_Iterable[_Union[TestEnum, str]]] = ..., bytes: _Optional[_Iterable[bytes]] = ..., strings: _Optional[_Iterable[str]] = ...) -> None: ... + +class TestByteBroken(_message.Message): + __slots__ = ("broken",) + BROKEN_FIELD_NUMBER: _ClassVar[int] + broken: bytes + def __init__(self, broken: _Optional[bytes] = ...) -> None: ... + +class MultiRule(_message.Message): + __slots__ = ("many",) + MANY_FIELD_NUMBER: _ClassVar[int] + many: int + def __init__(self, many: _Optional[int] = ...) -> None: ... diff --git a/test/gen/tests/example/v1/validations_pb.py b/test/gen/tests/example/v1/validations_pb.py index 70ff417d..a84fc0d5 100644 --- a/test/gen/tests/example/v1/validations_pb.py +++ b/test/gen/tests/example/v1/validations_pb.py @@ -20,17 +20,20 @@ from __future__ import annotations -from typing import Literal, TYPE_CHECKING, TypeAlias +from typing import Literal, NoReturn, TYPE_CHECKING, TypeAlias from protobuf import Message from protobuf._codegen import file_desc -from protobuf.wkt import timestamp_pb +from protobuf.wkt import duration_pb, timestamp_pb, wrappers_pb +from . import rules_pb from ....buf.validate import validate_pb if TYPE_CHECKING: from protobuf import DescFile, Oneof as Oneof_ - from protobuf.wkt import Timestamp + from protobuf.wkt import Duration, Int32Value, Timestamp + + from .rules_pb import TestEnum _MultipleValidationsFields: TypeAlias = Literal["title", "name"] @@ -531,12 +534,644 @@ def __init__( bar: list[str] baz: list[str] +_NestedMistypedRuleFields: TypeAlias = Literal["child"] + +class NestedMistypedRule(Message[_NestedMistypedRuleFields]): + """ + A rule that does not compile is reported when a validation reaches it. + + ```proto + message tests.example.v1.NestedMistypedRule + ``` + + Attributes: + child: + ```proto + optional tests.example.v1.ProtovalidateMistypedRule child = 1; + ``` + """ + + __slots__ = ("child",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + child: ProtovalidateMistypedRule | None = None, + ) -> None: + pass + + child: ProtovalidateMistypedRule | None + +_MessageRuleErrorFields: TypeAlias = NoReturn + +class MessageRuleError(Message[_MessageRuleErrorFields]): + """ + ```proto + message tests.example.v1.MessageRuleError + ``` + """ + + __slots__ = () + + if TYPE_CHECKING: + + def __init__( + self, + ) -> None: + pass + +_NestedMessageRuleErrorFields: TypeAlias = Literal["child"] + +class NestedMessageRuleError(Message[_NestedMessageRuleErrorFields]): + """ + ```proto + message tests.example.v1.NestedMessageRuleError + ``` + + Attributes: + child: + ```proto + optional tests.example.v1.MessageRuleError child = 1; + ``` + """ + + __slots__ = ("child",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + child: MessageRuleError | None = None, + ) -> None: + pass + + child: MessageRuleError | None + +_ViolationBeforeErrorFields: TypeAlias = Literal["a", "b"] + +class ViolationBeforeError(Message[_ViolationBeforeErrorFields]): + """ + ```proto + message tests.example.v1.ViolationBeforeError + ``` + + Attributes: + a: + ```proto + string a = 1; + ``` + b: + ```proto + string b = 2; + ``` + """ + + __slots__ = ("a", "b") + + if TYPE_CHECKING: + + def __init__( + self, + *, + a: str = "", + b: str = "", + ) -> None: + pass + + a: str + b: str + +_RepeatedFieldScalarRuleFields: TypeAlias = Literal["val"] + +class RepeatedFieldScalarRule(Message[_RepeatedFieldScalarRuleFields]): + """ + A repeated or map field takes only `repeated` or `map` rules; rules for + its elements' type do not compile. + + ```proto + message tests.example.v1.RepeatedFieldScalarRule + ``` + + Attributes: + val: + ```proto + repeated string val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[str] | None = None, + ) -> None: + pass + + val: list[str] + +_RepeatedFieldWrapperRuleFields: TypeAlias = Literal["val"] + +class RepeatedFieldWrapperRule(Message[_RepeatedFieldWrapperRuleFields]): + """ + ```proto + message tests.example.v1.RepeatedFieldWrapperRule + ``` + + Attributes: + val: + ```proto + repeated google.protobuf.Int32Value val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Int32Value] | None = None, + ) -> None: + pass + + val: list[Int32Value] + +_RepeatedFieldEnumRuleFields: TypeAlias = Literal["val"] + +class RepeatedFieldEnumRule(Message[_RepeatedFieldEnumRuleFields]): + """ + ```proto + message tests.example.v1.RepeatedFieldEnumRule + ``` + + Attributes: + val: + ```proto + repeated tests.example.v1.TestEnum val = 1 [packed = true]; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[TestEnum] | None = None, + ) -> None: + pass + + val: list[TestEnum] + +_RepeatedFieldDurationRuleFields: TypeAlias = Literal["val"] + +class RepeatedFieldDurationRule(Message[_RepeatedFieldDurationRuleFields]): + """ + ```proto + message tests.example.v1.RepeatedFieldDurationRule + ``` + + Attributes: + val: + ```proto + repeated google.protobuf.Duration val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Duration] | None = None, + ) -> None: + pass + + val: list[Duration] + +_MapFieldScalarRuleFields: TypeAlias = Literal["val"] + +class MapFieldScalarRule(Message[_MapFieldScalarRuleFields]): + """ + ```proto + message tests.example.v1.MapFieldScalarRule + ``` + + Attributes: + val: + ```proto + map val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: dict[str, str] | None = None, + ) -> None: + pass + + val: dict[str, str] + +_RepeatedUniqueMessagesFields: TypeAlias = Literal["val"] + +class RepeatedUniqueMessages(Message[_RepeatedUniqueMessagesFields]): + """ + `unique` compares scalars only, so it does not compile for messages. + + ```proto + message tests.example.v1.RepeatedUniqueMessages + ``` + + Attributes: + val: + ```proto + repeated tests.example.v1.Embed val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Embed] | None = None, + ) -> None: + pass + + val: list[Embed] + +_CelUniqueMessagesFields: TypeAlias = Literal["val"] + +class CelUniqueMessages(Message[_CelUniqueMessagesFields]): + """ + In CEL the same call cannot be rejected until it runs. + + ```proto + message tests.example.v1.CelUniqueMessages + ``` + + Attributes: + val: + ```proto + repeated tests.example.v1.Embed val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Embed] | None = None, + ) -> None: + pass + + val: list[Embed] + +_TimestampOutOfRangeFields: TypeAlias = Literal["val"] + +class TimestampOutOfRange(Message[_TimestampOutOfRangeFields]): + """ + 10000-01-01T00:00:00Z, past the range a Timestamp allows. + + ```proto + message tests.example.v1.TimestampOutOfRange + ``` + + Attributes: + val: + ```proto + optional google.protobuf.Timestamp val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: Timestamp | None = None, + ) -> None: + pass + + val: Timestamp | None + +_TimestampRuleOrderFields: TypeAlias = Literal["val"] + +class TimestampRuleOrder(Message[_TimestampRuleOrderFields]): + """ + ```proto + message tests.example.v1.TimestampRuleOrder + ``` + + Attributes: + val: + ```proto + optional google.protobuf.Timestamp val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: Timestamp | None = None, + ) -> None: + pass + + val: Timestamp | None + +_EnumRuleOrderFields: TypeAlias = Literal["val"] + +class EnumRuleOrder(Message[_EnumRuleOrderFields]): + """ + ```proto + message tests.example.v1.EnumRuleOrder + ``` + + Attributes: + val: + ```proto + tests.example.v1.TestEnum val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: TestEnum | None = None, + ) -> None: + pass + + val: TestEnum + +_HostnameFields: TypeAlias = Literal["val"] + +class Hostname(Message[_HostnameFields]): + """ + ```proto + message tests.example.v1.Hostname + ``` + + Attributes: + val: + ```proto + string val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: str = "", + ) -> None: + pass + + val: str + +_DoubleInfinityFields: TypeAlias = Literal["val"] + +class DoubleInfinity(Message[_DoubleInfinityFields]): + """ + ```proto + message tests.example.v1.DoubleInfinity + ``` + + Attributes: + val: + ```proto + double val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: float = 0, + ) -> None: + pass + + val: float + +_DoubleInfiniteRangeFields: TypeAlias = Literal["val"] + +class DoubleInfiniteRange(Message[_DoubleInfiniteRangeFields]): + """ + ```proto + message tests.example.v1.DoubleInfiniteRange + ``` + + Attributes: + val: + ```proto + double val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: float = 0, + ) -> None: + pass + + val: float + +_PatternAsciiDigitsFields: TypeAlias = Literal["val"] + +class PatternAsciiDigits(Message[_PatternAsciiDigitsFields]): + """ + Patterns are RE2: `\\d` is ASCII only, `\\Q...\\E` quotes literal text, + and repeat counts are capped at 1000. + + ```proto + message tests.example.v1.PatternAsciiDigits + ``` + + Attributes: + val: + ```proto + string val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: str = "", + ) -> None: + pass + + val: str + +_PatternQuotedLiteralFields: TypeAlias = Literal["val"] + +class PatternQuotedLiteral(Message[_PatternQuotedLiteralFields]): + """ + ```proto + message tests.example.v1.PatternQuotedLiteral + ``` + + Attributes: + val: + ```proto + string val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: str = "", + ) -> None: + pass + + val: str + +_PatternRepeatTooLargeFields: TypeAlias = Literal["val"] + +class PatternRepeatTooLarge(Message[_PatternRepeatTooLargeFields]): + """ + ```proto + message tests.example.v1.PatternRepeatTooLarge + ``` + + Attributes: + val: + ```proto + string val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: str = "", + ) -> None: + pass + + val: str + +_UniqueWrappersFields: TypeAlias = Literal["val"] + +class UniqueWrappers(Message[_UniqueWrappersFields]): + """ + A wrapper element stands for the scalar it holds, so `unique` compares + the inner values. + + ```proto + message tests.example.v1.UniqueWrappers + ``` + + Attributes: + val: + ```proto + repeated google.protobuf.Int32Value val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Int32Value] | None = None, + ) -> None: + pass + + val: list[Int32Value] + +_CelUniqueWrappersFields: TypeAlias = Literal["val"] + +class CelUniqueWrappers(Message[_CelUniqueWrappersFields]): + """ + ```proto + message tests.example.v1.CelUniqueWrappers + ``` + + Attributes: + val: + ```proto + repeated google.protobuf.Int32Value val = 1; + ``` + """ + + __slots__ = ("val",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + val: list[Int32Value] | None = None, + ) -> None: + pass + + val: list[Int32Value] + _DESC = file_desc( - b'\n"tests/example/v1/validations.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto"T\n\x13MultipleValidations\x12 \n\x05title\x18\x01 \x01(\tR\x05titleB\n\xbaH\x07r\x05:\x03foo\x12\x1b\n\x04name\x18\x02 \x01(\tR\x04nameB\x07\xbaH\x04r\x02\x10\x05")\n\x0cDoubleFinite\x12\x19\n\x03val\x18\x01 \x01(\x01R\x03valB\x07\xbaH\x04\x12\x02@\x01";\n\x0eSFixed64ExLTGT\x12)\n\x03val\x18\x01 \x01(\x10R\x03valB\x17\xbaH\x14b\x12\x11\x00\x00\x00\x00\x00\x00\x00\x00!\n\x00\x00\x00\x00\x00\x00\x00")\n\x0cTestOneofMsg\x12\x19\n\x03val\x18\x01 \x01(\x08R\x03valB\x07\xbaH\x04j\x02\x08\x01"q\n\x05Oneof\x12\x1a\n\x01x\x18\x01 \x01(\tH\x00R\x01xB\n\xbaH\x07r\x05:\x03foo\x12\x17\n\x01y\x18\x02 \x01(\x05H\x00R\x01yB\x07\xbaH\x04\x1a\x02 \x00\x12.\n\x01z\x18\x03 \x01(\x0b2\x1e.tests.example.v1.TestOneofMsgH\x00R\x01zB\x03\n\x01o"[\n\x12ProtovalidateOneof\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x0b\xbaH\x08"\x06\n\x01a\n\x01b"e\n\x1aProtovalidateOneofRequired\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\r\xbaH\n"\x08\n\x01a\n\x01b\x10\x01"p\n"ProtovalidateOneofUnknownFieldName\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x10\xbaH\r"\x0b\n\x01a\n\x01b\n\x03xxx"9\n\x19ProtovalidateMistypedRule\x12\x1c\n\x03val\x18\x01 \x01(\tR\x03valB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01"H\n\x0eTimestampGTNow\x126\n\x03val\x18\x01 \x01(\x0b2\x1a.google.protobuf.TimestampR\x03valB\x08\xbaH\x05\xb2\x01\x02@\x01"\x87\x01\n\tMapMinMax\x12B\n\x03val\x18\x01 \x03(\x0b2$.tests.example.v1.MapMinMax.ValEntryR\x03valB\n\xbaH\x07\x9a\x01\x04\x08\x02\x10\x04\x1a6\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\x08R\x05value:\x028\x01"\x85\x01\n\x07MapKeys\x12B\n\x03val\x18\x01 \x03(\x0b2".tests.example.v1.MapKeys.ValEntryR\x03valB\x0c\xbaH\t\x9a\x01\x06"\x04B\x02\x10\x00\x1a6\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\x12R\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01""\n\x05Embed\x12\x19\n\x03val\x18\x01 \x01(\x03R\x03valB\x07\xbaH\x04"\x02 \x00"K\n\x11RepeatedEmbedSkip\x126\n\x03val\x18\x01 \x03(\x0b2\x17.tests.example.v1.EmbedR\x03valB\x0b\xbaH\x08\x92\x01\x05"\x03\xd8\x01\x03"3\n\x0fInvalidRESyntax\x12 \n\x05value\x18\x01 \x01(\tR\x05valueB\n\xbaH\x07r\x052\x03^\\z"\xa9\x01\n\x12ConcatenatedValues\x12\x10\n\x03bar\x18\x01 \x03(\tR\x03bar\x12\x10\n\x03baz\x18\x02 \x03(\tR\x03baz:o\xbaHl\x1aj\n\x15globally_unique_names\x121all values in bar and baz must be globally unique\x1a\x1e(this.bar + this.baz).unique()B\x8a\x01\n\x14com.tests.example.v1B\x10ValidationsProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3', + b'\n"tests/example/v1/validations.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1ctests/example/v1/rules.proto"T\n\x13MultipleValidations\x12 \n\x05title\x18\x01 \x01(\tR\x05titleB\n\xbaH\x07r\x05:\x03foo\x12\x1b\n\x04name\x18\x02 \x01(\tR\x04nameB\x07\xbaH\x04r\x02\x10\x05")\n\x0cDoubleFinite\x12\x19\n\x03val\x18\x01 \x01(\x01R\x03valB\x07\xbaH\x04\x12\x02@\x01";\n\x0eSFixed64ExLTGT\x12)\n\x03val\x18\x01 \x01(\x10R\x03valB\x17\xbaH\x14b\x12\x11\x00\x00\x00\x00\x00\x00\x00\x00!\n\x00\x00\x00\x00\x00\x00\x00")\n\x0cTestOneofMsg\x12\x19\n\x03val\x18\x01 \x01(\x08R\x03valB\x07\xbaH\x04j\x02\x08\x01"q\n\x05Oneof\x12\x1a\n\x01x\x18\x01 \x01(\tH\x00R\x01xB\n\xbaH\x07r\x05:\x03foo\x12\x17\n\x01y\x18\x02 \x01(\x05H\x00R\x01yB\x07\xbaH\x04\x1a\x02 \x00\x12.\n\x01z\x18\x03 \x01(\x0b2\x1e.tests.example.v1.TestOneofMsgH\x00R\x01zB\x03\n\x01o"[\n\x12ProtovalidateOneof\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x0b\xbaH\x08"\x06\n\x01a\n\x01b"e\n\x1aProtovalidateOneofRequired\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\r\xbaH\n"\x08\n\x01a\n\x01b\x10\x01"p\n"ProtovalidateOneofUnknownFieldName\x12\x0c\n\x01a\x18\x01 \x01(\tR\x01a\x12\x0c\n\x01b\x18\x02 \x01(\tR\x01b\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x10\xbaH\r"\x0b\n\x01a\n\x01b\n\x03xxx"9\n\x19ProtovalidateMistypedRule\x12\x1c\n\x03val\x18\x01 \x01(\tR\x03valB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01"H\n\x0eTimestampGTNow\x126\n\x03val\x18\x01 \x01(\x0b2\x1a.google.protobuf.TimestampR\x03valB\x08\xbaH\x05\xb2\x01\x02@\x01"\x87\x01\n\tMapMinMax\x12B\n\x03val\x18\x01 \x03(\x0b2$.tests.example.v1.MapMinMax.ValEntryR\x03valB\n\xbaH\x07\x9a\x01\x04\x08\x02\x10\x04\x1a6\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\x08R\x05value:\x028\x01"\x85\x01\n\x07MapKeys\x12B\n\x03val\x18\x01 \x03(\x0b2".tests.example.v1.MapKeys.ValEntryR\x03valB\x0c\xbaH\t\x9a\x01\x06"\x04B\x02\x10\x00\x1a6\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\x12R\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01""\n\x05Embed\x12\x19\n\x03val\x18\x01 \x01(\x03R\x03valB\x07\xbaH\x04"\x02 \x00"K\n\x11RepeatedEmbedSkip\x126\n\x03val\x18\x01 \x03(\x0b2\x17.tests.example.v1.EmbedR\x03valB\x0b\xbaH\x08\x92\x01\x05"\x03\xd8\x01\x03"3\n\x0fInvalidRESyntax\x12 \n\x05value\x18\x01 \x01(\tR\x05valueB\n\xbaH\x07r\x052\x03^\\z"\xa9\x01\n\x12ConcatenatedValues\x12\x10\n\x03bar\x18\x01 \x03(\tR\x03bar\x12\x10\n\x03baz\x18\x02 \x03(\tR\x03baz:o\xbaHl\x1aj\n\x15globally_unique_names\x121all values in bar and baz must be globally unique\x1a\x1e(this.bar + this.baz).unique()"W\n\x12NestedMistypedRule\x12A\n\x05child\x18\x01 \x01(\x0b2+.tests.example.v1.ProtovalidateMistypedRuleR\x05child"2\n\x10MessageRuleError:\x1e\xbaH\x1b\x1a\x19\n\x12message_rule_error\x1a\x031 +"R\n\x16NestedMessageRuleError\x128\n\x05child\x18\x01 \x01(\x0b2".tests.example.v1.MessageRuleErrorR\x05child"G\n\x14ViolationBeforeError\x12\x15\n\x01a\x18\x01 \x01(\tR\x01aB\x07\xbaH\x04r\x02\x10\x05\x12\x18\n\x01b\x18\x02 \x01(\tR\x01bB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01"4\n\x17RepeatedFieldScalarRule\x12\x19\n\x03val\x18\x01 \x03(\tR\x03valB\x07\xbaH\x04r\x02\x10\x03"R\n\x18RepeatedFieldWrapperRule\x126\n\x03val\x18\x01 \x03(\x0b2\x1b.google.protobuf.Int32ValueR\x03valB\x07\xbaH\x04\x1a\x02 \n"O\n\x15RepeatedFieldEnumRule\x126\n\x03val\x18\x01 \x03(\x0e2\x1a.tests.example.v1.TestEnumR\x03valB\x08\xbaH\x05\x82\x01\x02\x10\x01"T\n\x19RepeatedFieldDurationRule\x127\n\x03val\x18\x01 \x03(\x0b2\x19.google.protobuf.DurationR\x03valB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01"\x96\x01\n\x12MapFieldScalarRule\x12H\n\x03val\x18\x01 \x03(\x0b2-.tests.example.v1.MapFieldScalarRule.ValEntryR\x03valB\x07\xbaH\x04r\x02\x10\x03\x1a6\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01"M\n\x16RepeatedUniqueMessages\x123\n\x03val\x18\x01 \x03(\x0b2\x17.tests.example.v1.EmbedR\x03valB\x08\xbaH\x05\x92\x01\x02\x18\x01"v\n\x11CelUniqueMessages\x12a\n\x03val\x18\x01 \x03(\x0b2\x17.tests.example.v1.EmbedR\x03valB6\xbaH3\xba\x010\n\x0funique_messages\x12\x0emust be unique\x1a\rthis.unique()"T\n\x13TimestampOutOfRange\x12=\n\x03val\x18\x01 \x01(\x0b2\x1a.google.protobuf.TimestampR\x03valB\x0f\xbaH\x0c\xb2\x01\t\x12\x07\x08\x80\x83\xd1\xff\xaf\x07"P\n\x12TimestampRuleOrder\x12:\n\x03val\x18\x01 \x01(\x0b2\x1a.google.protobuf.TimestampR\x03valB\x0c\xbaH\t\xb2\x01\x06\x12\x02\x08\x018\x01"M\n\rEnumRuleOrder\x12<\n\x03val\x18\x01 \x01(\x0e2\x1a.tests.example.v1.TestEnumR\x03valB\x0e\xbaH\x0b\x82\x01\x08\x08\x01\x10\x01\x18\x01 \x05"%\n\x08Hostname\x12\x19\n\x03val\x18\x01 \x01(\tR\x03valB\x07\xbaH\x04r\x02h\x01"2\n\x0eDoubleInfinity\x12 \n\x03val\x18\x01 \x01(\x01R\x03valB\x0e\xbaH\x0b\x12\t\t\x00\x00\x00\x00\x00\x00\xf0\x7f"@\n\x13DoubleInfiniteRange\x12)\n\x03val\x18\x01 \x01(\x01R\x03valB\x17\xbaH\x14\x12\x12\x11\x00\x00\x00\x00\x00\x00\xf0\x7f!\x00\x00\x00\x00\x00\x00\xf0\xff"4\n\x12PatternAsciiDigits\x12\x1e\n\x03val\x18\x01 \x01(\tR\x03valB\x0c\xbaH\tr\x072\x05^\\d+$":\n\x14PatternQuotedLiteral\x12"\n\x03val\x18\x01 \x01(\tR\x03valB\x10\xbaH\rr\x0b2\t^\\Qa.c\\E$"9\n\x15PatternRepeatTooLarge\x12 \n\x03val\x18\x01 \x01(\tR\x03valB\x0e\xbaH\x0br\t2\x07a{1001}"I\n\x0eUniqueWrappers\x127\n\x03val\x18\x01 \x03(\x0b2\x1b.google.protobuf.Int32ValueR\x03valB\x08\xbaH\x05\x92\x01\x02\x18\x01"z\n\x11CelUniqueWrappers\x12e\n\x03val\x18\x01 \x03(\x0b2\x1b.google.protobuf.Int32ValueR\x03valB6\xbaH3\xba\x010\n\x0funique_wrappers\x12\x0emust be unique\x1a\rthis.unique()B\x8a\x01\n\x14com.tests.example.v1B\x10ValidationsProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3', [ validate_pb.desc(), + duration_pb.desc(), timestamp_pb.desc(), + wrappers_pb.desc(), + rules_pb.desc(), ], { "MultipleValidations": MultipleValidations, @@ -555,6 +1190,28 @@ def __init__( "RepeatedEmbedSkip": RepeatedEmbedSkip, "InvalidRESyntax": InvalidRESyntax, "ConcatenatedValues": ConcatenatedValues, + "NestedMistypedRule": NestedMistypedRule, + "MessageRuleError": MessageRuleError, + "NestedMessageRuleError": NestedMessageRuleError, + "ViolationBeforeError": ViolationBeforeError, + "RepeatedFieldScalarRule": RepeatedFieldScalarRule, + "RepeatedFieldWrapperRule": RepeatedFieldWrapperRule, + "RepeatedFieldEnumRule": RepeatedFieldEnumRule, + "RepeatedFieldDurationRule": RepeatedFieldDurationRule, + "MapFieldScalarRule": MapFieldScalarRule, + "RepeatedUniqueMessages": RepeatedUniqueMessages, + "CelUniqueMessages": CelUniqueMessages, + "TimestampOutOfRange": TimestampOutOfRange, + "TimestampRuleOrder": TimestampRuleOrder, + "EnumRuleOrder": EnumRuleOrder, + "Hostname": Hostname, + "DoubleInfinity": DoubleInfinity, + "DoubleInfiniteRange": DoubleInfiniteRange, + "PatternAsciiDigits": PatternAsciiDigits, + "PatternQuotedLiteral": PatternQuotedLiteral, + "PatternRepeatTooLarge": PatternRepeatTooLarge, + "UniqueWrappers": UniqueWrappers, + "CelUniqueWrappers": CelUniqueWrappers, }, ) diff --git a/test/gen/tests/example/v1/validations_pb2.py b/test/gen/tests/example/v1/validations_pb2.py index a8405f4d..e02b65b4 100644 --- a/test/gen/tests/example/v1/validations_pb2.py +++ b/test/gen/tests/example/v1/validations_pb2.py @@ -27,10 +27,13 @@ from ....buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 +from ....tests.example.v1 import rules_pb2 as tests_dot_example_dot_v1_dot_rules__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"tests/example/v1/validations.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"T\n\x13MultipleValidations\x12 \n\x05title\x18\x01 \x01(\tB\n\xbaH\x07r\x05:\x03\x66ooR\x05title\x12\x1b\n\x04name\x18\x02 \x01(\tB\x07\xbaH\x04r\x02\x10\x05R\x04name\")\n\x0c\x44oubleFinite\x12\x19\n\x03val\x18\x01 \x01(\x01\x42\x07\xbaH\x04\x12\x02@\x01R\x03val\";\n\x0eSFixed64ExLTGT\x12)\n\x03val\x18\x01 \x01(\x10\x42\x17\xbaH\x14\x62\x12\x11\x00\x00\x00\x00\x00\x00\x00\x00!\n\x00\x00\x00\x00\x00\x00\x00R\x03val\")\n\x0cTestOneofMsg\x12\x19\n\x03val\x18\x01 \x01(\x08\x42\x07\xbaH\x04j\x02\x08\x01R\x03val\"q\n\x05Oneof\x12\x1a\n\x01x\x18\x01 \x01(\tB\n\xbaH\x07r\x05:\x03\x66ooH\x00R\x01x\x12\x17\n\x01y\x18\x02 \x01(\x05\x42\x07\xbaH\x04\x1a\x02 \x00H\x00R\x01y\x12.\n\x01z\x18\x03 \x01(\x0b\x32\x1e.tests.example.v1.TestOneofMsgH\x00R\x01zB\x03\n\x01o\"[\n\x12ProtovalidateOneof\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x0b\xbaH\x08\"\x06\n\x01\x61\n\x01\x62\"e\n\x1aProtovalidateOneofRequired\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\r\xbaH\n\"\x08\n\x01\x61\n\x01\x62\x10\x01\"p\n\"ProtovalidateOneofUnknownFieldName\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x10\xbaH\r\"\x0b\n\x01\x61\n\x01\x62\n\x03xxx\"9\n\x19ProtovalidateMistypedRule\x12\x1c\n\x03val\x18\x01 \x01(\tB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01R\x03val\"H\n\x0eTimestampGTNow\x12\x36\n\x03val\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x08\xbaH\x05\xb2\x01\x02@\x01R\x03val\"\x87\x01\n\tMapMinMax\x12\x42\n\x03val\x18\x01 \x03(\x0b\x32$.tests.example.v1.MapMinMax.ValEntryB\n\xbaH\x07\x9a\x01\x04\x08\x02\x10\x04R\x03val\x1a\x36\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\x08R\x05value:\x02\x38\x01\"\x85\x01\n\x07MapKeys\x12\x42\n\x03val\x18\x01 \x03(\x0b\x32\".tests.example.v1.MapKeys.ValEntryB\x0c\xbaH\t\x9a\x01\x06\"\x04\x42\x02\x10\x00R\x03val\x1a\x36\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\x12R\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\"\n\x05\x45mbed\x12\x19\n\x03val\x18\x01 \x01(\x03\x42\x07\xbaH\x04\"\x02 \x00R\x03val\"K\n\x11RepeatedEmbedSkip\x12\x36\n\x03val\x18\x01 \x03(\x0b\x32\x17.tests.example.v1.EmbedB\x0b\xbaH\x08\x92\x01\x05\"\x03\xd8\x01\x03R\x03val\"3\n\x0fInvalidRESyntax\x12 \n\x05value\x18\x01 \x01(\tB\n\xbaH\x07r\x05\x32\x03^\\zR\x05value\"\xa9\x01\n\x12\x43oncatenatedValues\x12\x10\n\x03\x62\x61r\x18\x01 \x03(\tR\x03\x62\x61r\x12\x10\n\x03\x62\x61z\x18\x02 \x03(\tR\x03\x62\x61z:o\xbaHl\x1aj\n\x15globally_unique_names\x12\x31\x61ll values in bar and baz must be globally unique\x1a\x1e(this.bar + this.baz).unique()B\x8a\x01\n\x14\x63om.tests.example.v1B\x10ValidationsProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"tests/example/v1/validations.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x1ctests/example/v1/rules.proto\"T\n\x13MultipleValidations\x12 \n\x05title\x18\x01 \x01(\tB\n\xbaH\x07r\x05:\x03\x66ooR\x05title\x12\x1b\n\x04name\x18\x02 \x01(\tB\x07\xbaH\x04r\x02\x10\x05R\x04name\")\n\x0c\x44oubleFinite\x12\x19\n\x03val\x18\x01 \x01(\x01\x42\x07\xbaH\x04\x12\x02@\x01R\x03val\";\n\x0eSFixed64ExLTGT\x12)\n\x03val\x18\x01 \x01(\x10\x42\x17\xbaH\x14\x62\x12\x11\x00\x00\x00\x00\x00\x00\x00\x00!\n\x00\x00\x00\x00\x00\x00\x00R\x03val\")\n\x0cTestOneofMsg\x12\x19\n\x03val\x18\x01 \x01(\x08\x42\x07\xbaH\x04j\x02\x08\x01R\x03val\"q\n\x05Oneof\x12\x1a\n\x01x\x18\x01 \x01(\tB\n\xbaH\x07r\x05:\x03\x66ooH\x00R\x01x\x12\x17\n\x01y\x18\x02 \x01(\x05\x42\x07\xbaH\x04\x1a\x02 \x00H\x00R\x01y\x12.\n\x01z\x18\x03 \x01(\x0b\x32\x1e.tests.example.v1.TestOneofMsgH\x00R\x01zB\x03\n\x01o\"[\n\x12ProtovalidateOneof\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x0b\xbaH\x08\"\x06\n\x01\x61\n\x01\x62\"e\n\x1aProtovalidateOneofRequired\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\r\xbaH\n\"\x08\n\x01\x61\n\x01\x62\x10\x01\"p\n\"ProtovalidateOneofUnknownFieldName\x12\x0c\n\x01\x61\x18\x01 \x01(\tR\x01\x61\x12\x0c\n\x01\x62\x18\x02 \x01(\tR\x01\x62\x12\x1c\n\tunrelated\x18\x03 \x01(\x08R\tunrelated:\x10\xbaH\r\"\x0b\n\x01\x61\n\x01\x62\n\x03xxx\"9\n\x19ProtovalidateMistypedRule\x12\x1c\n\x03val\x18\x01 \x01(\tB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01R\x03val\"H\n\x0eTimestampGTNow\x12\x36\n\x03val\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x08\xbaH\x05\xb2\x01\x02@\x01R\x03val\"\x87\x01\n\tMapMinMax\x12\x42\n\x03val\x18\x01 \x03(\x0b\x32$.tests.example.v1.MapMinMax.ValEntryB\n\xbaH\x07\x9a\x01\x04\x08\x02\x10\x04R\x03val\x1a\x36\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\x08R\x05value:\x02\x38\x01\"\x85\x01\n\x07MapKeys\x12\x42\n\x03val\x18\x01 \x03(\x0b\x32\".tests.example.v1.MapKeys.ValEntryB\x0c\xbaH\t\x9a\x01\x06\"\x04\x42\x02\x10\x00R\x03val\x1a\x36\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\x12R\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"\"\n\x05\x45mbed\x12\x19\n\x03val\x18\x01 \x01(\x03\x42\x07\xbaH\x04\"\x02 \x00R\x03val\"K\n\x11RepeatedEmbedSkip\x12\x36\n\x03val\x18\x01 \x03(\x0b\x32\x17.tests.example.v1.EmbedB\x0b\xbaH\x08\x92\x01\x05\"\x03\xd8\x01\x03R\x03val\"3\n\x0fInvalidRESyntax\x12 \n\x05value\x18\x01 \x01(\tB\n\xbaH\x07r\x05\x32\x03^\\zR\x05value\"\xa9\x01\n\x12\x43oncatenatedValues\x12\x10\n\x03\x62\x61r\x18\x01 \x03(\tR\x03\x62\x61r\x12\x10\n\x03\x62\x61z\x18\x02 \x03(\tR\x03\x62\x61z:o\xbaHl\x1aj\n\x15globally_unique_names\x12\x31\x61ll values in bar and baz must be globally unique\x1a\x1e(this.bar + this.baz).unique()\"W\n\x12NestedMistypedRule\x12\x41\n\x05\x63hild\x18\x01 \x01(\x0b\x32+.tests.example.v1.ProtovalidateMistypedRuleR\x05\x63hild\"2\n\x10MessageRuleError:\x1e\xbaH\x1b\x1a\x19\n\x12message_rule_error\x1a\x03\x31 +\"R\n\x16NestedMessageRuleError\x12\x38\n\x05\x63hild\x18\x01 \x01(\x0b\x32\".tests.example.v1.MessageRuleErrorR\x05\x63hild\"G\n\x14ViolationBeforeError\x12\x15\n\x01\x61\x18\x01 \x01(\tB\x07\xbaH\x04r\x02\x10\x05R\x01\x61\x12\x18\n\x01\x62\x18\x02 \x01(\tB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01R\x01\x62\"4\n\x17RepeatedFieldScalarRule\x12\x19\n\x03val\x18\x01 \x03(\tB\x07\xbaH\x04r\x02\x10\x03R\x03val\"R\n\x18RepeatedFieldWrapperRule\x12\x36\n\x03val\x18\x01 \x03(\x0b\x32\x1b.google.protobuf.Int32ValueB\x07\xbaH\x04\x1a\x02 \nR\x03val\"O\n\x15RepeatedFieldEnumRule\x12\x36\n\x03val\x18\x01 \x03(\x0e\x32\x1a.tests.example.v1.TestEnumB\x08\xbaH\x05\x82\x01\x02\x10\x01R\x03val\"T\n\x19RepeatedFieldDurationRule\x12\x37\n\x03val\x18\x01 \x03(\x0b\x32\x19.google.protobuf.DurationB\n\xbaH\x07\xaa\x01\x04*\x02\x08\x01R\x03val\"\x96\x01\n\x12MapFieldScalarRule\x12H\n\x03val\x18\x01 \x03(\x0b\x32-.tests.example.v1.MapFieldScalarRule.ValEntryB\x07\xbaH\x04r\x02\x10\x03R\x03val\x1a\x36\n\x08ValEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\"M\n\x16RepeatedUniqueMessages\x12\x33\n\x03val\x18\x01 \x03(\x0b\x32\x17.tests.example.v1.EmbedB\x08\xbaH\x05\x92\x01\x02\x18\x01R\x03val\"v\n\x11\x43\x65lUniqueMessages\x12\x61\n\x03val\x18\x01 \x03(\x0b\x32\x17.tests.example.v1.EmbedB6\xbaH3\xba\x01\x30\n\x0funique_messages\x12\x0emust be unique\x1a\rthis.unique()R\x03val\"T\n\x13TimestampOutOfRange\x12=\n\x03val\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x0f\xbaH\x0c\xb2\x01\t\x12\x07\x08\x80\x83\xd1\xff\xaf\x07R\x03val\"P\n\x12TimestampRuleOrder\x12:\n\x03val\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x0c\xbaH\t\xb2\x01\x06\x12\x02\x08\x01\x38\x01R\x03val\"M\n\rEnumRuleOrder\x12<\n\x03val\x18\x01 \x01(\x0e\x32\x1a.tests.example.v1.TestEnumB\x0e\xbaH\x0b\x82\x01\x08\x08\x01\x10\x01\x18\x01 \x05R\x03val\"%\n\x08Hostname\x12\x19\n\x03val\x18\x01 \x01(\tB\x07\xbaH\x04r\x02h\x01R\x03val\"2\n\x0e\x44oubleInfinity\x12 \n\x03val\x18\x01 \x01(\x01\x42\x0e\xbaH\x0b\x12\t\t\x00\x00\x00\x00\x00\x00\xf0\x7fR\x03val\"@\n\x13\x44oubleInfiniteRange\x12)\n\x03val\x18\x01 \x01(\x01\x42\x17\xbaH\x14\x12\x12\x11\x00\x00\x00\x00\x00\x00\xf0\x7f!\x00\x00\x00\x00\x00\x00\xf0\xffR\x03val\"4\n\x12PatternAsciiDigits\x12\x1e\n\x03val\x18\x01 \x01(\tB\x0c\xbaH\tr\x07\x32\x05^\\d+$R\x03val\":\n\x14PatternQuotedLiteral\x12\"\n\x03val\x18\x01 \x01(\tB\x10\xbaH\rr\x0b\x32\t^\\Qa.c\\E$R\x03val\"9\n\x15PatternRepeatTooLarge\x12 \n\x03val\x18\x01 \x01(\tB\x0e\xbaH\x0br\t2\x07\x61{1001}R\x03val\"I\n\x0eUniqueWrappers\x12\x37\n\x03val\x18\x01 \x03(\x0b\x32\x1b.google.protobuf.Int32ValueB\x08\xbaH\x05\x92\x01\x02\x18\x01R\x03val\"z\n\x11\x43\x65lUniqueWrappers\x12\x65\n\x03val\x18\x01 \x03(\x0b\x32\x1b.google.protobuf.Int32ValueB6\xbaH3\xba\x01\x30\n\x0funique_wrappers\x12\x0emust be unique\x1a\rthis.unique()R\x03valB\x8a\x01\n\x14\x63om.tests.example.v1B\x10ValidationsProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -78,40 +81,130 @@ _globals['_INVALIDRESYNTAX'].fields_by_name['value']._serialized_options = b'\272H\007r\0052\003^\\z' _globals['_CONCATENATEDVALUES']._loaded_options = None _globals['_CONCATENATEDVALUES']._serialized_options = b'\272Hl\032j\n\025globally_unique_names\0221all values in bar and baz must be globally unique\032\036(this.bar + this.baz).unique()' - _globals['_MULTIPLEVALIDATIONS']._serialized_start=118 - _globals['_MULTIPLEVALIDATIONS']._serialized_end=202 - _globals['_DOUBLEFINITE']._serialized_start=204 - _globals['_DOUBLEFINITE']._serialized_end=245 - _globals['_SFIXED64EXLTGT']._serialized_start=247 - _globals['_SFIXED64EXLTGT']._serialized_end=306 - _globals['_TESTONEOFMSG']._serialized_start=308 - _globals['_TESTONEOFMSG']._serialized_end=349 - _globals['_ONEOF']._serialized_start=351 - _globals['_ONEOF']._serialized_end=464 - _globals['_PROTOVALIDATEONEOF']._serialized_start=466 - _globals['_PROTOVALIDATEONEOF']._serialized_end=557 - _globals['_PROTOVALIDATEONEOFREQUIRED']._serialized_start=559 - _globals['_PROTOVALIDATEONEOFREQUIRED']._serialized_end=660 - _globals['_PROTOVALIDATEONEOFUNKNOWNFIELDNAME']._serialized_start=662 - _globals['_PROTOVALIDATEONEOFUNKNOWNFIELDNAME']._serialized_end=774 - _globals['_PROTOVALIDATEMISTYPEDRULE']._serialized_start=776 - _globals['_PROTOVALIDATEMISTYPEDRULE']._serialized_end=833 - _globals['_TIMESTAMPGTNOW']._serialized_start=835 - _globals['_TIMESTAMPGTNOW']._serialized_end=907 - _globals['_MAPMINMAX']._serialized_start=910 - _globals['_MAPMINMAX']._serialized_end=1045 - _globals['_MAPMINMAX_VALENTRY']._serialized_start=991 - _globals['_MAPMINMAX_VALENTRY']._serialized_end=1045 - _globals['_MAPKEYS']._serialized_start=1048 - _globals['_MAPKEYS']._serialized_end=1181 - _globals['_MAPKEYS_VALENTRY']._serialized_start=1127 - _globals['_MAPKEYS_VALENTRY']._serialized_end=1181 - _globals['_EMBED']._serialized_start=1183 - _globals['_EMBED']._serialized_end=1217 - _globals['_REPEATEDEMBEDSKIP']._serialized_start=1219 - _globals['_REPEATEDEMBEDSKIP']._serialized_end=1294 - _globals['_INVALIDRESYNTAX']._serialized_start=1296 - _globals['_INVALIDRESYNTAX']._serialized_end=1347 - _globals['_CONCATENATEDVALUES']._serialized_start=1350 - _globals['_CONCATENATEDVALUES']._serialized_end=1519 + _globals['_MESSAGERULEERROR']._loaded_options = None + _globals['_MESSAGERULEERROR']._serialized_options = b'\272H\033\032\031\n\022message_rule_error\032\0031 +' + _globals['_VIOLATIONBEFOREERROR'].fields_by_name['a']._loaded_options = None + _globals['_VIOLATIONBEFOREERROR'].fields_by_name['a']._serialized_options = b'\272H\004r\002\020\005' + _globals['_VIOLATIONBEFOREERROR'].fields_by_name['b']._loaded_options = None + _globals['_VIOLATIONBEFOREERROR'].fields_by_name['b']._serialized_options = b'\272H\007\252\001\004*\002\010\001' + _globals['_REPEATEDFIELDSCALARRULE'].fields_by_name['val']._loaded_options = None + _globals['_REPEATEDFIELDSCALARRULE'].fields_by_name['val']._serialized_options = b'\272H\004r\002\020\003' + _globals['_REPEATEDFIELDWRAPPERRULE'].fields_by_name['val']._loaded_options = None + _globals['_REPEATEDFIELDWRAPPERRULE'].fields_by_name['val']._serialized_options = b'\272H\004\032\002 \n' + _globals['_REPEATEDFIELDENUMRULE'].fields_by_name['val']._loaded_options = None + _globals['_REPEATEDFIELDENUMRULE'].fields_by_name['val']._serialized_options = b'\272H\005\202\001\002\020\001' + _globals['_REPEATEDFIELDDURATIONRULE'].fields_by_name['val']._loaded_options = None + _globals['_REPEATEDFIELDDURATIONRULE'].fields_by_name['val']._serialized_options = b'\272H\007\252\001\004*\002\010\001' + _globals['_MAPFIELDSCALARRULE_VALENTRY']._loaded_options = None + _globals['_MAPFIELDSCALARRULE_VALENTRY']._serialized_options = b'8\001' + _globals['_MAPFIELDSCALARRULE'].fields_by_name['val']._loaded_options = None + _globals['_MAPFIELDSCALARRULE'].fields_by_name['val']._serialized_options = b'\272H\004r\002\020\003' + _globals['_REPEATEDUNIQUEMESSAGES'].fields_by_name['val']._loaded_options = None + _globals['_REPEATEDUNIQUEMESSAGES'].fields_by_name['val']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_CELUNIQUEMESSAGES'].fields_by_name['val']._loaded_options = None + _globals['_CELUNIQUEMESSAGES'].fields_by_name['val']._serialized_options = b'\272H3\272\0010\n\017unique_messages\022\016must be unique\032\rthis.unique()' + _globals['_TIMESTAMPOUTOFRANGE'].fields_by_name['val']._loaded_options = None + _globals['_TIMESTAMPOUTOFRANGE'].fields_by_name['val']._serialized_options = b'\272H\014\262\001\t\022\007\010\200\203\321\377\257\007' + _globals['_TIMESTAMPRULEORDER'].fields_by_name['val']._loaded_options = None + _globals['_TIMESTAMPRULEORDER'].fields_by_name['val']._serialized_options = b'\272H\t\262\001\006\022\002\010\0018\001' + _globals['_ENUMRULEORDER'].fields_by_name['val']._loaded_options = None + _globals['_ENUMRULEORDER'].fields_by_name['val']._serialized_options = b'\272H\013\202\001\010\010\001\020\001\030\001 \005' + _globals['_HOSTNAME'].fields_by_name['val']._loaded_options = None + _globals['_HOSTNAME'].fields_by_name['val']._serialized_options = b'\272H\004r\002h\001' + _globals['_DOUBLEINFINITY'].fields_by_name['val']._loaded_options = None + _globals['_DOUBLEINFINITY'].fields_by_name['val']._serialized_options = b'\272H\013\022\t\t\000\000\000\000\000\000\360\177' + _globals['_DOUBLEINFINITERANGE'].fields_by_name['val']._loaded_options = None + _globals['_DOUBLEINFINITERANGE'].fields_by_name['val']._serialized_options = b'\272H\024\022\022\021\000\000\000\000\000\000\360\177!\000\000\000\000\000\000\360\377' + _globals['_PATTERNASCIIDIGITS'].fields_by_name['val']._loaded_options = None + _globals['_PATTERNASCIIDIGITS'].fields_by_name['val']._serialized_options = b'\272H\tr\0072\005^\\d+$' + _globals['_PATTERNQUOTEDLITERAL'].fields_by_name['val']._loaded_options = None + _globals['_PATTERNQUOTEDLITERAL'].fields_by_name['val']._serialized_options = b'\272H\rr\0132\t^\\Qa.c\\E$' + _globals['_PATTERNREPEATTOOLARGE'].fields_by_name['val']._loaded_options = None + _globals['_PATTERNREPEATTOOLARGE'].fields_by_name['val']._serialized_options = b'\272H\013r\t2\007a{1001}' + _globals['_UNIQUEWRAPPERS'].fields_by_name['val']._loaded_options = None + _globals['_UNIQUEWRAPPERS'].fields_by_name['val']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_CELUNIQUEWRAPPERS'].fields_by_name['val']._loaded_options = None + _globals['_CELUNIQUEWRAPPERS'].fields_by_name['val']._serialized_options = b'\272H3\272\0010\n\017unique_wrappers\022\016must be unique\032\rthis.unique()' + _globals['_MULTIPLEVALIDATIONS']._serialized_start=212 + _globals['_MULTIPLEVALIDATIONS']._serialized_end=296 + _globals['_DOUBLEFINITE']._serialized_start=298 + _globals['_DOUBLEFINITE']._serialized_end=339 + _globals['_SFIXED64EXLTGT']._serialized_start=341 + _globals['_SFIXED64EXLTGT']._serialized_end=400 + _globals['_TESTONEOFMSG']._serialized_start=402 + _globals['_TESTONEOFMSG']._serialized_end=443 + _globals['_ONEOF']._serialized_start=445 + _globals['_ONEOF']._serialized_end=558 + _globals['_PROTOVALIDATEONEOF']._serialized_start=560 + _globals['_PROTOVALIDATEONEOF']._serialized_end=651 + _globals['_PROTOVALIDATEONEOFREQUIRED']._serialized_start=653 + _globals['_PROTOVALIDATEONEOFREQUIRED']._serialized_end=754 + _globals['_PROTOVALIDATEONEOFUNKNOWNFIELDNAME']._serialized_start=756 + _globals['_PROTOVALIDATEONEOFUNKNOWNFIELDNAME']._serialized_end=868 + _globals['_PROTOVALIDATEMISTYPEDRULE']._serialized_start=870 + _globals['_PROTOVALIDATEMISTYPEDRULE']._serialized_end=927 + _globals['_TIMESTAMPGTNOW']._serialized_start=929 + _globals['_TIMESTAMPGTNOW']._serialized_end=1001 + _globals['_MAPMINMAX']._serialized_start=1004 + _globals['_MAPMINMAX']._serialized_end=1139 + _globals['_MAPMINMAX_VALENTRY']._serialized_start=1085 + _globals['_MAPMINMAX_VALENTRY']._serialized_end=1139 + _globals['_MAPKEYS']._serialized_start=1142 + _globals['_MAPKEYS']._serialized_end=1275 + _globals['_MAPKEYS_VALENTRY']._serialized_start=1221 + _globals['_MAPKEYS_VALENTRY']._serialized_end=1275 + _globals['_EMBED']._serialized_start=1277 + _globals['_EMBED']._serialized_end=1311 + _globals['_REPEATEDEMBEDSKIP']._serialized_start=1313 + _globals['_REPEATEDEMBEDSKIP']._serialized_end=1388 + _globals['_INVALIDRESYNTAX']._serialized_start=1390 + _globals['_INVALIDRESYNTAX']._serialized_end=1441 + _globals['_CONCATENATEDVALUES']._serialized_start=1444 + _globals['_CONCATENATEDVALUES']._serialized_end=1613 + _globals['_NESTEDMISTYPEDRULE']._serialized_start=1615 + _globals['_NESTEDMISTYPEDRULE']._serialized_end=1702 + _globals['_MESSAGERULEERROR']._serialized_start=1704 + _globals['_MESSAGERULEERROR']._serialized_end=1754 + _globals['_NESTEDMESSAGERULEERROR']._serialized_start=1756 + _globals['_NESTEDMESSAGERULEERROR']._serialized_end=1838 + _globals['_VIOLATIONBEFOREERROR']._serialized_start=1840 + _globals['_VIOLATIONBEFOREERROR']._serialized_end=1911 + _globals['_REPEATEDFIELDSCALARRULE']._serialized_start=1913 + _globals['_REPEATEDFIELDSCALARRULE']._serialized_end=1965 + _globals['_REPEATEDFIELDWRAPPERRULE']._serialized_start=1967 + _globals['_REPEATEDFIELDWRAPPERRULE']._serialized_end=2049 + _globals['_REPEATEDFIELDENUMRULE']._serialized_start=2051 + _globals['_REPEATEDFIELDENUMRULE']._serialized_end=2130 + _globals['_REPEATEDFIELDDURATIONRULE']._serialized_start=2132 + _globals['_REPEATEDFIELDDURATIONRULE']._serialized_end=2216 + _globals['_MAPFIELDSCALARRULE']._serialized_start=2219 + _globals['_MAPFIELDSCALARRULE']._serialized_end=2369 + _globals['_MAPFIELDSCALARRULE_VALENTRY']._serialized_start=2315 + _globals['_MAPFIELDSCALARRULE_VALENTRY']._serialized_end=2369 + _globals['_REPEATEDUNIQUEMESSAGES']._serialized_start=2371 + _globals['_REPEATEDUNIQUEMESSAGES']._serialized_end=2448 + _globals['_CELUNIQUEMESSAGES']._serialized_start=2450 + _globals['_CELUNIQUEMESSAGES']._serialized_end=2568 + _globals['_TIMESTAMPOUTOFRANGE']._serialized_start=2570 + _globals['_TIMESTAMPOUTOFRANGE']._serialized_end=2654 + _globals['_TIMESTAMPRULEORDER']._serialized_start=2656 + _globals['_TIMESTAMPRULEORDER']._serialized_end=2736 + _globals['_ENUMRULEORDER']._serialized_start=2738 + _globals['_ENUMRULEORDER']._serialized_end=2815 + _globals['_HOSTNAME']._serialized_start=2817 + _globals['_HOSTNAME']._serialized_end=2854 + _globals['_DOUBLEINFINITY']._serialized_start=2856 + _globals['_DOUBLEINFINITY']._serialized_end=2906 + _globals['_DOUBLEINFINITERANGE']._serialized_start=2908 + _globals['_DOUBLEINFINITERANGE']._serialized_end=2972 + _globals['_PATTERNASCIIDIGITS']._serialized_start=2974 + _globals['_PATTERNASCIIDIGITS']._serialized_end=3026 + _globals['_PATTERNQUOTEDLITERAL']._serialized_start=3028 + _globals['_PATTERNQUOTEDLITERAL']._serialized_end=3086 + _globals['_PATTERNREPEATTOOLARGE']._serialized_start=3088 + _globals['_PATTERNREPEATTOOLARGE']._serialized_end=3145 + _globals['_UNIQUEWRAPPERS']._serialized_start=3147 + _globals['_UNIQUEWRAPPERS']._serialized_end=3220 + _globals['_CELUNIQUEWRAPPERS']._serialized_start=3222 + _globals['_CELUNIQUEWRAPPERS']._serialized_end=3344 # @@protoc_insertion_point(module_scope) diff --git a/test/gen/tests/example/v1/validations_pb2.pyi b/test/gen/tests/example/v1/validations_pb2.pyi index c6e3c002..5fabc775 100644 --- a/test/gen/tests/example/v1/validations_pb2.pyi +++ b/test/gen/tests/example/v1/validations_pb2.pyi @@ -12,7 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. from ....buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf import duration_pb2 as _duration_pb2 from google.protobuf import timestamp_pb2 as _timestamp_pb2 +from google.protobuf import wrappers_pb2 as _wrappers_pb2 +from ....tests.example.v1 import rules_pb2 as _rules_pb2 from google.protobuf.internal import containers as _containers from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message @@ -149,3 +152,142 @@ class ConcatenatedValues(_message.Message): bar: _containers.RepeatedScalarFieldContainer[str] baz: _containers.RepeatedScalarFieldContainer[str] def __init__(self, bar: _Optional[_Iterable[str]] = ..., baz: _Optional[_Iterable[str]] = ...) -> None: ... + +class NestedMistypedRule(_message.Message): + __slots__ = ("child",) + CHILD_FIELD_NUMBER: _ClassVar[int] + child: ProtovalidateMistypedRule + def __init__(self, child: _Optional[_Union[ProtovalidateMistypedRule, _Mapping]] = ...) -> None: ... + +class MessageRuleError(_message.Message): + __slots__ = () + def __init__(self) -> None: ... + +class NestedMessageRuleError(_message.Message): + __slots__ = ("child",) + CHILD_FIELD_NUMBER: _ClassVar[int] + child: MessageRuleError + def __init__(self, child: _Optional[_Union[MessageRuleError, _Mapping]] = ...) -> None: ... + +class ViolationBeforeError(_message.Message): + __slots__ = ("a", "b") + A_FIELD_NUMBER: _ClassVar[int] + B_FIELD_NUMBER: _ClassVar[int] + a: str + b: str + def __init__(self, a: _Optional[str] = ..., b: _Optional[str] = ...) -> None: ... + +class RepeatedFieldScalarRule(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, val: _Optional[_Iterable[str]] = ...) -> None: ... + +class RepeatedFieldWrapperRule(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[_wrappers_pb2.Int32Value] + def __init__(self, val: _Optional[_Iterable[_Union[_wrappers_pb2.Int32Value, _Mapping]]] = ...) -> None: ... + +class RepeatedFieldEnumRule(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedScalarFieldContainer[_rules_pb2.TestEnum] + def __init__(self, val: _Optional[_Iterable[_Union[_rules_pb2.TestEnum, str]]] = ...) -> None: ... + +class RepeatedFieldDurationRule(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[_duration_pb2.Duration] + def __init__(self, val: _Optional[_Iterable[_Union[_duration_pb2.Duration, _Mapping]]] = ...) -> None: ... + +class MapFieldScalarRule(_message.Message): + __slots__ = ("val",) + class ValEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: str + def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ... + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.ScalarMap[str, str] + def __init__(self, val: _Optional[_Mapping[str, str]] = ...) -> None: ... + +class RepeatedUniqueMessages(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[Embed] + def __init__(self, val: _Optional[_Iterable[_Union[Embed, _Mapping]]] = ...) -> None: ... + +class CelUniqueMessages(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[Embed] + def __init__(self, val: _Optional[_Iterable[_Union[Embed, _Mapping]]] = ...) -> None: ... + +class TimestampOutOfRange(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _timestamp_pb2.Timestamp + def __init__(self, val: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class TimestampRuleOrder(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _timestamp_pb2.Timestamp + def __init__(self, val: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class EnumRuleOrder(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _rules_pb2.TestEnum + def __init__(self, val: _Optional[_Union[_rules_pb2.TestEnum, str]] = ...) -> None: ... + +class Hostname(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: str + def __init__(self, val: _Optional[str] = ...) -> None: ... + +class DoubleInfinity(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: float + def __init__(self, val: _Optional[float] = ...) -> None: ... + +class DoubleInfiniteRange(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: float + def __init__(self, val: _Optional[float] = ...) -> None: ... + +class PatternAsciiDigits(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: str + def __init__(self, val: _Optional[str] = ...) -> None: ... + +class PatternQuotedLiteral(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: str + def __init__(self, val: _Optional[str] = ...) -> None: ... + +class PatternRepeatTooLarge(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: str + def __init__(self, val: _Optional[str] = ...) -> None: ... + +class UniqueWrappers(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[_wrappers_pb2.Int32Value] + def __init__(self, val: _Optional[_Iterable[_Union[_wrappers_pb2.Int32Value, _Mapping]]] = ...) -> None: ... + +class CelUniqueWrappers(_message.Message): + __slots__ = ("val",) + VAL_FIELD_NUMBER: _ClassVar[int] + val: _containers.RepeatedCompositeFieldContainer[_wrappers_pb2.Int32Value] + def __init__(self, val: _Optional[_Iterable[_Union[_wrappers_pb2.Int32Value, _Mapping]]] = ...) -> None: ... diff --git a/test/gen/tests/example/v1/validator_pb.py b/test/gen/tests/example/v1/validator_pb.py new file mode 100644 index 00000000..d8940353 --- /dev/null +++ b/test/gen/tests/example/v1/validator_pb.py @@ -0,0 +1,763 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated from tests/example/v1/validator.proto. DO NOT EDIT. +# Generated by protoc-gen-py v0.1.1 with parameter "". +# ruff: noqa: PGH004 +# ruff: noqa +# fmt: off + +from __future__ import annotations + +from typing import Literal, TYPE_CHECKING, TypeAlias + +from protobuf import Message +from protobuf._codegen import file_desc +from protobuf.wkt import any_pb, api_pb, field_mask_pb, timestamp_pb + +from ....buf.validate import validate_pb + +if TYPE_CHECKING: + from protobuf import DescFile, Oneof + from protobuf.wkt import Any, Api, FieldMask, Timestamp + + +_HasMsgExprsFields: TypeAlias = Literal["x", "y"] + +class HasMsgExprs(Message[_HasMsgExprsFields]): + """ + ```proto + message tests.example.v1.HasMsgExprs + ``` + + Attributes: + x: + ```proto + int32 x = 1; + ``` + y: + ```proto + int32 y = 2; + ``` + """ + + __slots__ = ("x", "y") + + if TYPE_CHECKING: + + def __init__( + self, + *, + x: int = 0, + y: int = 0, + ) -> None: + pass + + x: int + y: int + +_SelfRecursiveFields: TypeAlias = Literal["x", "turtle"] + +class SelfRecursive(Message[_SelfRecursiveFields]): + """ + ```proto + message tests.example.v1.SelfRecursive + ``` + + Attributes: + x: + ```proto + int32 x = 1; + ``` + turtle: + ```proto + optional tests.example.v1.SelfRecursive turtle = 2; + ``` + """ + + __slots__ = ("x", "turtle") + + if TYPE_CHECKING: + + def __init__( + self, + *, + x: int = 0, + turtle: SelfRecursive | None = None, + ) -> None: + pass + + x: int + turtle: SelfRecursive | None + +_LoopRecursiveAFields: TypeAlias = Literal["b"] + +class LoopRecursiveA(Message[_LoopRecursiveAFields]): + """ + ```proto + message tests.example.v1.LoopRecursiveA + ``` + + Attributes: + b: + ```proto + optional tests.example.v1.LoopRecursiveB b = 1; + ``` + """ + + __slots__ = ("b",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + b: LoopRecursiveB | None = None, + ) -> None: + pass + + b: LoopRecursiveB | None + +_LoopRecursiveBFields: TypeAlias = Literal["a"] + +class LoopRecursiveB(Message[_LoopRecursiveBFields]): + """ + ```proto + message tests.example.v1.LoopRecursiveB + ``` + + Attributes: + a: + ```proto + optional tests.example.v1.LoopRecursiveA a = 1; + ``` + """ + + __slots__ = ("a",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + a: LoopRecursiveA | None = None, + ) -> None: + pass + + a: LoopRecursiveA | None + +_MsgHasOneofFields: TypeAlias = Literal["x", "y", "msg"] + +class MsgHasOneof(Message[_MsgHasOneofFields]): + """ + ```proto + message tests.example.v1.MsgHasOneof + ``` + + Attributes: + o: + ```proto + oneof o + ``` + """ + + __slots__ = ("o",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + o: Oneof[Literal["x"], str] | Oneof[Literal["y"], int] | Oneof[Literal["msg"], HasMsgExprs] | None = None, + ) -> None: + pass + + o: Oneof[Literal["x"], str] | Oneof[Literal["y"], int] | Oneof[Literal["msg"], HasMsgExprs] | None + +_MsgHasRepeatedFields: TypeAlias = Literal["x", "y", "z"] + +class MsgHasRepeated(Message[_MsgHasRepeatedFields]): + """ + ```proto + message tests.example.v1.MsgHasRepeated + ``` + + Attributes: + x: + ```proto + repeated float x = 1 [packed = true]; + ``` + y: + ```proto + repeated string y = 2; + ``` + z: + ```proto + repeated tests.example.v1.HasMsgExprs z = 3; + ``` + """ + + __slots__ = ("x", "y", "z") + + if TYPE_CHECKING: + + def __init__( + self, + *, + x: list[float] | None = None, + y: list[str] | None = None, + z: list[HasMsgExprs] | None = None, + ) -> None: + pass + + x: list[float] + y: list[str] + z: list[HasMsgExprs] + +_MsgHasMapFields: TypeAlias = Literal["int32map", "string_map", "message_map"] + +class MsgHasMap(Message[_MsgHasMapFields]): + """ + ```proto + message tests.example.v1.MsgHasMap + ``` + + Attributes: + int32map: + ```proto + map int32map = 1; + ``` + string_map: + ```proto + map string_map = 2; + ``` + message_map: + ```proto + map message_map = 3; + ``` + """ + + __slots__ = ("int32map", "string_map", "message_map") + + if TYPE_CHECKING: + + def __init__( + self, + *, + int32map: dict[int, int] | None = None, + string_map: dict[str, str] | None = None, + message_map: dict[int, LoopRecursiveA] | None = None, + ) -> None: + pass + + int32map: dict[int, int] + string_map: dict[str, str] + message_map: dict[int, LoopRecursiveA] + +_TransitiveFieldRuleFields: TypeAlias = Literal["mask"] + +class TransitiveFieldRule(Message[_TransitiveFieldRuleFields]): + """ + ```proto + message tests.example.v1.TransitiveFieldRule + ``` + + Attributes: + mask: + ```proto + optional google.protobuf.FieldMask mask = 1; + ``` + """ + + __slots__ = ("mask",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + mask: FieldMask | None = None, + ) -> None: + pass + + mask: FieldMask | None + +_MultipleStepsTransitiveFieldRulesFields: TypeAlias = Literal["api"] + +class MultipleStepsTransitiveFieldRules(Message[_MultipleStepsTransitiveFieldRulesFields]): + """ + ```proto + message tests.example.v1.MultipleStepsTransitiveFieldRules + ``` + + Attributes: + api: + ```proto + optional google.protobuf.Api api = 1; + ``` + """ + + __slots__ = ("api",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + api: Api | None = None, + ) -> None: + pass + + api: Api | None + +_SimpleFields: TypeAlias = Literal["s"] + +class Simple(Message[_SimpleFields]): + """ + ```proto + message tests.example.v1.Simple + ``` + + Attributes: + s: + ```proto + string s = 1; + ``` + """ + + __slots__ = ("s",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + s: str = "", + ) -> None: + pass + + s: str + +_FieldOfTypeAnyFields: TypeAlias = Literal["any"] + +class FieldOfTypeAny(Message[_FieldOfTypeAnyFields]): + """ + ```proto + message tests.example.v1.FieldOfTypeAny + ``` + + Attributes: + any: + ```proto + optional google.protobuf.Any any = 1; + ``` + """ + + __slots__ = ("any",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + any: Any | None = None, + ) -> None: + pass + + any: Any | None + +_CelMapOnARepeatedFields: TypeAlias = Literal["values"] + +class CelMapOnARepeated(Message[_CelMapOnARepeatedFields]): + """ + ```proto + message tests.example.v1.CelMapOnARepeated + ``` + + Attributes: + values: + ```proto + repeated tests.example.v1.CelMapOnARepeated.Value values = 1; + ``` + """ + + __slots__ = ("values",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + values: list[CelMapOnARepeated.Value] | None = None, + ) -> None: + pass + + values: list[CelMapOnARepeated.Value] + + _ValueFields: TypeAlias = Literal["name"] + + class Value(Message[_ValueFields]): + """ + ```proto + message tests.example.v1.CelMapOnARepeated.Value + ``` + + Attributes: + name: + ```proto + string name = 1; + ``` + """ + + __slots__ = ("name",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + name: str = "", + ) -> None: + pass + + name: str + +_RepeatedItemCelFields: TypeAlias = Literal["paths"] + +class RepeatedItemCel(Message[_RepeatedItemCelFields]): + """ + ```proto + message tests.example.v1.RepeatedItemCel + ``` + + Attributes: + paths: + ```proto + repeated string paths = 1; + ``` + """ + + __slots__ = ("paths",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + paths: list[str] | None = None, + ) -> None: + pass + + paths: list[str] + +_OneTwoFields: TypeAlias = Literal["field1", "field2"] + +class OneTwo(Message[_OneTwoFields]): + """ + ```proto + message tests.example.v1.OneTwo + ``` + + Attributes: + field1: + ```proto + optional tests.example.v1.F1 field1 = 1; + ``` + field2: + ```proto + optional tests.example.v1.F2 field2 = 2; + ``` + """ + + __slots__ = ("field1", "field2") + + if TYPE_CHECKING: + + def __init__( + self, + *, + field1: F1 | None = None, + field2: F2 | None = None, + ) -> None: + pass + + field1: F1 | None + field2: F2 | None + +_TwoOneFields: TypeAlias = Literal["field2", "field1"] + +class TwoOne(Message[_TwoOneFields]): + """ + ```proto + message tests.example.v1.TwoOne + ``` + + Attributes: + field2: + ```proto + optional tests.example.v1.F2 field2 = 1; + ``` + field1: + ```proto + optional tests.example.v1.F1 field1 = 2; + ``` + """ + + __slots__ = ("field2", "field1") + + if TYPE_CHECKING: + + def __init__( + self, + *, + field2: F2 | None = None, + field1: F1 | None = None, + ) -> None: + pass + + field2: F2 | None + field1: F1 | None + +_F1Fields: TypeAlias = Literal["need_this", "field"] + +class F1(Message[_F1Fields]): + """ + ```proto + message tests.example.v1.F1 + ``` + + Attributes: + need_this: + ```proto + string need_this = 1; + ``` + field: + ```proto + optional tests.example.v1.FieldWithIssue field = 2; + ``` + """ + + __slots__ = ("need_this", "field") + + if TYPE_CHECKING: + + def __init__( + self, + *, + need_this: str = "", + field: FieldWithIssue | None = None, + ) -> None: + pass + + need_this: str + field: FieldWithIssue | None + +_F2Fields: TypeAlias = Literal["field"] + +class F2(Message[_F2Fields]): + """ + ```proto + message tests.example.v1.F2 + ``` + + Attributes: + field: + ```proto + optional tests.example.v1.FieldWithIssue field = 1; + ``` + """ + + __slots__ = ("field",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + field: FieldWithIssue | None = None, + ) -> None: + pass + + field: FieldWithIssue | None + +_FieldWithIssueFields: TypeAlias = Literal["f1", "name"] + +class FieldWithIssue(Message[_FieldWithIssueFields]): + """ + ```proto + message tests.example.v1.FieldWithIssue + ``` + + Attributes: + f1: + ```proto + optional tests.example.v1.F1 f1 = 1; + ``` + name: + ```proto + string name = 2; + ``` + """ + + __slots__ = ("f1", "name") + + if TYPE_CHECKING: + + def __init__( + self, + *, + f1: F1 | None = None, + name: str = "", + ) -> None: + pass + + f1: F1 | None + name: str + +_Issue211Fields: TypeAlias = Literal["value"] + +class Issue211(Message[_Issue211Fields]): + """ + ```proto + message tests.example.v1.Issue211 + ``` + + Attributes: + value: + ```proto + optional google.protobuf.Timestamp value = 1; + ``` + """ + + __slots__ = ("value",) + + if TYPE_CHECKING: + + def __init__( + self, + *, + value: Timestamp | None = None, + ) -> None: + pass + + value: Timestamp | None + +_SelfReferentialRepeatedFields: TypeAlias = Literal["children", "name"] + +class SelfReferentialRepeated(Message[_SelfReferentialRepeatedFields]): + """ + ```proto + message tests.example.v1.SelfReferentialRepeated + ``` + + Attributes: + children: + ```proto + repeated tests.example.v1.SelfReferentialRepeated children = 1; + ``` + name: + ```proto + optional string name = 2; + ``` + """ + + __slots__ = ("children", "name") + + if TYPE_CHECKING: + + def __init__( + self, + *, + children: list[SelfReferentialRepeated] | None = None, + name: str | None = None, + ) -> None: + pass + + children: list[SelfReferentialRepeated] + name: str + +_SelfReferentialMapFields: TypeAlias = Literal["children", "name"] + +class SelfReferentialMap(Message[_SelfReferentialMapFields]): + """ + ```proto + message tests.example.v1.SelfReferentialMap + ``` + + Attributes: + children: + ```proto + map children = 1; + ``` + name: + ```proto + optional string name = 2; + ``` + """ + + __slots__ = ("children", "name") + + if TYPE_CHECKING: + + def __init__( + self, + *, + children: dict[str, SelfReferentialMap] | None = None, + name: str | None = None, + ) -> None: + pass + + children: dict[str, SelfReferentialMap] + name: str + + +_DESC = file_desc( + b'\n tests/example/v1/validator.proto\x12\x10tests.example.v1\x1a\x1bbuf/validate/validate.proto\x1a\x19google/protobuf/any.proto\x1a\x19google/protobuf/api.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x8d\x02\n\x0bHasMsgExprs\x12\x7f\n\x01x\x18\x01 \x01(\x05R\x01xBq\xbaHn\xba\x01\'\n\x06x_even\x12\x0ex must be even\x1a\rthis % 2 == 0\xba\x01A\n\x0bx_coprime_3\x1a2this % 3 != 0 ? \'\': \'x must not be divisible by 3\'\x12\x0c\n\x01y\x18\x02 \x01(\x05R\x01y:o\xbaHl\x1a0\n\x06x_lt_y\x12\x15x must be less than y\x1a\x0fthis.x < this.y\x1a8\n\x07y_gt_42\x1a-this.y > 42 ? \'\': \'y must be greater than 42\'"\xfe\x01\n\rSelfRecursive\x12\x0c\n\x01x\x18\x01 \x01(\x05R\x01x\x12\x8d\x01\n\x06turtle\x18\x02 \x01(\x0b2\x1f.tests.example.v1.SelfRecursiveR\x06turtleBT\xbaHQ\xba\x01N\n\x14non_zero_baby_turtle\x12*embedded turtle\'s x value must not be zero\x1a\nthis.x > 0:O\xbaHL\x1aJ\n\x0eunique_turtles\x12\x1fadjacent turtles must be unique\x1a\x17this.x != this.turtle.x"@\n\x0eLoopRecursiveA\x12.\n\x01b\x18\x01 \x01(\x0b2 .tests.example.v1.LoopRecursiveBR\x01b"@\n\x0eLoopRecursiveB\x12.\n\x01a\x18\x01 \x01(\x0b2 .tests.example.v1.LoopRecursiveAR\x01a"\xfb\x01\n\x0bMsgHasOneof\x12\x1a\n\x01x\x18\x01 \x01(\tH\x00R\x01xB\n\xbaH\x07r\x05:\x03foo\x12\x17\n\x01y\x18\x02 \x01(\x05H\x00R\x01yB\x07\xbaH\x04\x1a\x02 \x00\x121\n\x03msg\x18\x03 \x01(\x0b2\x1d.tests.example.v1.HasMsgExprsH\x00R\x03msgB\n\n\x01o\x12\x05\xbaH\x02\x08\x01:x\xbaHu\x1a\\\n\x06test x\x1aRthis.x == \'\' ? \'\' : \n!this.x.startsWith(\'foo\') ? \'does not have prefix `foo`\' : \'\'\x1a\x15\n\x06text y\x1a\x0bthis.y >= 0"\xa0\x01\n\x0eMsgHasRepeated\x12?\n\x01x\x18\x01 \x03(\x02R\x01xB1\xbaH.\x92\x01+\x08\x01\x10\x03\x18\x01"#\xba\x01\x19\x12\x11intentional false\x1a\x04true\n\x05%\x00\x00\x00\x00\x12\x16\n\x01y\x18\x02 \x03(\tR\x01yB\x08\xbaH\x05\x92\x01\x02\x18\x01\x125\n\x01z\x18\x03 \x03(\x0b2\x1d.tests.example.v1.HasMsgExprsR\x01zB\x08\xbaH\x05\x92\x01\x02\x10\x02"\xf1\x03\n\tMsgHasMap\x12[\n\x08int32map\x18\x01 \x03(\x0b2).tests.example.v1.MsgHasMap.Int32mapEntryR\x08int32mapB\x14\xbaH\x11\x9a\x01\x0e\x08\x03"\x04\x1a\x02 \x00*\x04\x1a\x02\x10\x00\x12S\n\nstring_map\x18\x02 \x03(\x0b2*.tests.example.v1.MsgHasMap.StringMapEntryR\tstringMapB\x08\xbaH\x05\x9a\x01\x02\x10\x01\x12V\n\x0bmessage_map\x18\x03 \x03(\x0b2+.tests.example.v1.MsgHasMap.MessageMapEntryR\nmessageMapB\x08\xbaH\x05\x9a\x01\x02\x08\x02\x1a;\n\rInt32mapEntry\x12\x10\n\x03key\x18\x01 \x01(\x05R\x03key\x12\x14\n\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1a<\n\x0eStringMapEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a_\n\x0fMessageMapEntry\x12\x10\n\x03key\x18\x01 \x01(\x03R\x03key\x126\n\x05value\x18\x02 \x01(\x0b2 .tests.example.v1.LoopRecursiveAR\x05value:\x028\x01"\x88\x01\n\x13TransitiveFieldRule\x12q\n\x04mask\x18\x01 \x01(\x0b2\x1a.google.protobuf.FieldMaskR\x04maskBA\xbaH>\xba\x01;\n\nmask.paths\x12\x1cmask.paths must not be empty\x1a\x0fhas(this.paths)"\xc8\x01\n!MultipleStepsTransitiveFieldRules\x12\xa2\x01\n\x03api\x18\x01 \x01(\x0b2\x14.google.protobuf.ApiR\x03apiBz\xbaHw\xba\x01t\n\x1capi.source_context.file_name\x120api\'s source context file name must not be empty\x1a"has(this.source_context.file_name)"\x16\n\x06Simple\x12\x0c\n\x01s\x18\x01 \x01(\tR\x01s"p\n\x0eFieldOfTypeAny\x12^\n\x03any\x18\x01 \x01(\x0b2\x14.google.protobuf.AnyR\x03anyB6\xbaH3\xba\x010\n\x08any_type\x12\x16this should never fail\x1a\x0cthis == this"\xcf\x01\n\x11CelMapOnARepeated\x12\x9c\x01\n\x06values\x18\x01 \x03(\x0b2).tests.example.v1.CelMapOnARepeated.ValueR\x06valuesBY\xbaHV\xba\x01S\n\x0fenv.vars.unique\x1a@this.map(v, v.name).unique() ? \'\' : \'value names must be unique\'\x1a\x1b\n\x05Value\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name"[\n\x0fRepeatedItemCel\x12H\n\x05paths\x18\x01 \x03(\tR\x05pathsB2\xbaH/\x92\x01,"*\xba\x01\'\n\x0epaths.no_space\x1a\x15!this.startsWith(\' \')"d\n\x06OneTwo\x12,\n\x06field1\x18\x01 \x01(\x0b2\x14.tests.example.v1.F1R\x06field1\x12,\n\x06field2\x18\x02 \x01(\x0b2\x14.tests.example.v1.F2R\x06field2"d\n\x06TwoOne\x12,\n\x06field2\x18\x01 \x01(\x0b2\x14.tests.example.v1.F2R\x06field2\x12,\n\x06field1\x18\x02 \x01(\x0b2\x14.tests.example.v1.F1R\x06field1"Y\n\x02F1\x12\x1b\n\tneed_this\x18\x01 \x01(\tR\x08needThis\x126\n\x05field\x18\x02 \x01(\x0b2 .tests.example.v1.FieldWithIssueR\x05field"<\n\x02F2\x126\n\x05field\x18\x01 \x01(\x0b2 .tests.example.v1.FieldWithIssueR\x05field"S\n\x0eFieldWithIssue\x12$\n\x02f1\x18\x01 \x01(\x0b2\x14.tests.example.v1.F1R\x02f1\x12\x1b\n\x04name\x18\x02 \x01(\tR\x04nameB\x07\xbaH\x04r\x02\x10\x01"F\n\x08Issue211\x12:\n\x05value\x18\x01 \x01(\x0b2\x1a.google.protobuf.TimestampR\x05valueB\x08\xbaH\x05\xb2\x01\x02@\x01"\x80\x02\n\x17SelfReferentialRepeated\x12E\n\x08children\x18\x01 \x03(\x0b2).tests.example.v1.SelfReferentialRepeatedR\x08children\x12\x17\n\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01B\x07\n\x05_name:|\xbaHy\x1aw\n\x17children_must_have_name\x12\x1dAll children must have a name\x1a=size(this.children) == 0 || this.children.all(c, has(c.name))"\xf9\x02\n\x12SelfReferentialMap\x12N\n\x08children\x18\x01 \x03(\x0b22.tests.example.v1.SelfReferentialMap.ChildrenEntryR\x08children\x12\x17\n\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01\x1aa\n\rChildrenEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12:\n\x05value\x18\x02 \x01(\x0b2$.tests.example.v1.SelfReferentialMapR\x05value:\x028\x01B\x07\n\x05_name:\x8d\x01\xbaH\x89\x01\x1a\x86\x01\n\x17children_must_have_name\x12\x1dAll children must have a name\x1aLsize(this.children) == 0 || this.children.all(k, has(this.children[k].name))B\x88\x01\n\x14com.tests.example.v1B\x0eValidatorProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3', + [ + validate_pb.desc(), + any_pb.desc(), + api_pb.desc(), + field_mask_pb.desc(), + timestamp_pb.desc(), + ], + { + "HasMsgExprs": HasMsgExprs, + "SelfRecursive": SelfRecursive, + "LoopRecursiveA": LoopRecursiveA, + "LoopRecursiveB": LoopRecursiveB, + "MsgHasOneof": MsgHasOneof, + "MsgHasRepeated": MsgHasRepeated, + "MsgHasMap": MsgHasMap, + "TransitiveFieldRule": TransitiveFieldRule, + "MultipleStepsTransitiveFieldRules": MultipleStepsTransitiveFieldRules, + "Simple": Simple, + "FieldOfTypeAny": FieldOfTypeAny, + "CelMapOnARepeated": CelMapOnARepeated, + "CelMapOnARepeated.Value": CelMapOnARepeated.Value, + "RepeatedItemCel": RepeatedItemCel, + "OneTwo": OneTwo, + "TwoOne": TwoOne, + "F1": F1, + "F2": F2, + "FieldWithIssue": FieldWithIssue, + "Issue211": Issue211, + "SelfReferentialRepeated": SelfReferentialRepeated, + "SelfReferentialMap": SelfReferentialMap, + }, +) + + +def desc() -> DescFile: + """Returns the descriptor for the file `tests/example/v1/validator.proto`.""" + return _DESC diff --git a/test/gen/tests/example/v1/validator_pb2.py b/test/gen/tests/example/v1/validator_pb2.py new file mode 100644 index 00000000..6aed9211 --- /dev/null +++ b/test/gen/tests/example/v1/validator_pb2.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: tests/example/v1/validator.proto +# Protobuf Python Version: 5.26.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from ....buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2 +from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 +from google.protobuf import api_pb2 as google_dot_protobuf_dot_api__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n tests/example/v1/validator.proto\x12\x10tests.example.v1\x1a\x1b\x62uf/validate/validate.proto\x1a\x19google/protobuf/any.proto\x1a\x19google/protobuf/api.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x8d\x02\n\x0bHasMsgExprs\x12\x7f\n\x01x\x18\x01 \x01(\x05\x42q\xbaHn\xba\x01\'\n\x06x_even\x12\x0ex must be even\x1a\rthis % 2 == 0\xba\x01\x41\n\x0bx_coprime_3\x1a\x32this % 3 != 0 ? \'\': \'x must not be divisible by 3\'R\x01x\x12\x0c\n\x01y\x18\x02 \x01(\x05R\x01y:o\xbaHl\x1a\x30\n\x06x_lt_y\x12\x15x must be less than y\x1a\x0fthis.x < this.y\x1a\x38\n\x07y_gt_42\x1a-this.y > 42 ? \'\': \'y must be greater than 42\'\"\xfe\x01\n\rSelfRecursive\x12\x0c\n\x01x\x18\x01 \x01(\x05R\x01x\x12\x8d\x01\n\x06turtle\x18\x02 \x01(\x0b\x32\x1f.tests.example.v1.SelfRecursiveBT\xbaHQ\xba\x01N\n\x14non_zero_baby_turtle\x12*embedded turtle\'s x value must not be zero\x1a\nthis.x > 0R\x06turtle:O\xbaHL\x1aJ\n\x0eunique_turtles\x12\x1f\x61\x64jacent turtles must be unique\x1a\x17this.x != this.turtle.x\"@\n\x0eLoopRecursiveA\x12.\n\x01\x62\x18\x01 \x01(\x0b\x32 .tests.example.v1.LoopRecursiveBR\x01\x62\"@\n\x0eLoopRecursiveB\x12.\n\x01\x61\x18\x01 \x01(\x0b\x32 .tests.example.v1.LoopRecursiveAR\x01\x61\"\xfb\x01\n\x0bMsgHasOneof\x12\x1a\n\x01x\x18\x01 \x01(\tB\n\xbaH\x07r\x05:\x03\x66ooH\x00R\x01x\x12\x17\n\x01y\x18\x02 \x01(\x05\x42\x07\xbaH\x04\x1a\x02 \x00H\x00R\x01y\x12\x31\n\x03msg\x18\x03 \x01(\x0b\x32\x1d.tests.example.v1.HasMsgExprsH\x00R\x03msg:x\xbaHu\x1a\\\n\x06test x\x1aRthis.x == \'\' ? \'\' : \n!this.x.startsWith(\'foo\') ? \'does not have prefix `foo`\' : \'\'\x1a\x15\n\x06text y\x1a\x0bthis.y >= 0B\n\n\x01o\x12\x05\xbaH\x02\x08\x01\"\xa0\x01\n\x0eMsgHasRepeated\x12?\n\x01x\x18\x01 \x03(\x02\x42\x31\xbaH.\x92\x01+\x08\x01\x10\x03\x18\x01\"#\n\x05%\x00\x00\x00\x00\xba\x01\x19\x12\x11intentional false\x1a\x04trueR\x01x\x12\x16\n\x01y\x18\x02 \x03(\tB\x08\xbaH\x05\x92\x01\x02\x18\x01R\x01y\x12\x35\n\x01z\x18\x03 \x03(\x0b\x32\x1d.tests.example.v1.HasMsgExprsB\x08\xbaH\x05\x92\x01\x02\x10\x02R\x01z\"\xf1\x03\n\tMsgHasMap\x12[\n\x08int32map\x18\x01 \x03(\x0b\x32).tests.example.v1.MsgHasMap.Int32mapEntryB\x14\xbaH\x11\x9a\x01\x0e\x08\x03\"\x04\x1a\x02 \x00*\x04\x1a\x02\x10\x00R\x08int32map\x12S\n\nstring_map\x18\x02 \x03(\x0b\x32*.tests.example.v1.MsgHasMap.StringMapEntryB\x08\xbaH\x05\x9a\x01\x02\x10\x01R\tstringMap\x12V\n\x0bmessage_map\x18\x03 \x03(\x0b\x32+.tests.example.v1.MsgHasMap.MessageMapEntryB\x08\xbaH\x05\x9a\x01\x02\x08\x02R\nmessageMap\x1a;\n\rInt32mapEntry\x12\x10\n\x03key\x18\x01 \x01(\x05R\x03key\x12\x14\n\x05value\x18\x02 \x01(\x05R\x05value:\x02\x38\x01\x1a<\n\x0eStringMapEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x1a_\n\x0fMessageMapEntry\x12\x10\n\x03key\x18\x01 \x01(\x03R\x03key\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32 .tests.example.v1.LoopRecursiveAR\x05value:\x02\x38\x01\"\x88\x01\n\x13TransitiveFieldRule\x12q\n\x04mask\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskBA\xbaH>\xba\x01;\n\nmask.paths\x12\x1cmask.paths must not be empty\x1a\x0fhas(this.paths)R\x04mask\"\xc8\x01\n!MultipleStepsTransitiveFieldRules\x12\xa2\x01\n\x03\x61pi\x18\x01 \x01(\x0b\x32\x14.google.protobuf.ApiBz\xbaHw\xba\x01t\n\x1c\x61pi.source_context.file_name\x12\x30\x61pi\'s source context file name must not be empty\x1a\"has(this.source_context.file_name)R\x03\x61pi\"\x16\n\x06Simple\x12\x0c\n\x01s\x18\x01 \x01(\tR\x01s\"p\n\x0e\x46ieldOfTypeAny\x12^\n\x03\x61ny\x18\x01 \x01(\x0b\x32\x14.google.protobuf.AnyB6\xbaH3\xba\x01\x30\n\x08\x61ny_type\x12\x16this should never fail\x1a\x0cthis == thisR\x03\x61ny\"\xcf\x01\n\x11\x43\x65lMapOnARepeated\x12\x9c\x01\n\x06values\x18\x01 \x03(\x0b\x32).tests.example.v1.CelMapOnARepeated.ValueBY\xbaHV\xba\x01S\n\x0f\x65nv.vars.unique\x1a@this.map(v, v.name).unique() ? \'\' : \'value names must be unique\'R\x06values\x1a\x1b\n\x05Value\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\"[\n\x0fRepeatedItemCel\x12H\n\x05paths\x18\x01 \x03(\tB2\xbaH/\x92\x01,\"*\xba\x01\'\n\x0epaths.no_space\x1a\x15!this.startsWith(\' \')R\x05paths\"d\n\x06OneTwo\x12,\n\x06\x66ield1\x18\x01 \x01(\x0b\x32\x14.tests.example.v1.F1R\x06\x66ield1\x12,\n\x06\x66ield2\x18\x02 \x01(\x0b\x32\x14.tests.example.v1.F2R\x06\x66ield2\"d\n\x06TwoOne\x12,\n\x06\x66ield2\x18\x01 \x01(\x0b\x32\x14.tests.example.v1.F2R\x06\x66ield2\x12,\n\x06\x66ield1\x18\x02 \x01(\x0b\x32\x14.tests.example.v1.F1R\x06\x66ield1\"Y\n\x02\x46\x31\x12\x1b\n\tneed_this\x18\x01 \x01(\tR\x08needThis\x12\x36\n\x05\x66ield\x18\x02 \x01(\x0b\x32 .tests.example.v1.FieldWithIssueR\x05\x66ield\"<\n\x02\x46\x32\x12\x36\n\x05\x66ield\x18\x01 \x01(\x0b\x32 .tests.example.v1.FieldWithIssueR\x05\x66ield\"S\n\x0e\x46ieldWithIssue\x12$\n\x02\x66\x31\x18\x01 \x01(\x0b\x32\x14.tests.example.v1.F1R\x02\x66\x31\x12\x1b\n\x04name\x18\x02 \x01(\tB\x07\xbaH\x04r\x02\x10\x01R\x04name\"F\n\x08Issue211\x12:\n\x05value\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x08\xbaH\x05\xb2\x01\x02@\x01R\x05value\"\x80\x02\n\x17SelfReferentialRepeated\x12\x45\n\x08\x63hildren\x18\x01 \x03(\x0b\x32).tests.example.v1.SelfReferentialRepeatedR\x08\x63hildren\x12\x17\n\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01:|\xbaHy\x1aw\n\x17\x63hildren_must_have_name\x12\x1d\x41ll children must have a name\x1a=size(this.children) == 0 || this.children.all(c, has(c.name))B\x07\n\x05_name\"\xf9\x02\n\x12SelfReferentialMap\x12N\n\x08\x63hildren\x18\x01 \x03(\x0b\x32\x32.tests.example.v1.SelfReferentialMap.ChildrenEntryR\x08\x63hildren\x12\x17\n\x04name\x18\x02 \x01(\tH\x00R\x04name\x88\x01\x01\x1a\x61\n\rChildrenEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12:\n\x05value\x18\x02 \x01(\x0b\x32$.tests.example.v1.SelfReferentialMapR\x05value:\x02\x38\x01:\x8d\x01\xbaH\x89\x01\x1a\x86\x01\n\x17\x63hildren_must_have_name\x12\x1d\x41ll children must have a name\x1aLsize(this.children) == 0 || this.children.all(k, has(this.children[k].name))B\x07\n\x05_nameB\x88\x01\n\x14\x63om.tests.example.v1B\x0eValidatorProtoP\x01\xa2\x02\x03TEX\xaa\x02\x10Tests.Example.V1\xca\x02\x10Tests\\Example\\V1\xe2\x02\x1cTests\\Example\\V1\\GPBMetadata\xea\x02\x12Tests::Example::V1b\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'tests.example.v1.validator_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\024com.tests.example.v1B\016ValidatorProtoP\001\242\002\003TEX\252\002\020Tests.Example.V1\312\002\020Tests\\Example\\V1\342\002\034Tests\\Example\\V1\\GPBMetadata\352\002\022Tests::Example::V1' + _globals['_HASMSGEXPRS'].fields_by_name['x']._loaded_options = None + _globals['_HASMSGEXPRS'].fields_by_name['x']._serialized_options = b'\272Hn\272\001\'\n\006x_even\022\016x must be even\032\rthis % 2 == 0\272\001A\n\013x_coprime_3\0322this % 3 != 0 ? \'\': \'x must not be divisible by 3\'' + _globals['_HASMSGEXPRS']._loaded_options = None + _globals['_HASMSGEXPRS']._serialized_options = b'\272Hl\0320\n\006x_lt_y\022\025x must be less than y\032\017this.x < this.y\0328\n\007y_gt_42\032-this.y > 42 ? \'\': \'y must be greater than 42\'' + _globals['_SELFRECURSIVE'].fields_by_name['turtle']._loaded_options = None + _globals['_SELFRECURSIVE'].fields_by_name['turtle']._serialized_options = b'\272HQ\272\001N\n\024non_zero_baby_turtle\022*embedded turtle\'s x value must not be zero\032\nthis.x > 0' + _globals['_SELFRECURSIVE']._loaded_options = None + _globals['_SELFRECURSIVE']._serialized_options = b'\272HL\032J\n\016unique_turtles\022\037adjacent turtles must be unique\032\027this.x != this.turtle.x' + _globals['_MSGHASONEOF'].oneofs_by_name['o']._loaded_options = None + _globals['_MSGHASONEOF'].oneofs_by_name['o']._serialized_options = b'\272H\002\010\001' + _globals['_MSGHASONEOF'].fields_by_name['x']._loaded_options = None + _globals['_MSGHASONEOF'].fields_by_name['x']._serialized_options = b'\272H\007r\005:\003foo' + _globals['_MSGHASONEOF'].fields_by_name['y']._loaded_options = None + _globals['_MSGHASONEOF'].fields_by_name['y']._serialized_options = b'\272H\004\032\002 \000' + _globals['_MSGHASONEOF']._loaded_options = None + _globals['_MSGHASONEOF']._serialized_options = b'\272Hu\032\\\n\006test x\032Rthis.x == \'\' ? \'\' : \n!this.x.startsWith(\'foo\') ? \'does not have prefix `foo`\' : \'\'\032\025\n\006text y\032\013this.y >= 0' + _globals['_MSGHASREPEATED'].fields_by_name['x']._loaded_options = None + _globals['_MSGHASREPEATED'].fields_by_name['x']._serialized_options = b'\272H.\222\001+\010\001\020\003\030\001\"#\n\005%\000\000\000\000\272\001\031\022\021intentional false\032\004true' + _globals['_MSGHASREPEATED'].fields_by_name['y']._loaded_options = None + _globals['_MSGHASREPEATED'].fields_by_name['y']._serialized_options = b'\272H\005\222\001\002\030\001' + _globals['_MSGHASREPEATED'].fields_by_name['z']._loaded_options = None + _globals['_MSGHASREPEATED'].fields_by_name['z']._serialized_options = b'\272H\005\222\001\002\020\002' + _globals['_MSGHASMAP_INT32MAPENTRY']._loaded_options = None + _globals['_MSGHASMAP_INT32MAPENTRY']._serialized_options = b'8\001' + _globals['_MSGHASMAP_STRINGMAPENTRY']._loaded_options = None + _globals['_MSGHASMAP_STRINGMAPENTRY']._serialized_options = b'8\001' + _globals['_MSGHASMAP_MESSAGEMAPENTRY']._loaded_options = None + _globals['_MSGHASMAP_MESSAGEMAPENTRY']._serialized_options = b'8\001' + _globals['_MSGHASMAP'].fields_by_name['int32map']._loaded_options = None + _globals['_MSGHASMAP'].fields_by_name['int32map']._serialized_options = b'\272H\021\232\001\016\010\003\"\004\032\002 \000*\004\032\002\020\000' + _globals['_MSGHASMAP'].fields_by_name['string_map']._loaded_options = None + _globals['_MSGHASMAP'].fields_by_name['string_map']._serialized_options = b'\272H\005\232\001\002\020\001' + _globals['_MSGHASMAP'].fields_by_name['message_map']._loaded_options = None + _globals['_MSGHASMAP'].fields_by_name['message_map']._serialized_options = b'\272H\005\232\001\002\010\002' + _globals['_TRANSITIVEFIELDRULE'].fields_by_name['mask']._loaded_options = None + _globals['_TRANSITIVEFIELDRULE'].fields_by_name['mask']._serialized_options = b'\272H>\272\001;\n\nmask.paths\022\034mask.paths must not be empty\032\017has(this.paths)' + _globals['_MULTIPLESTEPSTRANSITIVEFIELDRULES'].fields_by_name['api']._loaded_options = None + _globals['_MULTIPLESTEPSTRANSITIVEFIELDRULES'].fields_by_name['api']._serialized_options = b'\272Hw\272\001t\n\034api.source_context.file_name\0220api\'s source context file name must not be empty\032\"has(this.source_context.file_name)' + _globals['_FIELDOFTYPEANY'].fields_by_name['any']._loaded_options = None + _globals['_FIELDOFTYPEANY'].fields_by_name['any']._serialized_options = b'\272H3\272\0010\n\010any_type\022\026this should never fail\032\014this == this' + _globals['_CELMAPONAREPEATED'].fields_by_name['values']._loaded_options = None + _globals['_CELMAPONAREPEATED'].fields_by_name['values']._serialized_options = b'\272HV\272\001S\n\017env.vars.unique\032@this.map(v, v.name).unique() ? \'\' : \'value names must be unique\'' + _globals['_REPEATEDITEMCEL'].fields_by_name['paths']._loaded_options = None + _globals['_REPEATEDITEMCEL'].fields_by_name['paths']._serialized_options = b'\272H/\222\001,\"*\272\001\'\n\016paths.no_space\032\025!this.startsWith(\' \')' + _globals['_FIELDWITHISSUE'].fields_by_name['name']._loaded_options = None + _globals['_FIELDWITHISSUE'].fields_by_name['name']._serialized_options = b'\272H\004r\002\020\001' + _globals['_ISSUE211'].fields_by_name['value']._loaded_options = None + _globals['_ISSUE211'].fields_by_name['value']._serialized_options = b'\272H\005\262\001\002@\001' + _globals['_SELFREFERENTIALREPEATED']._loaded_options = None + _globals['_SELFREFERENTIALREPEATED']._serialized_options = b'\272Hy\032w\n\027children_must_have_name\022\035All children must have a name\032=size(this.children) == 0 || this.children.all(c, has(c.name))' + _globals['_SELFREFERENTIALMAP_CHILDRENENTRY']._loaded_options = None + _globals['_SELFREFERENTIALMAP_CHILDRENENTRY']._serialized_options = b'8\001' + _globals['_SELFREFERENTIALMAP']._loaded_options = None + _globals['_SELFREFERENTIALMAP']._serialized_options = b'\272H\211\001\032\206\001\n\027children_must_have_name\022\035All children must have a name\032Lsize(this.children) == 0 || this.children.all(k, has(this.children[k].name))' + _globals['_HASMSGEXPRS']._serialized_start=205 + _globals['_HASMSGEXPRS']._serialized_end=474 + _globals['_SELFRECURSIVE']._serialized_start=477 + _globals['_SELFRECURSIVE']._serialized_end=731 + _globals['_LOOPRECURSIVEA']._serialized_start=733 + _globals['_LOOPRECURSIVEA']._serialized_end=797 + _globals['_LOOPRECURSIVEB']._serialized_start=799 + _globals['_LOOPRECURSIVEB']._serialized_end=863 + _globals['_MSGHASONEOF']._serialized_start=866 + _globals['_MSGHASONEOF']._serialized_end=1117 + _globals['_MSGHASREPEATED']._serialized_start=1120 + _globals['_MSGHASREPEATED']._serialized_end=1280 + _globals['_MSGHASMAP']._serialized_start=1283 + _globals['_MSGHASMAP']._serialized_end=1780 + _globals['_MSGHASMAP_INT32MAPENTRY']._serialized_start=1562 + _globals['_MSGHASMAP_INT32MAPENTRY']._serialized_end=1621 + _globals['_MSGHASMAP_STRINGMAPENTRY']._serialized_start=1623 + _globals['_MSGHASMAP_STRINGMAPENTRY']._serialized_end=1683 + _globals['_MSGHASMAP_MESSAGEMAPENTRY']._serialized_start=1685 + _globals['_MSGHASMAP_MESSAGEMAPENTRY']._serialized_end=1780 + _globals['_TRANSITIVEFIELDRULE']._serialized_start=1783 + _globals['_TRANSITIVEFIELDRULE']._serialized_end=1919 + _globals['_MULTIPLESTEPSTRANSITIVEFIELDRULES']._serialized_start=1922 + _globals['_MULTIPLESTEPSTRANSITIVEFIELDRULES']._serialized_end=2122 + _globals['_SIMPLE']._serialized_start=2124 + _globals['_SIMPLE']._serialized_end=2146 + _globals['_FIELDOFTYPEANY']._serialized_start=2148 + _globals['_FIELDOFTYPEANY']._serialized_end=2260 + _globals['_CELMAPONAREPEATED']._serialized_start=2263 + _globals['_CELMAPONAREPEATED']._serialized_end=2470 + _globals['_CELMAPONAREPEATED_VALUE']._serialized_start=2443 + _globals['_CELMAPONAREPEATED_VALUE']._serialized_end=2470 + _globals['_REPEATEDITEMCEL']._serialized_start=2472 + _globals['_REPEATEDITEMCEL']._serialized_end=2563 + _globals['_ONETWO']._serialized_start=2565 + _globals['_ONETWO']._serialized_end=2665 + _globals['_TWOONE']._serialized_start=2667 + _globals['_TWOONE']._serialized_end=2767 + _globals['_F1']._serialized_start=2769 + _globals['_F1']._serialized_end=2858 + _globals['_F2']._serialized_start=2860 + _globals['_F2']._serialized_end=2920 + _globals['_FIELDWITHISSUE']._serialized_start=2922 + _globals['_FIELDWITHISSUE']._serialized_end=3005 + _globals['_ISSUE211']._serialized_start=3007 + _globals['_ISSUE211']._serialized_end=3077 + _globals['_SELFREFERENTIALREPEATED']._serialized_start=3080 + _globals['_SELFREFERENTIALREPEATED']._serialized_end=3336 + _globals['_SELFREFERENTIALMAP']._serialized_start=3339 + _globals['_SELFREFERENTIALMAP']._serialized_end=3716 + _globals['_SELFREFERENTIALMAP_CHILDRENENTRY']._serialized_start=3466 + _globals['_SELFREFERENTIALMAP_CHILDRENENTRY']._serialized_end=3563 +# @@protoc_insertion_point(module_scope) diff --git a/test/gen/tests/example/v1/validator_pb2.pyi b/test/gen/tests/example/v1/validator_pb2.pyi new file mode 100644 index 00000000..ab200077 --- /dev/null +++ b/test/gen/tests/example/v1/validator_pb2.pyi @@ -0,0 +1,211 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from ....buf.validate import validate_pb2 as _validate_pb2 +from google.protobuf import any_pb2 as _any_pb2 +from google.protobuf import api_pb2 as _api_pb2 +from google.protobuf import field_mask_pb2 as _field_mask_pb2 +from google.protobuf import timestamp_pb2 as _timestamp_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class HasMsgExprs(_message.Message): + __slots__ = ("x", "y") + X_FIELD_NUMBER: _ClassVar[int] + Y_FIELD_NUMBER: _ClassVar[int] + x: int + y: int + def __init__(self, x: _Optional[int] = ..., y: _Optional[int] = ...) -> None: ... + +class SelfRecursive(_message.Message): + __slots__ = ("x", "turtle") + X_FIELD_NUMBER: _ClassVar[int] + TURTLE_FIELD_NUMBER: _ClassVar[int] + x: int + turtle: SelfRecursive + def __init__(self, x: _Optional[int] = ..., turtle: _Optional[_Union[SelfRecursive, _Mapping]] = ...) -> None: ... + +class LoopRecursiveA(_message.Message): + __slots__ = ("b",) + B_FIELD_NUMBER: _ClassVar[int] + b: LoopRecursiveB + def __init__(self, b: _Optional[_Union[LoopRecursiveB, _Mapping]] = ...) -> None: ... + +class LoopRecursiveB(_message.Message): + __slots__ = ("a",) + A_FIELD_NUMBER: _ClassVar[int] + a: LoopRecursiveA + def __init__(self, a: _Optional[_Union[LoopRecursiveA, _Mapping]] = ...) -> None: ... + +class MsgHasOneof(_message.Message): + __slots__ = ("x", "y", "msg") + X_FIELD_NUMBER: _ClassVar[int] + Y_FIELD_NUMBER: _ClassVar[int] + MSG_FIELD_NUMBER: _ClassVar[int] + x: str + y: int + msg: HasMsgExprs + def __init__(self, x: _Optional[str] = ..., y: _Optional[int] = ..., msg: _Optional[_Union[HasMsgExprs, _Mapping]] = ...) -> None: ... + +class MsgHasRepeated(_message.Message): + __slots__ = ("x", "y", "z") + X_FIELD_NUMBER: _ClassVar[int] + Y_FIELD_NUMBER: _ClassVar[int] + Z_FIELD_NUMBER: _ClassVar[int] + x: _containers.RepeatedScalarFieldContainer[float] + y: _containers.RepeatedScalarFieldContainer[str] + z: _containers.RepeatedCompositeFieldContainer[HasMsgExprs] + def __init__(self, x: _Optional[_Iterable[float]] = ..., y: _Optional[_Iterable[str]] = ..., z: _Optional[_Iterable[_Union[HasMsgExprs, _Mapping]]] = ...) -> None: ... + +class MsgHasMap(_message.Message): + __slots__ = ("int32map", "string_map", "message_map") + class Int32mapEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: int + value: int + def __init__(self, key: _Optional[int] = ..., value: _Optional[int] = ...) -> None: ... + class StringMapEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: str + def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ... + class MessageMapEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: int + value: LoopRecursiveA + def __init__(self, key: _Optional[int] = ..., value: _Optional[_Union[LoopRecursiveA, _Mapping]] = ...) -> None: ... + INT32MAP_FIELD_NUMBER: _ClassVar[int] + STRING_MAP_FIELD_NUMBER: _ClassVar[int] + MESSAGE_MAP_FIELD_NUMBER: _ClassVar[int] + int32map: _containers.ScalarMap[int, int] + string_map: _containers.ScalarMap[str, str] + message_map: _containers.MessageMap[int, LoopRecursiveA] + def __init__(self, int32map: _Optional[_Mapping[int, int]] = ..., string_map: _Optional[_Mapping[str, str]] = ..., message_map: _Optional[_Mapping[int, LoopRecursiveA]] = ...) -> None: ... + +class TransitiveFieldRule(_message.Message): + __slots__ = ("mask",) + MASK_FIELD_NUMBER: _ClassVar[int] + mask: _field_mask_pb2.FieldMask + def __init__(self, mask: _Optional[_Union[_field_mask_pb2.FieldMask, _Mapping]] = ...) -> None: ... + +class MultipleStepsTransitiveFieldRules(_message.Message): + __slots__ = ("api",) + API_FIELD_NUMBER: _ClassVar[int] + api: _api_pb2.Api + def __init__(self, api: _Optional[_Union[_api_pb2.Api, _Mapping]] = ...) -> None: ... + +class Simple(_message.Message): + __slots__ = ("s",) + S_FIELD_NUMBER: _ClassVar[int] + s: str + def __init__(self, s: _Optional[str] = ...) -> None: ... + +class FieldOfTypeAny(_message.Message): + __slots__ = ("any",) + ANY_FIELD_NUMBER: _ClassVar[int] + any: _any_pb2.Any + def __init__(self, any: _Optional[_Union[_any_pb2.Any, _Mapping]] = ...) -> None: ... + +class CelMapOnARepeated(_message.Message): + __slots__ = ("values",) + class Value(_message.Message): + __slots__ = ("name",) + NAME_FIELD_NUMBER: _ClassVar[int] + name: str + def __init__(self, name: _Optional[str] = ...) -> None: ... + VALUES_FIELD_NUMBER: _ClassVar[int] + values: _containers.RepeatedCompositeFieldContainer[CelMapOnARepeated.Value] + def __init__(self, values: _Optional[_Iterable[_Union[CelMapOnARepeated.Value, _Mapping]]] = ...) -> None: ... + +class RepeatedItemCel(_message.Message): + __slots__ = ("paths",) + PATHS_FIELD_NUMBER: _ClassVar[int] + paths: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, paths: _Optional[_Iterable[str]] = ...) -> None: ... + +class OneTwo(_message.Message): + __slots__ = ("field1", "field2") + FIELD1_FIELD_NUMBER: _ClassVar[int] + FIELD2_FIELD_NUMBER: _ClassVar[int] + field1: F1 + field2: F2 + def __init__(self, field1: _Optional[_Union[F1, _Mapping]] = ..., field2: _Optional[_Union[F2, _Mapping]] = ...) -> None: ... + +class TwoOne(_message.Message): + __slots__ = ("field2", "field1") + FIELD2_FIELD_NUMBER: _ClassVar[int] + FIELD1_FIELD_NUMBER: _ClassVar[int] + field2: F2 + field1: F1 + def __init__(self, field2: _Optional[_Union[F2, _Mapping]] = ..., field1: _Optional[_Union[F1, _Mapping]] = ...) -> None: ... + +class F1(_message.Message): + __slots__ = ("need_this", "field") + NEED_THIS_FIELD_NUMBER: _ClassVar[int] + FIELD_FIELD_NUMBER: _ClassVar[int] + need_this: str + field: FieldWithIssue + def __init__(self, need_this: _Optional[str] = ..., field: _Optional[_Union[FieldWithIssue, _Mapping]] = ...) -> None: ... + +class F2(_message.Message): + __slots__ = ("field",) + FIELD_FIELD_NUMBER: _ClassVar[int] + field: FieldWithIssue + def __init__(self, field: _Optional[_Union[FieldWithIssue, _Mapping]] = ...) -> None: ... + +class FieldWithIssue(_message.Message): + __slots__ = ("f1", "name") + F1_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + f1: F1 + name: str + def __init__(self, f1: _Optional[_Union[F1, _Mapping]] = ..., name: _Optional[str] = ...) -> None: ... + +class Issue211(_message.Message): + __slots__ = ("value",) + VALUE_FIELD_NUMBER: _ClassVar[int] + value: _timestamp_pb2.Timestamp + def __init__(self, value: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class SelfReferentialRepeated(_message.Message): + __slots__ = ("children", "name") + CHILDREN_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + children: _containers.RepeatedCompositeFieldContainer[SelfReferentialRepeated] + name: str + def __init__(self, children: _Optional[_Iterable[_Union[SelfReferentialRepeated, _Mapping]]] = ..., name: _Optional[str] = ...) -> None: ... + +class SelfReferentialMap(_message.Message): + __slots__ = ("children", "name") + class ChildrenEntry(_message.Message): + __slots__ = ("key", "value") + KEY_FIELD_NUMBER: _ClassVar[int] + VALUE_FIELD_NUMBER: _ClassVar[int] + key: str + value: SelfReferentialMap + def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[SelfReferentialMap, _Mapping]] = ...) -> None: ... + CHILDREN_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + children: _containers.MessageMap[str, SelfReferentialMap] + name: str + def __init__(self, children: _Optional[_Mapping[str, SelfReferentialMap]] = ..., name: _Optional[str] = ...) -> None: ... diff --git a/test/proto/tests/example/v1/end_to_end.proto b/test/proto/tests/example/v1/end_to_end.proto new file mode 100644 index 00000000..29ee071e --- /dev/null +++ b/test/proto/tests/example/v1/end_to_end.proto @@ -0,0 +1,242 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// One message per rule, each with a single field `value` carrying the rule +// under test. + +syntax = "proto3"; + +package tests.example.v1; + +import "buf/validate/validate.proto"; + +enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_ACTIVE = 1; + STATUS_INACTIVE = 2; +} + +message Int32Gt { + int32 value = 1 [(buf.validate.field).int32.gt = 0]; +} + +message Int32Const { + int32 value = 1 [(buf.validate.field).int32.const = 5]; +} + +message Int32In { + int32 value = 1 [(buf.validate.field).int32 = { + in: [ + 1, + 2, + 3 + ] + }]; +} + +message Int32NotIn { + int32 value = 1 [(buf.validate.field).int32 = { + not_in: [7] + }]; +} + +message Int32GtLt { + int32 value = 1 [(buf.validate.field).int32 = { + gt: 0 + lt: 10 + }]; +} + +message Uint64Gte { + uint64 value = 1 [(buf.validate.field).uint64.gte = 10]; +} + +message DoubleLt { + double value = 1 [(buf.validate.field).double.lt = 100]; +} + +message StringMinLen { + string value = 1 [(buf.validate.field).string.min_len = 3]; +} + +message StringMinBytes { + string value = 1 [(buf.validate.field).string.min_bytes = 5]; +} + +message StringPrefix { + string value = 1 [(buf.validate.field).string.prefix = "hello"]; +} + +message StringSuffix { + string value = 1 [(buf.validate.field).string.suffix = "bar"]; +} + +message StringContains { + string value = 1 [(buf.validate.field).string.contains = "mid"]; +} + +message StringNotContains { + string value = 1 [(buf.validate.field).string.not_contains = "bad"]; +} + +message StringConst { + string value = 1 [(buf.validate.field).string.const = "a"]; +} + +message StringIn { + string value = 1 [(buf.validate.field).string = { + in: [ + "a", + "b" + ] + }]; +} + +message StringNotIn { + string value = 1 [(buf.validate.field).string = { + not_in: ["z"] + }]; +} + +message StringPattern { + string value = 1 [(buf.validate.field).string.pattern = "^[a-z]+$"]; +} + +message StringEmail { + string value = 1 [(buf.validate.field).string.email = true]; +} + +message StringUuid { + string value = 1 [(buf.validate.field).string.uuid = true]; +} + +message StringHeaderName { + string value = 1 [(buf.validate.field).string = { + well_known_regex: KNOWN_REGEX_HTTP_HEADER_NAME + strict: true + }]; +} + +message BoolConst { + bool value = 1 [(buf.validate.field).bool.const = true]; +} + +message BytesConst { + bytes value = 1 [(buf.validate.field).bytes.const = "\x01"]; +} + +message BytesIn { + bytes value = 1 [(buf.validate.field).bytes = { + in: [ + "\x01", + "\x02" + ] + }]; +} + +message BytesNotIn { + bytes value = 1 [(buf.validate.field).bytes = { + not_in: ["\x07"] + }]; +} + +message BytesMinLen { + bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; +} + +message BytesPrefix { + bytes value = 1 [(buf.validate.field).bytes.prefix = "\x0a"]; +} + +message BytesIp { + bytes value = 1 [(buf.validate.field).bytes.ip = true]; +} + +message RepeatedMinItems { + repeated int32 value = 1 [(buf.validate.field).repeated.min_items = 2]; +} + +message RepeatedMaxItems { + repeated int32 value = 1 [(buf.validate.field).repeated.max_items = 2]; +} + +message RepeatedUnique { + repeated int32 value = 1 [(buf.validate.field).repeated.unique = true]; +} + +message RepeatedUniqueItems { + repeated int32 value = 1 [(buf.validate.field).repeated = { + unique: true + items: { + int32: {gte: 2} + } + }]; +} + +message RepeatedUniqueMaxItems { + repeated int32 value = 1 [(buf.validate.field).repeated = { + unique: true + max_items: 3 + items: { + int32: {gte: 2} + } + }]; +} + +message MapMaxPairs { + map entries = 1 [(buf.validate.field).map.max_pairs = 2]; +} + +message EnumConst { + Status value = 1 [(buf.validate.field).enum.const = 1]; +} + +message EnumIn { + Status value = 1 [(buf.validate.field).enum = { + in: [ + 1, + 2 + ] + }]; +} + +message EnumNotIn { + Status value = 1 [(buf.validate.field).enum = { + not_in: [0] + }]; +} + +message EnumDefinedOnlyIn { + Status value = 1 [(buf.validate.field).enum = { + defined_only: true + in: [ + 1, + 2 + ] + }]; +} + +message EnumDefinedOnlyConst { + Status value = 1 [(buf.validate.field).enum = { + defined_only: true + const: 1 + }]; +} + +message EnumDefinedOnlyNotIn { + Status value = 1 [(buf.validate.field).enum = { + defined_only: true + not_in: [0] + }]; +} diff --git a/test/proto/tests/example/v1/predefined.proto b/test/proto/tests/example/v1/predefined.proto new file mode 100644 index 00000000..5084d923 --- /dev/null +++ b/test/proto/tests/example/v1/predefined.proto @@ -0,0 +1,63 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Messages with predefined rules, declared as extensions of the standard +// rules. + +syntax = "proto2"; + +package tests.example.v1; + +import "buf/validate/validate.proto"; +import "google/protobuf/field_mask.proto"; + +message Issue148 { + optional int32 test = 1 [ + (buf.validate.field).int32.(abs_not_in) = 1, + (buf.validate.field).int32.(abs_not_in) = -2 + ]; +} + +message Issue187 { + optional bool false_field = 1 [(buf.validate.field).bool.(this_equals_rule) = false]; + optional bool true_field = 2 [(buf.validate.field).bool.(this_equals_rule) = true]; +} + +extend buf.validate.Int32Rules { + repeated int32 abs_not_in = 1800 [(buf.validate.predefined).cel = { + id: "int32.abs_not_in" + expression: "this in rule || this in rule.map(n, -n)" + message: "value must not be in absolute value of list" + }]; +} + +extend buf.validate.BoolRules { + optional bool this_equals_rule = 1800 [(buf.validate.predefined).cel = { + id: "bool.this_equals_rule" + expression: "this == rule ? '' : 'this = %s, rule = %s'.format([string(this), string(rule)])" + }]; +} + +message Issue296 { + optional google.protobuf.FieldMask fm = 1 [(buf.validate.field).field_mask.(fm_rules_extension) = { + paths: ["a"] + }]; +} + +extend buf.validate.FieldMaskRules { + optional google.protobuf.FieldMask fm_rules_extension = 1801 [(buf.validate.predefined).cel = { + id: "field_mask.fm_rules_extension" + expression: "this == rule" + }]; +} diff --git a/test/proto/tests/example/v1/rules.proto b/test/proto/tests/example/v1/rules.proto new file mode 100644 index 00000000..f0aec643 --- /dev/null +++ b/test/proto/tests/example/v1/rules.proto @@ -0,0 +1,71 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Messages combining several rules on one field, and `unique` over each +// scalar type. + +syntax = "proto3"; + +package tests.example.v1; + +import "buf/validate/validate.proto"; + +message BenchTestBytes { + bytes b1 = 1 [(buf.validate.field).bytes = { + not_in: [ + "\x32\x33", + "\x34\x35", + "\x36\x37" + ] + min_len: 1 + max_len: 4 + }]; + bytes b = 4 [(buf.validate.field).bytes = { + in: [ + "\x32\x33", + "\x34\x35", + "\x36\x37" + ] + min_len: 2 + max_len: 2 + }]; +} + +enum TestEnum { + TEST_ENUM_UNSPECIFIED = 0; + TEST_ENUM_VAL1 = 1; + TEST_ENUM_VAL2 = 2; + TEST_ENUM_VAL3 = 3; +} + +message TestUnique { + repeated TestEnum enums = 1 [(buf.validate.field).repeated.unique = true]; + repeated bytes bytes = 2 [(buf.validate.field).repeated.unique = true]; + repeated string strings = 3 [(buf.validate.field).repeated.unique = true]; +} + +message TestByteBroken { + bytes broken = 1 [ + (buf.validate.field).bytes.min_len = 5, + (buf.validate.field).bytes.max_len = 10, + (buf.validate.field).bytes.uuid = true + ]; +} + +message MultiRule { + int64 many = 1 [ + (buf.validate.field).int64.const = 10, + (buf.validate.field).int64.gt = 5 + ]; +} diff --git a/test/proto/tests/example/v1/validations.proto b/test/proto/tests/example/v1/validations.proto index f69c299f..93c401a7 100644 --- a/test/proto/tests/example/v1/validations.proto +++ b/test/proto/tests/example/v1/validations.proto @@ -17,7 +17,10 @@ syntax = "proto3"; package tests.example.v1; import "buf/validate/validate.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "tests/example/v1/rules.proto"; message MultipleValidations { string title = 1 [(buf.validate.field).string.prefix = "foo"]; @@ -129,3 +132,124 @@ message ConcatenatedValues { repeated string bar = 1; repeated string baz = 2; } + +// A rule that does not compile is reported when a validation reaches it. +message NestedMistypedRule { + ProtovalidateMistypedRule child = 1; +} + +message MessageRuleError { + option (buf.validate.message).cel = { + id: "message_rule_error" + expression: "1 +" + }; +} + +message NestedMessageRuleError { + MessageRuleError child = 1; +} + +message ViolationBeforeError { + string a = 1 [(buf.validate.field).string.min_len = 5]; + string b = 2 [(buf.validate.field).duration.gt = {seconds: 1}]; +} + +// A repeated or map field takes only `repeated` or `map` rules; rules for +// its elements' type do not compile. +message RepeatedFieldScalarRule { + repeated string val = 1 [(buf.validate.field).string.min_len = 3]; +} + +message RepeatedFieldWrapperRule { + repeated google.protobuf.Int32Value val = 1 [(buf.validate.field).int32.gt = 10]; +} + +message RepeatedFieldEnumRule { + repeated TestEnum val = 1 [(buf.validate.field).enum.defined_only = true]; +} + +message RepeatedFieldDurationRule { + repeated google.protobuf.Duration val = 1 [(buf.validate.field).duration.gt = {seconds: 1}]; +} + +message MapFieldScalarRule { + map val = 1 [(buf.validate.field).string.min_len = 3]; +} + +// `unique` compares scalars only, so it does not compile for messages. +message RepeatedUniqueMessages { + repeated Embed val = 1 [(buf.validate.field).repeated.unique = true]; +} + +// In CEL the same call cannot be rejected until it runs. +message CelUniqueMessages { + repeated Embed val = 1 [(buf.validate.field).cel = { + id: "unique_messages" + message: "must be unique" + expression: "this.unique()" + }]; +} + +// 10000-01-01T00:00:00Z, past the range a Timestamp allows. +message TimestampOutOfRange { + google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.const = {seconds: 253402300800}]; +} + +message TimestampRuleOrder { + google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp = { + const: {seconds: 1} + lt_now: true + }]; +} + +message EnumRuleOrder { + TestEnum val = 1 [(buf.validate.field).enum = { + const: 1 + defined_only: true + in: [1] + not_in: [5] + }]; +} + +message Hostname { + string val = 1 [(buf.validate.field).string.hostname = true]; +} + +message DoubleInfinity { + double val = 1 [(buf.validate.field).double.const = inf]; +} + +message DoubleInfiniteRange { + double val = 1 [(buf.validate.field).double = { + gt: -inf + lt: inf + }]; +} + +// Patterns are RE2: `\d` is ASCII only, `\Q...\E` quotes literal text, +// and repeat counts are capped at 1000. +message PatternAsciiDigits { + string val = 1 [(buf.validate.field).string.pattern = "^\\d+$"]; +} + +message PatternQuotedLiteral { + string val = 1 [(buf.validate.field).string.pattern = "^\\Qa.c\\E$"]; +} + +message PatternRepeatTooLarge { + string val = 1 [(buf.validate.field).string.pattern = "a{1001}"]; +} + +// A wrapper element stands for the scalar it holds, so `unique` compares +// the inner values. +message UniqueWrappers { + repeated google.protobuf.Int32Value val = 1 [(buf.validate.field).repeated.unique = true]; +} + +message CelUniqueWrappers { + repeated google.protobuf.Int32Value val = 1 [(buf.validate.field).cel = { + id: "unique_wrappers" + message: "must be unique" + expression: "this.unique()" + }]; +} diff --git a/test/proto/tests/example/v1/validator.proto b/test/proto/tests/example/v1/validator.proto new file mode 100644 index 00000000..4db7d2a0 --- /dev/null +++ b/test/proto/tests/example/v1/validator.proto @@ -0,0 +1,227 @@ +// Copyright (c) 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Messages exercising custom CEL rules on messages, fields, oneofs and +// containers, well-known types, recursion, and past regressions. + +syntax = "proto3"; + +package tests.example.v1; + +import "buf/validate/validate.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +message HasMsgExprs { + option (buf.validate.message).cel = { + id: "x_lt_y" + message: "x must be less than y" + expression: "this.x < this.y" + }; + + option (buf.validate.message).cel = { + id: "y_gt_42" + expression: + "this.y > 42 ? ''" + ": 'y must be greater than 42'" + }; + + int32 x = 1 [ + (buf.validate.field).cel = { + id: "x_even" + message: "x must be even" + expression: "this % 2 == 0" + }, + (buf.validate.field).cel = { + id: "x_coprime_3" + expression: + "this % 3 != 0 ? ''" + ": 'x must not be divisible by 3'" + } + ]; + int32 y = 2; +} + +message SelfRecursive { + option (buf.validate.message).cel = { + id: "unique_turtles" + message: "adjacent turtles must be unique" + expression: "this.x != this.turtle.x" + }; + + int32 x = 1; + SelfRecursive turtle = 2 [(buf.validate.field).cel = { + id: "non_zero_baby_turtle" + message: "embedded turtle's x value must not be zero" + expression: "this.x > 0" + }]; +} + +message LoopRecursiveA { + LoopRecursiveB b = 1; +} + +message LoopRecursiveB { + LoopRecursiveA a = 1; +} + +message MsgHasOneof { + option (buf.validate.message).cel = { + id: "test x" + expression: + "this.x == '' ? '' : \n" + "!this.x.startsWith('foo') ? 'does not have prefix `foo`' : ''" + }; + + option (buf.validate.message).cel = { + id: "text y" + expression: "this.y >= 0" + }; + + oneof o { + option (buf.validate.oneof).required = true; + string x = 1 [(buf.validate.field).string.prefix = "foo"]; + int32 y = 2 [(buf.validate.field).int32.gt = 0]; + HasMsgExprs msg = 3; + } +} + +message MsgHasRepeated { + repeated float x = 1 [(buf.validate.field).repeated = { + max_items: 3 + min_items: 1 + items: { + cel: { + expression: "true" + message: "intentional false" + } + float: {gt: 0} + } + unique: true + }]; + repeated string y = 2 [(buf.validate.field).repeated.unique = true]; + repeated HasMsgExprs z = 3 [(buf.validate.field).repeated = {max_items: 2}]; +} + +message MsgHasMap { + map int32map = 1 [(buf.validate.field).map = { + min_pairs: 3 + keys: { + int32: {gt: 0} + } + values: { + int32: {lt: 0} + } + }]; + map string_map = 2 [(buf.validate.field).map = {max_pairs: 1}]; + map message_map = 3 [(buf.validate.field).map = {min_pairs: 2}]; +} + +message TransitiveFieldRule { + google.protobuf.FieldMask mask = 1 [(buf.validate.field).cel = { + id: "mask.paths" + message: "mask.paths must not be empty" + expression: "has(this.paths)" + }]; +} + +message MultipleStepsTransitiveFieldRules { + google.protobuf.Api api = 1 [(buf.validate.field).cel = { + id: "api.source_context.file_name" + message: "api's source context file name must not be empty" + expression: "has(this.source_context.file_name)" + }]; +} + +message Simple { + string s = 1; +} + +message FieldOfTypeAny { + google.protobuf.Any any = 1 [(buf.validate.field).cel = { + id: "any_type" + message: "this should never fail" + expression: "this == this" + }]; +} + +message CelMapOnARepeated { + repeated Value values = 1 [(buf.validate.field).cel = { + id: "env.vars.unique" + expression: "this.map(v, v.name).unique() ? '' : 'value names must be unique'" + }]; + + message Value { + string name = 1; + } +} + +message RepeatedItemCel { + repeated string paths = 1 [(buf.validate.field).repeated.items.cel = { + id: "paths.no_space" + expression: "!this.startsWith(' ')" + }]; +} + +message OneTwo { + F1 field1 = 1; + F2 field2 = 2; +} + +message TwoOne { + F2 field2 = 1; + F1 field1 = 2; +} + +message F1 { + string need_this = 1; + FieldWithIssue field = 2; +} + +message F2 { + FieldWithIssue field = 1; +} + +message FieldWithIssue { + F1 f1 = 1; + string name = 2 [(buf.validate.field).string.min_len = 1]; +} + +message Issue211 { + google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gt_now = true]; +} + +message SelfReferentialRepeated { + repeated SelfReferentialRepeated children = 1; + optional string name = 2; + + option (buf.validate.message).cel = { + id: "children_must_have_name" + message: "All children must have a name" + expression: "size(this.children) == 0 || this.children.all(c, has(c.name))" + }; +} + +message SelfReferentialMap { + map children = 1; + optional string name = 2; + + option (buf.validate.message).cel = { + id: "children_must_have_name" + message: "All children must have a name" + expression: "size(this.children) == 0 || this.children.all(k, has(this.children[k].name))" + }; +} diff --git a/test/test_concurrency.py b/test/test_concurrency.py index dd03846e..5d8510b9 100644 --- a/test/test_concurrency.py +++ b/test/test_concurrency.py @@ -14,6 +14,7 @@ from __future__ import annotations +import sys import threading from test.conftest import make_validator @@ -38,6 +39,11 @@ def test_concurrent_first_use() -> None: messages = [BenchScalar(x=42), BenchMap(entries={"k": "v"}), MultiRule(many=1)] barrier = threading.Barrier(THREADS) errors: list[Exception] = [] + # Switch threads as often as possible, so that any lock held while Python + # code runs is contended during that time, not just when timing happens + # to line up. + switch_interval = sys.getswitchinterval() + sys.setswitchinterval(1e-6) def run() -> None: try: @@ -51,9 +57,12 @@ def run() -> None: errors.append(e) threads = [threading.Thread(target=run, daemon=True) for _ in range(THREADS)] - for thread in threads: - thread.start() - for thread in threads: - thread.join(timeout=60) + try: + for thread in threads: + thread.start() + for thread in threads: + thread.join(timeout=60) + finally: + sys.setswitchinterval(switch_interval) assert not errors assert all(not thread.is_alive() for thread in threads) diff --git a/test/test_examples.py b/test/test_examples.py new file mode 100644 index 00000000..6b11429d --- /dev/null +++ b/test/test_examples.py @@ -0,0 +1,496 @@ +# Copyright (c) 2023-2026 Buf Technologies, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Validator tests over the example messages. + +Each test builds a message, runs the validator and checks the outcome: valid, +the violations in order, or the kind of error. +""" + +from __future__ import annotations + +import time +from typing import Any as AnyType + +import protobuf +import pytest +from protobuf import Oneof +from protobuf.wkt import Any, Api, FieldMask, SourceContext, Timestamp + +import protovalidate +from protovalidate import Violation + +from ._utils import ValidatorProtocol, check_valid +from .conftest import make_validator +from .gen.tests.example.v1 import end_to_end_pb, predefined_pb, rules_pb, validator_pb + +validators: list[ValidatorProtocol] = [ + protovalidate, # global module singleton + make_validator(), +] + + +def check_invalid( + validator: ValidatorProtocol, msg: protobuf.Message +) -> list[Violation]: + """Asserts that the message has violations and returns them.""" + with pytest.raises(protovalidate.ValidationError): + validator.validate(msg) + violations = validator.collect_violations(msg) + assert len(violations) > 0 + return violations + + +def rule_ids(violations: list[Violation]) -> list[str]: + return [violation.proto.rule_id for violation in violations] + + +# Custom CEL rules, oneofs, containers, well-known types and recursion + + +@pytest.mark.parametrize("validator", validators) +def test_has_msg_exprs(validator: ValidatorProtocol) -> None: + check_valid(validator, validator_pb.HasMsgExprs(x=2, y=43)) + check_invalid(validator, validator_pb.HasMsgExprs(x=9, y=8)) + + +@pytest.mark.parametrize("validator", validators) +def test_recursive(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.SelfRecursive(x=123, turtle=validator_pb.SelfRecursive(x=456)), + ) + check_valid(validator, validator_pb.LoopRecursiveA(b=validator_pb.LoopRecursiveB())) + + +@pytest.mark.parametrize("validator", validators) +def test_oneof(validator: ValidatorProtocol) -> None: + check_valid(validator, validator_pb.MsgHasOneof(o=Oneof(field="x", value="foo"))) + check_valid(validator, validator_pb.MsgHasOneof(o=Oneof(field="y", value=42))) + check_valid( + validator, + validator_pb.MsgHasOneof( + o=Oneof(field="msg", value=validator_pb.HasMsgExprs(x=4, y=50)) + ), + ) + check_invalid(validator, validator_pb.MsgHasOneof()) + + +@pytest.mark.parametrize("validator", validators) +def test_repeated(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.MsgHasRepeated( + x=[1, 2, 3], + y=["foo", "bar"], + z=[ + validator_pb.HasMsgExprs(x=4, y=55), + validator_pb.HasMsgExprs(x=4, y=60), + ], + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_map(validator: ValidatorProtocol) -> None: + check_invalid( + validator, + validator_pb.MsgHasMap( + int32map={-1: 1, 2: 2}, + string_map={"foo": "foo", "bar": "bar", "baz": "baz"}, + message_map={0: validator_pb.LoopRecursiveA()}, + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_transitive_field_rules(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.TransitiveFieldRule(mask=FieldMask(paths=["foo", "bar"])), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_multiple_steps_transitive_field_rules(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.MultipleStepsTransitiveFieldRules( + api=Api(source_context=SourceContext(file_name="path/file")) + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_field_of_type_any(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.FieldOfTypeAny(any=Any.pack(validator_pb.Simple(s="foo"))), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_cel_map_on_a_repeated(validator: ValidatorProtocol) -> None: + values = [ + validator_pb.CelMapOnARepeated.Value(name=n) for n in ("foo", "bar", "baz") + ] + check_valid(validator, validator_pb.CelMapOnARepeated(values=values)) + values.append(validator_pb.CelMapOnARepeated.Value(name="foo")) + check_invalid(validator, validator_pb.CelMapOnARepeated(values=values)) + + +@pytest.mark.parametrize("validator", validators) +def test_repeated_item_cel(validator: ValidatorProtocol) -> None: + check_valid(validator, validator_pb.RepeatedItemCel(paths=["foo"])) + violations = check_invalid( + validator, validator_pb.RepeatedItemCel(paths=["foo", " bar"]) + ) + assert violations[0].proto.rule_id == "paths.no_space" + + +@pytest.mark.parametrize("validator", validators) +def test_issue211(validator: ValidatorProtocol) -> None: + check_valid( + validator, validator_pb.Issue211(value=Timestamp(seconds=int(time.time()) + 60)) + ) + + +@pytest.mark.parametrize("validator", validators) +def test_issue141(validator: ValidatorProtocol) -> None: + check_invalid(validator, validator_pb.FieldWithIssue()) + check_invalid( + validator, + validator_pb.OneTwo( + field1=validator_pb.F1(field=validator_pb.FieldWithIssue()) + ), + ) + check_invalid( + validator, + validator_pb.TwoOne( + field1=validator_pb.F1(field=validator_pb.FieldWithIssue()) + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_issue148(validator: ValidatorProtocol) -> None: + check_valid(validator, predefined_pb.Issue148(test=1)) + + +@pytest.mark.parametrize("validator", validators) +def test_issue187(validator: ValidatorProtocol) -> None: + check_valid(validator, predefined_pb.Issue187(false_field=False, true_field=True)) + + +@pytest.mark.parametrize("validator", validators) +def test_issue307_map(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.SelfReferentialMap( + name="child", + children={ + "a": validator_pb.SelfReferentialMap(name="child"), + "b": validator_pb.SelfReferentialMap(name="child"), + }, + ), + ) + check_invalid( + validator, + validator_pb.SelfReferentialMap( + name="parent", + children={ + "a": validator_pb.SelfReferentialMap(name="parent"), + "b": validator_pb.SelfReferentialMap(), + }, + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_issue307_repeated(validator: ValidatorProtocol) -> None: + check_valid( + validator, + validator_pb.SelfReferentialRepeated( + name="child", + children=[ + validator_pb.SelfReferentialRepeated(name="child"), + validator_pb.SelfReferentialRepeated(name="child"), + ], + ), + ) + check_invalid( + validator, + validator_pb.SelfReferentialRepeated( + name="parent", + children=[ + validator_pb.SelfReferentialRepeated(name="parent"), + validator_pb.SelfReferentialRepeated(), + ], + ), + ) + + +@pytest.mark.parametrize("validator", validators) +def test_issue296(validator: ValidatorProtocol) -> None: + check_valid(validator, predefined_pb.Issue296(fm=FieldMask(paths=["a"]))) + + +# Several rules on one field, and uniqueness + + +@pytest.mark.parametrize("validator", validators) +def test_native_bytes(validator: ValidatorProtocol) -> None: + violations = check_invalid( + validator, rules_pb.BenchTestBytes(b1=b"\x32\x33", b=b"\x03\x04") + ) + assert [ + (v.proto.field.elements[0].field_name, v.proto.message) for v in violations + ] == [ + ("b1", "must not be in list [23, 45, 67]"), + ("b", "must be in list [23, 45, 67]"), + ] + + +@pytest.mark.parametrize("validator", validators) +def test_native_bytes_broken(validator: ValidatorProtocol) -> None: + violations = check_invalid( + validator, rules_pb.TestByteBroken(broken=b"greetings and salutations") + ) + assert len(violations) == 2 + + +@pytest.mark.parametrize("validator", validators) +def test_native_unique_enums(validator: ValidatorProtocol) -> None: + check_invalid(validator, rules_pb.TestUnique(enums=[1, 1, 2, 3])) + check_valid(validator, rules_pb.TestUnique(enums=[1, 2, 3])) + + +@pytest.mark.parametrize("validator", validators) +def test_native_unique_strings(validator: ValidatorProtocol) -> None: + check_invalid(validator, rules_pb.TestUnique(strings=["a", "b", "a"])) + check_valid(validator, rules_pb.TestUnique(strings=["a", "b", "c"])) + + +@pytest.mark.parametrize("validator", validators) +def test_native_unique_bytes(validator: ValidatorProtocol) -> None: + check_invalid(validator, rules_pb.TestUnique(bytes=[b"a", b"b", b"a"])) + check_valid(validator, rules_pb.TestUnique(bytes=[b"a", b"b", b"c"])) + + +@pytest.mark.parametrize("validator", validators) +def test_multi_rule(validator: ValidatorProtocol) -> None: + violations = check_invalid(validator, rules_pb.MultiRule(many=1)) + assert len(violations) == 2 + assert violations[0].field_value == 1 + + +# One rule per message: a good value, then a bad one with its violation + +END_TO_END: list[tuple[type[protobuf.Message], AnyType, AnyType, str, str]] = [ + (end_to_end_pb.Int32Gt, 1, 0, "int32.gt", "must be greater than 0"), + ( + end_to_end_pb.Uint64Gte, + 10, + 9, + "uint64.gte", + "must be greater than or equal to 10", + ), + (end_to_end_pb.DoubleLt, 50.0, 100.0, "double.lt", "must be less than 100"), + ( + end_to_end_pb.StringMinLen, + "abc", + "ab", + "string.min_len", + "must be at least 3 characters", + ), + ( + end_to_end_pb.StringPrefix, + "hello world", + "world", + "string.prefix", + "does not have prefix `hello`", + ), + (end_to_end_pb.BoolConst, True, False, "bool.const", "must equal true"), + ( + end_to_end_pb.BytesMinLen, + b"\x01\x02", + b"\x01", + "bytes.min_len", + "must be at least 2 bytes", + ), + ( + end_to_end_pb.RepeatedMinItems, + [1, 2, 3], + [1], + "repeated.min_items", + "must contain at least 2 item(s)", + ), + ( + end_to_end_pb.RepeatedMaxItems, + [1], + [1, 2, 3], + "repeated.max_items", + "must contain no more than 2 item(s)", + ), + ( + end_to_end_pb.RepeatedUnique, + [1, 2, 3], + [1, 2, 1], + "repeated.unique", + "repeated value must contain unique items", + ), + ( + end_to_end_pb.RepeatedUniqueItems, + [2, 4, 6], + [2, 1, 3], + "int32.gte", + "must be greater than or equal to 2", + ), + ( + end_to_end_pb.RepeatedUniqueMaxItems, + [2, 4, 6], + [2, 6, 3, 5], + "repeated.max_items", + "must contain no more than 3 item(s)", + ), + (end_to_end_pb.EnumConst, 1, 2, "enum.const", "must equal 1"), + (end_to_end_pb.EnumIn, 1, 3, "enum.in", "must be in list [1, 2]"), +] + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize(("msg_type", "good", "bad", "rule_id", "message"), END_TO_END) +def test_end_to_end( + validator: ValidatorProtocol, + msg_type: type[protobuf.Message], + good: AnyType, + bad: AnyType, + rule_id: str, + message: str, +) -> None: + check_valid(validator, msg_type(value=good)) + violations = check_invalid(validator, msg_type(value=bad)) + assert [(v.proto.rule_id, v.proto.message) for v in violations] == [ + (rule_id, message) + ] + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize( + ("msg_type", "good", "bad", "rule_id", "message"), + [ + ( + end_to_end_pb.MapMaxPairs, + {"a": "1", "b": "2"}, + {"a": "1", "b": "2", "c": "3"}, + "map.max_pairs", + "map must be at most 2 entries", + ) + ], +) +def test_end_to_end_map( + validator: ValidatorProtocol, + msg_type: type[protobuf.Message], + good: dict[str, str], + bad: dict[str, str], + rule_id: str, + message: str, +) -> None: + check_valid(validator, msg_type(entries=good)) + violations = check_invalid(validator, msg_type(entries=bad)) + assert [(v.proto.rule_id, v.proto.message) for v in violations] == [ + (rule_id, message) + ] + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize( + ("msg_type", "value", "expected"), + [ + (end_to_end_pb.EnumDefinedOnlyIn, 1, []), + (end_to_end_pb.EnumDefinedOnlyIn, 0, ["enum.in"]), + (end_to_end_pb.EnumDefinedOnlyIn, 99, ["enum.defined_only", "enum.in"]), + (end_to_end_pb.EnumDefinedOnlyConst, 1, []), + (end_to_end_pb.EnumDefinedOnlyConst, 2, ["enum.const"]), + (end_to_end_pb.EnumDefinedOnlyConst, 99, ["enum.const", "enum.defined_only"]), + (end_to_end_pb.EnumDefinedOnlyNotIn, 1, []), + (end_to_end_pb.EnumDefinedOnlyNotIn, 0, ["enum.not_in"]), + (end_to_end_pb.EnumDefinedOnlyNotIn, 99, ["enum.defined_only"]), + ], +) +def test_enum_combined_rules( + validator: ValidatorProtocol, + msg_type: type[protobuf.Message], + value: int, + expected: list[str], +) -> None: + """`defined_only` combined with another enum rule, in validate.proto's order.""" + assert rule_ids(validator.collect_violations(msg_type(value=value))) == expected + + +# One bad value per rule, checking the rule id and the rule value a violation +# reports. + +RULE_VALUES: list[tuple[type[protobuf.Message], AnyType, str, AnyType]] = [ + (end_to_end_pb.Int32Const, 4, "int32.const", 5), + (end_to_end_pb.Int32In, 9, "int32.in", [1, 2, 3]), + (end_to_end_pb.Int32NotIn, 7, "int32.not_in", [7]), + (end_to_end_pb.Int32Gt, -1, "int32.gt", 0), + (end_to_end_pb.Int32GtLt, 20, "int32.gt_lt", 0), + (end_to_end_pb.StringConst, "b", "string.const", "a"), + (end_to_end_pb.StringIn, "z", "string.in", ["a", "b"]), + (end_to_end_pb.StringNotIn, "z", "string.not_in", ["z"]), + (end_to_end_pb.StringPrefix, "bar", "string.prefix", "hello"), + (end_to_end_pb.StringSuffix, "foo", "string.suffix", "bar"), + (end_to_end_pb.StringContains, "absent", "string.contains", "mid"), + (end_to_end_pb.StringNotContains, "badger", "string.not_contains", "bad"), + (end_to_end_pb.StringPattern, "123", "string.pattern", "^[a-z]+$"), + (end_to_end_pb.StringMinLen, "ab", "string.min_len", 3), + (end_to_end_pb.StringMinBytes, "ab", "string.min_bytes", 5), + (end_to_end_pb.StringEmail, "not-an-email", "string.email", True), + (end_to_end_pb.StringUuid, "not-a-uuid", "string.uuid", True), + ( + end_to_end_pb.StringHeaderName, + "bad header", + "string.well_known_regex.header_name", + 1, + ), + (end_to_end_pb.BytesConst, b"\x02", "bytes.const", b"\x01"), + (end_to_end_pb.BytesIn, b"\x09", "bytes.in", [b"\x01", b"\x02"]), + (end_to_end_pb.BytesNotIn, b"\x07", "bytes.not_in", [b"\x07"]), + (end_to_end_pb.BytesMinLen, b"\x01", "bytes.min_len", 2), + (end_to_end_pb.BytesPrefix, b"\x0b", "bytes.prefix", b"\x0a"), + (end_to_end_pb.BytesIp, b"\x01\x02\x03", "bytes.ip", True), + (end_to_end_pb.BoolConst, False, "bool.const", True), + (end_to_end_pb.RepeatedMinItems, [1], "repeated.min_items", 2), + (end_to_end_pb.RepeatedUnique, [1, 1], "repeated.unique", True), + (end_to_end_pb.EnumConst, 2, "enum.const", 1), + (end_to_end_pb.EnumIn, 0, "enum.in", [1, 2]), + (end_to_end_pb.EnumNotIn, 0, "enum.not_in", [0]), +] + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize(("msg_type", "bad", "rule_id", "rule_value"), RULE_VALUES) +def test_rule_values( + validator: ValidatorProtocol, + msg_type: type[protobuf.Message], + bad: AnyType, + rule_id: str, + rule_value: AnyType, +) -> None: + violations = check_invalid(validator, msg_type(value=bad)) + assert len(violations) == 1 + assert violations[0].proto.rule_id == rule_id + assert violations[0].rule_value == rule_value diff --git a/test/test_validate.py b/test/test_validate.py index 7edfc461..9cec26fd 100644 --- a/test/test_validate.py +++ b/test/test_validate.py @@ -14,9 +14,12 @@ from __future__ import annotations +import math + import protobuf import pytest from protobuf import Oneof +from protobuf.wkt import Duration, Int32Value, Timestamp import protovalidate from protovalidate import Violation @@ -121,7 +124,7 @@ def test_protovalidate_oneof_unknown_field_name(validator: ValidatorProtocol) -> check_compilation_errors( validator, msg, - 'field "xxx" not found in message tests.example.v1.ProtovalidateOneofUnknownFieldName', + "field xxx not found in message tests.example.v1.ProtovalidateOneofUnknownFieldName", ) @@ -131,7 +134,9 @@ def test_protovalidate_mistyped_rule(validator: ValidatorProtocol) -> None: msg = validations_pb.ProtovalidateMistypedRule() check_compilation_errors( - validator, msg, "duration field validator on non-duration field" + validator, + msg, + 'expected rule "buf.validate.FieldRules.string", got "buf.validate.FieldRules.duration" on field "tests.example.v1.ProtovalidateMistypedRule.val"', ) @@ -236,3 +241,199 @@ def check_invalid( # Test collect_violations violations = validator.collect_violations(msg) compare_violations(violations, expected) + + +@pytest.mark.parametrize("validator", validators) +def test_nested_compilation_error_reached_lazily(validator: ValidatorProtocol) -> None: + """A nested type's rule that does not compile fails only a validation that reaches it.""" + check_valid(validator, validations_pb.NestedMistypedRule()) + + check_compilation_errors( + validator, + validations_pb.NestedMistypedRule( + child=validations_pb.ProtovalidateMistypedRule() + ), + 'expected rule "buf.validate.FieldRules.string", got "buf.validate.FieldRules.duration" on field "tests.example.v1.ProtovalidateMistypedRule.val"', + ) + + +@pytest.mark.parametrize("validator", validators) +def test_nested_message_rule_error(validator: ValidatorProtocol) -> None: + """A field whose message type's own rules do not compile fails with that, set or not.""" + msg = validations_pb.NestedMessageRuleError() + + with pytest.raises(protovalidate.CompilationError) as exc_info: + validator.validate(msg) + assert str(exc_info.value).startswith( + "failed to compile embedded type tests.example.v1.MessageRuleError " + "for tests.example.v1.NestedMessageRuleError.child: " + ) + + +@pytest.mark.parametrize("validator", validators) +def test_violation_before_compilation_error(validator: ValidatorProtocol) -> None: + """A compilation error is reported when its field is reached, so failing fast on an earlier violation never gets there.""" + msg = validations_pb.ViolationBeforeError(a="x") + + expected_violation = Violation( + message="must be at least 5 characters", + rule_id="string.min_len", + field_value="x", + rule_value=5, + ) + + violations = validator.collect_violations(msg, fail_fast=True) + compare_violations(violations, [expected_violation]) + + check_compilation_errors( + validator, + msg, + 'expected rule "buf.validate.FieldRules.string", ' + 'got "buf.validate.FieldRules.duration" ' + 'on field "tests.example.v1.ViolationBeforeError.b"', + ) + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize( + ("msg", "expected"), + [ + ( + validations_pb.RepeatedFieldScalarRule(val=["abcd"]), + 'expected rule "buf.validate.FieldRules.repeated", got "buf.validate.FieldRules.string" on field "tests.example.v1.RepeatedFieldScalarRule.val"', + ), + ( + validations_pb.RepeatedFieldWrapperRule(val=[Int32Value(value=100)]), + 'expected rule "buf.validate.FieldRules.repeated", got "buf.validate.FieldRules.int32" on field "tests.example.v1.RepeatedFieldWrapperRule.val"', + ), + ( + validations_pb.RepeatedFieldEnumRule(val=[1]), + 'expected rule "buf.validate.FieldRules.repeated", got "buf.validate.FieldRules.enum" on field "tests.example.v1.RepeatedFieldEnumRule.val"', + ), + ( + validations_pb.RepeatedFieldDurationRule(val=[Duration(seconds=2)]), + 'expected rule "buf.validate.FieldRules.repeated", got "buf.validate.FieldRules.duration" on field "tests.example.v1.RepeatedFieldDurationRule.val"', + ), + ( + validations_pb.MapFieldScalarRule(val={"abcd": "abcd"}), + 'expected rule "buf.validate.FieldRules.map", got "buf.validate.FieldRules.string" on field "tests.example.v1.MapFieldScalarRule.val"', + ), + ( + validations_pb.RepeatedUniqueMessages(val=[validations_pb.Embed(val=1)]), + "repeated.unique is not supported for message items", + ), + ( + validations_pb.TimestampOutOfRange(val=Timestamp(seconds=1)), + ( + "timestamp rule value out of range: seconds 253402300800 nanos 0 " + "is not between 0001-01-01T00:00:00Z and 9999-12-31T23:59:59.999999999Z" + ), + ), + ], +) +def test_rules_that_do_not_apply_to_field( + validator: ValidatorProtocol, msg: protobuf.Message, expected: str +) -> None: + """Rules that cannot apply to their field fail to compile rather than test the wrong value.""" + check_compilation_errors(validator, msg, expected) + + +@pytest.mark.parametrize("validator", validators) +def test_cel_unique_on_messages(validator: ValidatorProtocol) -> None: + """`unique()` on a list of messages has no overload, and says so rather than passing.""" + msg = validations_pb.CelUniqueMessages( + val=[validations_pb.Embed(val=1), validations_pb.Embed(val=1)] + ) + with pytest.raises(protovalidate.EvaluationError): + validator.validate(msg) + with pytest.raises(protovalidate.EvaluationError): + validator.collect_violations(msg) + + +@pytest.mark.parametrize("validator", validators) +def test_timestamp_rule_order(validator: ValidatorProtocol) -> None: + """`const` is checked before `lt_now`, as validate.proto declares them.""" + msg = validations_pb.TimestampRuleOrder(val=Timestamp(seconds=32503680000)) + violations = validator.collect_violations(msg) + assert [v.proto.rule_id for v in violations] == [ + "timestamp.const", + "timestamp.lt_now", + ] + + +@pytest.mark.parametrize("validator", validators) +def test_enum_rule_order(validator: ValidatorProtocol) -> None: + """Enum rules are checked in the order validate.proto declares them.""" + msg = validations_pb.EnumRuleOrder(val=5) + violations = validator.collect_violations(msg) + assert [v.proto.rule_id for v in violations] == [ + "enum.const", + "enum.defined_only", + "enum.in", + "enum.not_in", + ] + + +@pytest.mark.parametrize("validator", validators) +def test_hostname_length_excludes_trailing_dot(validator: ValidatorProtocol) -> None: + longest = ".".join(["a" * 63] * 3 + ["a" * 61]) + assert len(longest) == 253 + check_valid(validator, validations_pb.Hostname(val=longest)) + check_valid(validator, validations_pb.Hostname(val=longest + ".")) + + too_long = ".".join(["a" * 63] * 3 + ["a" * 62]) + assert len(too_long) == 254 + for val in (too_long, too_long + "."): + violations = validator.collect_violations(validations_pb.Hostname(val=val)) + assert [v.proto.rule_id for v in violations] == ["string.hostname"] + + +@pytest.mark.parametrize("validator", validators) +def test_infinity_in_messages(validator: ValidatorProtocol) -> None: + """Infinite rule values print as CEL's `Infinity`, not Rust's `inf`.""" + violations = validator.collect_violations(validations_pb.DoubleInfinity(val=1.0)) + assert [v.proto.message for v in violations] == ["must equal Infinity"] + check_valid(validator, validations_pb.DoubleInfinity(val=math.inf)) + + violations = validator.collect_violations( + validations_pb.DoubleInfiniteRange(val=math.inf) + ) + assert [v.proto.message for v in violations] == [ + "must be greater than -Infinity and less than Infinity" + ] + check_valid(validator, validations_pb.DoubleInfiniteRange(val=1.0)) + + +@pytest.mark.parametrize("validator", validators) +def test_pattern_is_re2(validator: ValidatorProtocol) -> None: + """Patterns follow RE2, the dialect the other implementations and CEL's `matches()` use.""" + check_valid(validator, validations_pb.PatternAsciiDigits(val="123")) + violations = validator.collect_violations( + validations_pb.PatternAsciiDigits(val="\u0661\u0662\u0663") + ) + assert [v.proto.rule_id for v in violations] == ["string.pattern"] + + check_valid(validator, validations_pb.PatternQuotedLiteral(val="a.c")) + violations = validator.collect_violations( + validations_pb.PatternQuotedLiteral(val="abc") + ) + assert [v.proto.rule_id for v in violations] == ["string.pattern"] + + with pytest.raises(protovalidate.CompilationError) as exc_info: + validator.validate(validations_pb.PatternRepeatTooLarge(val="a")) + assert str(exc_info.value).startswith("failed to compile program string.pattern: ") + + +@pytest.mark.parametrize("validator", validators) +@pytest.mark.parametrize( + "msg_type", [validations_pb.UniqueWrappers, validations_pb.CelUniqueWrappers] +) +def test_unique_wrappers( + validator: ValidatorProtocol, msg_type: type[protobuf.Message] +) -> None: + """`unique` compares wrapper elements by the scalars they hold.""" + check_valid(validator, msg_type(val=[Int32Value(value=1), Int32Value(value=2)])) + violations = validator.collect_violations( + msg_type(val=[Int32Value(value=1), Int32Value(value=1)]) + ) + assert len(violations) == 1