1#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
6#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
7#[repr(i32)]
8pub enum Edition {
9 EDITION_UNKNOWN = 0i32,
11 EDITION_LEGACY = 900i32,
14 EDITION_PROTO2 = 998i32,
19 EDITION_PROTO3 = 999i32,
20 EDITION_2023 = 1000i32,
24 EDITION_2024 = 1001i32,
25 EDITION_UNSTABLE = 9999i32,
27 EDITION_1_TEST_ONLY = 1i32,
30 EDITION_2_TEST_ONLY = 2i32,
31 EDITION_99997_TEST_ONLY = 99997i32,
32 EDITION_99998_TEST_ONLY = 99998i32,
33 EDITION_99999_TEST_ONLY = 99999i32,
34 EDITION_MAX = 2147483647i32,
38}
39impl ::core::default::Default for Edition {
40 fn default() -> Self {
41 Self::EDITION_UNKNOWN
42 }
43}
44#[cfg(feature = "json")]
45const _: () = {
46 impl ::serde::Serialize for Edition {
47 fn serialize<S: ::serde::Serializer>(
48 &self,
49 s: S,
50 ) -> ::core::result::Result<S::Ok, S::Error> {
51 s.serialize_str(::buffa::Enumeration::proto_name(self))
52 }
53 }
54 impl<'de> ::serde::Deserialize<'de> for Edition {
55 fn deserialize<D: ::serde::Deserializer<'de>>(
56 d: D,
57 ) -> ::core::result::Result<Self, D::Error> {
58 struct _V;
59 impl ::serde::de::Visitor<'_> for _V {
60 type Value = Edition;
61 fn expecting(
62 &self,
63 f: &mut ::core::fmt::Formatter<'_>,
64 ) -> ::core::fmt::Result {
65 f.write_str(
66 concat!("a string, integer, or null for ", stringify!(Edition)),
67 )
68 }
69 fn visit_str<E: ::serde::de::Error>(
70 self,
71 v: &str,
72 ) -> ::core::result::Result<Edition, E> {
73 <Edition as ::buffa::Enumeration>::from_proto_name(v)
74 .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
75 }
76 fn visit_i64<E: ::serde::de::Error>(
77 self,
78 v: i64,
79 ) -> ::core::result::Result<Edition, E> {
80 let v32 = i32::try_from(v)
81 .map_err(|_| {
82 ::serde::de::Error::custom(
83 ::buffa::alloc::format!("enum value {v} out of i32 range"),
84 )
85 })?;
86 <Edition as ::buffa::Enumeration>::from_i32(v32)
87 .ok_or_else(|| {
88 ::serde::de::Error::custom(
89 ::buffa::alloc::format!("unknown enum value {v32}"),
90 )
91 })
92 }
93 fn visit_u64<E: ::serde::de::Error>(
94 self,
95 v: u64,
96 ) -> ::core::result::Result<Edition, E> {
97 let v32 = i32::try_from(v)
98 .map_err(|_| {
99 ::serde::de::Error::custom(
100 ::buffa::alloc::format!("enum value {v} out of i32 range"),
101 )
102 })?;
103 <Edition as ::buffa::Enumeration>::from_i32(v32)
104 .ok_or_else(|| {
105 ::serde::de::Error::custom(
106 ::buffa::alloc::format!("unknown enum value {v32}"),
107 )
108 })
109 }
110 fn visit_unit<E: ::serde::de::Error>(
111 self,
112 ) -> ::core::result::Result<Edition, E> {
113 ::core::result::Result::Ok(::core::default::Default::default())
114 }
115 }
116 d.deserialize_any(_V)
117 }
118 }
119 impl ::buffa::json_helpers::ProtoElemJson for Edition {
120 fn serialize_proto_json<S: ::serde::Serializer>(
121 v: &Self,
122 s: S,
123 ) -> ::core::result::Result<S::Ok, S::Error> {
124 ::serde::Serialize::serialize(v, s)
125 }
126 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
127 d: D,
128 ) -> ::core::result::Result<Self, D::Error> {
129 <Self as ::serde::Deserialize>::deserialize(d)
130 }
131 }
132};
133impl ::buffa::Enumeration for Edition {
134 fn from_i32(value: i32) -> ::core::option::Option<Self> {
135 match value {
136 0i32 => ::core::option::Option::Some(Self::EDITION_UNKNOWN),
137 900i32 => ::core::option::Option::Some(Self::EDITION_LEGACY),
138 998i32 => ::core::option::Option::Some(Self::EDITION_PROTO2),
139 999i32 => ::core::option::Option::Some(Self::EDITION_PROTO3),
140 1000i32 => ::core::option::Option::Some(Self::EDITION_2023),
141 1001i32 => ::core::option::Option::Some(Self::EDITION_2024),
142 9999i32 => ::core::option::Option::Some(Self::EDITION_UNSTABLE),
143 1i32 => ::core::option::Option::Some(Self::EDITION_1_TEST_ONLY),
144 2i32 => ::core::option::Option::Some(Self::EDITION_2_TEST_ONLY),
145 99997i32 => ::core::option::Option::Some(Self::EDITION_99997_TEST_ONLY),
146 99998i32 => ::core::option::Option::Some(Self::EDITION_99998_TEST_ONLY),
147 99999i32 => ::core::option::Option::Some(Self::EDITION_99999_TEST_ONLY),
148 2147483647i32 => ::core::option::Option::Some(Self::EDITION_MAX),
149 _ => ::core::option::Option::None,
150 }
151 }
152 fn to_i32(&self) -> i32 {
153 *self as i32
154 }
155 fn proto_name(&self) -> &'static str {
156 match self {
157 Self::EDITION_UNKNOWN => "EDITION_UNKNOWN",
158 Self::EDITION_LEGACY => "EDITION_LEGACY",
159 Self::EDITION_PROTO2 => "EDITION_PROTO2",
160 Self::EDITION_PROTO3 => "EDITION_PROTO3",
161 Self::EDITION_2023 => "EDITION_2023",
162 Self::EDITION_2024 => "EDITION_2024",
163 Self::EDITION_UNSTABLE => "EDITION_UNSTABLE",
164 Self::EDITION_1_TEST_ONLY => "EDITION_1_TEST_ONLY",
165 Self::EDITION_2_TEST_ONLY => "EDITION_2_TEST_ONLY",
166 Self::EDITION_99997_TEST_ONLY => "EDITION_99997_TEST_ONLY",
167 Self::EDITION_99998_TEST_ONLY => "EDITION_99998_TEST_ONLY",
168 Self::EDITION_99999_TEST_ONLY => "EDITION_99999_TEST_ONLY",
169 Self::EDITION_MAX => "EDITION_MAX",
170 }
171 }
172 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
173 match name {
174 "EDITION_UNKNOWN" => ::core::option::Option::Some(Self::EDITION_UNKNOWN),
175 "EDITION_LEGACY" => ::core::option::Option::Some(Self::EDITION_LEGACY),
176 "EDITION_PROTO2" => ::core::option::Option::Some(Self::EDITION_PROTO2),
177 "EDITION_PROTO3" => ::core::option::Option::Some(Self::EDITION_PROTO3),
178 "EDITION_2023" => ::core::option::Option::Some(Self::EDITION_2023),
179 "EDITION_2024" => ::core::option::Option::Some(Self::EDITION_2024),
180 "EDITION_UNSTABLE" => ::core::option::Option::Some(Self::EDITION_UNSTABLE),
181 "EDITION_1_TEST_ONLY" => {
182 ::core::option::Option::Some(Self::EDITION_1_TEST_ONLY)
183 }
184 "EDITION_2_TEST_ONLY" => {
185 ::core::option::Option::Some(Self::EDITION_2_TEST_ONLY)
186 }
187 "EDITION_99997_TEST_ONLY" => {
188 ::core::option::Option::Some(Self::EDITION_99997_TEST_ONLY)
189 }
190 "EDITION_99998_TEST_ONLY" => {
191 ::core::option::Option::Some(Self::EDITION_99998_TEST_ONLY)
192 }
193 "EDITION_99999_TEST_ONLY" => {
194 ::core::option::Option::Some(Self::EDITION_99999_TEST_ONLY)
195 }
196 "EDITION_MAX" => ::core::option::Option::Some(Self::EDITION_MAX),
197 _ => ::core::option::Option::None,
198 }
199 }
200 fn values() -> &'static [Self] {
201 &[
202 Self::EDITION_UNKNOWN,
203 Self::EDITION_LEGACY,
204 Self::EDITION_PROTO2,
205 Self::EDITION_PROTO3,
206 Self::EDITION_2023,
207 Self::EDITION_2024,
208 Self::EDITION_UNSTABLE,
209 Self::EDITION_1_TEST_ONLY,
210 Self::EDITION_2_TEST_ONLY,
211 Self::EDITION_99997_TEST_ONLY,
212 Self::EDITION_99998_TEST_ONLY,
213 Self::EDITION_99999_TEST_ONLY,
214 Self::EDITION_MAX,
215 ]
216 }
217}
218#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
224#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
225#[repr(i32)]
226pub enum SymbolVisibility {
227 VISIBILITY_UNSET = 0i32,
228 VISIBILITY_LOCAL = 1i32,
229 VISIBILITY_EXPORT = 2i32,
230}
231impl ::core::default::Default for SymbolVisibility {
232 fn default() -> Self {
233 Self::VISIBILITY_UNSET
234 }
235}
236#[cfg(feature = "json")]
237const _: () = {
238 impl ::serde::Serialize for SymbolVisibility {
239 fn serialize<S: ::serde::Serializer>(
240 &self,
241 s: S,
242 ) -> ::core::result::Result<S::Ok, S::Error> {
243 s.serialize_str(::buffa::Enumeration::proto_name(self))
244 }
245 }
246 impl<'de> ::serde::Deserialize<'de> for SymbolVisibility {
247 fn deserialize<D: ::serde::Deserializer<'de>>(
248 d: D,
249 ) -> ::core::result::Result<Self, D::Error> {
250 struct _V;
251 impl ::serde::de::Visitor<'_> for _V {
252 type Value = SymbolVisibility;
253 fn expecting(
254 &self,
255 f: &mut ::core::fmt::Formatter<'_>,
256 ) -> ::core::fmt::Result {
257 f.write_str(
258 concat!(
259 "a string, integer, or null for ",
260 stringify!(SymbolVisibility)
261 ),
262 )
263 }
264 fn visit_str<E: ::serde::de::Error>(
265 self,
266 v: &str,
267 ) -> ::core::result::Result<SymbolVisibility, E> {
268 <SymbolVisibility as ::buffa::Enumeration>::from_proto_name(v)
269 .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
270 }
271 fn visit_i64<E: ::serde::de::Error>(
272 self,
273 v: i64,
274 ) -> ::core::result::Result<SymbolVisibility, E> {
275 let v32 = i32::try_from(v)
276 .map_err(|_| {
277 ::serde::de::Error::custom(
278 ::buffa::alloc::format!("enum value {v} out of i32 range"),
279 )
280 })?;
281 <SymbolVisibility as ::buffa::Enumeration>::from_i32(v32)
282 .ok_or_else(|| {
283 ::serde::de::Error::custom(
284 ::buffa::alloc::format!("unknown enum value {v32}"),
285 )
286 })
287 }
288 fn visit_u64<E: ::serde::de::Error>(
289 self,
290 v: u64,
291 ) -> ::core::result::Result<SymbolVisibility, E> {
292 let v32 = i32::try_from(v)
293 .map_err(|_| {
294 ::serde::de::Error::custom(
295 ::buffa::alloc::format!("enum value {v} out of i32 range"),
296 )
297 })?;
298 <SymbolVisibility as ::buffa::Enumeration>::from_i32(v32)
299 .ok_or_else(|| {
300 ::serde::de::Error::custom(
301 ::buffa::alloc::format!("unknown enum value {v32}"),
302 )
303 })
304 }
305 fn visit_unit<E: ::serde::de::Error>(
306 self,
307 ) -> ::core::result::Result<SymbolVisibility, E> {
308 ::core::result::Result::Ok(::core::default::Default::default())
309 }
310 }
311 d.deserialize_any(_V)
312 }
313 }
314 impl ::buffa::json_helpers::ProtoElemJson for SymbolVisibility {
315 fn serialize_proto_json<S: ::serde::Serializer>(
316 v: &Self,
317 s: S,
318 ) -> ::core::result::Result<S::Ok, S::Error> {
319 ::serde::Serialize::serialize(v, s)
320 }
321 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
322 d: D,
323 ) -> ::core::result::Result<Self, D::Error> {
324 <Self as ::serde::Deserialize>::deserialize(d)
325 }
326 }
327};
328impl ::buffa::Enumeration for SymbolVisibility {
329 fn from_i32(value: i32) -> ::core::option::Option<Self> {
330 match value {
331 0i32 => ::core::option::Option::Some(Self::VISIBILITY_UNSET),
332 1i32 => ::core::option::Option::Some(Self::VISIBILITY_LOCAL),
333 2i32 => ::core::option::Option::Some(Self::VISIBILITY_EXPORT),
334 _ => ::core::option::Option::None,
335 }
336 }
337 fn to_i32(&self) -> i32 {
338 *self as i32
339 }
340 fn proto_name(&self) -> &'static str {
341 match self {
342 Self::VISIBILITY_UNSET => "VISIBILITY_UNSET",
343 Self::VISIBILITY_LOCAL => "VISIBILITY_LOCAL",
344 Self::VISIBILITY_EXPORT => "VISIBILITY_EXPORT",
345 }
346 }
347 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
348 match name {
349 "VISIBILITY_UNSET" => ::core::option::Option::Some(Self::VISIBILITY_UNSET),
350 "VISIBILITY_LOCAL" => ::core::option::Option::Some(Self::VISIBILITY_LOCAL),
351 "VISIBILITY_EXPORT" => ::core::option::Option::Some(Self::VISIBILITY_EXPORT),
352 _ => ::core::option::Option::None,
353 }
354 }
355 fn values() -> &'static [Self] {
356 &[Self::VISIBILITY_UNSET, Self::VISIBILITY_LOCAL, Self::VISIBILITY_EXPORT]
357 }
358}
359#[derive(Clone, PartialEq, Default)]
362#[cfg_attr(feature = "json", derive(::serde::Serialize))]
363#[cfg_attr(feature = "json", serde(default))]
364#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
365pub struct FileDescriptorSet {
366 #[cfg_attr(
368 feature = "json",
369 serde(
370 rename = "file",
371 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
372 deserialize_with = "::buffa::json_helpers::null_as_default"
373 )
374 )]
375 pub file: ::buffa::alloc::vec::Vec<FileDescriptorProto>,
376 #[cfg_attr(feature = "json", serde(flatten))]
377 #[doc(hidden)]
378 pub __buffa_unknown_fields: __FileDescriptorSetExtJson,
379}
380impl ::core::fmt::Debug for FileDescriptorSet {
381 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
382 f.debug_struct("FileDescriptorSet").field("file", &self.file).finish()
383 }
384}
385impl FileDescriptorSet {
386 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileDescriptorSet";
391}
392impl ::buffa::DefaultInstance for FileDescriptorSet {
393 fn default_instance() -> &'static Self {
394 static VALUE: ::buffa::__private::OnceBox<FileDescriptorSet> = ::buffa::__private::OnceBox::new();
395 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
396 }
397}
398impl ::buffa::MessageName for FileDescriptorSet {
399 const PACKAGE: &'static str = "google.protobuf";
400 const NAME: &'static str = "FileDescriptorSet";
401 const FULL_NAME: &'static str = "google.protobuf.FileDescriptorSet";
402 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileDescriptorSet";
403}
404impl ::buffa::Message for FileDescriptorSet {
405 #[allow(clippy::let_and_return)]
411 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
412 #[allow(unused_imports)]
413 use ::buffa::Enumeration as _;
414 let mut size = 0u32;
415 for v in &self.file {
416 let __slot = __cache.reserve();
417 let inner_size = v.compute_size(__cache);
418 __cache.set(__slot, inner_size);
419 size
420 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
421 + inner_size;
422 }
423 size += self.__buffa_unknown_fields.encoded_len() as u32;
424 size
425 }
426 fn write_to(
427 &self,
428 __cache: &mut ::buffa::SizeCache,
429 buf: &mut impl ::buffa::bytes::BufMut,
430 ) {
431 #[allow(unused_imports)]
432 use ::buffa::Enumeration as _;
433 for v in &self.file {
434 ::buffa::encoding::Tag::new(
435 1u32,
436 ::buffa::encoding::WireType::LengthDelimited,
437 )
438 .encode(buf);
439 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
440 v.write_to(__cache, buf);
441 }
442 self.__buffa_unknown_fields.write_to(buf);
443 }
444 fn merge_field(
445 &mut self,
446 tag: ::buffa::encoding::Tag,
447 buf: &mut impl ::buffa::bytes::Buf,
448 depth: u32,
449 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
450 #[allow(unused_imports)]
451 use ::buffa::bytes::Buf as _;
452 #[allow(unused_imports)]
453 use ::buffa::Enumeration as _;
454 match tag.field_number() {
455 1u32 => {
456 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
457 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
458 field_number: 1u32,
459 expected: 2u8,
460 actual: tag.wire_type() as u8,
461 });
462 }
463 let mut elem = ::core::default::Default::default();
464 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
465 self.file.push(elem);
466 }
467 _ => {
468 self.__buffa_unknown_fields
469 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
470 }
471 }
472 ::core::result::Result::Ok(())
473 }
474 fn clear(&mut self) {
475 self.file.clear();
476 self.__buffa_unknown_fields.clear();
477 }
478}
479impl ::buffa::ExtensionSet for FileDescriptorSet {
480 const PROTO_FQN: &'static str = "google.protobuf.FileDescriptorSet";
481 fn unknown_fields(&self) -> &::buffa::UnknownFields {
482 &self.__buffa_unknown_fields
483 }
484 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
485 &mut self.__buffa_unknown_fields
486 }
487}
488#[cfg(feature = "text")]
489impl ::buffa::text::TextFormat for FileDescriptorSet {
490 fn encode_text(
491 &self,
492 enc: &mut ::buffa::text::TextEncoder<'_>,
493 ) -> ::core::fmt::Result {
494 #[allow(unused_imports)]
495 use ::buffa::Enumeration as _;
496 for __v in &self.file {
497 enc.write_field_name("file")?;
498 enc.write_message(__v)?;
499 }
500 enc.write_extension_fields(
501 "google.protobuf.FileDescriptorSet",
502 &self.__buffa_unknown_fields,
503 )?;
504 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
505 ::core::result::Result::Ok(())
506 }
507 fn merge_text(
508 &mut self,
509 dec: &mut ::buffa::text::TextDecoder<'_>,
510 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
511 #[allow(unused_imports)]
512 use ::buffa::Enumeration as _;
513 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
514 match __name {
515 "file" => {
516 dec.read_repeated_into(
517 &mut self.file,
518 |__d| {
519 let mut __m = ::core::default::Default::default();
520 __d.merge_message(&mut __m)?;
521 ::core::result::Result::Ok(__m)
522 },
523 )?
524 }
525 __name if __name.starts_with('[') => {
526 for __r in dec
527 .read_extension(__name, "google.protobuf.FileDescriptorSet")?
528 {
529 self.__buffa_unknown_fields.push(__r);
530 }
531 }
532 _ => dec.skip_value()?,
533 }
534 }
535 ::core::result::Result::Ok(())
536 }
537}
538#[cfg(feature = "json")]
539impl<'de> serde::Deserialize<'de> for FileDescriptorSet {
540 fn deserialize<D: serde::Deserializer<'de>>(
541 d: D,
542 ) -> ::core::result::Result<Self, D::Error> {
543 struct _V;
544 impl<'de> serde::de::Visitor<'de> for _V {
545 type Value = FileDescriptorSet;
546 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
547 f.write_str("struct FileDescriptorSet")
548 }
549 #[allow(clippy::field_reassign_with_default)]
550 fn visit_map<A: serde::de::MapAccess<'de>>(
551 self,
552 mut map: A,
553 ) -> ::core::result::Result<FileDescriptorSet, A::Error> {
554 let mut __f_file: ::core::option::Option<
555 ::buffa::alloc::vec::Vec<FileDescriptorProto>,
556 > = None;
557 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
558 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
559 match key.as_str() {
560 "file" => {
561 __f_file = Some({
562 struct _S;
563 impl<'de> serde::de::DeserializeSeed<'de> for _S {
564 type Value = ::buffa::alloc::vec::Vec<FileDescriptorProto>;
565 fn deserialize<D: serde::Deserializer<'de>>(
566 self,
567 d: D,
568 ) -> ::core::result::Result<
569 ::buffa::alloc::vec::Vec<FileDescriptorProto>,
570 D::Error,
571 > {
572 ::buffa::json_helpers::null_as_default(d)
573 }
574 }
575 map.next_value_seed(_S)?
576 });
577 }
578 __k if __k.starts_with('[') => {
579 let __v: ::buffa::serde_json::Value = map.next_value()?;
580 match ::buffa::extension_registry::deserialize_extension_key(
581 "google.protobuf.FileDescriptorSet",
582 __k,
583 __v,
584 ) {
585 ::core::option::Option::Some(
586 ::core::result::Result::Ok(__recs),
587 ) => {
588 for __rec in __recs {
589 __ext_records.push(__rec);
590 }
591 }
592 ::core::option::Option::Some(
593 ::core::result::Result::Err(__e),
594 ) => {
595 return ::core::result::Result::Err(
596 <A::Error as ::serde::de::Error>::custom(__e),
597 );
598 }
599 ::core::option::Option::None => {}
600 }
601 }
602 _ => {
603 map.next_value::<serde::de::IgnoredAny>()?;
604 }
605 }
606 }
607 let mut __r = <FileDescriptorSet as ::core::default::Default>::default();
608 if let ::core::option::Option::Some(v) = __f_file {
609 __r.file = v;
610 }
611 for __rec in __ext_records {
612 __r.__buffa_unknown_fields.push(__rec);
613 }
614 Ok(__r)
615 }
616 }
617 d.deserialize_map(_V)
618 }
619}
620#[cfg(feature = "json")]
621impl ::buffa::json_helpers::ProtoElemJson for FileDescriptorSet {
622 fn serialize_proto_json<S: ::serde::Serializer>(
623 v: &Self,
624 s: S,
625 ) -> ::core::result::Result<S::Ok, S::Error> {
626 ::serde::Serialize::serialize(v, s)
627 }
628 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
629 d: D,
630 ) -> ::core::result::Result<Self, D::Error> {
631 <Self as ::serde::Deserialize>::deserialize(d)
632 }
633}
634#[doc(hidden)]
635#[derive(Clone, Debug, Default, PartialEq)]
636#[repr(transparent)]
637#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
638pub struct __FileDescriptorSetExtJson(pub ::buffa::UnknownFields);
639impl ::core::ops::Deref for __FileDescriptorSetExtJson {
640 type Target = ::buffa::UnknownFields;
641 fn deref(&self) -> &::buffa::UnknownFields {
642 &self.0
643 }
644}
645impl ::core::ops::DerefMut for __FileDescriptorSetExtJson {
646 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
647 &mut self.0
648 }
649}
650impl ::core::convert::From<::buffa::UnknownFields> for __FileDescriptorSetExtJson {
651 fn from(u: ::buffa::UnknownFields) -> Self {
652 Self(u)
653 }
654}
655#[cfg(feature = "json")]
656impl ::serde::Serialize for __FileDescriptorSetExtJson {
657 fn serialize<S: ::serde::Serializer>(
658 &self,
659 s: S,
660 ) -> ::core::result::Result<S::Ok, S::Error> {
661 ::buffa::extension_registry::serialize_extensions(
662 "google.protobuf.FileDescriptorSet",
663 &self.0,
664 s,
665 )
666 }
667}
668#[cfg(feature = "json")]
669impl<'de> ::serde::Deserialize<'de> for __FileDescriptorSetExtJson {
670 fn deserialize<D: ::serde::Deserializer<'de>>(
671 d: D,
672 ) -> ::core::result::Result<Self, D::Error> {
673 ::buffa::extension_registry::deserialize_extensions(
674 "google.protobuf.FileDescriptorSet",
675 d,
676 )
677 .map(Self)
678 }
679}
680#[cfg(feature = "json")]
681#[doc(hidden)]
682pub const __FILE_DESCRIPTOR_SET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
683 type_url: "type.googleapis.com/google.protobuf.FileDescriptorSet",
684 to_json: ::buffa::type_registry::any_to_json::<FileDescriptorSet>,
685 from_json: ::buffa::type_registry::any_from_json::<FileDescriptorSet>,
686 is_wkt: false,
687};
688#[cfg(feature = "text")]
689#[doc(hidden)]
690pub const __FILE_DESCRIPTOR_SET_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
691 type_url: "type.googleapis.com/google.protobuf.FileDescriptorSet",
692 text_encode: ::buffa::type_registry::any_encode_text::<FileDescriptorSet>,
693 text_merge: ::buffa::type_registry::any_merge_text::<FileDescriptorSet>,
694};
695#[derive(Clone, PartialEq, Default)]
697#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
698#[cfg_attr(feature = "json", serde(default))]
699#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
700pub struct FileDescriptorProto {
701 #[cfg_attr(
705 feature = "json",
706 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
707 )]
708 pub name: ::core::option::Option<::buffa::alloc::string::String>,
709 #[cfg_attr(
713 feature = "json",
714 serde(
715 rename = "package",
716 skip_serializing_if = "::core::option::Option::is_none"
717 )
718 )]
719 pub package: ::core::option::Option<::buffa::alloc::string::String>,
720 #[cfg_attr(
724 feature = "json",
725 serde(
726 rename = "dependency",
727 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
728 deserialize_with = "::buffa::json_helpers::null_as_default"
729 )
730 )]
731 pub dependency: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
732 #[cfg_attr(
736 feature = "json",
737 serde(
738 rename = "publicDependency",
739 alias = "public_dependency",
740 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
741 deserialize_with = "::buffa::json_helpers::null_as_default"
742 )
743 )]
744 pub public_dependency: ::buffa::alloc::vec::Vec<i32>,
745 #[cfg_attr(
750 feature = "json",
751 serde(
752 rename = "weakDependency",
753 alias = "weak_dependency",
754 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
755 deserialize_with = "::buffa::json_helpers::null_as_default"
756 )
757 )]
758 pub weak_dependency: ::buffa::alloc::vec::Vec<i32>,
759 #[cfg_attr(
764 feature = "json",
765 serde(
766 rename = "optionDependency",
767 alias = "option_dependency",
768 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
769 deserialize_with = "::buffa::json_helpers::null_as_default"
770 )
771 )]
772 pub option_dependency: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
773 #[cfg_attr(
777 feature = "json",
778 serde(
779 rename = "messageType",
780 alias = "message_type",
781 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
782 deserialize_with = "::buffa::json_helpers::null_as_default"
783 )
784 )]
785 pub message_type: ::buffa::alloc::vec::Vec<DescriptorProto>,
786 #[cfg_attr(
788 feature = "json",
789 serde(
790 rename = "enumType",
791 alias = "enum_type",
792 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
793 deserialize_with = "::buffa::json_helpers::null_as_default"
794 )
795 )]
796 pub enum_type: ::buffa::alloc::vec::Vec<EnumDescriptorProto>,
797 #[cfg_attr(
799 feature = "json",
800 serde(
801 rename = "service",
802 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
803 deserialize_with = "::buffa::json_helpers::null_as_default"
804 )
805 )]
806 pub service: ::buffa::alloc::vec::Vec<ServiceDescriptorProto>,
807 #[cfg_attr(
809 feature = "json",
810 serde(
811 rename = "extension",
812 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
813 deserialize_with = "::buffa::json_helpers::null_as_default"
814 )
815 )]
816 pub extension: ::buffa::alloc::vec::Vec<FieldDescriptorProto>,
817 #[cfg_attr(
819 feature = "json",
820 serde(
821 rename = "options",
822 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
823 )
824 )]
825 pub options: ::buffa::MessageField<FileOptions>,
826 #[cfg_attr(
833 feature = "json",
834 serde(
835 rename = "sourceCodeInfo",
836 alias = "source_code_info",
837 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
838 )
839 )]
840 pub source_code_info: ::buffa::MessageField<SourceCodeInfo>,
841 #[cfg_attr(
851 feature = "json",
852 serde(rename = "syntax", skip_serializing_if = "::core::option::Option::is_none")
853 )]
854 pub syntax: ::core::option::Option<::buffa::alloc::string::String>,
855 #[cfg_attr(
862 feature = "json",
863 serde(
864 rename = "edition",
865 with = "::buffa::json_helpers::opt_closed_enum",
866 skip_serializing_if = "::core::option::Option::is_none"
867 )
868 )]
869 pub edition: ::core::option::Option<Edition>,
870 #[cfg_attr(feature = "json", serde(skip))]
871 #[doc(hidden)]
872 pub __buffa_unknown_fields: ::buffa::UnknownFields,
873}
874impl ::core::fmt::Debug for FileDescriptorProto {
875 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
876 f.debug_struct("FileDescriptorProto")
877 .field("name", &self.name)
878 .field("package", &self.package)
879 .field("dependency", &self.dependency)
880 .field("public_dependency", &self.public_dependency)
881 .field("weak_dependency", &self.weak_dependency)
882 .field("option_dependency", &self.option_dependency)
883 .field("message_type", &self.message_type)
884 .field("enum_type", &self.enum_type)
885 .field("service", &self.service)
886 .field("extension", &self.extension)
887 .field("options", &self.options)
888 .field("source_code_info", &self.source_code_info)
889 .field("syntax", &self.syntax)
890 .field("edition", &self.edition)
891 .finish()
892 }
893}
894impl FileDescriptorProto {
895 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileDescriptorProto";
900}
901impl FileDescriptorProto {
902 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
903 #[inline]
904 pub fn with_name(
906 mut self,
907 value: impl Into<::buffa::alloc::string::String>,
908 ) -> Self {
909 self.name = Some(value.into());
910 self
911 }
912 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
913 #[inline]
914 pub fn with_package(
916 mut self,
917 value: impl Into<::buffa::alloc::string::String>,
918 ) -> Self {
919 self.package = Some(value.into());
920 self
921 }
922 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
923 #[inline]
924 pub fn with_syntax(
926 mut self,
927 value: impl Into<::buffa::alloc::string::String>,
928 ) -> Self {
929 self.syntax = Some(value.into());
930 self
931 }
932 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
933 #[inline]
934 pub fn with_edition(mut self, value: impl Into<Edition>) -> Self {
936 self.edition = Some(value.into());
937 self
938 }
939}
940impl ::buffa::DefaultInstance for FileDescriptorProto {
941 fn default_instance() -> &'static Self {
942 static VALUE: ::buffa::__private::OnceBox<FileDescriptorProto> = ::buffa::__private::OnceBox::new();
943 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
944 }
945}
946impl ::buffa::MessageName for FileDescriptorProto {
947 const PACKAGE: &'static str = "google.protobuf";
948 const NAME: &'static str = "FileDescriptorProto";
949 const FULL_NAME: &'static str = "google.protobuf.FileDescriptorProto";
950 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileDescriptorProto";
951}
952impl ::buffa::Message for FileDescriptorProto {
953 #[allow(clippy::let_and_return)]
959 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
960 #[allow(unused_imports)]
961 use ::buffa::Enumeration as _;
962 let mut size = 0u32;
963 if let Some(ref v) = self.name {
964 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
965 }
966 if let Some(ref v) = self.package {
967 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
968 }
969 for v in &self.dependency {
970 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
971 }
972 for v in &self.message_type {
973 let __slot = __cache.reserve();
974 let inner_size = v.compute_size(__cache);
975 __cache.set(__slot, inner_size);
976 size
977 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
978 + inner_size;
979 }
980 for v in &self.enum_type {
981 let __slot = __cache.reserve();
982 let inner_size = v.compute_size(__cache);
983 __cache.set(__slot, inner_size);
984 size
985 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
986 + inner_size;
987 }
988 for v in &self.service {
989 let __slot = __cache.reserve();
990 let inner_size = v.compute_size(__cache);
991 __cache.set(__slot, inner_size);
992 size
993 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
994 + inner_size;
995 }
996 for v in &self.extension {
997 let __slot = __cache.reserve();
998 let inner_size = v.compute_size(__cache);
999 __cache.set(__slot, inner_size);
1000 size
1001 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1002 + inner_size;
1003 }
1004 if self.options.is_set() {
1005 let __slot = __cache.reserve();
1006 let inner_size = self.options.compute_size(__cache);
1007 __cache.set(__slot, inner_size);
1008 size
1009 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1010 + inner_size;
1011 }
1012 if self.source_code_info.is_set() {
1013 let __slot = __cache.reserve();
1014 let inner_size = self.source_code_info.compute_size(__cache);
1015 __cache.set(__slot, inner_size);
1016 size
1017 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1018 + inner_size;
1019 }
1020 for v in &self.public_dependency {
1021 size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1022 }
1023 for v in &self.weak_dependency {
1024 size += 1u32 + ::buffa::types::int32_encoded_len(*v) as u32;
1025 }
1026 if let Some(ref v) = self.syntax {
1027 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1028 }
1029 if let Some(ref v) = self.edition {
1030 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
1031 }
1032 for v in &self.option_dependency {
1033 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1034 }
1035 size += self.__buffa_unknown_fields.encoded_len() as u32;
1036 size
1037 }
1038 fn write_to(
1039 &self,
1040 __cache: &mut ::buffa::SizeCache,
1041 buf: &mut impl ::buffa::bytes::BufMut,
1042 ) {
1043 #[allow(unused_imports)]
1044 use ::buffa::Enumeration as _;
1045 if let Some(ref v) = self.name {
1046 ::buffa::encoding::Tag::new(
1047 1u32,
1048 ::buffa::encoding::WireType::LengthDelimited,
1049 )
1050 .encode(buf);
1051 ::buffa::types::encode_string(v, buf);
1052 }
1053 if let Some(ref v) = self.package {
1054 ::buffa::encoding::Tag::new(
1055 2u32,
1056 ::buffa::encoding::WireType::LengthDelimited,
1057 )
1058 .encode(buf);
1059 ::buffa::types::encode_string(v, buf);
1060 }
1061 for v in &self.dependency {
1062 ::buffa::encoding::Tag::new(
1063 3u32,
1064 ::buffa::encoding::WireType::LengthDelimited,
1065 )
1066 .encode(buf);
1067 ::buffa::types::encode_string(v, buf);
1068 }
1069 for v in &self.message_type {
1070 ::buffa::encoding::Tag::new(
1071 4u32,
1072 ::buffa::encoding::WireType::LengthDelimited,
1073 )
1074 .encode(buf);
1075 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1076 v.write_to(__cache, buf);
1077 }
1078 for v in &self.enum_type {
1079 ::buffa::encoding::Tag::new(
1080 5u32,
1081 ::buffa::encoding::WireType::LengthDelimited,
1082 )
1083 .encode(buf);
1084 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1085 v.write_to(__cache, buf);
1086 }
1087 for v in &self.service {
1088 ::buffa::encoding::Tag::new(
1089 6u32,
1090 ::buffa::encoding::WireType::LengthDelimited,
1091 )
1092 .encode(buf);
1093 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1094 v.write_to(__cache, buf);
1095 }
1096 for v in &self.extension {
1097 ::buffa::encoding::Tag::new(
1098 7u32,
1099 ::buffa::encoding::WireType::LengthDelimited,
1100 )
1101 .encode(buf);
1102 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1103 v.write_to(__cache, buf);
1104 }
1105 if self.options.is_set() {
1106 ::buffa::encoding::Tag::new(
1107 8u32,
1108 ::buffa::encoding::WireType::LengthDelimited,
1109 )
1110 .encode(buf);
1111 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1112 self.options.write_to(__cache, buf);
1113 }
1114 if self.source_code_info.is_set() {
1115 ::buffa::encoding::Tag::new(
1116 9u32,
1117 ::buffa::encoding::WireType::LengthDelimited,
1118 )
1119 .encode(buf);
1120 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1121 self.source_code_info.write_to(__cache, buf);
1122 }
1123 for v in &self.public_dependency {
1124 ::buffa::encoding::Tag::new(10u32, ::buffa::encoding::WireType::Varint)
1125 .encode(buf);
1126 ::buffa::types::encode_int32(*v, buf);
1127 }
1128 for v in &self.weak_dependency {
1129 ::buffa::encoding::Tag::new(11u32, ::buffa::encoding::WireType::Varint)
1130 .encode(buf);
1131 ::buffa::types::encode_int32(*v, buf);
1132 }
1133 if let Some(ref v) = self.syntax {
1134 ::buffa::encoding::Tag::new(
1135 12u32,
1136 ::buffa::encoding::WireType::LengthDelimited,
1137 )
1138 .encode(buf);
1139 ::buffa::types::encode_string(v, buf);
1140 }
1141 if let Some(ref v) = self.edition {
1142 ::buffa::encoding::Tag::new(14u32, ::buffa::encoding::WireType::Varint)
1143 .encode(buf);
1144 ::buffa::types::encode_int32(v.to_i32(), buf);
1145 }
1146 for v in &self.option_dependency {
1147 ::buffa::encoding::Tag::new(
1148 15u32,
1149 ::buffa::encoding::WireType::LengthDelimited,
1150 )
1151 .encode(buf);
1152 ::buffa::types::encode_string(v, buf);
1153 }
1154 self.__buffa_unknown_fields.write_to(buf);
1155 }
1156 fn merge_field(
1157 &mut self,
1158 tag: ::buffa::encoding::Tag,
1159 buf: &mut impl ::buffa::bytes::Buf,
1160 depth: u32,
1161 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1162 #[allow(unused_imports)]
1163 use ::buffa::bytes::Buf as _;
1164 #[allow(unused_imports)]
1165 use ::buffa::Enumeration as _;
1166 match tag.field_number() {
1167 1u32 => {
1168 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1169 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1170 field_number: 1u32,
1171 expected: 2u8,
1172 actual: tag.wire_type() as u8,
1173 });
1174 }
1175 ::buffa::types::merge_string(
1176 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
1177 buf,
1178 )?;
1179 }
1180 2u32 => {
1181 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1182 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1183 field_number: 2u32,
1184 expected: 2u8,
1185 actual: tag.wire_type() as u8,
1186 });
1187 }
1188 ::buffa::types::merge_string(
1189 self.package.get_or_insert_with(::buffa::alloc::string::String::new),
1190 buf,
1191 )?;
1192 }
1193 3u32 => {
1194 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1195 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1196 field_number: 3u32,
1197 expected: 2u8,
1198 actual: tag.wire_type() as u8,
1199 });
1200 }
1201 self.dependency.push(::buffa::types::decode_string(buf)?);
1202 }
1203 4u32 => {
1204 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1205 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1206 field_number: 4u32,
1207 expected: 2u8,
1208 actual: tag.wire_type() as u8,
1209 });
1210 }
1211 let mut elem = ::core::default::Default::default();
1212 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1213 self.message_type.push(elem);
1214 }
1215 5u32 => {
1216 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1217 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1218 field_number: 5u32,
1219 expected: 2u8,
1220 actual: tag.wire_type() as u8,
1221 });
1222 }
1223 let mut elem = ::core::default::Default::default();
1224 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1225 self.enum_type.push(elem);
1226 }
1227 6u32 => {
1228 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1229 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1230 field_number: 6u32,
1231 expected: 2u8,
1232 actual: tag.wire_type() as u8,
1233 });
1234 }
1235 let mut elem = ::core::default::Default::default();
1236 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1237 self.service.push(elem);
1238 }
1239 7u32 => {
1240 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1241 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1242 field_number: 7u32,
1243 expected: 2u8,
1244 actual: tag.wire_type() as u8,
1245 });
1246 }
1247 let mut elem = ::core::default::Default::default();
1248 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1249 self.extension.push(elem);
1250 }
1251 8u32 => {
1252 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1253 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1254 field_number: 8u32,
1255 expected: 2u8,
1256 actual: tag.wire_type() as u8,
1257 });
1258 }
1259 ::buffa::Message::merge_length_delimited(
1260 self.options.get_or_insert_default(),
1261 buf,
1262 depth,
1263 )?;
1264 }
1265 9u32 => {
1266 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1267 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1268 field_number: 9u32,
1269 expected: 2u8,
1270 actual: tag.wire_type() as u8,
1271 });
1272 }
1273 ::buffa::Message::merge_length_delimited(
1274 self.source_code_info.get_or_insert_default(),
1275 buf,
1276 depth,
1277 )?;
1278 }
1279 10u32 => {
1280 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1281 let len = ::buffa::encoding::decode_varint(buf)?;
1282 let len = usize::try_from(len)
1283 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1284 if buf.remaining() < len {
1285 return ::core::result::Result::Err(
1286 ::buffa::DecodeError::UnexpectedEof,
1287 );
1288 }
1289 self.public_dependency.reserve(len);
1290 let mut limited = buf.take(len);
1291 while limited.has_remaining() {
1292 self.public_dependency
1293 .push(::buffa::types::decode_int32(&mut limited)?);
1294 }
1295 let leftover = limited.remaining();
1296 if leftover > 0 {
1297 limited.advance(leftover);
1298 }
1299 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1300 self.public_dependency.push(::buffa::types::decode_int32(buf)?);
1301 } else {
1302 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1303 field_number: 10u32,
1304 expected: 2u8,
1305 actual: tag.wire_type() as u8,
1306 });
1307 }
1308 }
1309 11u32 => {
1310 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
1311 let len = ::buffa::encoding::decode_varint(buf)?;
1312 let len = usize::try_from(len)
1313 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
1314 if buf.remaining() < len {
1315 return ::core::result::Result::Err(
1316 ::buffa::DecodeError::UnexpectedEof,
1317 );
1318 }
1319 self.weak_dependency.reserve(len);
1320 let mut limited = buf.take(len);
1321 while limited.has_remaining() {
1322 self.weak_dependency
1323 .push(::buffa::types::decode_int32(&mut limited)?);
1324 }
1325 let leftover = limited.remaining();
1326 if leftover > 0 {
1327 limited.advance(leftover);
1328 }
1329 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
1330 self.weak_dependency.push(::buffa::types::decode_int32(buf)?);
1331 } else {
1332 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1333 field_number: 11u32,
1334 expected: 2u8,
1335 actual: tag.wire_type() as u8,
1336 });
1337 }
1338 }
1339 12u32 => {
1340 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1341 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1342 field_number: 12u32,
1343 expected: 2u8,
1344 actual: tag.wire_type() as u8,
1345 });
1346 }
1347 ::buffa::types::merge_string(
1348 self.syntax.get_or_insert_with(::buffa::alloc::string::String::new),
1349 buf,
1350 )?;
1351 }
1352 14u32 => {
1353 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1354 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1355 field_number: 14u32,
1356 expected: 0u8,
1357 actual: tag.wire_type() as u8,
1358 });
1359 }
1360 let __raw = ::buffa::types::decode_int32(buf)?;
1361 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
1362 __raw,
1363 ) {
1364 self.edition = ::core::option::Option::Some(__v);
1365 } else {
1366 self.__buffa_unknown_fields
1367 .push(::buffa::UnknownField {
1368 number: 14u32,
1369 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
1370 });
1371 }
1372 }
1373 15u32 => {
1374 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1375 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1376 field_number: 15u32,
1377 expected: 2u8,
1378 actual: tag.wire_type() as u8,
1379 });
1380 }
1381 self.option_dependency.push(::buffa::types::decode_string(buf)?);
1382 }
1383 _ => {
1384 self.__buffa_unknown_fields
1385 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1386 }
1387 }
1388 ::core::result::Result::Ok(())
1389 }
1390 fn clear(&mut self) {
1391 self.name = ::core::option::Option::None;
1392 self.package = ::core::option::Option::None;
1393 self.dependency.clear();
1394 self.message_type.clear();
1395 self.enum_type.clear();
1396 self.service.clear();
1397 self.extension.clear();
1398 self.options = ::buffa::MessageField::none();
1399 self.source_code_info = ::buffa::MessageField::none();
1400 self.public_dependency.clear();
1401 self.weak_dependency.clear();
1402 self.syntax = ::core::option::Option::None;
1403 self.edition = ::core::option::Option::None;
1404 self.option_dependency.clear();
1405 self.__buffa_unknown_fields.clear();
1406 }
1407}
1408impl ::buffa::ExtensionSet for FileDescriptorProto {
1409 const PROTO_FQN: &'static str = "google.protobuf.FileDescriptorProto";
1410 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1411 &self.__buffa_unknown_fields
1412 }
1413 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1414 &mut self.__buffa_unknown_fields
1415 }
1416}
1417#[cfg(feature = "text")]
1418impl ::buffa::text::TextFormat for FileDescriptorProto {
1419 fn encode_text(
1420 &self,
1421 enc: &mut ::buffa::text::TextEncoder<'_>,
1422 ) -> ::core::fmt::Result {
1423 #[allow(unused_imports)]
1424 use ::buffa::Enumeration as _;
1425 if let ::core::option::Option::Some(ref __v) = self.name {
1426 enc.write_field_name("name")?;
1427 enc.write_string(__v)?;
1428 }
1429 if let ::core::option::Option::Some(ref __v) = self.package {
1430 enc.write_field_name("package")?;
1431 enc.write_string(__v)?;
1432 }
1433 if self.options.is_set() {
1434 enc.write_field_name("options")?;
1435 enc.write_message(&*self.options)?;
1436 }
1437 if self.source_code_info.is_set() {
1438 enc.write_field_name("source_code_info")?;
1439 enc.write_message(&*self.source_code_info)?;
1440 }
1441 if let ::core::option::Option::Some(ref __v) = self.syntax {
1442 enc.write_field_name("syntax")?;
1443 enc.write_string(__v)?;
1444 }
1445 if let ::core::option::Option::Some(ref __v) = self.edition {
1446 enc.write_field_name("edition")?;
1447 enc.write_enum_name(__v.proto_name())?;
1448 }
1449 for __v in &self.dependency {
1450 enc.write_field_name("dependency")?;
1451 enc.write_string(__v)?;
1452 }
1453 for __v in &self.public_dependency {
1454 enc.write_field_name("public_dependency")?;
1455 enc.write_i32(*__v)?;
1456 }
1457 for __v in &self.weak_dependency {
1458 enc.write_field_name("weak_dependency")?;
1459 enc.write_i32(*__v)?;
1460 }
1461 for __v in &self.option_dependency {
1462 enc.write_field_name("option_dependency")?;
1463 enc.write_string(__v)?;
1464 }
1465 for __v in &self.message_type {
1466 enc.write_field_name("message_type")?;
1467 enc.write_message(__v)?;
1468 }
1469 for __v in &self.enum_type {
1470 enc.write_field_name("enum_type")?;
1471 enc.write_message(__v)?;
1472 }
1473 for __v in &self.service {
1474 enc.write_field_name("service")?;
1475 enc.write_message(__v)?;
1476 }
1477 for __v in &self.extension {
1478 enc.write_field_name("extension")?;
1479 enc.write_message(__v)?;
1480 }
1481 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1482 ::core::result::Result::Ok(())
1483 }
1484 fn merge_text(
1485 &mut self,
1486 dec: &mut ::buffa::text::TextDecoder<'_>,
1487 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1488 #[allow(unused_imports)]
1489 use ::buffa::Enumeration as _;
1490 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1491 match __name {
1492 "name" => {
1493 self.name = ::core::option::Option::Some(
1494 dec.read_string()?.into_owned(),
1495 );
1496 }
1497 "package" => {
1498 self.package = ::core::option::Option::Some(
1499 dec.read_string()?.into_owned(),
1500 );
1501 }
1502 "options" => dec.merge_message(self.options.get_or_insert_default())?,
1503 "source_code_info" => {
1504 dec.merge_message(self.source_code_info.get_or_insert_default())?
1505 }
1506 "syntax" => {
1507 self.syntax = ::core::option::Option::Some(
1508 dec.read_string()?.into_owned(),
1509 );
1510 }
1511 "edition" => {
1512 self.edition = ::core::option::Option::Some(
1513 dec.read_closed_enum_by_name::<Edition>()?,
1514 );
1515 }
1516 "dependency" => {
1517 dec.read_repeated_into(
1518 &mut self.dependency,
1519 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
1520 )?
1521 }
1522 "public_dependency" => {
1523 dec.read_repeated_into(
1524 &mut self.public_dependency,
1525 |__d| __d.read_i32(),
1526 )?
1527 }
1528 "weak_dependency" => {
1529 dec.read_repeated_into(
1530 &mut self.weak_dependency,
1531 |__d| __d.read_i32(),
1532 )?
1533 }
1534 "option_dependency" => {
1535 dec.read_repeated_into(
1536 &mut self.option_dependency,
1537 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
1538 )?
1539 }
1540 "message_type" => {
1541 dec.read_repeated_into(
1542 &mut self.message_type,
1543 |__d| {
1544 let mut __m = ::core::default::Default::default();
1545 __d.merge_message(&mut __m)?;
1546 ::core::result::Result::Ok(__m)
1547 },
1548 )?
1549 }
1550 "enum_type" => {
1551 dec.read_repeated_into(
1552 &mut self.enum_type,
1553 |__d| {
1554 let mut __m = ::core::default::Default::default();
1555 __d.merge_message(&mut __m)?;
1556 ::core::result::Result::Ok(__m)
1557 },
1558 )?
1559 }
1560 "service" => {
1561 dec.read_repeated_into(
1562 &mut self.service,
1563 |__d| {
1564 let mut __m = ::core::default::Default::default();
1565 __d.merge_message(&mut __m)?;
1566 ::core::result::Result::Ok(__m)
1567 },
1568 )?
1569 }
1570 "extension" => {
1571 dec.read_repeated_into(
1572 &mut self.extension,
1573 |__d| {
1574 let mut __m = ::core::default::Default::default();
1575 __d.merge_message(&mut __m)?;
1576 ::core::result::Result::Ok(__m)
1577 },
1578 )?
1579 }
1580 _ => dec.skip_value()?,
1581 }
1582 }
1583 ::core::result::Result::Ok(())
1584 }
1585}
1586#[cfg(feature = "json")]
1587impl ::buffa::json_helpers::ProtoElemJson for FileDescriptorProto {
1588 fn serialize_proto_json<S: ::serde::Serializer>(
1589 v: &Self,
1590 s: S,
1591 ) -> ::core::result::Result<S::Ok, S::Error> {
1592 ::serde::Serialize::serialize(v, s)
1593 }
1594 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1595 d: D,
1596 ) -> ::core::result::Result<Self, D::Error> {
1597 <Self as ::serde::Deserialize>::deserialize(d)
1598 }
1599}
1600#[cfg(feature = "json")]
1601#[doc(hidden)]
1602pub const __FILE_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1603 type_url: "type.googleapis.com/google.protobuf.FileDescriptorProto",
1604 to_json: ::buffa::type_registry::any_to_json::<FileDescriptorProto>,
1605 from_json: ::buffa::type_registry::any_from_json::<FileDescriptorProto>,
1606 is_wkt: false,
1607};
1608#[cfg(feature = "text")]
1609#[doc(hidden)]
1610pub const __FILE_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1611 type_url: "type.googleapis.com/google.protobuf.FileDescriptorProto",
1612 text_encode: ::buffa::type_registry::any_encode_text::<FileDescriptorProto>,
1613 text_merge: ::buffa::type_registry::any_merge_text::<FileDescriptorProto>,
1614};
1615#[derive(Clone, PartialEq, Default)]
1617#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
1618#[cfg_attr(feature = "json", serde(default))]
1619#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1620pub struct DescriptorProto {
1621 #[cfg_attr(
1623 feature = "json",
1624 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
1625 )]
1626 pub name: ::core::option::Option<::buffa::alloc::string::String>,
1627 #[cfg_attr(
1629 feature = "json",
1630 serde(
1631 rename = "field",
1632 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1633 deserialize_with = "::buffa::json_helpers::null_as_default"
1634 )
1635 )]
1636 pub field: ::buffa::alloc::vec::Vec<FieldDescriptorProto>,
1637 #[cfg_attr(
1639 feature = "json",
1640 serde(
1641 rename = "extension",
1642 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1643 deserialize_with = "::buffa::json_helpers::null_as_default"
1644 )
1645 )]
1646 pub extension: ::buffa::alloc::vec::Vec<FieldDescriptorProto>,
1647 #[cfg_attr(
1649 feature = "json",
1650 serde(
1651 rename = "nestedType",
1652 alias = "nested_type",
1653 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1654 deserialize_with = "::buffa::json_helpers::null_as_default"
1655 )
1656 )]
1657 pub nested_type: ::buffa::alloc::vec::Vec<Self>,
1658 #[cfg_attr(
1660 feature = "json",
1661 serde(
1662 rename = "enumType",
1663 alias = "enum_type",
1664 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1665 deserialize_with = "::buffa::json_helpers::null_as_default"
1666 )
1667 )]
1668 pub enum_type: ::buffa::alloc::vec::Vec<EnumDescriptorProto>,
1669 #[cfg_attr(
1671 feature = "json",
1672 serde(
1673 rename = "extensionRange",
1674 alias = "extension_range",
1675 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1676 deserialize_with = "::buffa::json_helpers::null_as_default"
1677 )
1678 )]
1679 pub extension_range: ::buffa::alloc::vec::Vec<descriptor_proto::ExtensionRange>,
1680 #[cfg_attr(
1682 feature = "json",
1683 serde(
1684 rename = "oneofDecl",
1685 alias = "oneof_decl",
1686 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1687 deserialize_with = "::buffa::json_helpers::null_as_default"
1688 )
1689 )]
1690 pub oneof_decl: ::buffa::alloc::vec::Vec<OneofDescriptorProto>,
1691 #[cfg_attr(
1693 feature = "json",
1694 serde(
1695 rename = "options",
1696 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
1697 )
1698 )]
1699 pub options: ::buffa::MessageField<MessageOptions>,
1700 #[cfg_attr(
1702 feature = "json",
1703 serde(
1704 rename = "reservedRange",
1705 alias = "reserved_range",
1706 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1707 deserialize_with = "::buffa::json_helpers::null_as_default"
1708 )
1709 )]
1710 pub reserved_range: ::buffa::alloc::vec::Vec<descriptor_proto::ReservedRange>,
1711 #[cfg_attr(
1716 feature = "json",
1717 serde(
1718 rename = "reservedName",
1719 alias = "reserved_name",
1720 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
1721 deserialize_with = "::buffa::json_helpers::null_as_default"
1722 )
1723 )]
1724 pub reserved_name: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
1725 #[cfg_attr(
1729 feature = "json",
1730 serde(
1731 rename = "visibility",
1732 with = "::buffa::json_helpers::opt_closed_enum",
1733 skip_serializing_if = "::core::option::Option::is_none"
1734 )
1735 )]
1736 pub visibility: ::core::option::Option<SymbolVisibility>,
1737 #[cfg_attr(feature = "json", serde(skip))]
1738 #[doc(hidden)]
1739 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1740}
1741impl ::core::fmt::Debug for DescriptorProto {
1742 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1743 f.debug_struct("DescriptorProto")
1744 .field("name", &self.name)
1745 .field("field", &self.field)
1746 .field("extension", &self.extension)
1747 .field("nested_type", &self.nested_type)
1748 .field("enum_type", &self.enum_type)
1749 .field("extension_range", &self.extension_range)
1750 .field("oneof_decl", &self.oneof_decl)
1751 .field("options", &self.options)
1752 .field("reserved_range", &self.reserved_range)
1753 .field("reserved_name", &self.reserved_name)
1754 .field("visibility", &self.visibility)
1755 .finish()
1756 }
1757}
1758impl DescriptorProto {
1759 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto";
1764}
1765impl DescriptorProto {
1766 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1767 #[inline]
1768 pub fn with_name(
1770 mut self,
1771 value: impl Into<::buffa::alloc::string::String>,
1772 ) -> Self {
1773 self.name = Some(value.into());
1774 self
1775 }
1776 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1777 #[inline]
1778 pub fn with_visibility(mut self, value: impl Into<SymbolVisibility>) -> Self {
1780 self.visibility = Some(value.into());
1781 self
1782 }
1783}
1784impl ::buffa::DefaultInstance for DescriptorProto {
1785 fn default_instance() -> &'static Self {
1786 static VALUE: ::buffa::__private::OnceBox<DescriptorProto> = ::buffa::__private::OnceBox::new();
1787 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1788 }
1789}
1790impl ::buffa::MessageName for DescriptorProto {
1791 const PACKAGE: &'static str = "google.protobuf";
1792 const NAME: &'static str = "DescriptorProto";
1793 const FULL_NAME: &'static str = "google.protobuf.DescriptorProto";
1794 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto";
1795}
1796impl ::buffa::Message for DescriptorProto {
1797 #[allow(clippy::let_and_return)]
1803 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1804 #[allow(unused_imports)]
1805 use ::buffa::Enumeration as _;
1806 let mut size = 0u32;
1807 if let Some(ref v) = self.name {
1808 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1809 }
1810 for v in &self.field {
1811 let __slot = __cache.reserve();
1812 let inner_size = v.compute_size(__cache);
1813 __cache.set(__slot, inner_size);
1814 size
1815 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1816 + inner_size;
1817 }
1818 for v in &self.nested_type {
1819 let __slot = __cache.reserve();
1820 let inner_size = v.compute_size(__cache);
1821 __cache.set(__slot, inner_size);
1822 size
1823 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1824 + inner_size;
1825 }
1826 for v in &self.enum_type {
1827 let __slot = __cache.reserve();
1828 let inner_size = v.compute_size(__cache);
1829 __cache.set(__slot, inner_size);
1830 size
1831 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1832 + inner_size;
1833 }
1834 for v in &self.extension_range {
1835 let __slot = __cache.reserve();
1836 let inner_size = v.compute_size(__cache);
1837 __cache.set(__slot, inner_size);
1838 size
1839 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1840 + inner_size;
1841 }
1842 for v in &self.extension {
1843 let __slot = __cache.reserve();
1844 let inner_size = v.compute_size(__cache);
1845 __cache.set(__slot, inner_size);
1846 size
1847 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1848 + inner_size;
1849 }
1850 if self.options.is_set() {
1851 let __slot = __cache.reserve();
1852 let inner_size = self.options.compute_size(__cache);
1853 __cache.set(__slot, inner_size);
1854 size
1855 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1856 + inner_size;
1857 }
1858 for v in &self.oneof_decl {
1859 let __slot = __cache.reserve();
1860 let inner_size = v.compute_size(__cache);
1861 __cache.set(__slot, inner_size);
1862 size
1863 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1864 + inner_size;
1865 }
1866 for v in &self.reserved_range {
1867 let __slot = __cache.reserve();
1868 let inner_size = v.compute_size(__cache);
1869 __cache.set(__slot, inner_size);
1870 size
1871 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1872 + inner_size;
1873 }
1874 for v in &self.reserved_name {
1875 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1876 }
1877 if let Some(ref v) = self.visibility {
1878 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
1879 }
1880 size += self.__buffa_unknown_fields.encoded_len() as u32;
1881 size
1882 }
1883 fn write_to(
1884 &self,
1885 __cache: &mut ::buffa::SizeCache,
1886 buf: &mut impl ::buffa::bytes::BufMut,
1887 ) {
1888 #[allow(unused_imports)]
1889 use ::buffa::Enumeration as _;
1890 if let Some(ref v) = self.name {
1891 ::buffa::encoding::Tag::new(
1892 1u32,
1893 ::buffa::encoding::WireType::LengthDelimited,
1894 )
1895 .encode(buf);
1896 ::buffa::types::encode_string(v, buf);
1897 }
1898 for v in &self.field {
1899 ::buffa::encoding::Tag::new(
1900 2u32,
1901 ::buffa::encoding::WireType::LengthDelimited,
1902 )
1903 .encode(buf);
1904 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1905 v.write_to(__cache, buf);
1906 }
1907 for v in &self.nested_type {
1908 ::buffa::encoding::Tag::new(
1909 3u32,
1910 ::buffa::encoding::WireType::LengthDelimited,
1911 )
1912 .encode(buf);
1913 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1914 v.write_to(__cache, buf);
1915 }
1916 for v in &self.enum_type {
1917 ::buffa::encoding::Tag::new(
1918 4u32,
1919 ::buffa::encoding::WireType::LengthDelimited,
1920 )
1921 .encode(buf);
1922 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1923 v.write_to(__cache, buf);
1924 }
1925 for v in &self.extension_range {
1926 ::buffa::encoding::Tag::new(
1927 5u32,
1928 ::buffa::encoding::WireType::LengthDelimited,
1929 )
1930 .encode(buf);
1931 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1932 v.write_to(__cache, buf);
1933 }
1934 for v in &self.extension {
1935 ::buffa::encoding::Tag::new(
1936 6u32,
1937 ::buffa::encoding::WireType::LengthDelimited,
1938 )
1939 .encode(buf);
1940 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1941 v.write_to(__cache, buf);
1942 }
1943 if self.options.is_set() {
1944 ::buffa::encoding::Tag::new(
1945 7u32,
1946 ::buffa::encoding::WireType::LengthDelimited,
1947 )
1948 .encode(buf);
1949 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1950 self.options.write_to(__cache, buf);
1951 }
1952 for v in &self.oneof_decl {
1953 ::buffa::encoding::Tag::new(
1954 8u32,
1955 ::buffa::encoding::WireType::LengthDelimited,
1956 )
1957 .encode(buf);
1958 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1959 v.write_to(__cache, buf);
1960 }
1961 for v in &self.reserved_range {
1962 ::buffa::encoding::Tag::new(
1963 9u32,
1964 ::buffa::encoding::WireType::LengthDelimited,
1965 )
1966 .encode(buf);
1967 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1968 v.write_to(__cache, buf);
1969 }
1970 for v in &self.reserved_name {
1971 ::buffa::encoding::Tag::new(
1972 10u32,
1973 ::buffa::encoding::WireType::LengthDelimited,
1974 )
1975 .encode(buf);
1976 ::buffa::types::encode_string(v, buf);
1977 }
1978 if let Some(ref v) = self.visibility {
1979 ::buffa::encoding::Tag::new(11u32, ::buffa::encoding::WireType::Varint)
1980 .encode(buf);
1981 ::buffa::types::encode_int32(v.to_i32(), buf);
1982 }
1983 self.__buffa_unknown_fields.write_to(buf);
1984 }
1985 fn merge_field(
1986 &mut self,
1987 tag: ::buffa::encoding::Tag,
1988 buf: &mut impl ::buffa::bytes::Buf,
1989 depth: u32,
1990 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1991 #[allow(unused_imports)]
1992 use ::buffa::bytes::Buf as _;
1993 #[allow(unused_imports)]
1994 use ::buffa::Enumeration as _;
1995 match tag.field_number() {
1996 1u32 => {
1997 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1998 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1999 field_number: 1u32,
2000 expected: 2u8,
2001 actual: tag.wire_type() as u8,
2002 });
2003 }
2004 ::buffa::types::merge_string(
2005 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
2006 buf,
2007 )?;
2008 }
2009 2u32 => {
2010 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2011 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2012 field_number: 2u32,
2013 expected: 2u8,
2014 actual: tag.wire_type() as u8,
2015 });
2016 }
2017 let mut elem = ::core::default::Default::default();
2018 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2019 self.field.push(elem);
2020 }
2021 3u32 => {
2022 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2023 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2024 field_number: 3u32,
2025 expected: 2u8,
2026 actual: tag.wire_type() as u8,
2027 });
2028 }
2029 let mut elem = ::core::default::Default::default();
2030 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2031 self.nested_type.push(elem);
2032 }
2033 4u32 => {
2034 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2035 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2036 field_number: 4u32,
2037 expected: 2u8,
2038 actual: tag.wire_type() as u8,
2039 });
2040 }
2041 let mut elem = ::core::default::Default::default();
2042 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2043 self.enum_type.push(elem);
2044 }
2045 5u32 => {
2046 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2047 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2048 field_number: 5u32,
2049 expected: 2u8,
2050 actual: tag.wire_type() as u8,
2051 });
2052 }
2053 let mut elem = ::core::default::Default::default();
2054 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2055 self.extension_range.push(elem);
2056 }
2057 6u32 => {
2058 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2059 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2060 field_number: 6u32,
2061 expected: 2u8,
2062 actual: tag.wire_type() as u8,
2063 });
2064 }
2065 let mut elem = ::core::default::Default::default();
2066 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2067 self.extension.push(elem);
2068 }
2069 7u32 => {
2070 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2071 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2072 field_number: 7u32,
2073 expected: 2u8,
2074 actual: tag.wire_type() as u8,
2075 });
2076 }
2077 ::buffa::Message::merge_length_delimited(
2078 self.options.get_or_insert_default(),
2079 buf,
2080 depth,
2081 )?;
2082 }
2083 8u32 => {
2084 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2085 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2086 field_number: 8u32,
2087 expected: 2u8,
2088 actual: tag.wire_type() as u8,
2089 });
2090 }
2091 let mut elem = ::core::default::Default::default();
2092 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2093 self.oneof_decl.push(elem);
2094 }
2095 9u32 => {
2096 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2097 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2098 field_number: 9u32,
2099 expected: 2u8,
2100 actual: tag.wire_type() as u8,
2101 });
2102 }
2103 let mut elem = ::core::default::Default::default();
2104 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2105 self.reserved_range.push(elem);
2106 }
2107 10u32 => {
2108 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2109 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2110 field_number: 10u32,
2111 expected: 2u8,
2112 actual: tag.wire_type() as u8,
2113 });
2114 }
2115 self.reserved_name.push(::buffa::types::decode_string(buf)?);
2116 }
2117 11u32 => {
2118 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2119 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2120 field_number: 11u32,
2121 expected: 0u8,
2122 actual: tag.wire_type() as u8,
2123 });
2124 }
2125 let __raw = ::buffa::types::decode_int32(buf)?;
2126 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
2127 __raw,
2128 ) {
2129 self.visibility = ::core::option::Option::Some(__v);
2130 } else {
2131 self.__buffa_unknown_fields
2132 .push(::buffa::UnknownField {
2133 number: 11u32,
2134 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
2135 });
2136 }
2137 }
2138 _ => {
2139 self.__buffa_unknown_fields
2140 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2141 }
2142 }
2143 ::core::result::Result::Ok(())
2144 }
2145 fn clear(&mut self) {
2146 self.name = ::core::option::Option::None;
2147 self.field.clear();
2148 self.nested_type.clear();
2149 self.enum_type.clear();
2150 self.extension_range.clear();
2151 self.extension.clear();
2152 self.options = ::buffa::MessageField::none();
2153 self.oneof_decl.clear();
2154 self.reserved_range.clear();
2155 self.reserved_name.clear();
2156 self.visibility = ::core::option::Option::None;
2157 self.__buffa_unknown_fields.clear();
2158 }
2159}
2160impl ::buffa::ExtensionSet for DescriptorProto {
2161 const PROTO_FQN: &'static str = "google.protobuf.DescriptorProto";
2162 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2163 &self.__buffa_unknown_fields
2164 }
2165 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2166 &mut self.__buffa_unknown_fields
2167 }
2168}
2169#[cfg(feature = "text")]
2170impl ::buffa::text::TextFormat for DescriptorProto {
2171 fn encode_text(
2172 &self,
2173 enc: &mut ::buffa::text::TextEncoder<'_>,
2174 ) -> ::core::fmt::Result {
2175 #[allow(unused_imports)]
2176 use ::buffa::Enumeration as _;
2177 if let ::core::option::Option::Some(ref __v) = self.name {
2178 enc.write_field_name("name")?;
2179 enc.write_string(__v)?;
2180 }
2181 if self.options.is_set() {
2182 enc.write_field_name("options")?;
2183 enc.write_message(&*self.options)?;
2184 }
2185 if let ::core::option::Option::Some(ref __v) = self.visibility {
2186 enc.write_field_name("visibility")?;
2187 enc.write_enum_name(__v.proto_name())?;
2188 }
2189 for __v in &self.field {
2190 enc.write_field_name("field")?;
2191 enc.write_message(__v)?;
2192 }
2193 for __v in &self.extension {
2194 enc.write_field_name("extension")?;
2195 enc.write_message(__v)?;
2196 }
2197 for __v in &self.nested_type {
2198 enc.write_field_name("nested_type")?;
2199 enc.write_message(__v)?;
2200 }
2201 for __v in &self.enum_type {
2202 enc.write_field_name("enum_type")?;
2203 enc.write_message(__v)?;
2204 }
2205 for __v in &self.extension_range {
2206 enc.write_field_name("extension_range")?;
2207 enc.write_message(__v)?;
2208 }
2209 for __v in &self.oneof_decl {
2210 enc.write_field_name("oneof_decl")?;
2211 enc.write_message(__v)?;
2212 }
2213 for __v in &self.reserved_range {
2214 enc.write_field_name("reserved_range")?;
2215 enc.write_message(__v)?;
2216 }
2217 for __v in &self.reserved_name {
2218 enc.write_field_name("reserved_name")?;
2219 enc.write_string(__v)?;
2220 }
2221 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
2222 ::core::result::Result::Ok(())
2223 }
2224 fn merge_text(
2225 &mut self,
2226 dec: &mut ::buffa::text::TextDecoder<'_>,
2227 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
2228 #[allow(unused_imports)]
2229 use ::buffa::Enumeration as _;
2230 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
2231 match __name {
2232 "name" => {
2233 self.name = ::core::option::Option::Some(
2234 dec.read_string()?.into_owned(),
2235 );
2236 }
2237 "options" => dec.merge_message(self.options.get_or_insert_default())?,
2238 "visibility" => {
2239 self.visibility = ::core::option::Option::Some(
2240 dec.read_closed_enum_by_name::<SymbolVisibility>()?,
2241 );
2242 }
2243 "field" => {
2244 dec.read_repeated_into(
2245 &mut self.field,
2246 |__d| {
2247 let mut __m = ::core::default::Default::default();
2248 __d.merge_message(&mut __m)?;
2249 ::core::result::Result::Ok(__m)
2250 },
2251 )?
2252 }
2253 "extension" => {
2254 dec.read_repeated_into(
2255 &mut self.extension,
2256 |__d| {
2257 let mut __m = ::core::default::Default::default();
2258 __d.merge_message(&mut __m)?;
2259 ::core::result::Result::Ok(__m)
2260 },
2261 )?
2262 }
2263 "nested_type" => {
2264 dec.read_repeated_into(
2265 &mut self.nested_type,
2266 |__d| {
2267 let mut __m = ::core::default::Default::default();
2268 __d.merge_message(&mut __m)?;
2269 ::core::result::Result::Ok(__m)
2270 },
2271 )?
2272 }
2273 "enum_type" => {
2274 dec.read_repeated_into(
2275 &mut self.enum_type,
2276 |__d| {
2277 let mut __m = ::core::default::Default::default();
2278 __d.merge_message(&mut __m)?;
2279 ::core::result::Result::Ok(__m)
2280 },
2281 )?
2282 }
2283 "extension_range" => {
2284 dec.read_repeated_into(
2285 &mut self.extension_range,
2286 |__d| {
2287 let mut __m = ::core::default::Default::default();
2288 __d.merge_message(&mut __m)?;
2289 ::core::result::Result::Ok(__m)
2290 },
2291 )?
2292 }
2293 "oneof_decl" => {
2294 dec.read_repeated_into(
2295 &mut self.oneof_decl,
2296 |__d| {
2297 let mut __m = ::core::default::Default::default();
2298 __d.merge_message(&mut __m)?;
2299 ::core::result::Result::Ok(__m)
2300 },
2301 )?
2302 }
2303 "reserved_range" => {
2304 dec.read_repeated_into(
2305 &mut self.reserved_range,
2306 |__d| {
2307 let mut __m = ::core::default::Default::default();
2308 __d.merge_message(&mut __m)?;
2309 ::core::result::Result::Ok(__m)
2310 },
2311 )?
2312 }
2313 "reserved_name" => {
2314 dec.read_repeated_into(
2315 &mut self.reserved_name,
2316 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
2317 )?
2318 }
2319 _ => dec.skip_value()?,
2320 }
2321 }
2322 ::core::result::Result::Ok(())
2323 }
2324}
2325#[cfg(feature = "json")]
2326impl ::buffa::json_helpers::ProtoElemJson for DescriptorProto {
2327 fn serialize_proto_json<S: ::serde::Serializer>(
2328 v: &Self,
2329 s: S,
2330 ) -> ::core::result::Result<S::Ok, S::Error> {
2331 ::serde::Serialize::serialize(v, s)
2332 }
2333 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2334 d: D,
2335 ) -> ::core::result::Result<Self, D::Error> {
2336 <Self as ::serde::Deserialize>::deserialize(d)
2337 }
2338}
2339#[cfg(feature = "json")]
2340#[doc(hidden)]
2341pub const __DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2342 type_url: "type.googleapis.com/google.protobuf.DescriptorProto",
2343 to_json: ::buffa::type_registry::any_to_json::<DescriptorProto>,
2344 from_json: ::buffa::type_registry::any_from_json::<DescriptorProto>,
2345 is_wkt: false,
2346};
2347#[cfg(feature = "text")]
2348#[doc(hidden)]
2349pub const __DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
2350 type_url: "type.googleapis.com/google.protobuf.DescriptorProto",
2351 text_encode: ::buffa::type_registry::any_encode_text::<DescriptorProto>,
2352 text_merge: ::buffa::type_registry::any_merge_text::<DescriptorProto>,
2353};
2354pub mod descriptor_proto {
2355 #[allow(unused_imports)]
2356 use super::*;
2357 #[derive(Clone, PartialEq, Default)]
2358 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
2359 #[cfg_attr(feature = "json", serde(default))]
2360 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
2361 pub struct ExtensionRange {
2362 #[cfg_attr(
2366 feature = "json",
2367 serde(
2368 rename = "start",
2369 with = "::buffa::json_helpers::opt_int32",
2370 skip_serializing_if = "::core::option::Option::is_none"
2371 )
2372 )]
2373 pub start: ::core::option::Option<i32>,
2374 #[cfg_attr(
2378 feature = "json",
2379 serde(
2380 rename = "end",
2381 with = "::buffa::json_helpers::opt_int32",
2382 skip_serializing_if = "::core::option::Option::is_none"
2383 )
2384 )]
2385 pub end: ::core::option::Option<i32>,
2386 #[cfg_attr(
2388 feature = "json",
2389 serde(
2390 rename = "options",
2391 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2392 )
2393 )]
2394 pub options: ::buffa::MessageField<super::ExtensionRangeOptions>,
2395 #[cfg_attr(feature = "json", serde(skip))]
2396 #[doc(hidden)]
2397 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2398 }
2399 impl ::core::fmt::Debug for ExtensionRange {
2400 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2401 f.debug_struct("ExtensionRange")
2402 .field("start", &self.start)
2403 .field("end", &self.end)
2404 .field("options", &self.options)
2405 .finish()
2406 }
2407 }
2408 impl ExtensionRange {
2409 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange";
2414 }
2415 impl ExtensionRange {
2416 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2417 #[inline]
2418 pub fn with_start(mut self, value: i32) -> Self {
2420 self.start = Some(value);
2421 self
2422 }
2423 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2424 #[inline]
2425 pub fn with_end(mut self, value: i32) -> Self {
2427 self.end = Some(value);
2428 self
2429 }
2430 }
2431 impl ::buffa::DefaultInstance for ExtensionRange {
2432 fn default_instance() -> &'static Self {
2433 static VALUE: ::buffa::__private::OnceBox<ExtensionRange> = ::buffa::__private::OnceBox::new();
2434 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2435 }
2436 }
2437 impl ::buffa::MessageName for ExtensionRange {
2438 const PACKAGE: &'static str = "google.protobuf";
2439 const NAME: &'static str = "DescriptorProto.ExtensionRange";
2440 const FULL_NAME: &'static str = "google.protobuf.DescriptorProto.ExtensionRange";
2441 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange";
2442 }
2443 impl ::buffa::Message for ExtensionRange {
2444 #[allow(clippy::let_and_return)]
2450 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2451 #[allow(unused_imports)]
2452 use ::buffa::Enumeration as _;
2453 let mut size = 0u32;
2454 if let Some(v) = self.start {
2455 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
2456 }
2457 if let Some(v) = self.end {
2458 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
2459 }
2460 if self.options.is_set() {
2461 let __slot = __cache.reserve();
2462 let inner_size = self.options.compute_size(__cache);
2463 __cache.set(__slot, inner_size);
2464 size
2465 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2466 + inner_size;
2467 }
2468 size += self.__buffa_unknown_fields.encoded_len() as u32;
2469 size
2470 }
2471 fn write_to(
2472 &self,
2473 __cache: &mut ::buffa::SizeCache,
2474 buf: &mut impl ::buffa::bytes::BufMut,
2475 ) {
2476 #[allow(unused_imports)]
2477 use ::buffa::Enumeration as _;
2478 if let Some(v) = self.start {
2479 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
2480 .encode(buf);
2481 ::buffa::types::encode_int32(v, buf);
2482 }
2483 if let Some(v) = self.end {
2484 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
2485 .encode(buf);
2486 ::buffa::types::encode_int32(v, buf);
2487 }
2488 if self.options.is_set() {
2489 ::buffa::encoding::Tag::new(
2490 3u32,
2491 ::buffa::encoding::WireType::LengthDelimited,
2492 )
2493 .encode(buf);
2494 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
2495 self.options.write_to(__cache, buf);
2496 }
2497 self.__buffa_unknown_fields.write_to(buf);
2498 }
2499 fn merge_field(
2500 &mut self,
2501 tag: ::buffa::encoding::Tag,
2502 buf: &mut impl ::buffa::bytes::Buf,
2503 depth: u32,
2504 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2505 #[allow(unused_imports)]
2506 use ::buffa::bytes::Buf as _;
2507 #[allow(unused_imports)]
2508 use ::buffa::Enumeration as _;
2509 match tag.field_number() {
2510 1u32 => {
2511 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2512 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2513 field_number: 1u32,
2514 expected: 0u8,
2515 actual: tag.wire_type() as u8,
2516 });
2517 }
2518 self.start = ::core::option::Option::Some(
2519 ::buffa::types::decode_int32(buf)?,
2520 );
2521 }
2522 2u32 => {
2523 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2524 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2525 field_number: 2u32,
2526 expected: 0u8,
2527 actual: tag.wire_type() as u8,
2528 });
2529 }
2530 self.end = ::core::option::Option::Some(
2531 ::buffa::types::decode_int32(buf)?,
2532 );
2533 }
2534 3u32 => {
2535 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2536 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2537 field_number: 3u32,
2538 expected: 2u8,
2539 actual: tag.wire_type() as u8,
2540 });
2541 }
2542 ::buffa::Message::merge_length_delimited(
2543 self.options.get_or_insert_default(),
2544 buf,
2545 depth,
2546 )?;
2547 }
2548 _ => {
2549 self.__buffa_unknown_fields
2550 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2551 }
2552 }
2553 ::core::result::Result::Ok(())
2554 }
2555 fn clear(&mut self) {
2556 self.start = ::core::option::Option::None;
2557 self.end = ::core::option::Option::None;
2558 self.options = ::buffa::MessageField::none();
2559 self.__buffa_unknown_fields.clear();
2560 }
2561 }
2562 impl ::buffa::ExtensionSet for ExtensionRange {
2563 const PROTO_FQN: &'static str = "google.protobuf.DescriptorProto.ExtensionRange";
2564 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2565 &self.__buffa_unknown_fields
2566 }
2567 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2568 &mut self.__buffa_unknown_fields
2569 }
2570 }
2571 #[cfg(feature = "text")]
2572 impl ::buffa::text::TextFormat for ExtensionRange {
2573 fn encode_text(
2574 &self,
2575 enc: &mut ::buffa::text::TextEncoder<'_>,
2576 ) -> ::core::fmt::Result {
2577 #[allow(unused_imports)]
2578 use ::buffa::Enumeration as _;
2579 if let ::core::option::Option::Some(ref __v) = self.start {
2580 enc.write_field_name("start")?;
2581 enc.write_i32(*__v)?;
2582 }
2583 if let ::core::option::Option::Some(ref __v) = self.end {
2584 enc.write_field_name("end")?;
2585 enc.write_i32(*__v)?;
2586 }
2587 if self.options.is_set() {
2588 enc.write_field_name("options")?;
2589 enc.write_message(&*self.options)?;
2590 }
2591 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
2592 ::core::result::Result::Ok(())
2593 }
2594 fn merge_text(
2595 &mut self,
2596 dec: &mut ::buffa::text::TextDecoder<'_>,
2597 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
2598 #[allow(unused_imports)]
2599 use ::buffa::Enumeration as _;
2600 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
2601 match __name {
2602 "start" => self.start = ::core::option::Option::Some(dec.read_i32()?),
2603 "end" => self.end = ::core::option::Option::Some(dec.read_i32()?),
2604 "options" => dec.merge_message(self.options.get_or_insert_default())?,
2605 _ => dec.skip_value()?,
2606 }
2607 }
2608 ::core::result::Result::Ok(())
2609 }
2610 }
2611 #[cfg(feature = "json")]
2612 impl ::buffa::json_helpers::ProtoElemJson for ExtensionRange {
2613 fn serialize_proto_json<S: ::serde::Serializer>(
2614 v: &Self,
2615 s: S,
2616 ) -> ::core::result::Result<S::Ok, S::Error> {
2617 ::serde::Serialize::serialize(v, s)
2618 }
2619 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2620 d: D,
2621 ) -> ::core::result::Result<Self, D::Error> {
2622 <Self as ::serde::Deserialize>::deserialize(d)
2623 }
2624 }
2625 #[cfg(feature = "json")]
2626 #[doc(hidden)]
2627 pub const __EXTENSION_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2628 type_url: "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange",
2629 to_json: ::buffa::type_registry::any_to_json::<ExtensionRange>,
2630 from_json: ::buffa::type_registry::any_from_json::<ExtensionRange>,
2631 is_wkt: false,
2632 };
2633 #[cfg(feature = "text")]
2634 #[doc(hidden)]
2635 pub const __EXTENSION_RANGE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
2636 type_url: "type.googleapis.com/google.protobuf.DescriptorProto.ExtensionRange",
2637 text_encode: ::buffa::type_registry::any_encode_text::<ExtensionRange>,
2638 text_merge: ::buffa::type_registry::any_merge_text::<ExtensionRange>,
2639 };
2640 #[derive(Clone, PartialEq, Default)]
2644 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
2645 #[cfg_attr(feature = "json", serde(default))]
2646 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
2647 pub struct ReservedRange {
2648 #[cfg_attr(
2652 feature = "json",
2653 serde(
2654 rename = "start",
2655 with = "::buffa::json_helpers::opt_int32",
2656 skip_serializing_if = "::core::option::Option::is_none"
2657 )
2658 )]
2659 pub start: ::core::option::Option<i32>,
2660 #[cfg_attr(
2664 feature = "json",
2665 serde(
2666 rename = "end",
2667 with = "::buffa::json_helpers::opt_int32",
2668 skip_serializing_if = "::core::option::Option::is_none"
2669 )
2670 )]
2671 pub end: ::core::option::Option<i32>,
2672 #[cfg_attr(feature = "json", serde(skip))]
2673 #[doc(hidden)]
2674 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2675 }
2676 impl ::core::fmt::Debug for ReservedRange {
2677 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2678 f.debug_struct("ReservedRange")
2679 .field("start", &self.start)
2680 .field("end", &self.end)
2681 .finish()
2682 }
2683 }
2684 impl ReservedRange {
2685 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange";
2690 }
2691 impl ReservedRange {
2692 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2693 #[inline]
2694 pub fn with_start(mut self, value: i32) -> Self {
2696 self.start = Some(value);
2697 self
2698 }
2699 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2700 #[inline]
2701 pub fn with_end(mut self, value: i32) -> Self {
2703 self.end = Some(value);
2704 self
2705 }
2706 }
2707 impl ::buffa::DefaultInstance for ReservedRange {
2708 fn default_instance() -> &'static Self {
2709 static VALUE: ::buffa::__private::OnceBox<ReservedRange> = ::buffa::__private::OnceBox::new();
2710 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2711 }
2712 }
2713 impl ::buffa::MessageName for ReservedRange {
2714 const PACKAGE: &'static str = "google.protobuf";
2715 const NAME: &'static str = "DescriptorProto.ReservedRange";
2716 const FULL_NAME: &'static str = "google.protobuf.DescriptorProto.ReservedRange";
2717 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange";
2718 }
2719 impl ::buffa::Message for ReservedRange {
2720 #[allow(clippy::let_and_return)]
2726 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2727 #[allow(unused_imports)]
2728 use ::buffa::Enumeration as _;
2729 let mut size = 0u32;
2730 if let Some(v) = self.start {
2731 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
2732 }
2733 if let Some(v) = self.end {
2734 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
2735 }
2736 size += self.__buffa_unknown_fields.encoded_len() as u32;
2737 size
2738 }
2739 fn write_to(
2740 &self,
2741 _cache: &mut ::buffa::SizeCache,
2742 buf: &mut impl ::buffa::bytes::BufMut,
2743 ) {
2744 #[allow(unused_imports)]
2745 use ::buffa::Enumeration as _;
2746 if let Some(v) = self.start {
2747 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
2748 .encode(buf);
2749 ::buffa::types::encode_int32(v, buf);
2750 }
2751 if let Some(v) = self.end {
2752 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
2753 .encode(buf);
2754 ::buffa::types::encode_int32(v, buf);
2755 }
2756 self.__buffa_unknown_fields.write_to(buf);
2757 }
2758 fn merge_field(
2759 &mut self,
2760 tag: ::buffa::encoding::Tag,
2761 buf: &mut impl ::buffa::bytes::Buf,
2762 depth: u32,
2763 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2764 #[allow(unused_imports)]
2765 use ::buffa::bytes::Buf as _;
2766 #[allow(unused_imports)]
2767 use ::buffa::Enumeration as _;
2768 match tag.field_number() {
2769 1u32 => {
2770 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2771 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2772 field_number: 1u32,
2773 expected: 0u8,
2774 actual: tag.wire_type() as u8,
2775 });
2776 }
2777 self.start = ::core::option::Option::Some(
2778 ::buffa::types::decode_int32(buf)?,
2779 );
2780 }
2781 2u32 => {
2782 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2783 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2784 field_number: 2u32,
2785 expected: 0u8,
2786 actual: tag.wire_type() as u8,
2787 });
2788 }
2789 self.end = ::core::option::Option::Some(
2790 ::buffa::types::decode_int32(buf)?,
2791 );
2792 }
2793 _ => {
2794 self.__buffa_unknown_fields
2795 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2796 }
2797 }
2798 ::core::result::Result::Ok(())
2799 }
2800 fn clear(&mut self) {
2801 self.start = ::core::option::Option::None;
2802 self.end = ::core::option::Option::None;
2803 self.__buffa_unknown_fields.clear();
2804 }
2805 }
2806 impl ::buffa::ExtensionSet for ReservedRange {
2807 const PROTO_FQN: &'static str = "google.protobuf.DescriptorProto.ReservedRange";
2808 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2809 &self.__buffa_unknown_fields
2810 }
2811 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2812 &mut self.__buffa_unknown_fields
2813 }
2814 }
2815 #[cfg(feature = "text")]
2816 impl ::buffa::text::TextFormat for ReservedRange {
2817 fn encode_text(
2818 &self,
2819 enc: &mut ::buffa::text::TextEncoder<'_>,
2820 ) -> ::core::fmt::Result {
2821 #[allow(unused_imports)]
2822 use ::buffa::Enumeration as _;
2823 if let ::core::option::Option::Some(ref __v) = self.start {
2824 enc.write_field_name("start")?;
2825 enc.write_i32(*__v)?;
2826 }
2827 if let ::core::option::Option::Some(ref __v) = self.end {
2828 enc.write_field_name("end")?;
2829 enc.write_i32(*__v)?;
2830 }
2831 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
2832 ::core::result::Result::Ok(())
2833 }
2834 fn merge_text(
2835 &mut self,
2836 dec: &mut ::buffa::text::TextDecoder<'_>,
2837 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
2838 #[allow(unused_imports)]
2839 use ::buffa::Enumeration as _;
2840 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
2841 match __name {
2842 "start" => self.start = ::core::option::Option::Some(dec.read_i32()?),
2843 "end" => self.end = ::core::option::Option::Some(dec.read_i32()?),
2844 _ => dec.skip_value()?,
2845 }
2846 }
2847 ::core::result::Result::Ok(())
2848 }
2849 }
2850 #[cfg(feature = "json")]
2851 impl ::buffa::json_helpers::ProtoElemJson for ReservedRange {
2852 fn serialize_proto_json<S: ::serde::Serializer>(
2853 v: &Self,
2854 s: S,
2855 ) -> ::core::result::Result<S::Ok, S::Error> {
2856 ::serde::Serialize::serialize(v, s)
2857 }
2858 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2859 d: D,
2860 ) -> ::core::result::Result<Self, D::Error> {
2861 <Self as ::serde::Deserialize>::deserialize(d)
2862 }
2863 }
2864 #[cfg(feature = "json")]
2865 #[doc(hidden)]
2866 pub const __RESERVED_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2867 type_url: "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange",
2868 to_json: ::buffa::type_registry::any_to_json::<ReservedRange>,
2869 from_json: ::buffa::type_registry::any_from_json::<ReservedRange>,
2870 is_wkt: false,
2871 };
2872 #[cfg(feature = "text")]
2873 #[doc(hidden)]
2874 pub const __RESERVED_RANGE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
2875 type_url: "type.googleapis.com/google.protobuf.DescriptorProto.ReservedRange",
2876 text_encode: ::buffa::type_registry::any_encode_text::<ReservedRange>,
2877 text_merge: ::buffa::type_registry::any_merge_text::<ReservedRange>,
2878 };
2879 #[cfg(feature = "views")]
2880 #[doc(inline)]
2881 pub use super::__buffa::view::descriptor_proto::ExtensionRangeView;
2882 #[cfg(feature = "views")]
2883 #[doc(inline)]
2884 pub use super::__buffa::view::descriptor_proto::ReservedRangeView;
2885}
2886#[derive(Clone, PartialEq, Default)]
2887#[cfg_attr(feature = "json", derive(::serde::Serialize))]
2888#[cfg_attr(feature = "json", serde(default))]
2889#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
2890pub struct ExtensionRangeOptions {
2891 #[cfg_attr(
2895 feature = "json",
2896 serde(
2897 rename = "uninterpretedOption",
2898 alias = "uninterpreted_option",
2899 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2900 deserialize_with = "::buffa::json_helpers::null_as_default"
2901 )
2902 )]
2903 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
2904 #[cfg_attr(
2910 feature = "json",
2911 serde(
2912 rename = "declaration",
2913 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2914 deserialize_with = "::buffa::json_helpers::null_as_default"
2915 )
2916 )]
2917 pub declaration: ::buffa::alloc::vec::Vec<extension_range_options::Declaration>,
2918 #[cfg_attr(
2922 feature = "json",
2923 serde(
2924 rename = "features",
2925 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2926 )
2927 )]
2928 pub features: ::buffa::MessageField<FeatureSet>,
2929 #[cfg_attr(
2935 feature = "json",
2936 serde(
2937 rename = "verification",
2938 with = "::buffa::json_helpers::opt_closed_enum",
2939 skip_serializing_if = "::core::option::Option::is_none"
2940 )
2941 )]
2942 pub verification: ::core::option::Option<extension_range_options::VerificationState>,
2943 #[cfg_attr(feature = "json", serde(flatten))]
2944 #[doc(hidden)]
2945 pub __buffa_unknown_fields: __ExtensionRangeOptionsExtJson,
2946}
2947impl ::core::fmt::Debug for ExtensionRangeOptions {
2948 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2949 f.debug_struct("ExtensionRangeOptions")
2950 .field("uninterpreted_option", &self.uninterpreted_option)
2951 .field("declaration", &self.declaration)
2952 .field("features", &self.features)
2953 .field("verification", &self.verification)
2954 .finish()
2955 }
2956}
2957impl ExtensionRangeOptions {
2958 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ExtensionRangeOptions";
2963}
2964impl ExtensionRangeOptions {
2965 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2966 #[inline]
2967 pub fn with_verification(
2969 mut self,
2970 value: impl Into<extension_range_options::VerificationState>,
2971 ) -> Self {
2972 self.verification = Some(value.into());
2973 self
2974 }
2975}
2976impl ::buffa::DefaultInstance for ExtensionRangeOptions {
2977 fn default_instance() -> &'static Self {
2978 static VALUE: ::buffa::__private::OnceBox<ExtensionRangeOptions> = ::buffa::__private::OnceBox::new();
2979 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2980 }
2981}
2982impl ::buffa::MessageName for ExtensionRangeOptions {
2983 const PACKAGE: &'static str = "google.protobuf";
2984 const NAME: &'static str = "ExtensionRangeOptions";
2985 const FULL_NAME: &'static str = "google.protobuf.ExtensionRangeOptions";
2986 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ExtensionRangeOptions";
2987}
2988impl ::buffa::Message for ExtensionRangeOptions {
2989 #[allow(clippy::let_and_return)]
2995 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2996 #[allow(unused_imports)]
2997 use ::buffa::Enumeration as _;
2998 let mut size = 0u32;
2999 for v in &self.declaration {
3000 let __slot = __cache.reserve();
3001 let inner_size = v.compute_size(__cache);
3002 __cache.set(__slot, inner_size);
3003 size
3004 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3005 + inner_size;
3006 }
3007 if let Some(ref v) = self.verification {
3008 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
3009 }
3010 if self.features.is_set() {
3011 let __slot = __cache.reserve();
3012 let inner_size = self.features.compute_size(__cache);
3013 __cache.set(__slot, inner_size);
3014 size
3015 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3016 + inner_size;
3017 }
3018 for v in &self.uninterpreted_option {
3019 let __slot = __cache.reserve();
3020 let inner_size = v.compute_size(__cache);
3021 __cache.set(__slot, inner_size);
3022 size
3023 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
3024 + inner_size;
3025 }
3026 size += self.__buffa_unknown_fields.encoded_len() as u32;
3027 size
3028 }
3029 fn write_to(
3030 &self,
3031 __cache: &mut ::buffa::SizeCache,
3032 buf: &mut impl ::buffa::bytes::BufMut,
3033 ) {
3034 #[allow(unused_imports)]
3035 use ::buffa::Enumeration as _;
3036 for v in &self.declaration {
3037 ::buffa::encoding::Tag::new(
3038 2u32,
3039 ::buffa::encoding::WireType::LengthDelimited,
3040 )
3041 .encode(buf);
3042 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
3043 v.write_to(__cache, buf);
3044 }
3045 if let Some(ref v) = self.verification {
3046 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
3047 .encode(buf);
3048 ::buffa::types::encode_int32(v.to_i32(), buf);
3049 }
3050 if self.features.is_set() {
3051 ::buffa::encoding::Tag::new(
3052 50u32,
3053 ::buffa::encoding::WireType::LengthDelimited,
3054 )
3055 .encode(buf);
3056 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
3057 self.features.write_to(__cache, buf);
3058 }
3059 for v in &self.uninterpreted_option {
3060 ::buffa::encoding::Tag::new(
3061 999u32,
3062 ::buffa::encoding::WireType::LengthDelimited,
3063 )
3064 .encode(buf);
3065 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
3066 v.write_to(__cache, buf);
3067 }
3068 self.__buffa_unknown_fields.write_to(buf);
3069 }
3070 fn merge_field(
3071 &mut self,
3072 tag: ::buffa::encoding::Tag,
3073 buf: &mut impl ::buffa::bytes::Buf,
3074 depth: u32,
3075 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3076 #[allow(unused_imports)]
3077 use ::buffa::bytes::Buf as _;
3078 #[allow(unused_imports)]
3079 use ::buffa::Enumeration as _;
3080 match tag.field_number() {
3081 2u32 => {
3082 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3083 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3084 field_number: 2u32,
3085 expected: 2u8,
3086 actual: tag.wire_type() as u8,
3087 });
3088 }
3089 let mut elem = ::core::default::Default::default();
3090 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
3091 self.declaration.push(elem);
3092 }
3093 3u32 => {
3094 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3095 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3096 field_number: 3u32,
3097 expected: 0u8,
3098 actual: tag.wire_type() as u8,
3099 });
3100 }
3101 let __raw = ::buffa::types::decode_int32(buf)?;
3102 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
3103 __raw,
3104 ) {
3105 self.verification = ::core::option::Option::Some(__v);
3106 } else {
3107 self.__buffa_unknown_fields
3108 .push(::buffa::UnknownField {
3109 number: 3u32,
3110 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
3111 });
3112 }
3113 }
3114 50u32 => {
3115 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3116 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3117 field_number: 50u32,
3118 expected: 2u8,
3119 actual: tag.wire_type() as u8,
3120 });
3121 }
3122 ::buffa::Message::merge_length_delimited(
3123 self.features.get_or_insert_default(),
3124 buf,
3125 depth,
3126 )?;
3127 }
3128 999u32 => {
3129 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3130 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3131 field_number: 999u32,
3132 expected: 2u8,
3133 actual: tag.wire_type() as u8,
3134 });
3135 }
3136 let mut elem = ::core::default::Default::default();
3137 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
3138 self.uninterpreted_option.push(elem);
3139 }
3140 _ => {
3141 self.__buffa_unknown_fields
3142 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3143 }
3144 }
3145 ::core::result::Result::Ok(())
3146 }
3147 fn clear(&mut self) {
3148 self.declaration.clear();
3149 self.verification = ::core::option::Option::None;
3150 self.features = ::buffa::MessageField::none();
3151 self.uninterpreted_option.clear();
3152 self.__buffa_unknown_fields.clear();
3153 }
3154}
3155impl ::buffa::ExtensionSet for ExtensionRangeOptions {
3156 const PROTO_FQN: &'static str = "google.protobuf.ExtensionRangeOptions";
3157 fn unknown_fields(&self) -> &::buffa::UnknownFields {
3158 &self.__buffa_unknown_fields
3159 }
3160 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3161 &mut self.__buffa_unknown_fields
3162 }
3163}
3164#[cfg(feature = "text")]
3165impl ::buffa::text::TextFormat for ExtensionRangeOptions {
3166 fn encode_text(
3167 &self,
3168 enc: &mut ::buffa::text::TextEncoder<'_>,
3169 ) -> ::core::fmt::Result {
3170 #[allow(unused_imports)]
3171 use ::buffa::Enumeration as _;
3172 if self.features.is_set() {
3173 enc.write_field_name("features")?;
3174 enc.write_message(&*self.features)?;
3175 }
3176 if let ::core::option::Option::Some(ref __v) = self.verification {
3177 enc.write_field_name("verification")?;
3178 enc.write_enum_name(__v.proto_name())?;
3179 }
3180 for __v in &self.uninterpreted_option {
3181 enc.write_field_name("uninterpreted_option")?;
3182 enc.write_message(__v)?;
3183 }
3184 for __v in &self.declaration {
3185 enc.write_field_name("declaration")?;
3186 enc.write_message(__v)?;
3187 }
3188 enc.write_extension_fields(
3189 "google.protobuf.ExtensionRangeOptions",
3190 &self.__buffa_unknown_fields,
3191 )?;
3192 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
3193 ::core::result::Result::Ok(())
3194 }
3195 fn merge_text(
3196 &mut self,
3197 dec: &mut ::buffa::text::TextDecoder<'_>,
3198 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
3199 #[allow(unused_imports)]
3200 use ::buffa::Enumeration as _;
3201 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
3202 match __name {
3203 "features" => dec.merge_message(self.features.get_or_insert_default())?,
3204 "verification" => {
3205 self.verification = ::core::option::Option::Some(
3206 dec
3207 .read_closed_enum_by_name::<
3208 extension_range_options::VerificationState,
3209 >()?,
3210 );
3211 }
3212 "uninterpreted_option" => {
3213 dec.read_repeated_into(
3214 &mut self.uninterpreted_option,
3215 |__d| {
3216 let mut __m = ::core::default::Default::default();
3217 __d.merge_message(&mut __m)?;
3218 ::core::result::Result::Ok(__m)
3219 },
3220 )?
3221 }
3222 "declaration" => {
3223 dec.read_repeated_into(
3224 &mut self.declaration,
3225 |__d| {
3226 let mut __m = ::core::default::Default::default();
3227 __d.merge_message(&mut __m)?;
3228 ::core::result::Result::Ok(__m)
3229 },
3230 )?
3231 }
3232 __name if __name.starts_with('[') => {
3233 for __r in dec
3234 .read_extension(__name, "google.protobuf.ExtensionRangeOptions")?
3235 {
3236 self.__buffa_unknown_fields.push(__r);
3237 }
3238 }
3239 _ => dec.skip_value()?,
3240 }
3241 }
3242 ::core::result::Result::Ok(())
3243 }
3244}
3245#[cfg(feature = "json")]
3246impl<'de> serde::Deserialize<'de> for ExtensionRangeOptions {
3247 fn deserialize<D: serde::Deserializer<'de>>(
3248 d: D,
3249 ) -> ::core::result::Result<Self, D::Error> {
3250 struct _V;
3251 impl<'de> serde::de::Visitor<'de> for _V {
3252 type Value = ExtensionRangeOptions;
3253 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3254 f.write_str("struct ExtensionRangeOptions")
3255 }
3256 #[allow(clippy::field_reassign_with_default)]
3257 fn visit_map<A: serde::de::MapAccess<'de>>(
3258 self,
3259 mut map: A,
3260 ) -> ::core::result::Result<ExtensionRangeOptions, A::Error> {
3261 let mut __f_uninterpreted_option: ::core::option::Option<
3262 ::buffa::alloc::vec::Vec<UninterpretedOption>,
3263 > = None;
3264 let mut __f_declaration: ::core::option::Option<
3265 ::buffa::alloc::vec::Vec<extension_range_options::Declaration>,
3266 > = None;
3267 let mut __f_features: ::core::option::Option<
3268 ::buffa::MessageField<FeatureSet>,
3269 > = None;
3270 let mut __f_verification: ::core::option::Option<
3271 ::core::option::Option<extension_range_options::VerificationState>,
3272 > = None;
3273 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
3274 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
3275 match key.as_str() {
3276 "uninterpretedOption" | "uninterpreted_option" => {
3277 __f_uninterpreted_option = Some({
3278 struct _S;
3279 impl<'de> serde::de::DeserializeSeed<'de> for _S {
3280 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
3281 fn deserialize<D: serde::Deserializer<'de>>(
3282 self,
3283 d: D,
3284 ) -> ::core::result::Result<
3285 ::buffa::alloc::vec::Vec<UninterpretedOption>,
3286 D::Error,
3287 > {
3288 ::buffa::json_helpers::null_as_default(d)
3289 }
3290 }
3291 map.next_value_seed(_S)?
3292 });
3293 }
3294 "declaration" => {
3295 __f_declaration = Some({
3296 struct _S;
3297 impl<'de> serde::de::DeserializeSeed<'de> for _S {
3298 type Value = ::buffa::alloc::vec::Vec<
3299 extension_range_options::Declaration,
3300 >;
3301 fn deserialize<D: serde::Deserializer<'de>>(
3302 self,
3303 d: D,
3304 ) -> ::core::result::Result<
3305 ::buffa::alloc::vec::Vec<
3306 extension_range_options::Declaration,
3307 >,
3308 D::Error,
3309 > {
3310 ::buffa::json_helpers::null_as_default(d)
3311 }
3312 }
3313 map.next_value_seed(_S)?
3314 });
3315 }
3316 "features" => {
3317 __f_features = Some(
3318 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
3319 );
3320 }
3321 "verification" => {
3322 __f_verification = Some({
3323 struct _S;
3324 impl<'de> serde::de::DeserializeSeed<'de> for _S {
3325 type Value = ::core::option::Option<
3326 extension_range_options::VerificationState,
3327 >;
3328 fn deserialize<D: serde::Deserializer<'de>>(
3329 self,
3330 d: D,
3331 ) -> ::core::result::Result<
3332 ::core::option::Option<
3333 extension_range_options::VerificationState,
3334 >,
3335 D::Error,
3336 > {
3337 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
3338 }
3339 }
3340 map.next_value_seed(_S)?
3341 });
3342 }
3343 __k if __k.starts_with('[') => {
3344 let __v: ::buffa::serde_json::Value = map.next_value()?;
3345 match ::buffa::extension_registry::deserialize_extension_key(
3346 "google.protobuf.ExtensionRangeOptions",
3347 __k,
3348 __v,
3349 ) {
3350 ::core::option::Option::Some(
3351 ::core::result::Result::Ok(__recs),
3352 ) => {
3353 for __rec in __recs {
3354 __ext_records.push(__rec);
3355 }
3356 }
3357 ::core::option::Option::Some(
3358 ::core::result::Result::Err(__e),
3359 ) => {
3360 return ::core::result::Result::Err(
3361 <A::Error as ::serde::de::Error>::custom(__e),
3362 );
3363 }
3364 ::core::option::Option::None => {}
3365 }
3366 }
3367 _ => {
3368 map.next_value::<serde::de::IgnoredAny>()?;
3369 }
3370 }
3371 }
3372 let mut __r = <ExtensionRangeOptions as ::core::default::Default>::default();
3373 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
3374 __r.uninterpreted_option = v;
3375 }
3376 if let ::core::option::Option::Some(v) = __f_declaration {
3377 __r.declaration = v;
3378 }
3379 if let ::core::option::Option::Some(v) = __f_features {
3380 __r.features = v;
3381 }
3382 if let ::core::option::Option::Some(v) = __f_verification {
3383 __r.verification = v;
3384 }
3385 for __rec in __ext_records {
3386 __r.__buffa_unknown_fields.push(__rec);
3387 }
3388 Ok(__r)
3389 }
3390 }
3391 d.deserialize_map(_V)
3392 }
3393}
3394#[cfg(feature = "json")]
3395impl ::buffa::json_helpers::ProtoElemJson for ExtensionRangeOptions {
3396 fn serialize_proto_json<S: ::serde::Serializer>(
3397 v: &Self,
3398 s: S,
3399 ) -> ::core::result::Result<S::Ok, S::Error> {
3400 ::serde::Serialize::serialize(v, s)
3401 }
3402 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3403 d: D,
3404 ) -> ::core::result::Result<Self, D::Error> {
3405 <Self as ::serde::Deserialize>::deserialize(d)
3406 }
3407}
3408#[doc(hidden)]
3409#[derive(Clone, Debug, Default, PartialEq)]
3410#[repr(transparent)]
3411#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
3412pub struct __ExtensionRangeOptionsExtJson(pub ::buffa::UnknownFields);
3413impl ::core::ops::Deref for __ExtensionRangeOptionsExtJson {
3414 type Target = ::buffa::UnknownFields;
3415 fn deref(&self) -> &::buffa::UnknownFields {
3416 &self.0
3417 }
3418}
3419impl ::core::ops::DerefMut for __ExtensionRangeOptionsExtJson {
3420 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
3421 &mut self.0
3422 }
3423}
3424impl ::core::convert::From<::buffa::UnknownFields> for __ExtensionRangeOptionsExtJson {
3425 fn from(u: ::buffa::UnknownFields) -> Self {
3426 Self(u)
3427 }
3428}
3429#[cfg(feature = "json")]
3430impl ::serde::Serialize for __ExtensionRangeOptionsExtJson {
3431 fn serialize<S: ::serde::Serializer>(
3432 &self,
3433 s: S,
3434 ) -> ::core::result::Result<S::Ok, S::Error> {
3435 ::buffa::extension_registry::serialize_extensions(
3436 "google.protobuf.ExtensionRangeOptions",
3437 &self.0,
3438 s,
3439 )
3440 }
3441}
3442#[cfg(feature = "json")]
3443impl<'de> ::serde::Deserialize<'de> for __ExtensionRangeOptionsExtJson {
3444 fn deserialize<D: ::serde::Deserializer<'de>>(
3445 d: D,
3446 ) -> ::core::result::Result<Self, D::Error> {
3447 ::buffa::extension_registry::deserialize_extensions(
3448 "google.protobuf.ExtensionRangeOptions",
3449 d,
3450 )
3451 .map(Self)
3452 }
3453}
3454#[cfg(feature = "json")]
3455#[doc(hidden)]
3456pub const __EXTENSION_RANGE_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3457 type_url: "type.googleapis.com/google.protobuf.ExtensionRangeOptions",
3458 to_json: ::buffa::type_registry::any_to_json::<ExtensionRangeOptions>,
3459 from_json: ::buffa::type_registry::any_from_json::<ExtensionRangeOptions>,
3460 is_wkt: false,
3461};
3462#[cfg(feature = "text")]
3463#[doc(hidden)]
3464pub const __EXTENSION_RANGE_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
3465 type_url: "type.googleapis.com/google.protobuf.ExtensionRangeOptions",
3466 text_encode: ::buffa::type_registry::any_encode_text::<ExtensionRangeOptions>,
3467 text_merge: ::buffa::type_registry::any_merge_text::<ExtensionRangeOptions>,
3468};
3469pub mod extension_range_options {
3470 #[allow(unused_imports)]
3471 use super::*;
3472 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
3474 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
3475 #[repr(i32)]
3476 pub enum VerificationState {
3477 DECLARATION = 0i32,
3479 UNVERIFIED = 1i32,
3480 }
3481 impl ::core::default::Default for VerificationState {
3482 fn default() -> Self {
3483 Self::DECLARATION
3484 }
3485 }
3486 #[cfg(feature = "json")]
3487 const _: () = {
3488 impl ::serde::Serialize for VerificationState {
3489 fn serialize<S: ::serde::Serializer>(
3490 &self,
3491 s: S,
3492 ) -> ::core::result::Result<S::Ok, S::Error> {
3493 s.serialize_str(::buffa::Enumeration::proto_name(self))
3494 }
3495 }
3496 impl<'de> ::serde::Deserialize<'de> for VerificationState {
3497 fn deserialize<D: ::serde::Deserializer<'de>>(
3498 d: D,
3499 ) -> ::core::result::Result<Self, D::Error> {
3500 struct _V;
3501 impl ::serde::de::Visitor<'_> for _V {
3502 type Value = VerificationState;
3503 fn expecting(
3504 &self,
3505 f: &mut ::core::fmt::Formatter<'_>,
3506 ) -> ::core::fmt::Result {
3507 f.write_str(
3508 concat!(
3509 "a string, integer, or null for ",
3510 stringify!(VerificationState)
3511 ),
3512 )
3513 }
3514 fn visit_str<E: ::serde::de::Error>(
3515 self,
3516 v: &str,
3517 ) -> ::core::result::Result<VerificationState, E> {
3518 <VerificationState as ::buffa::Enumeration>::from_proto_name(v)
3519 .ok_or_else(|| {
3520 ::serde::de::Error::unknown_variant(v, &[])
3521 })
3522 }
3523 fn visit_i64<E: ::serde::de::Error>(
3524 self,
3525 v: i64,
3526 ) -> ::core::result::Result<VerificationState, E> {
3527 let v32 = i32::try_from(v)
3528 .map_err(|_| {
3529 ::serde::de::Error::custom(
3530 ::buffa::alloc::format!("enum value {v} out of i32 range"),
3531 )
3532 })?;
3533 <VerificationState as ::buffa::Enumeration>::from_i32(v32)
3534 .ok_or_else(|| {
3535 ::serde::de::Error::custom(
3536 ::buffa::alloc::format!("unknown enum value {v32}"),
3537 )
3538 })
3539 }
3540 fn visit_u64<E: ::serde::de::Error>(
3541 self,
3542 v: u64,
3543 ) -> ::core::result::Result<VerificationState, E> {
3544 let v32 = i32::try_from(v)
3545 .map_err(|_| {
3546 ::serde::de::Error::custom(
3547 ::buffa::alloc::format!("enum value {v} out of i32 range"),
3548 )
3549 })?;
3550 <VerificationState as ::buffa::Enumeration>::from_i32(v32)
3551 .ok_or_else(|| {
3552 ::serde::de::Error::custom(
3553 ::buffa::alloc::format!("unknown enum value {v32}"),
3554 )
3555 })
3556 }
3557 fn visit_unit<E: ::serde::de::Error>(
3558 self,
3559 ) -> ::core::result::Result<VerificationState, E> {
3560 ::core::result::Result::Ok(::core::default::Default::default())
3561 }
3562 }
3563 d.deserialize_any(_V)
3564 }
3565 }
3566 impl ::buffa::json_helpers::ProtoElemJson for VerificationState {
3567 fn serialize_proto_json<S: ::serde::Serializer>(
3568 v: &Self,
3569 s: S,
3570 ) -> ::core::result::Result<S::Ok, S::Error> {
3571 ::serde::Serialize::serialize(v, s)
3572 }
3573 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3574 d: D,
3575 ) -> ::core::result::Result<Self, D::Error> {
3576 <Self as ::serde::Deserialize>::deserialize(d)
3577 }
3578 }
3579 };
3580 impl ::buffa::Enumeration for VerificationState {
3581 fn from_i32(value: i32) -> ::core::option::Option<Self> {
3582 match value {
3583 0i32 => ::core::option::Option::Some(Self::DECLARATION),
3584 1i32 => ::core::option::Option::Some(Self::UNVERIFIED),
3585 _ => ::core::option::Option::None,
3586 }
3587 }
3588 fn to_i32(&self) -> i32 {
3589 *self as i32
3590 }
3591 fn proto_name(&self) -> &'static str {
3592 match self {
3593 Self::DECLARATION => "DECLARATION",
3594 Self::UNVERIFIED => "UNVERIFIED",
3595 }
3596 }
3597 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
3598 match name {
3599 "DECLARATION" => ::core::option::Option::Some(Self::DECLARATION),
3600 "UNVERIFIED" => ::core::option::Option::Some(Self::UNVERIFIED),
3601 _ => ::core::option::Option::None,
3602 }
3603 }
3604 fn values() -> &'static [Self] {
3605 &[Self::DECLARATION, Self::UNVERIFIED]
3606 }
3607 }
3608 #[derive(Clone, PartialEq, Default)]
3609 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
3610 #[cfg_attr(feature = "json", serde(default))]
3611 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
3612 pub struct Declaration {
3613 #[cfg_attr(
3617 feature = "json",
3618 serde(
3619 rename = "number",
3620 with = "::buffa::json_helpers::opt_int32",
3621 skip_serializing_if = "::core::option::Option::is_none"
3622 )
3623 )]
3624 pub number: ::core::option::Option<i32>,
3625 #[cfg_attr(
3630 feature = "json",
3631 serde(
3632 rename = "fullName",
3633 alias = "full_name",
3634 skip_serializing_if = "::core::option::Option::is_none"
3635 )
3636 )]
3637 pub full_name: ::core::option::Option<::buffa::alloc::string::String>,
3638 #[cfg_attr(
3644 feature = "json",
3645 serde(
3646 rename = "type",
3647 skip_serializing_if = "::core::option::Option::is_none"
3648 )
3649 )]
3650 pub r#type: ::core::option::Option<::buffa::alloc::string::String>,
3651 #[cfg_attr(
3657 feature = "json",
3658 serde(
3659 rename = "reserved",
3660 skip_serializing_if = "::core::option::Option::is_none"
3661 )
3662 )]
3663 pub reserved: ::core::option::Option<bool>,
3664 #[cfg_attr(
3669 feature = "json",
3670 serde(
3671 rename = "repeated",
3672 skip_serializing_if = "::core::option::Option::is_none"
3673 )
3674 )]
3675 pub repeated: ::core::option::Option<bool>,
3676 #[cfg_attr(feature = "json", serde(skip))]
3677 #[doc(hidden)]
3678 pub __buffa_unknown_fields: ::buffa::UnknownFields,
3679 }
3680 impl ::core::fmt::Debug for Declaration {
3681 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3682 f.debug_struct("Declaration")
3683 .field("number", &self.number)
3684 .field("full_name", &self.full_name)
3685 .field("r#type", &self.r#type)
3686 .field("reserved", &self.reserved)
3687 .field("repeated", &self.repeated)
3688 .finish()
3689 }
3690 }
3691 impl Declaration {
3692 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration";
3697 }
3698 impl Declaration {
3699 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3700 #[inline]
3701 pub fn with_number(mut self, value: i32) -> Self {
3703 self.number = Some(value);
3704 self
3705 }
3706 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3707 #[inline]
3708 pub fn with_full_name(
3710 mut self,
3711 value: impl Into<::buffa::alloc::string::String>,
3712 ) -> Self {
3713 self.full_name = Some(value.into());
3714 self
3715 }
3716 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3717 #[inline]
3718 pub fn with_type(
3720 mut self,
3721 value: impl Into<::buffa::alloc::string::String>,
3722 ) -> Self {
3723 self.r#type = Some(value.into());
3724 self
3725 }
3726 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3727 #[inline]
3728 pub fn with_reserved(mut self, value: bool) -> Self {
3730 self.reserved = Some(value);
3731 self
3732 }
3733 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
3734 #[inline]
3735 pub fn with_repeated(mut self, value: bool) -> Self {
3737 self.repeated = Some(value);
3738 self
3739 }
3740 }
3741 impl ::buffa::DefaultInstance for Declaration {
3742 fn default_instance() -> &'static Self {
3743 static VALUE: ::buffa::__private::OnceBox<Declaration> = ::buffa::__private::OnceBox::new();
3744 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3745 }
3746 }
3747 impl ::buffa::MessageName for Declaration {
3748 const PACKAGE: &'static str = "google.protobuf";
3749 const NAME: &'static str = "ExtensionRangeOptions.Declaration";
3750 const FULL_NAME: &'static str = "google.protobuf.ExtensionRangeOptions.Declaration";
3751 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration";
3752 }
3753 impl ::buffa::Message for Declaration {
3754 #[allow(clippy::let_and_return)]
3760 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3761 #[allow(unused_imports)]
3762 use ::buffa::Enumeration as _;
3763 let mut size = 0u32;
3764 if let Some(v) = self.number {
3765 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
3766 }
3767 if let Some(ref v) = self.full_name {
3768 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
3769 }
3770 if let Some(ref v) = self.r#type {
3771 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
3772 }
3773 if self.reserved.is_some() {
3774 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3775 }
3776 if self.repeated.is_some() {
3777 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
3778 }
3779 size += self.__buffa_unknown_fields.encoded_len() as u32;
3780 size
3781 }
3782 fn write_to(
3783 &self,
3784 _cache: &mut ::buffa::SizeCache,
3785 buf: &mut impl ::buffa::bytes::BufMut,
3786 ) {
3787 #[allow(unused_imports)]
3788 use ::buffa::Enumeration as _;
3789 if let Some(v) = self.number {
3790 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
3791 .encode(buf);
3792 ::buffa::types::encode_int32(v, buf);
3793 }
3794 if let Some(ref v) = self.full_name {
3795 ::buffa::encoding::Tag::new(
3796 2u32,
3797 ::buffa::encoding::WireType::LengthDelimited,
3798 )
3799 .encode(buf);
3800 ::buffa::types::encode_string(v, buf);
3801 }
3802 if let Some(ref v) = self.r#type {
3803 ::buffa::encoding::Tag::new(
3804 3u32,
3805 ::buffa::encoding::WireType::LengthDelimited,
3806 )
3807 .encode(buf);
3808 ::buffa::types::encode_string(v, buf);
3809 }
3810 if let Some(v) = self.reserved {
3811 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
3812 .encode(buf);
3813 ::buffa::types::encode_bool(v, buf);
3814 }
3815 if let Some(v) = self.repeated {
3816 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
3817 .encode(buf);
3818 ::buffa::types::encode_bool(v, buf);
3819 }
3820 self.__buffa_unknown_fields.write_to(buf);
3821 }
3822 fn merge_field(
3823 &mut self,
3824 tag: ::buffa::encoding::Tag,
3825 buf: &mut impl ::buffa::bytes::Buf,
3826 depth: u32,
3827 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3828 #[allow(unused_imports)]
3829 use ::buffa::bytes::Buf as _;
3830 #[allow(unused_imports)]
3831 use ::buffa::Enumeration as _;
3832 match tag.field_number() {
3833 1u32 => {
3834 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3835 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3836 field_number: 1u32,
3837 expected: 0u8,
3838 actual: tag.wire_type() as u8,
3839 });
3840 }
3841 self.number = ::core::option::Option::Some(
3842 ::buffa::types::decode_int32(buf)?,
3843 );
3844 }
3845 2u32 => {
3846 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3847 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3848 field_number: 2u32,
3849 expected: 2u8,
3850 actual: tag.wire_type() as u8,
3851 });
3852 }
3853 ::buffa::types::merge_string(
3854 self
3855 .full_name
3856 .get_or_insert_with(::buffa::alloc::string::String::new),
3857 buf,
3858 )?;
3859 }
3860 3u32 => {
3861 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3862 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3863 field_number: 3u32,
3864 expected: 2u8,
3865 actual: tag.wire_type() as u8,
3866 });
3867 }
3868 ::buffa::types::merge_string(
3869 self
3870 .r#type
3871 .get_or_insert_with(::buffa::alloc::string::String::new),
3872 buf,
3873 )?;
3874 }
3875 5u32 => {
3876 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3877 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3878 field_number: 5u32,
3879 expected: 0u8,
3880 actual: tag.wire_type() as u8,
3881 });
3882 }
3883 self.reserved = ::core::option::Option::Some(
3884 ::buffa::types::decode_bool(buf)?,
3885 );
3886 }
3887 6u32 => {
3888 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
3889 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3890 field_number: 6u32,
3891 expected: 0u8,
3892 actual: tag.wire_type() as u8,
3893 });
3894 }
3895 self.repeated = ::core::option::Option::Some(
3896 ::buffa::types::decode_bool(buf)?,
3897 );
3898 }
3899 _ => {
3900 self.__buffa_unknown_fields
3901 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3902 }
3903 }
3904 ::core::result::Result::Ok(())
3905 }
3906 fn clear(&mut self) {
3907 self.number = ::core::option::Option::None;
3908 self.full_name = ::core::option::Option::None;
3909 self.r#type = ::core::option::Option::None;
3910 self.reserved = ::core::option::Option::None;
3911 self.repeated = ::core::option::Option::None;
3912 self.__buffa_unknown_fields.clear();
3913 }
3914 }
3915 impl ::buffa::ExtensionSet for Declaration {
3916 const PROTO_FQN: &'static str = "google.protobuf.ExtensionRangeOptions.Declaration";
3917 fn unknown_fields(&self) -> &::buffa::UnknownFields {
3918 &self.__buffa_unknown_fields
3919 }
3920 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3921 &mut self.__buffa_unknown_fields
3922 }
3923 }
3924 #[cfg(feature = "text")]
3925 impl ::buffa::text::TextFormat for Declaration {
3926 fn encode_text(
3927 &self,
3928 enc: &mut ::buffa::text::TextEncoder<'_>,
3929 ) -> ::core::fmt::Result {
3930 #[allow(unused_imports)]
3931 use ::buffa::Enumeration as _;
3932 if let ::core::option::Option::Some(ref __v) = self.number {
3933 enc.write_field_name("number")?;
3934 enc.write_i32(*__v)?;
3935 }
3936 if let ::core::option::Option::Some(ref __v) = self.full_name {
3937 enc.write_field_name("full_name")?;
3938 enc.write_string(__v)?;
3939 }
3940 if let ::core::option::Option::Some(ref __v) = self.r#type {
3941 enc.write_field_name("type")?;
3942 enc.write_string(__v)?;
3943 }
3944 if let ::core::option::Option::Some(ref __v) = self.reserved {
3945 enc.write_field_name("reserved")?;
3946 enc.write_bool(*__v)?;
3947 }
3948 if let ::core::option::Option::Some(ref __v) = self.repeated {
3949 enc.write_field_name("repeated")?;
3950 enc.write_bool(*__v)?;
3951 }
3952 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
3953 ::core::result::Result::Ok(())
3954 }
3955 fn merge_text(
3956 &mut self,
3957 dec: &mut ::buffa::text::TextDecoder<'_>,
3958 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
3959 #[allow(unused_imports)]
3960 use ::buffa::Enumeration as _;
3961 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
3962 match __name {
3963 "number" => {
3964 self.number = ::core::option::Option::Some(dec.read_i32()?);
3965 }
3966 "full_name" => {
3967 self.full_name = ::core::option::Option::Some(
3968 dec.read_string()?.into_owned(),
3969 );
3970 }
3971 "type" => {
3972 self.r#type = ::core::option::Option::Some(
3973 dec.read_string()?.into_owned(),
3974 );
3975 }
3976 "reserved" => {
3977 self.reserved = ::core::option::Option::Some(dec.read_bool()?);
3978 }
3979 "repeated" => {
3980 self.repeated = ::core::option::Option::Some(dec.read_bool()?);
3981 }
3982 _ => dec.skip_value()?,
3983 }
3984 }
3985 ::core::result::Result::Ok(())
3986 }
3987 }
3988 #[cfg(feature = "json")]
3989 impl ::buffa::json_helpers::ProtoElemJson for Declaration {
3990 fn serialize_proto_json<S: ::serde::Serializer>(
3991 v: &Self,
3992 s: S,
3993 ) -> ::core::result::Result<S::Ok, S::Error> {
3994 ::serde::Serialize::serialize(v, s)
3995 }
3996 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3997 d: D,
3998 ) -> ::core::result::Result<Self, D::Error> {
3999 <Self as ::serde::Deserialize>::deserialize(d)
4000 }
4001 }
4002 #[cfg(feature = "json")]
4003 #[doc(hidden)]
4004 pub const __DECLARATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4005 type_url: "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration",
4006 to_json: ::buffa::type_registry::any_to_json::<Declaration>,
4007 from_json: ::buffa::type_registry::any_from_json::<Declaration>,
4008 is_wkt: false,
4009 };
4010 #[cfg(feature = "text")]
4011 #[doc(hidden)]
4012 pub const __DECLARATION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
4013 type_url: "type.googleapis.com/google.protobuf.ExtensionRangeOptions.Declaration",
4014 text_encode: ::buffa::type_registry::any_encode_text::<Declaration>,
4015 text_merge: ::buffa::type_registry::any_merge_text::<Declaration>,
4016 };
4017 #[cfg(feature = "views")]
4018 #[doc(inline)]
4019 pub use super::__buffa::view::extension_range_options::DeclarationView;
4020}
4021#[derive(Clone, PartialEq, Default)]
4023#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
4024#[cfg_attr(feature = "json", serde(default))]
4025#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
4026pub struct FieldDescriptorProto {
4027 #[cfg_attr(
4029 feature = "json",
4030 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
4031 )]
4032 pub name: ::core::option::Option<::buffa::alloc::string::String>,
4033 #[cfg_attr(
4035 feature = "json",
4036 serde(
4037 rename = "number",
4038 with = "::buffa::json_helpers::opt_int32",
4039 skip_serializing_if = "::core::option::Option::is_none"
4040 )
4041 )]
4042 pub number: ::core::option::Option<i32>,
4043 #[cfg_attr(
4045 feature = "json",
4046 serde(
4047 rename = "label",
4048 with = "::buffa::json_helpers::opt_closed_enum",
4049 skip_serializing_if = "::core::option::Option::is_none"
4050 )
4051 )]
4052 pub label: ::core::option::Option<field_descriptor_proto::Label>,
4053 #[cfg_attr(
4058 feature = "json",
4059 serde(
4060 rename = "type",
4061 with = "::buffa::json_helpers::opt_closed_enum",
4062 skip_serializing_if = "::core::option::Option::is_none"
4063 )
4064 )]
4065 pub r#type: ::core::option::Option<field_descriptor_proto::Type>,
4066 #[cfg_attr(
4074 feature = "json",
4075 serde(
4076 rename = "typeName",
4077 alias = "type_name",
4078 skip_serializing_if = "::core::option::Option::is_none"
4079 )
4080 )]
4081 pub type_name: ::core::option::Option<::buffa::alloc::string::String>,
4082 #[cfg_attr(
4087 feature = "json",
4088 serde(
4089 rename = "extendee",
4090 skip_serializing_if = "::core::option::Option::is_none"
4091 )
4092 )]
4093 pub extendee: ::core::option::Option<::buffa::alloc::string::String>,
4094 #[cfg_attr(
4101 feature = "json",
4102 serde(
4103 rename = "defaultValue",
4104 alias = "default_value",
4105 skip_serializing_if = "::core::option::Option::is_none"
4106 )
4107 )]
4108 pub default_value: ::core::option::Option<::buffa::alloc::string::String>,
4109 #[cfg_attr(
4114 feature = "json",
4115 serde(
4116 rename = "oneofIndex",
4117 alias = "oneof_index",
4118 with = "::buffa::json_helpers::opt_int32",
4119 skip_serializing_if = "::core::option::Option::is_none"
4120 )
4121 )]
4122 pub oneof_index: ::core::option::Option<i32>,
4123 #[cfg_attr(
4130 feature = "json",
4131 serde(
4132 rename = "jsonName",
4133 alias = "json_name",
4134 skip_serializing_if = "::core::option::Option::is_none"
4135 )
4136 )]
4137 pub json_name: ::core::option::Option<::buffa::alloc::string::String>,
4138 #[cfg_attr(
4140 feature = "json",
4141 serde(
4142 rename = "options",
4143 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
4144 )
4145 )]
4146 pub options: ::buffa::MessageField<FieldOptions>,
4147 #[cfg_attr(
4171 feature = "json",
4172 serde(
4173 rename = "proto3Optional",
4174 alias = "proto3_optional",
4175 skip_serializing_if = "::core::option::Option::is_none"
4176 )
4177 )]
4178 pub proto3_optional: ::core::option::Option<bool>,
4179 #[cfg_attr(feature = "json", serde(skip))]
4180 #[doc(hidden)]
4181 pub __buffa_unknown_fields: ::buffa::UnknownFields,
4182}
4183impl ::core::fmt::Debug for FieldDescriptorProto {
4184 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4185 f.debug_struct("FieldDescriptorProto")
4186 .field("name", &self.name)
4187 .field("number", &self.number)
4188 .field("label", &self.label)
4189 .field("r#type", &self.r#type)
4190 .field("type_name", &self.type_name)
4191 .field("extendee", &self.extendee)
4192 .field("default_value", &self.default_value)
4193 .field("oneof_index", &self.oneof_index)
4194 .field("json_name", &self.json_name)
4195 .field("options", &self.options)
4196 .field("proto3_optional", &self.proto3_optional)
4197 .finish()
4198 }
4199}
4200impl FieldDescriptorProto {
4201 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldDescriptorProto";
4206}
4207impl FieldDescriptorProto {
4208 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4209 #[inline]
4210 pub fn with_name(
4212 mut self,
4213 value: impl Into<::buffa::alloc::string::String>,
4214 ) -> Self {
4215 self.name = Some(value.into());
4216 self
4217 }
4218 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4219 #[inline]
4220 pub fn with_number(mut self, value: i32) -> Self {
4222 self.number = Some(value);
4223 self
4224 }
4225 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4226 #[inline]
4227 pub fn with_label(
4229 mut self,
4230 value: impl Into<field_descriptor_proto::Label>,
4231 ) -> Self {
4232 self.label = Some(value.into());
4233 self
4234 }
4235 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4236 #[inline]
4237 pub fn with_type(mut self, value: impl Into<field_descriptor_proto::Type>) -> Self {
4239 self.r#type = Some(value.into());
4240 self
4241 }
4242 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4243 #[inline]
4244 pub fn with_type_name(
4246 mut self,
4247 value: impl Into<::buffa::alloc::string::String>,
4248 ) -> Self {
4249 self.type_name = Some(value.into());
4250 self
4251 }
4252 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4253 #[inline]
4254 pub fn with_extendee(
4256 mut self,
4257 value: impl Into<::buffa::alloc::string::String>,
4258 ) -> Self {
4259 self.extendee = Some(value.into());
4260 self
4261 }
4262 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4263 #[inline]
4264 pub fn with_default_value(
4266 mut self,
4267 value: impl Into<::buffa::alloc::string::String>,
4268 ) -> Self {
4269 self.default_value = Some(value.into());
4270 self
4271 }
4272 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4273 #[inline]
4274 pub fn with_oneof_index(mut self, value: i32) -> Self {
4276 self.oneof_index = Some(value);
4277 self
4278 }
4279 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4280 #[inline]
4281 pub fn with_json_name(
4283 mut self,
4284 value: impl Into<::buffa::alloc::string::String>,
4285 ) -> Self {
4286 self.json_name = Some(value.into());
4287 self
4288 }
4289 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
4290 #[inline]
4291 pub fn with_proto3_optional(mut self, value: bool) -> Self {
4293 self.proto3_optional = Some(value);
4294 self
4295 }
4296}
4297impl ::buffa::DefaultInstance for FieldDescriptorProto {
4298 fn default_instance() -> &'static Self {
4299 static VALUE: ::buffa::__private::OnceBox<FieldDescriptorProto> = ::buffa::__private::OnceBox::new();
4300 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
4301 }
4302}
4303impl ::buffa::MessageName for FieldDescriptorProto {
4304 const PACKAGE: &'static str = "google.protobuf";
4305 const NAME: &'static str = "FieldDescriptorProto";
4306 const FULL_NAME: &'static str = "google.protobuf.FieldDescriptorProto";
4307 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldDescriptorProto";
4308}
4309impl ::buffa::Message for FieldDescriptorProto {
4310 #[allow(clippy::let_and_return)]
4316 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4317 #[allow(unused_imports)]
4318 use ::buffa::Enumeration as _;
4319 let mut size = 0u32;
4320 if let Some(ref v) = self.name {
4321 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4322 }
4323 if let Some(ref v) = self.extendee {
4324 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4325 }
4326 if let Some(v) = self.number {
4327 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
4328 }
4329 if let Some(ref v) = self.label {
4330 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
4331 }
4332 if let Some(ref v) = self.r#type {
4333 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
4334 }
4335 if let Some(ref v) = self.type_name {
4336 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4337 }
4338 if let Some(ref v) = self.default_value {
4339 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4340 }
4341 if self.options.is_set() {
4342 let __slot = __cache.reserve();
4343 let inner_size = self.options.compute_size(__cache);
4344 __cache.set(__slot, inner_size);
4345 size
4346 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4347 + inner_size;
4348 }
4349 if let Some(v) = self.oneof_index {
4350 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
4351 }
4352 if let Some(ref v) = self.json_name {
4353 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4354 }
4355 if self.proto3_optional.is_some() {
4356 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
4357 }
4358 size += self.__buffa_unknown_fields.encoded_len() as u32;
4359 size
4360 }
4361 fn write_to(
4362 &self,
4363 __cache: &mut ::buffa::SizeCache,
4364 buf: &mut impl ::buffa::bytes::BufMut,
4365 ) {
4366 #[allow(unused_imports)]
4367 use ::buffa::Enumeration as _;
4368 if let Some(ref v) = self.name {
4369 ::buffa::encoding::Tag::new(
4370 1u32,
4371 ::buffa::encoding::WireType::LengthDelimited,
4372 )
4373 .encode(buf);
4374 ::buffa::types::encode_string(v, buf);
4375 }
4376 if let Some(ref v) = self.extendee {
4377 ::buffa::encoding::Tag::new(
4378 2u32,
4379 ::buffa::encoding::WireType::LengthDelimited,
4380 )
4381 .encode(buf);
4382 ::buffa::types::encode_string(v, buf);
4383 }
4384 if let Some(v) = self.number {
4385 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
4386 .encode(buf);
4387 ::buffa::types::encode_int32(v, buf);
4388 }
4389 if let Some(ref v) = self.label {
4390 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
4391 .encode(buf);
4392 ::buffa::types::encode_int32(v.to_i32(), buf);
4393 }
4394 if let Some(ref v) = self.r#type {
4395 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
4396 .encode(buf);
4397 ::buffa::types::encode_int32(v.to_i32(), buf);
4398 }
4399 if let Some(ref v) = self.type_name {
4400 ::buffa::encoding::Tag::new(
4401 6u32,
4402 ::buffa::encoding::WireType::LengthDelimited,
4403 )
4404 .encode(buf);
4405 ::buffa::types::encode_string(v, buf);
4406 }
4407 if let Some(ref v) = self.default_value {
4408 ::buffa::encoding::Tag::new(
4409 7u32,
4410 ::buffa::encoding::WireType::LengthDelimited,
4411 )
4412 .encode(buf);
4413 ::buffa::types::encode_string(v, buf);
4414 }
4415 if self.options.is_set() {
4416 ::buffa::encoding::Tag::new(
4417 8u32,
4418 ::buffa::encoding::WireType::LengthDelimited,
4419 )
4420 .encode(buf);
4421 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
4422 self.options.write_to(__cache, buf);
4423 }
4424 if let Some(v) = self.oneof_index {
4425 ::buffa::encoding::Tag::new(9u32, ::buffa::encoding::WireType::Varint)
4426 .encode(buf);
4427 ::buffa::types::encode_int32(v, buf);
4428 }
4429 if let Some(ref v) = self.json_name {
4430 ::buffa::encoding::Tag::new(
4431 10u32,
4432 ::buffa::encoding::WireType::LengthDelimited,
4433 )
4434 .encode(buf);
4435 ::buffa::types::encode_string(v, buf);
4436 }
4437 if let Some(v) = self.proto3_optional {
4438 ::buffa::encoding::Tag::new(17u32, ::buffa::encoding::WireType::Varint)
4439 .encode(buf);
4440 ::buffa::types::encode_bool(v, buf);
4441 }
4442 self.__buffa_unknown_fields.write_to(buf);
4443 }
4444 fn merge_field(
4445 &mut self,
4446 tag: ::buffa::encoding::Tag,
4447 buf: &mut impl ::buffa::bytes::Buf,
4448 depth: u32,
4449 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4450 #[allow(unused_imports)]
4451 use ::buffa::bytes::Buf as _;
4452 #[allow(unused_imports)]
4453 use ::buffa::Enumeration as _;
4454 match tag.field_number() {
4455 1u32 => {
4456 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4457 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4458 field_number: 1u32,
4459 expected: 2u8,
4460 actual: tag.wire_type() as u8,
4461 });
4462 }
4463 ::buffa::types::merge_string(
4464 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
4465 buf,
4466 )?;
4467 }
4468 2u32 => {
4469 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4470 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4471 field_number: 2u32,
4472 expected: 2u8,
4473 actual: tag.wire_type() as u8,
4474 });
4475 }
4476 ::buffa::types::merge_string(
4477 self
4478 .extendee
4479 .get_or_insert_with(::buffa::alloc::string::String::new),
4480 buf,
4481 )?;
4482 }
4483 3u32 => {
4484 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4485 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4486 field_number: 3u32,
4487 expected: 0u8,
4488 actual: tag.wire_type() as u8,
4489 });
4490 }
4491 self.number = ::core::option::Option::Some(
4492 ::buffa::types::decode_int32(buf)?,
4493 );
4494 }
4495 4u32 => {
4496 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4497 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4498 field_number: 4u32,
4499 expected: 0u8,
4500 actual: tag.wire_type() as u8,
4501 });
4502 }
4503 let __raw = ::buffa::types::decode_int32(buf)?;
4504 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
4505 __raw,
4506 ) {
4507 self.label = ::core::option::Option::Some(__v);
4508 } else {
4509 self.__buffa_unknown_fields
4510 .push(::buffa::UnknownField {
4511 number: 4u32,
4512 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
4513 });
4514 }
4515 }
4516 5u32 => {
4517 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4518 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4519 field_number: 5u32,
4520 expected: 0u8,
4521 actual: tag.wire_type() as u8,
4522 });
4523 }
4524 let __raw = ::buffa::types::decode_int32(buf)?;
4525 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
4526 __raw,
4527 ) {
4528 self.r#type = ::core::option::Option::Some(__v);
4529 } else {
4530 self.__buffa_unknown_fields
4531 .push(::buffa::UnknownField {
4532 number: 5u32,
4533 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
4534 });
4535 }
4536 }
4537 6u32 => {
4538 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4539 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4540 field_number: 6u32,
4541 expected: 2u8,
4542 actual: tag.wire_type() as u8,
4543 });
4544 }
4545 ::buffa::types::merge_string(
4546 self
4547 .type_name
4548 .get_or_insert_with(::buffa::alloc::string::String::new),
4549 buf,
4550 )?;
4551 }
4552 7u32 => {
4553 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4554 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4555 field_number: 7u32,
4556 expected: 2u8,
4557 actual: tag.wire_type() as u8,
4558 });
4559 }
4560 ::buffa::types::merge_string(
4561 self
4562 .default_value
4563 .get_or_insert_with(::buffa::alloc::string::String::new),
4564 buf,
4565 )?;
4566 }
4567 8u32 => {
4568 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4569 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4570 field_number: 8u32,
4571 expected: 2u8,
4572 actual: tag.wire_type() as u8,
4573 });
4574 }
4575 ::buffa::Message::merge_length_delimited(
4576 self.options.get_or_insert_default(),
4577 buf,
4578 depth,
4579 )?;
4580 }
4581 9u32 => {
4582 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4583 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4584 field_number: 9u32,
4585 expected: 0u8,
4586 actual: tag.wire_type() as u8,
4587 });
4588 }
4589 self.oneof_index = ::core::option::Option::Some(
4590 ::buffa::types::decode_int32(buf)?,
4591 );
4592 }
4593 10u32 => {
4594 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
4595 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4596 field_number: 10u32,
4597 expected: 2u8,
4598 actual: tag.wire_type() as u8,
4599 });
4600 }
4601 ::buffa::types::merge_string(
4602 self
4603 .json_name
4604 .get_or_insert_with(::buffa::alloc::string::String::new),
4605 buf,
4606 )?;
4607 }
4608 17u32 => {
4609 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4610 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4611 field_number: 17u32,
4612 expected: 0u8,
4613 actual: tag.wire_type() as u8,
4614 });
4615 }
4616 self.proto3_optional = ::core::option::Option::Some(
4617 ::buffa::types::decode_bool(buf)?,
4618 );
4619 }
4620 _ => {
4621 self.__buffa_unknown_fields
4622 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
4623 }
4624 }
4625 ::core::result::Result::Ok(())
4626 }
4627 fn clear(&mut self) {
4628 self.name = ::core::option::Option::None;
4629 self.extendee = ::core::option::Option::None;
4630 self.number = ::core::option::Option::None;
4631 self.label = ::core::option::Option::None;
4632 self.r#type = ::core::option::Option::None;
4633 self.type_name = ::core::option::Option::None;
4634 self.default_value = ::core::option::Option::None;
4635 self.options = ::buffa::MessageField::none();
4636 self.oneof_index = ::core::option::Option::None;
4637 self.json_name = ::core::option::Option::None;
4638 self.proto3_optional = ::core::option::Option::None;
4639 self.__buffa_unknown_fields.clear();
4640 }
4641}
4642impl ::buffa::ExtensionSet for FieldDescriptorProto {
4643 const PROTO_FQN: &'static str = "google.protobuf.FieldDescriptorProto";
4644 fn unknown_fields(&self) -> &::buffa::UnknownFields {
4645 &self.__buffa_unknown_fields
4646 }
4647 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
4648 &mut self.__buffa_unknown_fields
4649 }
4650}
4651#[cfg(feature = "text")]
4652impl ::buffa::text::TextFormat for FieldDescriptorProto {
4653 fn encode_text(
4654 &self,
4655 enc: &mut ::buffa::text::TextEncoder<'_>,
4656 ) -> ::core::fmt::Result {
4657 #[allow(unused_imports)]
4658 use ::buffa::Enumeration as _;
4659 if let ::core::option::Option::Some(ref __v) = self.name {
4660 enc.write_field_name("name")?;
4661 enc.write_string(__v)?;
4662 }
4663 if let ::core::option::Option::Some(ref __v) = self.number {
4664 enc.write_field_name("number")?;
4665 enc.write_i32(*__v)?;
4666 }
4667 if let ::core::option::Option::Some(ref __v) = self.label {
4668 enc.write_field_name("label")?;
4669 enc.write_enum_name(__v.proto_name())?;
4670 }
4671 if let ::core::option::Option::Some(ref __v) = self.r#type {
4672 enc.write_field_name("type")?;
4673 enc.write_enum_name(__v.proto_name())?;
4674 }
4675 if let ::core::option::Option::Some(ref __v) = self.type_name {
4676 enc.write_field_name("type_name")?;
4677 enc.write_string(__v)?;
4678 }
4679 if let ::core::option::Option::Some(ref __v) = self.extendee {
4680 enc.write_field_name("extendee")?;
4681 enc.write_string(__v)?;
4682 }
4683 if let ::core::option::Option::Some(ref __v) = self.default_value {
4684 enc.write_field_name("default_value")?;
4685 enc.write_string(__v)?;
4686 }
4687 if let ::core::option::Option::Some(ref __v) = self.oneof_index {
4688 enc.write_field_name("oneof_index")?;
4689 enc.write_i32(*__v)?;
4690 }
4691 if let ::core::option::Option::Some(ref __v) = self.json_name {
4692 enc.write_field_name("json_name")?;
4693 enc.write_string(__v)?;
4694 }
4695 if self.options.is_set() {
4696 enc.write_field_name("options")?;
4697 enc.write_message(&*self.options)?;
4698 }
4699 if let ::core::option::Option::Some(ref __v) = self.proto3_optional {
4700 enc.write_field_name("proto3_optional")?;
4701 enc.write_bool(*__v)?;
4702 }
4703 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
4704 ::core::result::Result::Ok(())
4705 }
4706 fn merge_text(
4707 &mut self,
4708 dec: &mut ::buffa::text::TextDecoder<'_>,
4709 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
4710 #[allow(unused_imports)]
4711 use ::buffa::Enumeration as _;
4712 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
4713 match __name {
4714 "name" => {
4715 self.name = ::core::option::Option::Some(
4716 dec.read_string()?.into_owned(),
4717 );
4718 }
4719 "number" => self.number = ::core::option::Option::Some(dec.read_i32()?),
4720 "label" => {
4721 self.label = ::core::option::Option::Some(
4722 dec.read_closed_enum_by_name::<field_descriptor_proto::Label>()?,
4723 );
4724 }
4725 "type" => {
4726 self.r#type = ::core::option::Option::Some(
4727 dec.read_closed_enum_by_name::<field_descriptor_proto::Type>()?,
4728 );
4729 }
4730 "type_name" => {
4731 self.type_name = ::core::option::Option::Some(
4732 dec.read_string()?.into_owned(),
4733 );
4734 }
4735 "extendee" => {
4736 self.extendee = ::core::option::Option::Some(
4737 dec.read_string()?.into_owned(),
4738 );
4739 }
4740 "default_value" => {
4741 self.default_value = ::core::option::Option::Some(
4742 dec.read_string()?.into_owned(),
4743 );
4744 }
4745 "oneof_index" => {
4746 self.oneof_index = ::core::option::Option::Some(dec.read_i32()?);
4747 }
4748 "json_name" => {
4749 self.json_name = ::core::option::Option::Some(
4750 dec.read_string()?.into_owned(),
4751 );
4752 }
4753 "options" => dec.merge_message(self.options.get_or_insert_default())?,
4754 "proto3_optional" => {
4755 self.proto3_optional = ::core::option::Option::Some(dec.read_bool()?);
4756 }
4757 _ => dec.skip_value()?,
4758 }
4759 }
4760 ::core::result::Result::Ok(())
4761 }
4762}
4763#[cfg(feature = "json")]
4764impl ::buffa::json_helpers::ProtoElemJson for FieldDescriptorProto {
4765 fn serialize_proto_json<S: ::serde::Serializer>(
4766 v: &Self,
4767 s: S,
4768 ) -> ::core::result::Result<S::Ok, S::Error> {
4769 ::serde::Serialize::serialize(v, s)
4770 }
4771 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4772 d: D,
4773 ) -> ::core::result::Result<Self, D::Error> {
4774 <Self as ::serde::Deserialize>::deserialize(d)
4775 }
4776}
4777#[cfg(feature = "json")]
4778#[doc(hidden)]
4779pub const __FIELD_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
4780 type_url: "type.googleapis.com/google.protobuf.FieldDescriptorProto",
4781 to_json: ::buffa::type_registry::any_to_json::<FieldDescriptorProto>,
4782 from_json: ::buffa::type_registry::any_from_json::<FieldDescriptorProto>,
4783 is_wkt: false,
4784};
4785#[cfg(feature = "text")]
4786#[doc(hidden)]
4787pub const __FIELD_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
4788 type_url: "type.googleapis.com/google.protobuf.FieldDescriptorProto",
4789 text_encode: ::buffa::type_registry::any_encode_text::<FieldDescriptorProto>,
4790 text_merge: ::buffa::type_registry::any_merge_text::<FieldDescriptorProto>,
4791};
4792pub mod field_descriptor_proto {
4793 #[allow(unused_imports)]
4794 use super::*;
4795 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
4796 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
4797 #[repr(i32)]
4798 pub enum Type {
4799 TYPE_DOUBLE = 1i32,
4802 TYPE_FLOAT = 2i32,
4803 TYPE_INT64 = 3i32,
4806 TYPE_UINT64 = 4i32,
4807 TYPE_INT32 = 5i32,
4810 TYPE_FIXED64 = 6i32,
4811 TYPE_FIXED32 = 7i32,
4812 TYPE_BOOL = 8i32,
4813 TYPE_STRING = 9i32,
4814 TYPE_GROUP = 10i32,
4820 TYPE_MESSAGE = 11i32,
4822 TYPE_BYTES = 12i32,
4824 TYPE_UINT32 = 13i32,
4825 TYPE_ENUM = 14i32,
4826 TYPE_SFIXED32 = 15i32,
4827 TYPE_SFIXED64 = 16i32,
4828 TYPE_SINT32 = 17i32,
4830 TYPE_SINT64 = 18i32,
4832 }
4833 impl ::core::default::Default for Type {
4834 fn default() -> Self {
4835 Self::TYPE_DOUBLE
4836 }
4837 }
4838 #[cfg(feature = "json")]
4839 const _: () = {
4840 impl ::serde::Serialize for Type {
4841 fn serialize<S: ::serde::Serializer>(
4842 &self,
4843 s: S,
4844 ) -> ::core::result::Result<S::Ok, S::Error> {
4845 s.serialize_str(::buffa::Enumeration::proto_name(self))
4846 }
4847 }
4848 impl<'de> ::serde::Deserialize<'de> for Type {
4849 fn deserialize<D: ::serde::Deserializer<'de>>(
4850 d: D,
4851 ) -> ::core::result::Result<Self, D::Error> {
4852 struct _V;
4853 impl ::serde::de::Visitor<'_> for _V {
4854 type Value = Type;
4855 fn expecting(
4856 &self,
4857 f: &mut ::core::fmt::Formatter<'_>,
4858 ) -> ::core::fmt::Result {
4859 f.write_str(
4860 concat!("a string, integer, or null for ", stringify!(Type)),
4861 )
4862 }
4863 fn visit_str<E: ::serde::de::Error>(
4864 self,
4865 v: &str,
4866 ) -> ::core::result::Result<Type, E> {
4867 <Type as ::buffa::Enumeration>::from_proto_name(v)
4868 .ok_or_else(|| {
4869 ::serde::de::Error::unknown_variant(v, &[])
4870 })
4871 }
4872 fn visit_i64<E: ::serde::de::Error>(
4873 self,
4874 v: i64,
4875 ) -> ::core::result::Result<Type, E> {
4876 let v32 = i32::try_from(v)
4877 .map_err(|_| {
4878 ::serde::de::Error::custom(
4879 ::buffa::alloc::format!("enum value {v} out of i32 range"),
4880 )
4881 })?;
4882 <Type as ::buffa::Enumeration>::from_i32(v32)
4883 .ok_or_else(|| {
4884 ::serde::de::Error::custom(
4885 ::buffa::alloc::format!("unknown enum value {v32}"),
4886 )
4887 })
4888 }
4889 fn visit_u64<E: ::serde::de::Error>(
4890 self,
4891 v: u64,
4892 ) -> ::core::result::Result<Type, E> {
4893 let v32 = i32::try_from(v)
4894 .map_err(|_| {
4895 ::serde::de::Error::custom(
4896 ::buffa::alloc::format!("enum value {v} out of i32 range"),
4897 )
4898 })?;
4899 <Type as ::buffa::Enumeration>::from_i32(v32)
4900 .ok_or_else(|| {
4901 ::serde::de::Error::custom(
4902 ::buffa::alloc::format!("unknown enum value {v32}"),
4903 )
4904 })
4905 }
4906 fn visit_unit<E: ::serde::de::Error>(
4907 self,
4908 ) -> ::core::result::Result<Type, E> {
4909 ::core::result::Result::Ok(::core::default::Default::default())
4910 }
4911 }
4912 d.deserialize_any(_V)
4913 }
4914 }
4915 impl ::buffa::json_helpers::ProtoElemJson for Type {
4916 fn serialize_proto_json<S: ::serde::Serializer>(
4917 v: &Self,
4918 s: S,
4919 ) -> ::core::result::Result<S::Ok, S::Error> {
4920 ::serde::Serialize::serialize(v, s)
4921 }
4922 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
4923 d: D,
4924 ) -> ::core::result::Result<Self, D::Error> {
4925 <Self as ::serde::Deserialize>::deserialize(d)
4926 }
4927 }
4928 };
4929 impl ::buffa::Enumeration for Type {
4930 fn from_i32(value: i32) -> ::core::option::Option<Self> {
4931 match value {
4932 1i32 => ::core::option::Option::Some(Self::TYPE_DOUBLE),
4933 2i32 => ::core::option::Option::Some(Self::TYPE_FLOAT),
4934 3i32 => ::core::option::Option::Some(Self::TYPE_INT64),
4935 4i32 => ::core::option::Option::Some(Self::TYPE_UINT64),
4936 5i32 => ::core::option::Option::Some(Self::TYPE_INT32),
4937 6i32 => ::core::option::Option::Some(Self::TYPE_FIXED64),
4938 7i32 => ::core::option::Option::Some(Self::TYPE_FIXED32),
4939 8i32 => ::core::option::Option::Some(Self::TYPE_BOOL),
4940 9i32 => ::core::option::Option::Some(Self::TYPE_STRING),
4941 10i32 => ::core::option::Option::Some(Self::TYPE_GROUP),
4942 11i32 => ::core::option::Option::Some(Self::TYPE_MESSAGE),
4943 12i32 => ::core::option::Option::Some(Self::TYPE_BYTES),
4944 13i32 => ::core::option::Option::Some(Self::TYPE_UINT32),
4945 14i32 => ::core::option::Option::Some(Self::TYPE_ENUM),
4946 15i32 => ::core::option::Option::Some(Self::TYPE_SFIXED32),
4947 16i32 => ::core::option::Option::Some(Self::TYPE_SFIXED64),
4948 17i32 => ::core::option::Option::Some(Self::TYPE_SINT32),
4949 18i32 => ::core::option::Option::Some(Self::TYPE_SINT64),
4950 _ => ::core::option::Option::None,
4951 }
4952 }
4953 fn to_i32(&self) -> i32 {
4954 *self as i32
4955 }
4956 fn proto_name(&self) -> &'static str {
4957 match self {
4958 Self::TYPE_DOUBLE => "TYPE_DOUBLE",
4959 Self::TYPE_FLOAT => "TYPE_FLOAT",
4960 Self::TYPE_INT64 => "TYPE_INT64",
4961 Self::TYPE_UINT64 => "TYPE_UINT64",
4962 Self::TYPE_INT32 => "TYPE_INT32",
4963 Self::TYPE_FIXED64 => "TYPE_FIXED64",
4964 Self::TYPE_FIXED32 => "TYPE_FIXED32",
4965 Self::TYPE_BOOL => "TYPE_BOOL",
4966 Self::TYPE_STRING => "TYPE_STRING",
4967 Self::TYPE_GROUP => "TYPE_GROUP",
4968 Self::TYPE_MESSAGE => "TYPE_MESSAGE",
4969 Self::TYPE_BYTES => "TYPE_BYTES",
4970 Self::TYPE_UINT32 => "TYPE_UINT32",
4971 Self::TYPE_ENUM => "TYPE_ENUM",
4972 Self::TYPE_SFIXED32 => "TYPE_SFIXED32",
4973 Self::TYPE_SFIXED64 => "TYPE_SFIXED64",
4974 Self::TYPE_SINT32 => "TYPE_SINT32",
4975 Self::TYPE_SINT64 => "TYPE_SINT64",
4976 }
4977 }
4978 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
4979 match name {
4980 "TYPE_DOUBLE" => ::core::option::Option::Some(Self::TYPE_DOUBLE),
4981 "TYPE_FLOAT" => ::core::option::Option::Some(Self::TYPE_FLOAT),
4982 "TYPE_INT64" => ::core::option::Option::Some(Self::TYPE_INT64),
4983 "TYPE_UINT64" => ::core::option::Option::Some(Self::TYPE_UINT64),
4984 "TYPE_INT32" => ::core::option::Option::Some(Self::TYPE_INT32),
4985 "TYPE_FIXED64" => ::core::option::Option::Some(Self::TYPE_FIXED64),
4986 "TYPE_FIXED32" => ::core::option::Option::Some(Self::TYPE_FIXED32),
4987 "TYPE_BOOL" => ::core::option::Option::Some(Self::TYPE_BOOL),
4988 "TYPE_STRING" => ::core::option::Option::Some(Self::TYPE_STRING),
4989 "TYPE_GROUP" => ::core::option::Option::Some(Self::TYPE_GROUP),
4990 "TYPE_MESSAGE" => ::core::option::Option::Some(Self::TYPE_MESSAGE),
4991 "TYPE_BYTES" => ::core::option::Option::Some(Self::TYPE_BYTES),
4992 "TYPE_UINT32" => ::core::option::Option::Some(Self::TYPE_UINT32),
4993 "TYPE_ENUM" => ::core::option::Option::Some(Self::TYPE_ENUM),
4994 "TYPE_SFIXED32" => ::core::option::Option::Some(Self::TYPE_SFIXED32),
4995 "TYPE_SFIXED64" => ::core::option::Option::Some(Self::TYPE_SFIXED64),
4996 "TYPE_SINT32" => ::core::option::Option::Some(Self::TYPE_SINT32),
4997 "TYPE_SINT64" => ::core::option::Option::Some(Self::TYPE_SINT64),
4998 _ => ::core::option::Option::None,
4999 }
5000 }
5001 fn values() -> &'static [Self] {
5002 &[
5003 Self::TYPE_DOUBLE,
5004 Self::TYPE_FLOAT,
5005 Self::TYPE_INT64,
5006 Self::TYPE_UINT64,
5007 Self::TYPE_INT32,
5008 Self::TYPE_FIXED64,
5009 Self::TYPE_FIXED32,
5010 Self::TYPE_BOOL,
5011 Self::TYPE_STRING,
5012 Self::TYPE_GROUP,
5013 Self::TYPE_MESSAGE,
5014 Self::TYPE_BYTES,
5015 Self::TYPE_UINT32,
5016 Self::TYPE_ENUM,
5017 Self::TYPE_SFIXED32,
5018 Self::TYPE_SFIXED64,
5019 Self::TYPE_SINT32,
5020 Self::TYPE_SINT64,
5021 ]
5022 }
5023 }
5024 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5025 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
5026 #[repr(i32)]
5027 pub enum Label {
5028 LABEL_OPTIONAL = 1i32,
5030 LABEL_REPEATED = 3i32,
5031 LABEL_REQUIRED = 2i32,
5035 }
5036 impl ::core::default::Default for Label {
5037 fn default() -> Self {
5038 Self::LABEL_OPTIONAL
5039 }
5040 }
5041 #[cfg(feature = "json")]
5042 const _: () = {
5043 impl ::serde::Serialize for Label {
5044 fn serialize<S: ::serde::Serializer>(
5045 &self,
5046 s: S,
5047 ) -> ::core::result::Result<S::Ok, S::Error> {
5048 s.serialize_str(::buffa::Enumeration::proto_name(self))
5049 }
5050 }
5051 impl<'de> ::serde::Deserialize<'de> for Label {
5052 fn deserialize<D: ::serde::Deserializer<'de>>(
5053 d: D,
5054 ) -> ::core::result::Result<Self, D::Error> {
5055 struct _V;
5056 impl ::serde::de::Visitor<'_> for _V {
5057 type Value = Label;
5058 fn expecting(
5059 &self,
5060 f: &mut ::core::fmt::Formatter<'_>,
5061 ) -> ::core::fmt::Result {
5062 f.write_str(
5063 concat!("a string, integer, or null for ", stringify!(Label)),
5064 )
5065 }
5066 fn visit_str<E: ::serde::de::Error>(
5067 self,
5068 v: &str,
5069 ) -> ::core::result::Result<Label, E> {
5070 <Label as ::buffa::Enumeration>::from_proto_name(v)
5071 .ok_or_else(|| {
5072 ::serde::de::Error::unknown_variant(v, &[])
5073 })
5074 }
5075 fn visit_i64<E: ::serde::de::Error>(
5076 self,
5077 v: i64,
5078 ) -> ::core::result::Result<Label, E> {
5079 let v32 = i32::try_from(v)
5080 .map_err(|_| {
5081 ::serde::de::Error::custom(
5082 ::buffa::alloc::format!("enum value {v} out of i32 range"),
5083 )
5084 })?;
5085 <Label as ::buffa::Enumeration>::from_i32(v32)
5086 .ok_or_else(|| {
5087 ::serde::de::Error::custom(
5088 ::buffa::alloc::format!("unknown enum value {v32}"),
5089 )
5090 })
5091 }
5092 fn visit_u64<E: ::serde::de::Error>(
5093 self,
5094 v: u64,
5095 ) -> ::core::result::Result<Label, E> {
5096 let v32 = i32::try_from(v)
5097 .map_err(|_| {
5098 ::serde::de::Error::custom(
5099 ::buffa::alloc::format!("enum value {v} out of i32 range"),
5100 )
5101 })?;
5102 <Label as ::buffa::Enumeration>::from_i32(v32)
5103 .ok_or_else(|| {
5104 ::serde::de::Error::custom(
5105 ::buffa::alloc::format!("unknown enum value {v32}"),
5106 )
5107 })
5108 }
5109 fn visit_unit<E: ::serde::de::Error>(
5110 self,
5111 ) -> ::core::result::Result<Label, E> {
5112 ::core::result::Result::Ok(::core::default::Default::default())
5113 }
5114 }
5115 d.deserialize_any(_V)
5116 }
5117 }
5118 impl ::buffa::json_helpers::ProtoElemJson for Label {
5119 fn serialize_proto_json<S: ::serde::Serializer>(
5120 v: &Self,
5121 s: S,
5122 ) -> ::core::result::Result<S::Ok, S::Error> {
5123 ::serde::Serialize::serialize(v, s)
5124 }
5125 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5126 d: D,
5127 ) -> ::core::result::Result<Self, D::Error> {
5128 <Self as ::serde::Deserialize>::deserialize(d)
5129 }
5130 }
5131 };
5132 impl ::buffa::Enumeration for Label {
5133 fn from_i32(value: i32) -> ::core::option::Option<Self> {
5134 match value {
5135 1i32 => ::core::option::Option::Some(Self::LABEL_OPTIONAL),
5136 3i32 => ::core::option::Option::Some(Self::LABEL_REPEATED),
5137 2i32 => ::core::option::Option::Some(Self::LABEL_REQUIRED),
5138 _ => ::core::option::Option::None,
5139 }
5140 }
5141 fn to_i32(&self) -> i32 {
5142 *self as i32
5143 }
5144 fn proto_name(&self) -> &'static str {
5145 match self {
5146 Self::LABEL_OPTIONAL => "LABEL_OPTIONAL",
5147 Self::LABEL_REPEATED => "LABEL_REPEATED",
5148 Self::LABEL_REQUIRED => "LABEL_REQUIRED",
5149 }
5150 }
5151 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
5152 match name {
5153 "LABEL_OPTIONAL" => ::core::option::Option::Some(Self::LABEL_OPTIONAL),
5154 "LABEL_REPEATED" => ::core::option::Option::Some(Self::LABEL_REPEATED),
5155 "LABEL_REQUIRED" => ::core::option::Option::Some(Self::LABEL_REQUIRED),
5156 _ => ::core::option::Option::None,
5157 }
5158 }
5159 fn values() -> &'static [Self] {
5160 &[Self::LABEL_OPTIONAL, Self::LABEL_REPEATED, Self::LABEL_REQUIRED]
5161 }
5162 }
5163}
5164#[derive(Clone, PartialEq, Default)]
5166#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
5167#[cfg_attr(feature = "json", serde(default))]
5168#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
5169pub struct OneofDescriptorProto {
5170 #[cfg_attr(
5172 feature = "json",
5173 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
5174 )]
5175 pub name: ::core::option::Option<::buffa::alloc::string::String>,
5176 #[cfg_attr(
5178 feature = "json",
5179 serde(
5180 rename = "options",
5181 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
5182 )
5183 )]
5184 pub options: ::buffa::MessageField<OneofOptions>,
5185 #[cfg_attr(feature = "json", serde(skip))]
5186 #[doc(hidden)]
5187 pub __buffa_unknown_fields: ::buffa::UnknownFields,
5188}
5189impl ::core::fmt::Debug for OneofDescriptorProto {
5190 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5191 f.debug_struct("OneofDescriptorProto")
5192 .field("name", &self.name)
5193 .field("options", &self.options)
5194 .finish()
5195 }
5196}
5197impl OneofDescriptorProto {
5198 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.OneofDescriptorProto";
5203}
5204impl OneofDescriptorProto {
5205 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5206 #[inline]
5207 pub fn with_name(
5209 mut self,
5210 value: impl Into<::buffa::alloc::string::String>,
5211 ) -> Self {
5212 self.name = Some(value.into());
5213 self
5214 }
5215}
5216impl ::buffa::DefaultInstance for OneofDescriptorProto {
5217 fn default_instance() -> &'static Self {
5218 static VALUE: ::buffa::__private::OnceBox<OneofDescriptorProto> = ::buffa::__private::OnceBox::new();
5219 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
5220 }
5221}
5222impl ::buffa::MessageName for OneofDescriptorProto {
5223 const PACKAGE: &'static str = "google.protobuf";
5224 const NAME: &'static str = "OneofDescriptorProto";
5225 const FULL_NAME: &'static str = "google.protobuf.OneofDescriptorProto";
5226 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.OneofDescriptorProto";
5227}
5228impl ::buffa::Message for OneofDescriptorProto {
5229 #[allow(clippy::let_and_return)]
5235 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5236 #[allow(unused_imports)]
5237 use ::buffa::Enumeration as _;
5238 let mut size = 0u32;
5239 if let Some(ref v) = self.name {
5240 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
5241 }
5242 if self.options.is_set() {
5243 let __slot = __cache.reserve();
5244 let inner_size = self.options.compute_size(__cache);
5245 __cache.set(__slot, inner_size);
5246 size
5247 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5248 + inner_size;
5249 }
5250 size += self.__buffa_unknown_fields.encoded_len() as u32;
5251 size
5252 }
5253 fn write_to(
5254 &self,
5255 __cache: &mut ::buffa::SizeCache,
5256 buf: &mut impl ::buffa::bytes::BufMut,
5257 ) {
5258 #[allow(unused_imports)]
5259 use ::buffa::Enumeration as _;
5260 if let Some(ref v) = self.name {
5261 ::buffa::encoding::Tag::new(
5262 1u32,
5263 ::buffa::encoding::WireType::LengthDelimited,
5264 )
5265 .encode(buf);
5266 ::buffa::types::encode_string(v, buf);
5267 }
5268 if self.options.is_set() {
5269 ::buffa::encoding::Tag::new(
5270 2u32,
5271 ::buffa::encoding::WireType::LengthDelimited,
5272 )
5273 .encode(buf);
5274 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
5275 self.options.write_to(__cache, buf);
5276 }
5277 self.__buffa_unknown_fields.write_to(buf);
5278 }
5279 fn merge_field(
5280 &mut self,
5281 tag: ::buffa::encoding::Tag,
5282 buf: &mut impl ::buffa::bytes::Buf,
5283 depth: u32,
5284 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5285 #[allow(unused_imports)]
5286 use ::buffa::bytes::Buf as _;
5287 #[allow(unused_imports)]
5288 use ::buffa::Enumeration as _;
5289 match tag.field_number() {
5290 1u32 => {
5291 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5292 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5293 field_number: 1u32,
5294 expected: 2u8,
5295 actual: tag.wire_type() as u8,
5296 });
5297 }
5298 ::buffa::types::merge_string(
5299 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
5300 buf,
5301 )?;
5302 }
5303 2u32 => {
5304 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5305 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5306 field_number: 2u32,
5307 expected: 2u8,
5308 actual: tag.wire_type() as u8,
5309 });
5310 }
5311 ::buffa::Message::merge_length_delimited(
5312 self.options.get_or_insert_default(),
5313 buf,
5314 depth,
5315 )?;
5316 }
5317 _ => {
5318 self.__buffa_unknown_fields
5319 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
5320 }
5321 }
5322 ::core::result::Result::Ok(())
5323 }
5324 fn clear(&mut self) {
5325 self.name = ::core::option::Option::None;
5326 self.options = ::buffa::MessageField::none();
5327 self.__buffa_unknown_fields.clear();
5328 }
5329}
5330impl ::buffa::ExtensionSet for OneofDescriptorProto {
5331 const PROTO_FQN: &'static str = "google.protobuf.OneofDescriptorProto";
5332 fn unknown_fields(&self) -> &::buffa::UnknownFields {
5333 &self.__buffa_unknown_fields
5334 }
5335 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5336 &mut self.__buffa_unknown_fields
5337 }
5338}
5339#[cfg(feature = "text")]
5340impl ::buffa::text::TextFormat for OneofDescriptorProto {
5341 fn encode_text(
5342 &self,
5343 enc: &mut ::buffa::text::TextEncoder<'_>,
5344 ) -> ::core::fmt::Result {
5345 #[allow(unused_imports)]
5346 use ::buffa::Enumeration as _;
5347 if let ::core::option::Option::Some(ref __v) = self.name {
5348 enc.write_field_name("name")?;
5349 enc.write_string(__v)?;
5350 }
5351 if self.options.is_set() {
5352 enc.write_field_name("options")?;
5353 enc.write_message(&*self.options)?;
5354 }
5355 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
5356 ::core::result::Result::Ok(())
5357 }
5358 fn merge_text(
5359 &mut self,
5360 dec: &mut ::buffa::text::TextDecoder<'_>,
5361 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
5362 #[allow(unused_imports)]
5363 use ::buffa::Enumeration as _;
5364 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
5365 match __name {
5366 "name" => {
5367 self.name = ::core::option::Option::Some(
5368 dec.read_string()?.into_owned(),
5369 );
5370 }
5371 "options" => dec.merge_message(self.options.get_or_insert_default())?,
5372 _ => dec.skip_value()?,
5373 }
5374 }
5375 ::core::result::Result::Ok(())
5376 }
5377}
5378#[cfg(feature = "json")]
5379impl ::buffa::json_helpers::ProtoElemJson for OneofDescriptorProto {
5380 fn serialize_proto_json<S: ::serde::Serializer>(
5381 v: &Self,
5382 s: S,
5383 ) -> ::core::result::Result<S::Ok, S::Error> {
5384 ::serde::Serialize::serialize(v, s)
5385 }
5386 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5387 d: D,
5388 ) -> ::core::result::Result<Self, D::Error> {
5389 <Self as ::serde::Deserialize>::deserialize(d)
5390 }
5391}
5392#[cfg(feature = "json")]
5393#[doc(hidden)]
5394pub const __ONEOF_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5395 type_url: "type.googleapis.com/google.protobuf.OneofDescriptorProto",
5396 to_json: ::buffa::type_registry::any_to_json::<OneofDescriptorProto>,
5397 from_json: ::buffa::type_registry::any_from_json::<OneofDescriptorProto>,
5398 is_wkt: false,
5399};
5400#[cfg(feature = "text")]
5401#[doc(hidden)]
5402pub const __ONEOF_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
5403 type_url: "type.googleapis.com/google.protobuf.OneofDescriptorProto",
5404 text_encode: ::buffa::type_registry::any_encode_text::<OneofDescriptorProto>,
5405 text_merge: ::buffa::type_registry::any_merge_text::<OneofDescriptorProto>,
5406};
5407#[derive(Clone, PartialEq, Default)]
5409#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
5410#[cfg_attr(feature = "json", serde(default))]
5411#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
5412pub struct EnumDescriptorProto {
5413 #[cfg_attr(
5415 feature = "json",
5416 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
5417 )]
5418 pub name: ::core::option::Option<::buffa::alloc::string::String>,
5419 #[cfg_attr(
5421 feature = "json",
5422 serde(
5423 rename = "value",
5424 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5425 deserialize_with = "::buffa::json_helpers::null_as_default"
5426 )
5427 )]
5428 pub value: ::buffa::alloc::vec::Vec<EnumValueDescriptorProto>,
5429 #[cfg_attr(
5431 feature = "json",
5432 serde(
5433 rename = "options",
5434 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
5435 )
5436 )]
5437 pub options: ::buffa::MessageField<EnumOptions>,
5438 #[cfg_attr(
5444 feature = "json",
5445 serde(
5446 rename = "reservedRange",
5447 alias = "reserved_range",
5448 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5449 deserialize_with = "::buffa::json_helpers::null_as_default"
5450 )
5451 )]
5452 pub reserved_range: ::buffa::alloc::vec::Vec<
5453 enum_descriptor_proto::EnumReservedRange,
5454 >,
5455 #[cfg_attr(
5460 feature = "json",
5461 serde(
5462 rename = "reservedName",
5463 alias = "reserved_name",
5464 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
5465 deserialize_with = "::buffa::json_helpers::null_as_default"
5466 )
5467 )]
5468 pub reserved_name: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
5469 #[cfg_attr(
5473 feature = "json",
5474 serde(
5475 rename = "visibility",
5476 with = "::buffa::json_helpers::opt_closed_enum",
5477 skip_serializing_if = "::core::option::Option::is_none"
5478 )
5479 )]
5480 pub visibility: ::core::option::Option<SymbolVisibility>,
5481 #[cfg_attr(feature = "json", serde(skip))]
5482 #[doc(hidden)]
5483 pub __buffa_unknown_fields: ::buffa::UnknownFields,
5484}
5485impl ::core::fmt::Debug for EnumDescriptorProto {
5486 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5487 f.debug_struct("EnumDescriptorProto")
5488 .field("name", &self.name)
5489 .field("value", &self.value)
5490 .field("options", &self.options)
5491 .field("reserved_range", &self.reserved_range)
5492 .field("reserved_name", &self.reserved_name)
5493 .field("visibility", &self.visibility)
5494 .finish()
5495 }
5496}
5497impl EnumDescriptorProto {
5498 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumDescriptorProto";
5503}
5504impl EnumDescriptorProto {
5505 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5506 #[inline]
5507 pub fn with_name(
5509 mut self,
5510 value: impl Into<::buffa::alloc::string::String>,
5511 ) -> Self {
5512 self.name = Some(value.into());
5513 self
5514 }
5515 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5516 #[inline]
5517 pub fn with_visibility(mut self, value: impl Into<SymbolVisibility>) -> Self {
5519 self.visibility = Some(value.into());
5520 self
5521 }
5522}
5523impl ::buffa::DefaultInstance for EnumDescriptorProto {
5524 fn default_instance() -> &'static Self {
5525 static VALUE: ::buffa::__private::OnceBox<EnumDescriptorProto> = ::buffa::__private::OnceBox::new();
5526 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
5527 }
5528}
5529impl ::buffa::MessageName for EnumDescriptorProto {
5530 const PACKAGE: &'static str = "google.protobuf";
5531 const NAME: &'static str = "EnumDescriptorProto";
5532 const FULL_NAME: &'static str = "google.protobuf.EnumDescriptorProto";
5533 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumDescriptorProto";
5534}
5535impl ::buffa::Message for EnumDescriptorProto {
5536 #[allow(clippy::let_and_return)]
5542 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5543 #[allow(unused_imports)]
5544 use ::buffa::Enumeration as _;
5545 let mut size = 0u32;
5546 if let Some(ref v) = self.name {
5547 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
5548 }
5549 for v in &self.value {
5550 let __slot = __cache.reserve();
5551 let inner_size = v.compute_size(__cache);
5552 __cache.set(__slot, inner_size);
5553 size
5554 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5555 + inner_size;
5556 }
5557 if self.options.is_set() {
5558 let __slot = __cache.reserve();
5559 let inner_size = self.options.compute_size(__cache);
5560 __cache.set(__slot, inner_size);
5561 size
5562 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5563 + inner_size;
5564 }
5565 for v in &self.reserved_range {
5566 let __slot = __cache.reserve();
5567 let inner_size = v.compute_size(__cache);
5568 __cache.set(__slot, inner_size);
5569 size
5570 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5571 + inner_size;
5572 }
5573 for v in &self.reserved_name {
5574 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
5575 }
5576 if let Some(ref v) = self.visibility {
5577 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
5578 }
5579 size += self.__buffa_unknown_fields.encoded_len() as u32;
5580 size
5581 }
5582 fn write_to(
5583 &self,
5584 __cache: &mut ::buffa::SizeCache,
5585 buf: &mut impl ::buffa::bytes::BufMut,
5586 ) {
5587 #[allow(unused_imports)]
5588 use ::buffa::Enumeration as _;
5589 if let Some(ref v) = self.name {
5590 ::buffa::encoding::Tag::new(
5591 1u32,
5592 ::buffa::encoding::WireType::LengthDelimited,
5593 )
5594 .encode(buf);
5595 ::buffa::types::encode_string(v, buf);
5596 }
5597 for v in &self.value {
5598 ::buffa::encoding::Tag::new(
5599 2u32,
5600 ::buffa::encoding::WireType::LengthDelimited,
5601 )
5602 .encode(buf);
5603 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
5604 v.write_to(__cache, buf);
5605 }
5606 if self.options.is_set() {
5607 ::buffa::encoding::Tag::new(
5608 3u32,
5609 ::buffa::encoding::WireType::LengthDelimited,
5610 )
5611 .encode(buf);
5612 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
5613 self.options.write_to(__cache, buf);
5614 }
5615 for v in &self.reserved_range {
5616 ::buffa::encoding::Tag::new(
5617 4u32,
5618 ::buffa::encoding::WireType::LengthDelimited,
5619 )
5620 .encode(buf);
5621 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
5622 v.write_to(__cache, buf);
5623 }
5624 for v in &self.reserved_name {
5625 ::buffa::encoding::Tag::new(
5626 5u32,
5627 ::buffa::encoding::WireType::LengthDelimited,
5628 )
5629 .encode(buf);
5630 ::buffa::types::encode_string(v, buf);
5631 }
5632 if let Some(ref v) = self.visibility {
5633 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
5634 .encode(buf);
5635 ::buffa::types::encode_int32(v.to_i32(), buf);
5636 }
5637 self.__buffa_unknown_fields.write_to(buf);
5638 }
5639 fn merge_field(
5640 &mut self,
5641 tag: ::buffa::encoding::Tag,
5642 buf: &mut impl ::buffa::bytes::Buf,
5643 depth: u32,
5644 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5645 #[allow(unused_imports)]
5646 use ::buffa::bytes::Buf as _;
5647 #[allow(unused_imports)]
5648 use ::buffa::Enumeration as _;
5649 match tag.field_number() {
5650 1u32 => {
5651 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5652 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5653 field_number: 1u32,
5654 expected: 2u8,
5655 actual: tag.wire_type() as u8,
5656 });
5657 }
5658 ::buffa::types::merge_string(
5659 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
5660 buf,
5661 )?;
5662 }
5663 2u32 => {
5664 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5665 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5666 field_number: 2u32,
5667 expected: 2u8,
5668 actual: tag.wire_type() as u8,
5669 });
5670 }
5671 let mut elem = ::core::default::Default::default();
5672 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
5673 self.value.push(elem);
5674 }
5675 3u32 => {
5676 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5677 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5678 field_number: 3u32,
5679 expected: 2u8,
5680 actual: tag.wire_type() as u8,
5681 });
5682 }
5683 ::buffa::Message::merge_length_delimited(
5684 self.options.get_or_insert_default(),
5685 buf,
5686 depth,
5687 )?;
5688 }
5689 4u32 => {
5690 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5691 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5692 field_number: 4u32,
5693 expected: 2u8,
5694 actual: tag.wire_type() as u8,
5695 });
5696 }
5697 let mut elem = ::core::default::Default::default();
5698 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
5699 self.reserved_range.push(elem);
5700 }
5701 5u32 => {
5702 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
5703 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5704 field_number: 5u32,
5705 expected: 2u8,
5706 actual: tag.wire_type() as u8,
5707 });
5708 }
5709 self.reserved_name.push(::buffa::types::decode_string(buf)?);
5710 }
5711 6u32 => {
5712 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
5713 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5714 field_number: 6u32,
5715 expected: 0u8,
5716 actual: tag.wire_type() as u8,
5717 });
5718 }
5719 let __raw = ::buffa::types::decode_int32(buf)?;
5720 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
5721 __raw,
5722 ) {
5723 self.visibility = ::core::option::Option::Some(__v);
5724 } else {
5725 self.__buffa_unknown_fields
5726 .push(::buffa::UnknownField {
5727 number: 6u32,
5728 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
5729 });
5730 }
5731 }
5732 _ => {
5733 self.__buffa_unknown_fields
5734 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
5735 }
5736 }
5737 ::core::result::Result::Ok(())
5738 }
5739 fn clear(&mut self) {
5740 self.name = ::core::option::Option::None;
5741 self.value.clear();
5742 self.options = ::buffa::MessageField::none();
5743 self.reserved_range.clear();
5744 self.reserved_name.clear();
5745 self.visibility = ::core::option::Option::None;
5746 self.__buffa_unknown_fields.clear();
5747 }
5748}
5749impl ::buffa::ExtensionSet for EnumDescriptorProto {
5750 const PROTO_FQN: &'static str = "google.protobuf.EnumDescriptorProto";
5751 fn unknown_fields(&self) -> &::buffa::UnknownFields {
5752 &self.__buffa_unknown_fields
5753 }
5754 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
5755 &mut self.__buffa_unknown_fields
5756 }
5757}
5758#[cfg(feature = "text")]
5759impl ::buffa::text::TextFormat for EnumDescriptorProto {
5760 fn encode_text(
5761 &self,
5762 enc: &mut ::buffa::text::TextEncoder<'_>,
5763 ) -> ::core::fmt::Result {
5764 #[allow(unused_imports)]
5765 use ::buffa::Enumeration as _;
5766 if let ::core::option::Option::Some(ref __v) = self.name {
5767 enc.write_field_name("name")?;
5768 enc.write_string(__v)?;
5769 }
5770 if self.options.is_set() {
5771 enc.write_field_name("options")?;
5772 enc.write_message(&*self.options)?;
5773 }
5774 if let ::core::option::Option::Some(ref __v) = self.visibility {
5775 enc.write_field_name("visibility")?;
5776 enc.write_enum_name(__v.proto_name())?;
5777 }
5778 for __v in &self.value {
5779 enc.write_field_name("value")?;
5780 enc.write_message(__v)?;
5781 }
5782 for __v in &self.reserved_range {
5783 enc.write_field_name("reserved_range")?;
5784 enc.write_message(__v)?;
5785 }
5786 for __v in &self.reserved_name {
5787 enc.write_field_name("reserved_name")?;
5788 enc.write_string(__v)?;
5789 }
5790 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
5791 ::core::result::Result::Ok(())
5792 }
5793 fn merge_text(
5794 &mut self,
5795 dec: &mut ::buffa::text::TextDecoder<'_>,
5796 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
5797 #[allow(unused_imports)]
5798 use ::buffa::Enumeration as _;
5799 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
5800 match __name {
5801 "name" => {
5802 self.name = ::core::option::Option::Some(
5803 dec.read_string()?.into_owned(),
5804 );
5805 }
5806 "options" => dec.merge_message(self.options.get_or_insert_default())?,
5807 "visibility" => {
5808 self.visibility = ::core::option::Option::Some(
5809 dec.read_closed_enum_by_name::<SymbolVisibility>()?,
5810 );
5811 }
5812 "value" => {
5813 dec.read_repeated_into(
5814 &mut self.value,
5815 |__d| {
5816 let mut __m = ::core::default::Default::default();
5817 __d.merge_message(&mut __m)?;
5818 ::core::result::Result::Ok(__m)
5819 },
5820 )?
5821 }
5822 "reserved_range" => {
5823 dec.read_repeated_into(
5824 &mut self.reserved_range,
5825 |__d| {
5826 let mut __m = ::core::default::Default::default();
5827 __d.merge_message(&mut __m)?;
5828 ::core::result::Result::Ok(__m)
5829 },
5830 )?
5831 }
5832 "reserved_name" => {
5833 dec.read_repeated_into(
5834 &mut self.reserved_name,
5835 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
5836 )?
5837 }
5838 _ => dec.skip_value()?,
5839 }
5840 }
5841 ::core::result::Result::Ok(())
5842 }
5843}
5844#[cfg(feature = "json")]
5845impl ::buffa::json_helpers::ProtoElemJson for EnumDescriptorProto {
5846 fn serialize_proto_json<S: ::serde::Serializer>(
5847 v: &Self,
5848 s: S,
5849 ) -> ::core::result::Result<S::Ok, S::Error> {
5850 ::serde::Serialize::serialize(v, s)
5851 }
5852 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
5853 d: D,
5854 ) -> ::core::result::Result<Self, D::Error> {
5855 <Self as ::serde::Deserialize>::deserialize(d)
5856 }
5857}
5858#[cfg(feature = "json")]
5859#[doc(hidden)]
5860pub const __ENUM_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
5861 type_url: "type.googleapis.com/google.protobuf.EnumDescriptorProto",
5862 to_json: ::buffa::type_registry::any_to_json::<EnumDescriptorProto>,
5863 from_json: ::buffa::type_registry::any_from_json::<EnumDescriptorProto>,
5864 is_wkt: false,
5865};
5866#[cfg(feature = "text")]
5867#[doc(hidden)]
5868pub const __ENUM_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
5869 type_url: "type.googleapis.com/google.protobuf.EnumDescriptorProto",
5870 text_encode: ::buffa::type_registry::any_encode_text::<EnumDescriptorProto>,
5871 text_merge: ::buffa::type_registry::any_merge_text::<EnumDescriptorProto>,
5872};
5873pub mod enum_descriptor_proto {
5874 #[allow(unused_imports)]
5875 use super::*;
5876 #[derive(Clone, PartialEq, Default)]
5883 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
5884 #[cfg_attr(feature = "json", serde(default))]
5885 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
5886 pub struct EnumReservedRange {
5887 #[cfg_attr(
5891 feature = "json",
5892 serde(
5893 rename = "start",
5894 with = "::buffa::json_helpers::opt_int32",
5895 skip_serializing_if = "::core::option::Option::is_none"
5896 )
5897 )]
5898 pub start: ::core::option::Option<i32>,
5899 #[cfg_attr(
5903 feature = "json",
5904 serde(
5905 rename = "end",
5906 with = "::buffa::json_helpers::opt_int32",
5907 skip_serializing_if = "::core::option::Option::is_none"
5908 )
5909 )]
5910 pub end: ::core::option::Option<i32>,
5911 #[cfg_attr(feature = "json", serde(skip))]
5912 #[doc(hidden)]
5913 pub __buffa_unknown_fields: ::buffa::UnknownFields,
5914 }
5915 impl ::core::fmt::Debug for EnumReservedRange {
5916 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
5917 f.debug_struct("EnumReservedRange")
5918 .field("start", &self.start)
5919 .field("end", &self.end)
5920 .finish()
5921 }
5922 }
5923 impl EnumReservedRange {
5924 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange";
5929 }
5930 impl EnumReservedRange {
5931 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5932 #[inline]
5933 pub fn with_start(mut self, value: i32) -> Self {
5935 self.start = Some(value);
5936 self
5937 }
5938 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
5939 #[inline]
5940 pub fn with_end(mut self, value: i32) -> Self {
5942 self.end = Some(value);
5943 self
5944 }
5945 }
5946 impl ::buffa::DefaultInstance for EnumReservedRange {
5947 fn default_instance() -> &'static Self {
5948 static VALUE: ::buffa::__private::OnceBox<EnumReservedRange> = ::buffa::__private::OnceBox::new();
5949 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
5950 }
5951 }
5952 impl ::buffa::MessageName for EnumReservedRange {
5953 const PACKAGE: &'static str = "google.protobuf";
5954 const NAME: &'static str = "EnumDescriptorProto.EnumReservedRange";
5955 const FULL_NAME: &'static str = "google.protobuf.EnumDescriptorProto.EnumReservedRange";
5956 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange";
5957 }
5958 impl ::buffa::Message for EnumReservedRange {
5959 #[allow(clippy::let_and_return)]
5965 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5966 #[allow(unused_imports)]
5967 use ::buffa::Enumeration as _;
5968 let mut size = 0u32;
5969 if let Some(v) = self.start {
5970 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
5971 }
5972 if let Some(v) = self.end {
5973 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
5974 }
5975 size += self.__buffa_unknown_fields.encoded_len() as u32;
5976 size
5977 }
5978 fn write_to(
5979 &self,
5980 _cache: &mut ::buffa::SizeCache,
5981 buf: &mut impl ::buffa::bytes::BufMut,
5982 ) {
5983 #[allow(unused_imports)]
5984 use ::buffa::Enumeration as _;
5985 if let Some(v) = self.start {
5986 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
5987 .encode(buf);
5988 ::buffa::types::encode_int32(v, buf);
5989 }
5990 if let Some(v) = self.end {
5991 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
5992 .encode(buf);
5993 ::buffa::types::encode_int32(v, buf);
5994 }
5995 self.__buffa_unknown_fields.write_to(buf);
5996 }
5997 fn merge_field(
5998 &mut self,
5999 tag: ::buffa::encoding::Tag,
6000 buf: &mut impl ::buffa::bytes::Buf,
6001 depth: u32,
6002 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6003 #[allow(unused_imports)]
6004 use ::buffa::bytes::Buf as _;
6005 #[allow(unused_imports)]
6006 use ::buffa::Enumeration as _;
6007 match tag.field_number() {
6008 1u32 => {
6009 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
6010 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6011 field_number: 1u32,
6012 expected: 0u8,
6013 actual: tag.wire_type() as u8,
6014 });
6015 }
6016 self.start = ::core::option::Option::Some(
6017 ::buffa::types::decode_int32(buf)?,
6018 );
6019 }
6020 2u32 => {
6021 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
6022 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6023 field_number: 2u32,
6024 expected: 0u8,
6025 actual: tag.wire_type() as u8,
6026 });
6027 }
6028 self.end = ::core::option::Option::Some(
6029 ::buffa::types::decode_int32(buf)?,
6030 );
6031 }
6032 _ => {
6033 self.__buffa_unknown_fields
6034 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
6035 }
6036 }
6037 ::core::result::Result::Ok(())
6038 }
6039 fn clear(&mut self) {
6040 self.start = ::core::option::Option::None;
6041 self.end = ::core::option::Option::None;
6042 self.__buffa_unknown_fields.clear();
6043 }
6044 }
6045 impl ::buffa::ExtensionSet for EnumReservedRange {
6046 const PROTO_FQN: &'static str = "google.protobuf.EnumDescriptorProto.EnumReservedRange";
6047 fn unknown_fields(&self) -> &::buffa::UnknownFields {
6048 &self.__buffa_unknown_fields
6049 }
6050 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6051 &mut self.__buffa_unknown_fields
6052 }
6053 }
6054 #[cfg(feature = "text")]
6055 impl ::buffa::text::TextFormat for EnumReservedRange {
6056 fn encode_text(
6057 &self,
6058 enc: &mut ::buffa::text::TextEncoder<'_>,
6059 ) -> ::core::fmt::Result {
6060 #[allow(unused_imports)]
6061 use ::buffa::Enumeration as _;
6062 if let ::core::option::Option::Some(ref __v) = self.start {
6063 enc.write_field_name("start")?;
6064 enc.write_i32(*__v)?;
6065 }
6066 if let ::core::option::Option::Some(ref __v) = self.end {
6067 enc.write_field_name("end")?;
6068 enc.write_i32(*__v)?;
6069 }
6070 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
6071 ::core::result::Result::Ok(())
6072 }
6073 fn merge_text(
6074 &mut self,
6075 dec: &mut ::buffa::text::TextDecoder<'_>,
6076 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
6077 #[allow(unused_imports)]
6078 use ::buffa::Enumeration as _;
6079 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
6080 match __name {
6081 "start" => self.start = ::core::option::Option::Some(dec.read_i32()?),
6082 "end" => self.end = ::core::option::Option::Some(dec.read_i32()?),
6083 _ => dec.skip_value()?,
6084 }
6085 }
6086 ::core::result::Result::Ok(())
6087 }
6088 }
6089 #[cfg(feature = "json")]
6090 impl ::buffa::json_helpers::ProtoElemJson for EnumReservedRange {
6091 fn serialize_proto_json<S: ::serde::Serializer>(
6092 v: &Self,
6093 s: S,
6094 ) -> ::core::result::Result<S::Ok, S::Error> {
6095 ::serde::Serialize::serialize(v, s)
6096 }
6097 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6098 d: D,
6099 ) -> ::core::result::Result<Self, D::Error> {
6100 <Self as ::serde::Deserialize>::deserialize(d)
6101 }
6102 }
6103 #[cfg(feature = "json")]
6104 #[doc(hidden)]
6105 pub const __ENUM_RESERVED_RANGE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6106 type_url: "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange",
6107 to_json: ::buffa::type_registry::any_to_json::<EnumReservedRange>,
6108 from_json: ::buffa::type_registry::any_from_json::<EnumReservedRange>,
6109 is_wkt: false,
6110 };
6111 #[cfg(feature = "text")]
6112 #[doc(hidden)]
6113 pub const __ENUM_RESERVED_RANGE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
6114 type_url: "type.googleapis.com/google.protobuf.EnumDescriptorProto.EnumReservedRange",
6115 text_encode: ::buffa::type_registry::any_encode_text::<EnumReservedRange>,
6116 text_merge: ::buffa::type_registry::any_merge_text::<EnumReservedRange>,
6117 };
6118 #[cfg(feature = "views")]
6119 #[doc(inline)]
6120 pub use super::__buffa::view::enum_descriptor_proto::EnumReservedRangeView;
6121}
6122#[derive(Clone, PartialEq, Default)]
6124#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
6125#[cfg_attr(feature = "json", serde(default))]
6126#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
6127pub struct EnumValueDescriptorProto {
6128 #[cfg_attr(
6130 feature = "json",
6131 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
6132 )]
6133 pub name: ::core::option::Option<::buffa::alloc::string::String>,
6134 #[cfg_attr(
6136 feature = "json",
6137 serde(
6138 rename = "number",
6139 with = "::buffa::json_helpers::opt_int32",
6140 skip_serializing_if = "::core::option::Option::is_none"
6141 )
6142 )]
6143 pub number: ::core::option::Option<i32>,
6144 #[cfg_attr(
6146 feature = "json",
6147 serde(
6148 rename = "options",
6149 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6150 )
6151 )]
6152 pub options: ::buffa::MessageField<EnumValueOptions>,
6153 #[cfg_attr(feature = "json", serde(skip))]
6154 #[doc(hidden)]
6155 pub __buffa_unknown_fields: ::buffa::UnknownFields,
6156}
6157impl ::core::fmt::Debug for EnumValueDescriptorProto {
6158 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6159 f.debug_struct("EnumValueDescriptorProto")
6160 .field("name", &self.name)
6161 .field("number", &self.number)
6162 .field("options", &self.options)
6163 .finish()
6164 }
6165}
6166impl EnumValueDescriptorProto {
6167 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValueDescriptorProto";
6172}
6173impl EnumValueDescriptorProto {
6174 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6175 #[inline]
6176 pub fn with_name(
6178 mut self,
6179 value: impl Into<::buffa::alloc::string::String>,
6180 ) -> Self {
6181 self.name = Some(value.into());
6182 self
6183 }
6184 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6185 #[inline]
6186 pub fn with_number(mut self, value: i32) -> Self {
6188 self.number = Some(value);
6189 self
6190 }
6191}
6192impl ::buffa::DefaultInstance for EnumValueDescriptorProto {
6193 fn default_instance() -> &'static Self {
6194 static VALUE: ::buffa::__private::OnceBox<EnumValueDescriptorProto> = ::buffa::__private::OnceBox::new();
6195 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
6196 }
6197}
6198impl ::buffa::MessageName for EnumValueDescriptorProto {
6199 const PACKAGE: &'static str = "google.protobuf";
6200 const NAME: &'static str = "EnumValueDescriptorProto";
6201 const FULL_NAME: &'static str = "google.protobuf.EnumValueDescriptorProto";
6202 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValueDescriptorProto";
6203}
6204impl ::buffa::Message for EnumValueDescriptorProto {
6205 #[allow(clippy::let_and_return)]
6211 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6212 #[allow(unused_imports)]
6213 use ::buffa::Enumeration as _;
6214 let mut size = 0u32;
6215 if let Some(ref v) = self.name {
6216 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
6217 }
6218 if let Some(v) = self.number {
6219 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
6220 }
6221 if self.options.is_set() {
6222 let __slot = __cache.reserve();
6223 let inner_size = self.options.compute_size(__cache);
6224 __cache.set(__slot, inner_size);
6225 size
6226 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6227 + inner_size;
6228 }
6229 size += self.__buffa_unknown_fields.encoded_len() as u32;
6230 size
6231 }
6232 fn write_to(
6233 &self,
6234 __cache: &mut ::buffa::SizeCache,
6235 buf: &mut impl ::buffa::bytes::BufMut,
6236 ) {
6237 #[allow(unused_imports)]
6238 use ::buffa::Enumeration as _;
6239 if let Some(ref v) = self.name {
6240 ::buffa::encoding::Tag::new(
6241 1u32,
6242 ::buffa::encoding::WireType::LengthDelimited,
6243 )
6244 .encode(buf);
6245 ::buffa::types::encode_string(v, buf);
6246 }
6247 if let Some(v) = self.number {
6248 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
6249 .encode(buf);
6250 ::buffa::types::encode_int32(v, buf);
6251 }
6252 if self.options.is_set() {
6253 ::buffa::encoding::Tag::new(
6254 3u32,
6255 ::buffa::encoding::WireType::LengthDelimited,
6256 )
6257 .encode(buf);
6258 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6259 self.options.write_to(__cache, buf);
6260 }
6261 self.__buffa_unknown_fields.write_to(buf);
6262 }
6263 fn merge_field(
6264 &mut self,
6265 tag: ::buffa::encoding::Tag,
6266 buf: &mut impl ::buffa::bytes::Buf,
6267 depth: u32,
6268 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6269 #[allow(unused_imports)]
6270 use ::buffa::bytes::Buf as _;
6271 #[allow(unused_imports)]
6272 use ::buffa::Enumeration as _;
6273 match tag.field_number() {
6274 1u32 => {
6275 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6276 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6277 field_number: 1u32,
6278 expected: 2u8,
6279 actual: tag.wire_type() as u8,
6280 });
6281 }
6282 ::buffa::types::merge_string(
6283 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
6284 buf,
6285 )?;
6286 }
6287 2u32 => {
6288 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
6289 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6290 field_number: 2u32,
6291 expected: 0u8,
6292 actual: tag.wire_type() as u8,
6293 });
6294 }
6295 self.number = ::core::option::Option::Some(
6296 ::buffa::types::decode_int32(buf)?,
6297 );
6298 }
6299 3u32 => {
6300 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6301 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6302 field_number: 3u32,
6303 expected: 2u8,
6304 actual: tag.wire_type() as u8,
6305 });
6306 }
6307 ::buffa::Message::merge_length_delimited(
6308 self.options.get_or_insert_default(),
6309 buf,
6310 depth,
6311 )?;
6312 }
6313 _ => {
6314 self.__buffa_unknown_fields
6315 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
6316 }
6317 }
6318 ::core::result::Result::Ok(())
6319 }
6320 fn clear(&mut self) {
6321 self.name = ::core::option::Option::None;
6322 self.number = ::core::option::Option::None;
6323 self.options = ::buffa::MessageField::none();
6324 self.__buffa_unknown_fields.clear();
6325 }
6326}
6327impl ::buffa::ExtensionSet for EnumValueDescriptorProto {
6328 const PROTO_FQN: &'static str = "google.protobuf.EnumValueDescriptorProto";
6329 fn unknown_fields(&self) -> &::buffa::UnknownFields {
6330 &self.__buffa_unknown_fields
6331 }
6332 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6333 &mut self.__buffa_unknown_fields
6334 }
6335}
6336#[cfg(feature = "text")]
6337impl ::buffa::text::TextFormat for EnumValueDescriptorProto {
6338 fn encode_text(
6339 &self,
6340 enc: &mut ::buffa::text::TextEncoder<'_>,
6341 ) -> ::core::fmt::Result {
6342 #[allow(unused_imports)]
6343 use ::buffa::Enumeration as _;
6344 if let ::core::option::Option::Some(ref __v) = self.name {
6345 enc.write_field_name("name")?;
6346 enc.write_string(__v)?;
6347 }
6348 if let ::core::option::Option::Some(ref __v) = self.number {
6349 enc.write_field_name("number")?;
6350 enc.write_i32(*__v)?;
6351 }
6352 if self.options.is_set() {
6353 enc.write_field_name("options")?;
6354 enc.write_message(&*self.options)?;
6355 }
6356 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
6357 ::core::result::Result::Ok(())
6358 }
6359 fn merge_text(
6360 &mut self,
6361 dec: &mut ::buffa::text::TextDecoder<'_>,
6362 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
6363 #[allow(unused_imports)]
6364 use ::buffa::Enumeration as _;
6365 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
6366 match __name {
6367 "name" => {
6368 self.name = ::core::option::Option::Some(
6369 dec.read_string()?.into_owned(),
6370 );
6371 }
6372 "number" => self.number = ::core::option::Option::Some(dec.read_i32()?),
6373 "options" => dec.merge_message(self.options.get_or_insert_default())?,
6374 _ => dec.skip_value()?,
6375 }
6376 }
6377 ::core::result::Result::Ok(())
6378 }
6379}
6380#[cfg(feature = "json")]
6381impl ::buffa::json_helpers::ProtoElemJson for EnumValueDescriptorProto {
6382 fn serialize_proto_json<S: ::serde::Serializer>(
6383 v: &Self,
6384 s: S,
6385 ) -> ::core::result::Result<S::Ok, S::Error> {
6386 ::serde::Serialize::serialize(v, s)
6387 }
6388 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6389 d: D,
6390 ) -> ::core::result::Result<Self, D::Error> {
6391 <Self as ::serde::Deserialize>::deserialize(d)
6392 }
6393}
6394#[cfg(feature = "json")]
6395#[doc(hidden)]
6396pub const __ENUM_VALUE_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6397 type_url: "type.googleapis.com/google.protobuf.EnumValueDescriptorProto",
6398 to_json: ::buffa::type_registry::any_to_json::<EnumValueDescriptorProto>,
6399 from_json: ::buffa::type_registry::any_from_json::<EnumValueDescriptorProto>,
6400 is_wkt: false,
6401};
6402#[cfg(feature = "text")]
6403#[doc(hidden)]
6404pub const __ENUM_VALUE_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
6405 type_url: "type.googleapis.com/google.protobuf.EnumValueDescriptorProto",
6406 text_encode: ::buffa::type_registry::any_encode_text::<EnumValueDescriptorProto>,
6407 text_merge: ::buffa::type_registry::any_merge_text::<EnumValueDescriptorProto>,
6408};
6409#[derive(Clone, PartialEq, Default)]
6411#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
6412#[cfg_attr(feature = "json", serde(default))]
6413#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
6414pub struct ServiceDescriptorProto {
6415 #[cfg_attr(
6417 feature = "json",
6418 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
6419 )]
6420 pub name: ::core::option::Option<::buffa::alloc::string::String>,
6421 #[cfg_attr(
6423 feature = "json",
6424 serde(
6425 rename = "method",
6426 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
6427 deserialize_with = "::buffa::json_helpers::null_as_default"
6428 )
6429 )]
6430 pub method: ::buffa::alloc::vec::Vec<MethodDescriptorProto>,
6431 #[cfg_attr(
6433 feature = "json",
6434 serde(
6435 rename = "options",
6436 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6437 )
6438 )]
6439 pub options: ::buffa::MessageField<ServiceOptions>,
6440 #[cfg_attr(feature = "json", serde(skip))]
6441 #[doc(hidden)]
6442 pub __buffa_unknown_fields: ::buffa::UnknownFields,
6443}
6444impl ::core::fmt::Debug for ServiceDescriptorProto {
6445 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6446 f.debug_struct("ServiceDescriptorProto")
6447 .field("name", &self.name)
6448 .field("method", &self.method)
6449 .field("options", &self.options)
6450 .finish()
6451 }
6452}
6453impl ServiceDescriptorProto {
6454 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ServiceDescriptorProto";
6459}
6460impl ServiceDescriptorProto {
6461 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6462 #[inline]
6463 pub fn with_name(
6465 mut self,
6466 value: impl Into<::buffa::alloc::string::String>,
6467 ) -> Self {
6468 self.name = Some(value.into());
6469 self
6470 }
6471}
6472impl ::buffa::DefaultInstance for ServiceDescriptorProto {
6473 fn default_instance() -> &'static Self {
6474 static VALUE: ::buffa::__private::OnceBox<ServiceDescriptorProto> = ::buffa::__private::OnceBox::new();
6475 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
6476 }
6477}
6478impl ::buffa::MessageName for ServiceDescriptorProto {
6479 const PACKAGE: &'static str = "google.protobuf";
6480 const NAME: &'static str = "ServiceDescriptorProto";
6481 const FULL_NAME: &'static str = "google.protobuf.ServiceDescriptorProto";
6482 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ServiceDescriptorProto";
6483}
6484impl ::buffa::Message for ServiceDescriptorProto {
6485 #[allow(clippy::let_and_return)]
6491 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6492 #[allow(unused_imports)]
6493 use ::buffa::Enumeration as _;
6494 let mut size = 0u32;
6495 if let Some(ref v) = self.name {
6496 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
6497 }
6498 for v in &self.method {
6499 let __slot = __cache.reserve();
6500 let inner_size = v.compute_size(__cache);
6501 __cache.set(__slot, inner_size);
6502 size
6503 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6504 + inner_size;
6505 }
6506 if self.options.is_set() {
6507 let __slot = __cache.reserve();
6508 let inner_size = self.options.compute_size(__cache);
6509 __cache.set(__slot, inner_size);
6510 size
6511 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6512 + inner_size;
6513 }
6514 size += self.__buffa_unknown_fields.encoded_len() as u32;
6515 size
6516 }
6517 fn write_to(
6518 &self,
6519 __cache: &mut ::buffa::SizeCache,
6520 buf: &mut impl ::buffa::bytes::BufMut,
6521 ) {
6522 #[allow(unused_imports)]
6523 use ::buffa::Enumeration as _;
6524 if let Some(ref v) = self.name {
6525 ::buffa::encoding::Tag::new(
6526 1u32,
6527 ::buffa::encoding::WireType::LengthDelimited,
6528 )
6529 .encode(buf);
6530 ::buffa::types::encode_string(v, buf);
6531 }
6532 for v in &self.method {
6533 ::buffa::encoding::Tag::new(
6534 2u32,
6535 ::buffa::encoding::WireType::LengthDelimited,
6536 )
6537 .encode(buf);
6538 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6539 v.write_to(__cache, buf);
6540 }
6541 if self.options.is_set() {
6542 ::buffa::encoding::Tag::new(
6543 3u32,
6544 ::buffa::encoding::WireType::LengthDelimited,
6545 )
6546 .encode(buf);
6547 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6548 self.options.write_to(__cache, buf);
6549 }
6550 self.__buffa_unknown_fields.write_to(buf);
6551 }
6552 fn merge_field(
6553 &mut self,
6554 tag: ::buffa::encoding::Tag,
6555 buf: &mut impl ::buffa::bytes::Buf,
6556 depth: u32,
6557 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6558 #[allow(unused_imports)]
6559 use ::buffa::bytes::Buf as _;
6560 #[allow(unused_imports)]
6561 use ::buffa::Enumeration as _;
6562 match tag.field_number() {
6563 1u32 => {
6564 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6565 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6566 field_number: 1u32,
6567 expected: 2u8,
6568 actual: tag.wire_type() as u8,
6569 });
6570 }
6571 ::buffa::types::merge_string(
6572 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
6573 buf,
6574 )?;
6575 }
6576 2u32 => {
6577 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6578 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6579 field_number: 2u32,
6580 expected: 2u8,
6581 actual: tag.wire_type() as u8,
6582 });
6583 }
6584 let mut elem = ::core::default::Default::default();
6585 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
6586 self.method.push(elem);
6587 }
6588 3u32 => {
6589 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6590 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6591 field_number: 3u32,
6592 expected: 2u8,
6593 actual: tag.wire_type() as u8,
6594 });
6595 }
6596 ::buffa::Message::merge_length_delimited(
6597 self.options.get_or_insert_default(),
6598 buf,
6599 depth,
6600 )?;
6601 }
6602 _ => {
6603 self.__buffa_unknown_fields
6604 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
6605 }
6606 }
6607 ::core::result::Result::Ok(())
6608 }
6609 fn clear(&mut self) {
6610 self.name = ::core::option::Option::None;
6611 self.method.clear();
6612 self.options = ::buffa::MessageField::none();
6613 self.__buffa_unknown_fields.clear();
6614 }
6615}
6616impl ::buffa::ExtensionSet for ServiceDescriptorProto {
6617 const PROTO_FQN: &'static str = "google.protobuf.ServiceDescriptorProto";
6618 fn unknown_fields(&self) -> &::buffa::UnknownFields {
6619 &self.__buffa_unknown_fields
6620 }
6621 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
6622 &mut self.__buffa_unknown_fields
6623 }
6624}
6625#[cfg(feature = "text")]
6626impl ::buffa::text::TextFormat for ServiceDescriptorProto {
6627 fn encode_text(
6628 &self,
6629 enc: &mut ::buffa::text::TextEncoder<'_>,
6630 ) -> ::core::fmt::Result {
6631 #[allow(unused_imports)]
6632 use ::buffa::Enumeration as _;
6633 if let ::core::option::Option::Some(ref __v) = self.name {
6634 enc.write_field_name("name")?;
6635 enc.write_string(__v)?;
6636 }
6637 if self.options.is_set() {
6638 enc.write_field_name("options")?;
6639 enc.write_message(&*self.options)?;
6640 }
6641 for __v in &self.method {
6642 enc.write_field_name("method")?;
6643 enc.write_message(__v)?;
6644 }
6645 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
6646 ::core::result::Result::Ok(())
6647 }
6648 fn merge_text(
6649 &mut self,
6650 dec: &mut ::buffa::text::TextDecoder<'_>,
6651 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
6652 #[allow(unused_imports)]
6653 use ::buffa::Enumeration as _;
6654 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
6655 match __name {
6656 "name" => {
6657 self.name = ::core::option::Option::Some(
6658 dec.read_string()?.into_owned(),
6659 );
6660 }
6661 "options" => dec.merge_message(self.options.get_or_insert_default())?,
6662 "method" => {
6663 dec.read_repeated_into(
6664 &mut self.method,
6665 |__d| {
6666 let mut __m = ::core::default::Default::default();
6667 __d.merge_message(&mut __m)?;
6668 ::core::result::Result::Ok(__m)
6669 },
6670 )?
6671 }
6672 _ => dec.skip_value()?,
6673 }
6674 }
6675 ::core::result::Result::Ok(())
6676 }
6677}
6678#[cfg(feature = "json")]
6679impl ::buffa::json_helpers::ProtoElemJson for ServiceDescriptorProto {
6680 fn serialize_proto_json<S: ::serde::Serializer>(
6681 v: &Self,
6682 s: S,
6683 ) -> ::core::result::Result<S::Ok, S::Error> {
6684 ::serde::Serialize::serialize(v, s)
6685 }
6686 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
6687 d: D,
6688 ) -> ::core::result::Result<Self, D::Error> {
6689 <Self as ::serde::Deserialize>::deserialize(d)
6690 }
6691}
6692#[cfg(feature = "json")]
6693#[doc(hidden)]
6694pub const __SERVICE_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
6695 type_url: "type.googleapis.com/google.protobuf.ServiceDescriptorProto",
6696 to_json: ::buffa::type_registry::any_to_json::<ServiceDescriptorProto>,
6697 from_json: ::buffa::type_registry::any_from_json::<ServiceDescriptorProto>,
6698 is_wkt: false,
6699};
6700#[cfg(feature = "text")]
6701#[doc(hidden)]
6702pub const __SERVICE_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
6703 type_url: "type.googleapis.com/google.protobuf.ServiceDescriptorProto",
6704 text_encode: ::buffa::type_registry::any_encode_text::<ServiceDescriptorProto>,
6705 text_merge: ::buffa::type_registry::any_merge_text::<ServiceDescriptorProto>,
6706};
6707#[derive(Clone, PartialEq, Default)]
6709#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
6710#[cfg_attr(feature = "json", serde(default))]
6711#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
6712pub struct MethodDescriptorProto {
6713 #[cfg_attr(
6715 feature = "json",
6716 serde(rename = "name", skip_serializing_if = "::core::option::Option::is_none")
6717 )]
6718 pub name: ::core::option::Option<::buffa::alloc::string::String>,
6719 #[cfg_attr(
6724 feature = "json",
6725 serde(
6726 rename = "inputType",
6727 alias = "input_type",
6728 skip_serializing_if = "::core::option::Option::is_none"
6729 )
6730 )]
6731 pub input_type: ::core::option::Option<::buffa::alloc::string::String>,
6732 #[cfg_attr(
6734 feature = "json",
6735 serde(
6736 rename = "outputType",
6737 alias = "output_type",
6738 skip_serializing_if = "::core::option::Option::is_none"
6739 )
6740 )]
6741 pub output_type: ::core::option::Option<::buffa::alloc::string::String>,
6742 #[cfg_attr(
6744 feature = "json",
6745 serde(
6746 rename = "options",
6747 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
6748 )
6749 )]
6750 pub options: ::buffa::MessageField<MethodOptions>,
6751 #[cfg_attr(
6755 feature = "json",
6756 serde(
6757 rename = "clientStreaming",
6758 alias = "client_streaming",
6759 skip_serializing_if = "::core::option::Option::is_none"
6760 )
6761 )]
6762 pub client_streaming: ::core::option::Option<bool>,
6763 #[cfg_attr(
6767 feature = "json",
6768 serde(
6769 rename = "serverStreaming",
6770 alias = "server_streaming",
6771 skip_serializing_if = "::core::option::Option::is_none"
6772 )
6773 )]
6774 pub server_streaming: ::core::option::Option<bool>,
6775 #[cfg_attr(feature = "json", serde(skip))]
6776 #[doc(hidden)]
6777 pub __buffa_unknown_fields: ::buffa::UnknownFields,
6778}
6779impl ::core::fmt::Debug for MethodDescriptorProto {
6780 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
6781 f.debug_struct("MethodDescriptorProto")
6782 .field("name", &self.name)
6783 .field("input_type", &self.input_type)
6784 .field("output_type", &self.output_type)
6785 .field("options", &self.options)
6786 .field("client_streaming", &self.client_streaming)
6787 .field("server_streaming", &self.server_streaming)
6788 .finish()
6789 }
6790}
6791impl MethodDescriptorProto {
6792 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MethodDescriptorProto";
6797}
6798impl MethodDescriptorProto {
6799 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6800 #[inline]
6801 pub fn with_name(
6803 mut self,
6804 value: impl Into<::buffa::alloc::string::String>,
6805 ) -> Self {
6806 self.name = Some(value.into());
6807 self
6808 }
6809 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6810 #[inline]
6811 pub fn with_input_type(
6813 mut self,
6814 value: impl Into<::buffa::alloc::string::String>,
6815 ) -> Self {
6816 self.input_type = Some(value.into());
6817 self
6818 }
6819 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6820 #[inline]
6821 pub fn with_output_type(
6823 mut self,
6824 value: impl Into<::buffa::alloc::string::String>,
6825 ) -> Self {
6826 self.output_type = Some(value.into());
6827 self
6828 }
6829 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6830 #[inline]
6831 pub fn with_client_streaming(mut self, value: bool) -> Self {
6833 self.client_streaming = Some(value);
6834 self
6835 }
6836 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
6837 #[inline]
6838 pub fn with_server_streaming(mut self, value: bool) -> Self {
6840 self.server_streaming = Some(value);
6841 self
6842 }
6843}
6844impl ::buffa::DefaultInstance for MethodDescriptorProto {
6845 fn default_instance() -> &'static Self {
6846 static VALUE: ::buffa::__private::OnceBox<MethodDescriptorProto> = ::buffa::__private::OnceBox::new();
6847 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
6848 }
6849}
6850impl ::buffa::MessageName for MethodDescriptorProto {
6851 const PACKAGE: &'static str = "google.protobuf";
6852 const NAME: &'static str = "MethodDescriptorProto";
6853 const FULL_NAME: &'static str = "google.protobuf.MethodDescriptorProto";
6854 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MethodDescriptorProto";
6855}
6856impl ::buffa::Message for MethodDescriptorProto {
6857 #[allow(clippy::let_and_return)]
6863 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6864 #[allow(unused_imports)]
6865 use ::buffa::Enumeration as _;
6866 let mut size = 0u32;
6867 if let Some(ref v) = self.name {
6868 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
6869 }
6870 if let Some(ref v) = self.input_type {
6871 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
6872 }
6873 if let Some(ref v) = self.output_type {
6874 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
6875 }
6876 if self.options.is_set() {
6877 let __slot = __cache.reserve();
6878 let inner_size = self.options.compute_size(__cache);
6879 __cache.set(__slot, inner_size);
6880 size
6881 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6882 + inner_size;
6883 }
6884 if self.client_streaming.is_some() {
6885 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
6886 }
6887 if self.server_streaming.is_some() {
6888 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
6889 }
6890 size += self.__buffa_unknown_fields.encoded_len() as u32;
6891 size
6892 }
6893 fn write_to(
6894 &self,
6895 __cache: &mut ::buffa::SizeCache,
6896 buf: &mut impl ::buffa::bytes::BufMut,
6897 ) {
6898 #[allow(unused_imports)]
6899 use ::buffa::Enumeration as _;
6900 if let Some(ref v) = self.name {
6901 ::buffa::encoding::Tag::new(
6902 1u32,
6903 ::buffa::encoding::WireType::LengthDelimited,
6904 )
6905 .encode(buf);
6906 ::buffa::types::encode_string(v, buf);
6907 }
6908 if let Some(ref v) = self.input_type {
6909 ::buffa::encoding::Tag::new(
6910 2u32,
6911 ::buffa::encoding::WireType::LengthDelimited,
6912 )
6913 .encode(buf);
6914 ::buffa::types::encode_string(v, buf);
6915 }
6916 if let Some(ref v) = self.output_type {
6917 ::buffa::encoding::Tag::new(
6918 3u32,
6919 ::buffa::encoding::WireType::LengthDelimited,
6920 )
6921 .encode(buf);
6922 ::buffa::types::encode_string(v, buf);
6923 }
6924 if self.options.is_set() {
6925 ::buffa::encoding::Tag::new(
6926 4u32,
6927 ::buffa::encoding::WireType::LengthDelimited,
6928 )
6929 .encode(buf);
6930 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6931 self.options.write_to(__cache, buf);
6932 }
6933 if let Some(v) = self.client_streaming {
6934 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
6935 .encode(buf);
6936 ::buffa::types::encode_bool(v, buf);
6937 }
6938 if let Some(v) = self.server_streaming {
6939 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
6940 .encode(buf);
6941 ::buffa::types::encode_bool(v, buf);
6942 }
6943 self.__buffa_unknown_fields.write_to(buf);
6944 }
6945 fn merge_field(
6946 &mut self,
6947 tag: ::buffa::encoding::Tag,
6948 buf: &mut impl ::buffa::bytes::Buf,
6949 depth: u32,
6950 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6951 #[allow(unused_imports)]
6952 use ::buffa::bytes::Buf as _;
6953 #[allow(unused_imports)]
6954 use ::buffa::Enumeration as _;
6955 match tag.field_number() {
6956 1u32 => {
6957 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6958 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6959 field_number: 1u32,
6960 expected: 2u8,
6961 actual: tag.wire_type() as u8,
6962 });
6963 }
6964 ::buffa::types::merge_string(
6965 self.name.get_or_insert_with(::buffa::alloc::string::String::new),
6966 buf,
6967 )?;
6968 }
6969 2u32 => {
6970 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6971 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6972 field_number: 2u32,
6973 expected: 2u8,
6974 actual: tag.wire_type() as u8,
6975 });
6976 }
6977 ::buffa::types::merge_string(
6978 self
6979 .input_type
6980 .get_or_insert_with(::buffa::alloc::string::String::new),
6981 buf,
6982 )?;
6983 }
6984 3u32 => {
6985 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
6986 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6987 field_number: 3u32,
6988 expected: 2u8,
6989 actual: tag.wire_type() as u8,
6990 });
6991 }
6992 ::buffa::types::merge_string(
6993 self
6994 .output_type
6995 .get_or_insert_with(::buffa::alloc::string::String::new),
6996 buf,
6997 )?;
6998 }
6999 4u32 => {
7000 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
7001 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7002 field_number: 4u32,
7003 expected: 2u8,
7004 actual: tag.wire_type() as u8,
7005 });
7006 }
7007 ::buffa::Message::merge_length_delimited(
7008 self.options.get_or_insert_default(),
7009 buf,
7010 depth,
7011 )?;
7012 }
7013 5u32 => {
7014 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
7015 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7016 field_number: 5u32,
7017 expected: 0u8,
7018 actual: tag.wire_type() as u8,
7019 });
7020 }
7021 self.client_streaming = ::core::option::Option::Some(
7022 ::buffa::types::decode_bool(buf)?,
7023 );
7024 }
7025 6u32 => {
7026 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
7027 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7028 field_number: 6u32,
7029 expected: 0u8,
7030 actual: tag.wire_type() as u8,
7031 });
7032 }
7033 self.server_streaming = ::core::option::Option::Some(
7034 ::buffa::types::decode_bool(buf)?,
7035 );
7036 }
7037 _ => {
7038 self.__buffa_unknown_fields
7039 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
7040 }
7041 }
7042 ::core::result::Result::Ok(())
7043 }
7044 fn clear(&mut self) {
7045 self.name = ::core::option::Option::None;
7046 self.input_type = ::core::option::Option::None;
7047 self.output_type = ::core::option::Option::None;
7048 self.options = ::buffa::MessageField::none();
7049 self.client_streaming = ::core::option::Option::None;
7050 self.server_streaming = ::core::option::Option::None;
7051 self.__buffa_unknown_fields.clear();
7052 }
7053}
7054impl ::buffa::ExtensionSet for MethodDescriptorProto {
7055 const PROTO_FQN: &'static str = "google.protobuf.MethodDescriptorProto";
7056 fn unknown_fields(&self) -> &::buffa::UnknownFields {
7057 &self.__buffa_unknown_fields
7058 }
7059 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
7060 &mut self.__buffa_unknown_fields
7061 }
7062}
7063#[cfg(feature = "text")]
7064impl ::buffa::text::TextFormat for MethodDescriptorProto {
7065 fn encode_text(
7066 &self,
7067 enc: &mut ::buffa::text::TextEncoder<'_>,
7068 ) -> ::core::fmt::Result {
7069 #[allow(unused_imports)]
7070 use ::buffa::Enumeration as _;
7071 if let ::core::option::Option::Some(ref __v) = self.name {
7072 enc.write_field_name("name")?;
7073 enc.write_string(__v)?;
7074 }
7075 if let ::core::option::Option::Some(ref __v) = self.input_type {
7076 enc.write_field_name("input_type")?;
7077 enc.write_string(__v)?;
7078 }
7079 if let ::core::option::Option::Some(ref __v) = self.output_type {
7080 enc.write_field_name("output_type")?;
7081 enc.write_string(__v)?;
7082 }
7083 if self.options.is_set() {
7084 enc.write_field_name("options")?;
7085 enc.write_message(&*self.options)?;
7086 }
7087 if let ::core::option::Option::Some(ref __v) = self.client_streaming {
7088 enc.write_field_name("client_streaming")?;
7089 enc.write_bool(*__v)?;
7090 }
7091 if let ::core::option::Option::Some(ref __v) = self.server_streaming {
7092 enc.write_field_name("server_streaming")?;
7093 enc.write_bool(*__v)?;
7094 }
7095 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
7096 ::core::result::Result::Ok(())
7097 }
7098 fn merge_text(
7099 &mut self,
7100 dec: &mut ::buffa::text::TextDecoder<'_>,
7101 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
7102 #[allow(unused_imports)]
7103 use ::buffa::Enumeration as _;
7104 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
7105 match __name {
7106 "name" => {
7107 self.name = ::core::option::Option::Some(
7108 dec.read_string()?.into_owned(),
7109 );
7110 }
7111 "input_type" => {
7112 self.input_type = ::core::option::Option::Some(
7113 dec.read_string()?.into_owned(),
7114 );
7115 }
7116 "output_type" => {
7117 self.output_type = ::core::option::Option::Some(
7118 dec.read_string()?.into_owned(),
7119 );
7120 }
7121 "options" => dec.merge_message(self.options.get_or_insert_default())?,
7122 "client_streaming" => {
7123 self.client_streaming = ::core::option::Option::Some(
7124 dec.read_bool()?,
7125 );
7126 }
7127 "server_streaming" => {
7128 self.server_streaming = ::core::option::Option::Some(
7129 dec.read_bool()?,
7130 );
7131 }
7132 _ => dec.skip_value()?,
7133 }
7134 }
7135 ::core::result::Result::Ok(())
7136 }
7137}
7138#[cfg(feature = "json")]
7139impl ::buffa::json_helpers::ProtoElemJson for MethodDescriptorProto {
7140 fn serialize_proto_json<S: ::serde::Serializer>(
7141 v: &Self,
7142 s: S,
7143 ) -> ::core::result::Result<S::Ok, S::Error> {
7144 ::serde::Serialize::serialize(v, s)
7145 }
7146 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
7147 d: D,
7148 ) -> ::core::result::Result<Self, D::Error> {
7149 <Self as ::serde::Deserialize>::deserialize(d)
7150 }
7151}
7152#[cfg(feature = "json")]
7153#[doc(hidden)]
7154pub const __METHOD_DESCRIPTOR_PROTO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
7155 type_url: "type.googleapis.com/google.protobuf.MethodDescriptorProto",
7156 to_json: ::buffa::type_registry::any_to_json::<MethodDescriptorProto>,
7157 from_json: ::buffa::type_registry::any_from_json::<MethodDescriptorProto>,
7158 is_wkt: false,
7159};
7160#[cfg(feature = "text")]
7161#[doc(hidden)]
7162pub const __METHOD_DESCRIPTOR_PROTO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
7163 type_url: "type.googleapis.com/google.protobuf.MethodDescriptorProto",
7164 text_encode: ::buffa::type_registry::any_encode_text::<MethodDescriptorProto>,
7165 text_merge: ::buffa::type_registry::any_merge_text::<MethodDescriptorProto>,
7166};
7167#[derive(Clone, PartialEq, Default)]
7199#[cfg_attr(feature = "json", derive(::serde::Serialize))]
7200#[cfg_attr(feature = "json", serde(default))]
7201#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
7202pub struct FileOptions {
7203 #[cfg_attr(
7210 feature = "json",
7211 serde(
7212 rename = "javaPackage",
7213 alias = "java_package",
7214 skip_serializing_if = "::core::option::Option::is_none"
7215 )
7216 )]
7217 pub java_package: ::core::option::Option<::buffa::alloc::string::String>,
7218 #[cfg_attr(
7226 feature = "json",
7227 serde(
7228 rename = "javaOuterClassname",
7229 alias = "java_outer_classname",
7230 skip_serializing_if = "::core::option::Option::is_none"
7231 )
7232 )]
7233 pub java_outer_classname: ::core::option::Option<::buffa::alloc::string::String>,
7234 #[cfg_attr(
7243 feature = "json",
7244 serde(
7245 rename = "javaMultipleFiles",
7246 alias = "java_multiple_files",
7247 skip_serializing_if = "::core::option::Option::is_none"
7248 )
7249 )]
7250 pub java_multiple_files: ::core::option::Option<bool>,
7251 #[cfg_attr(
7255 feature = "json",
7256 serde(
7257 rename = "javaGenerateEqualsAndHash",
7258 alias = "java_generate_equals_and_hash",
7259 skip_serializing_if = "::core::option::Option::is_none"
7260 )
7261 )]
7262 pub java_generate_equals_and_hash: ::core::option::Option<bool>,
7263 #[cfg_attr(
7276 feature = "json",
7277 serde(
7278 rename = "javaStringCheckUtf8",
7279 alias = "java_string_check_utf8",
7280 skip_serializing_if = "::core::option::Option::is_none"
7281 )
7282 )]
7283 pub java_string_check_utf8: ::core::option::Option<bool>,
7284 #[cfg_attr(
7286 feature = "json",
7287 serde(
7288 rename = "optimizeFor",
7289 alias = "optimize_for",
7290 with = "::buffa::json_helpers::opt_closed_enum",
7291 skip_serializing_if = "::core::option::Option::is_none"
7292 )
7293 )]
7294 pub optimize_for: ::core::option::Option<file_options::OptimizeMode>,
7295 #[cfg_attr(
7303 feature = "json",
7304 serde(
7305 rename = "goPackage",
7306 alias = "go_package",
7307 skip_serializing_if = "::core::option::Option::is_none"
7308 )
7309 )]
7310 pub go_package: ::core::option::Option<::buffa::alloc::string::String>,
7311 #[cfg_attr(
7324 feature = "json",
7325 serde(
7326 rename = "ccGenericServices",
7327 alias = "cc_generic_services",
7328 skip_serializing_if = "::core::option::Option::is_none"
7329 )
7330 )]
7331 pub cc_generic_services: ::core::option::Option<bool>,
7332 #[cfg_attr(
7334 feature = "json",
7335 serde(
7336 rename = "javaGenericServices",
7337 alias = "java_generic_services",
7338 skip_serializing_if = "::core::option::Option::is_none"
7339 )
7340 )]
7341 pub java_generic_services: ::core::option::Option<bool>,
7342 #[cfg_attr(
7344 feature = "json",
7345 serde(
7346 rename = "pyGenericServices",
7347 alias = "py_generic_services",
7348 skip_serializing_if = "::core::option::Option::is_none"
7349 )
7350 )]
7351 pub py_generic_services: ::core::option::Option<bool>,
7352 #[cfg_attr(
7359 feature = "json",
7360 serde(
7361 rename = "deprecated",
7362 skip_serializing_if = "::core::option::Option::is_none"
7363 )
7364 )]
7365 pub deprecated: ::core::option::Option<bool>,
7366 #[cfg_attr(
7371 feature = "json",
7372 serde(
7373 rename = "ccEnableArenas",
7374 alias = "cc_enable_arenas",
7375 skip_serializing_if = "::core::option::Option::is_none"
7376 )
7377 )]
7378 pub cc_enable_arenas: ::core::option::Option<bool>,
7379 #[cfg_attr(
7384 feature = "json",
7385 serde(
7386 rename = "objcClassPrefix",
7387 alias = "objc_class_prefix",
7388 skip_serializing_if = "::core::option::Option::is_none"
7389 )
7390 )]
7391 pub objc_class_prefix: ::core::option::Option<::buffa::alloc::string::String>,
7392 #[cfg_attr(
7396 feature = "json",
7397 serde(
7398 rename = "csharpNamespace",
7399 alias = "csharp_namespace",
7400 skip_serializing_if = "::core::option::Option::is_none"
7401 )
7402 )]
7403 pub csharp_namespace: ::core::option::Option<::buffa::alloc::string::String>,
7404 #[cfg_attr(
7411 feature = "json",
7412 serde(
7413 rename = "swiftPrefix",
7414 alias = "swift_prefix",
7415 skip_serializing_if = "::core::option::Option::is_none"
7416 )
7417 )]
7418 pub swift_prefix: ::core::option::Option<::buffa::alloc::string::String>,
7419 #[cfg_attr(
7424 feature = "json",
7425 serde(
7426 rename = "phpClassPrefix",
7427 alias = "php_class_prefix",
7428 skip_serializing_if = "::core::option::Option::is_none"
7429 )
7430 )]
7431 pub php_class_prefix: ::core::option::Option<::buffa::alloc::string::String>,
7432 #[cfg_attr(
7438 feature = "json",
7439 serde(
7440 rename = "phpNamespace",
7441 alias = "php_namespace",
7442 skip_serializing_if = "::core::option::Option::is_none"
7443 )
7444 )]
7445 pub php_namespace: ::core::option::Option<::buffa::alloc::string::String>,
7446 #[cfg_attr(
7452 feature = "json",
7453 serde(
7454 rename = "phpMetadataNamespace",
7455 alias = "php_metadata_namespace",
7456 skip_serializing_if = "::core::option::Option::is_none"
7457 )
7458 )]
7459 pub php_metadata_namespace: ::core::option::Option<::buffa::alloc::string::String>,
7460 #[cfg_attr(
7466 feature = "json",
7467 serde(
7468 rename = "rubyPackage",
7469 alias = "ruby_package",
7470 skip_serializing_if = "::core::option::Option::is_none"
7471 )
7472 )]
7473 pub ruby_package: ::core::option::Option<::buffa::alloc::string::String>,
7474 #[cfg_attr(
7481 feature = "json",
7482 serde(
7483 rename = "features",
7484 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
7485 )
7486 )]
7487 pub features: ::buffa::MessageField<FeatureSet>,
7488 #[cfg_attr(
7493 feature = "json",
7494 serde(
7495 rename = "uninterpretedOption",
7496 alias = "uninterpreted_option",
7497 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
7498 deserialize_with = "::buffa::json_helpers::null_as_default"
7499 )
7500 )]
7501 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
7502 #[cfg_attr(feature = "json", serde(flatten))]
7503 #[doc(hidden)]
7504 pub __buffa_unknown_fields: __FileOptionsExtJson,
7505}
7506impl ::core::fmt::Debug for FileOptions {
7507 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7508 f.debug_struct("FileOptions")
7509 .field("java_package", &self.java_package)
7510 .field("java_outer_classname", &self.java_outer_classname)
7511 .field("java_multiple_files", &self.java_multiple_files)
7512 .field("java_generate_equals_and_hash", &self.java_generate_equals_and_hash)
7513 .field("java_string_check_utf8", &self.java_string_check_utf8)
7514 .field("optimize_for", &self.optimize_for)
7515 .field("go_package", &self.go_package)
7516 .field("cc_generic_services", &self.cc_generic_services)
7517 .field("java_generic_services", &self.java_generic_services)
7518 .field("py_generic_services", &self.py_generic_services)
7519 .field("deprecated", &self.deprecated)
7520 .field("cc_enable_arenas", &self.cc_enable_arenas)
7521 .field("objc_class_prefix", &self.objc_class_prefix)
7522 .field("csharp_namespace", &self.csharp_namespace)
7523 .field("swift_prefix", &self.swift_prefix)
7524 .field("php_class_prefix", &self.php_class_prefix)
7525 .field("php_namespace", &self.php_namespace)
7526 .field("php_metadata_namespace", &self.php_metadata_namespace)
7527 .field("ruby_package", &self.ruby_package)
7528 .field("features", &self.features)
7529 .field("uninterpreted_option", &self.uninterpreted_option)
7530 .finish()
7531 }
7532}
7533impl FileOptions {
7534 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileOptions";
7539}
7540impl FileOptions {
7541 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7542 #[inline]
7543 pub fn with_java_package(
7545 mut self,
7546 value: impl Into<::buffa::alloc::string::String>,
7547 ) -> Self {
7548 self.java_package = Some(value.into());
7549 self
7550 }
7551 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7552 #[inline]
7553 pub fn with_java_outer_classname(
7555 mut self,
7556 value: impl Into<::buffa::alloc::string::String>,
7557 ) -> Self {
7558 self.java_outer_classname = Some(value.into());
7559 self
7560 }
7561 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7562 #[inline]
7563 pub fn with_java_multiple_files(mut self, value: bool) -> Self {
7565 self.java_multiple_files = Some(value);
7566 self
7567 }
7568 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7569 #[inline]
7570 pub fn with_java_generate_equals_and_hash(mut self, value: bool) -> Self {
7572 self.java_generate_equals_and_hash = Some(value);
7573 self
7574 }
7575 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7576 #[inline]
7577 pub fn with_java_string_check_utf8(mut self, value: bool) -> Self {
7579 self.java_string_check_utf8 = Some(value);
7580 self
7581 }
7582 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7583 #[inline]
7584 pub fn with_optimize_for(
7586 mut self,
7587 value: impl Into<file_options::OptimizeMode>,
7588 ) -> Self {
7589 self.optimize_for = Some(value.into());
7590 self
7591 }
7592 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7593 #[inline]
7594 pub fn with_go_package(
7596 mut self,
7597 value: impl Into<::buffa::alloc::string::String>,
7598 ) -> Self {
7599 self.go_package = Some(value.into());
7600 self
7601 }
7602 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7603 #[inline]
7604 pub fn with_cc_generic_services(mut self, value: bool) -> Self {
7606 self.cc_generic_services = Some(value);
7607 self
7608 }
7609 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7610 #[inline]
7611 pub fn with_java_generic_services(mut self, value: bool) -> Self {
7613 self.java_generic_services = Some(value);
7614 self
7615 }
7616 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7617 #[inline]
7618 pub fn with_py_generic_services(mut self, value: bool) -> Self {
7620 self.py_generic_services = Some(value);
7621 self
7622 }
7623 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7624 #[inline]
7625 pub fn with_deprecated(mut self, value: bool) -> Self {
7627 self.deprecated = Some(value);
7628 self
7629 }
7630 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7631 #[inline]
7632 pub fn with_cc_enable_arenas(mut self, value: bool) -> Self {
7634 self.cc_enable_arenas = Some(value);
7635 self
7636 }
7637 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7638 #[inline]
7639 pub fn with_objc_class_prefix(
7641 mut self,
7642 value: impl Into<::buffa::alloc::string::String>,
7643 ) -> Self {
7644 self.objc_class_prefix = Some(value.into());
7645 self
7646 }
7647 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7648 #[inline]
7649 pub fn with_csharp_namespace(
7651 mut self,
7652 value: impl Into<::buffa::alloc::string::String>,
7653 ) -> Self {
7654 self.csharp_namespace = Some(value.into());
7655 self
7656 }
7657 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7658 #[inline]
7659 pub fn with_swift_prefix(
7661 mut self,
7662 value: impl Into<::buffa::alloc::string::String>,
7663 ) -> Self {
7664 self.swift_prefix = Some(value.into());
7665 self
7666 }
7667 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7668 #[inline]
7669 pub fn with_php_class_prefix(
7671 mut self,
7672 value: impl Into<::buffa::alloc::string::String>,
7673 ) -> Self {
7674 self.php_class_prefix = Some(value.into());
7675 self
7676 }
7677 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7678 #[inline]
7679 pub fn with_php_namespace(
7681 mut self,
7682 value: impl Into<::buffa::alloc::string::String>,
7683 ) -> Self {
7684 self.php_namespace = Some(value.into());
7685 self
7686 }
7687 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7688 #[inline]
7689 pub fn with_php_metadata_namespace(
7691 mut self,
7692 value: impl Into<::buffa::alloc::string::String>,
7693 ) -> Self {
7694 self.php_metadata_namespace = Some(value.into());
7695 self
7696 }
7697 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
7698 #[inline]
7699 pub fn with_ruby_package(
7701 mut self,
7702 value: impl Into<::buffa::alloc::string::String>,
7703 ) -> Self {
7704 self.ruby_package = Some(value.into());
7705 self
7706 }
7707}
7708impl ::buffa::DefaultInstance for FileOptions {
7709 fn default_instance() -> &'static Self {
7710 static VALUE: ::buffa::__private::OnceBox<FileOptions> = ::buffa::__private::OnceBox::new();
7711 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
7712 }
7713}
7714impl ::buffa::MessageName for FileOptions {
7715 const PACKAGE: &'static str = "google.protobuf";
7716 const NAME: &'static str = "FileOptions";
7717 const FULL_NAME: &'static str = "google.protobuf.FileOptions";
7718 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FileOptions";
7719}
7720impl ::buffa::Message for FileOptions {
7721 #[allow(clippy::let_and_return)]
7727 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7728 #[allow(unused_imports)]
7729 use ::buffa::Enumeration as _;
7730 let mut size = 0u32;
7731 if let Some(ref v) = self.java_package {
7732 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
7733 }
7734 if let Some(ref v) = self.java_outer_classname {
7735 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
7736 }
7737 if let Some(ref v) = self.optimize_for {
7738 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
7739 }
7740 if self.java_multiple_files.is_some() {
7741 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7742 }
7743 if let Some(ref v) = self.go_package {
7744 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
7745 }
7746 if self.cc_generic_services.is_some() {
7747 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7748 }
7749 if self.java_generic_services.is_some() {
7750 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7751 }
7752 if self.py_generic_services.is_some() {
7753 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7754 }
7755 if self.java_generate_equals_and_hash.is_some() {
7756 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7757 }
7758 if self.deprecated.is_some() {
7759 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7760 }
7761 if self.java_string_check_utf8.is_some() {
7762 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7763 }
7764 if self.cc_enable_arenas.is_some() {
7765 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
7766 }
7767 if let Some(ref v) = self.objc_class_prefix {
7768 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7769 }
7770 if let Some(ref v) = self.csharp_namespace {
7771 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7772 }
7773 if let Some(ref v) = self.swift_prefix {
7774 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7775 }
7776 if let Some(ref v) = self.php_class_prefix {
7777 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7778 }
7779 if let Some(ref v) = self.php_namespace {
7780 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7781 }
7782 if let Some(ref v) = self.php_metadata_namespace {
7783 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7784 }
7785 if let Some(ref v) = self.ruby_package {
7786 size += 2u32 + ::buffa::types::string_encoded_len(v) as u32;
7787 }
7788 if self.features.is_set() {
7789 let __slot = __cache.reserve();
7790 let inner_size = self.features.compute_size(__cache);
7791 __cache.set(__slot, inner_size);
7792 size
7793 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7794 + inner_size;
7795 }
7796 for v in &self.uninterpreted_option {
7797 let __slot = __cache.reserve();
7798 let inner_size = v.compute_size(__cache);
7799 __cache.set(__slot, inner_size);
7800 size
7801 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7802 + inner_size;
7803 }
7804 size += self.__buffa_unknown_fields.encoded_len() as u32;
7805 size
7806 }
7807 fn write_to(
7808 &self,
7809 __cache: &mut ::buffa::SizeCache,
7810 buf: &mut impl ::buffa::bytes::BufMut,
7811 ) {
7812 #[allow(unused_imports)]
7813 use ::buffa::Enumeration as _;
7814 if let Some(ref v) = self.java_package {
7815 ::buffa::encoding::Tag::new(
7816 1u32,
7817 ::buffa::encoding::WireType::LengthDelimited,
7818 )
7819 .encode(buf);
7820 ::buffa::types::encode_string(v, buf);
7821 }
7822 if let Some(ref v) = self.java_outer_classname {
7823 ::buffa::encoding::Tag::new(
7824 8u32,
7825 ::buffa::encoding::WireType::LengthDelimited,
7826 )
7827 .encode(buf);
7828 ::buffa::types::encode_string(v, buf);
7829 }
7830 if let Some(ref v) = self.optimize_for {
7831 ::buffa::encoding::Tag::new(9u32, ::buffa::encoding::WireType::Varint)
7832 .encode(buf);
7833 ::buffa::types::encode_int32(v.to_i32(), buf);
7834 }
7835 if let Some(v) = self.java_multiple_files {
7836 ::buffa::encoding::Tag::new(10u32, ::buffa::encoding::WireType::Varint)
7837 .encode(buf);
7838 ::buffa::types::encode_bool(v, buf);
7839 }
7840 if let Some(ref v) = self.go_package {
7841 ::buffa::encoding::Tag::new(
7842 11u32,
7843 ::buffa::encoding::WireType::LengthDelimited,
7844 )
7845 .encode(buf);
7846 ::buffa::types::encode_string(v, buf);
7847 }
7848 if let Some(v) = self.cc_generic_services {
7849 ::buffa::encoding::Tag::new(16u32, ::buffa::encoding::WireType::Varint)
7850 .encode(buf);
7851 ::buffa::types::encode_bool(v, buf);
7852 }
7853 if let Some(v) = self.java_generic_services {
7854 ::buffa::encoding::Tag::new(17u32, ::buffa::encoding::WireType::Varint)
7855 .encode(buf);
7856 ::buffa::types::encode_bool(v, buf);
7857 }
7858 if let Some(v) = self.py_generic_services {
7859 ::buffa::encoding::Tag::new(18u32, ::buffa::encoding::WireType::Varint)
7860 .encode(buf);
7861 ::buffa::types::encode_bool(v, buf);
7862 }
7863 if let Some(v) = self.java_generate_equals_and_hash {
7864 ::buffa::encoding::Tag::new(20u32, ::buffa::encoding::WireType::Varint)
7865 .encode(buf);
7866 ::buffa::types::encode_bool(v, buf);
7867 }
7868 if let Some(v) = self.deprecated {
7869 ::buffa::encoding::Tag::new(23u32, ::buffa::encoding::WireType::Varint)
7870 .encode(buf);
7871 ::buffa::types::encode_bool(v, buf);
7872 }
7873 if let Some(v) = self.java_string_check_utf8 {
7874 ::buffa::encoding::Tag::new(27u32, ::buffa::encoding::WireType::Varint)
7875 .encode(buf);
7876 ::buffa::types::encode_bool(v, buf);
7877 }
7878 if let Some(v) = self.cc_enable_arenas {
7879 ::buffa::encoding::Tag::new(31u32, ::buffa::encoding::WireType::Varint)
7880 .encode(buf);
7881 ::buffa::types::encode_bool(v, buf);
7882 }
7883 if let Some(ref v) = self.objc_class_prefix {
7884 ::buffa::encoding::Tag::new(
7885 36u32,
7886 ::buffa::encoding::WireType::LengthDelimited,
7887 )
7888 .encode(buf);
7889 ::buffa::types::encode_string(v, buf);
7890 }
7891 if let Some(ref v) = self.csharp_namespace {
7892 ::buffa::encoding::Tag::new(
7893 37u32,
7894 ::buffa::encoding::WireType::LengthDelimited,
7895 )
7896 .encode(buf);
7897 ::buffa::types::encode_string(v, buf);
7898 }
7899 if let Some(ref v) = self.swift_prefix {
7900 ::buffa::encoding::Tag::new(
7901 39u32,
7902 ::buffa::encoding::WireType::LengthDelimited,
7903 )
7904 .encode(buf);
7905 ::buffa::types::encode_string(v, buf);
7906 }
7907 if let Some(ref v) = self.php_class_prefix {
7908 ::buffa::encoding::Tag::new(
7909 40u32,
7910 ::buffa::encoding::WireType::LengthDelimited,
7911 )
7912 .encode(buf);
7913 ::buffa::types::encode_string(v, buf);
7914 }
7915 if let Some(ref v) = self.php_namespace {
7916 ::buffa::encoding::Tag::new(
7917 41u32,
7918 ::buffa::encoding::WireType::LengthDelimited,
7919 )
7920 .encode(buf);
7921 ::buffa::types::encode_string(v, buf);
7922 }
7923 if let Some(ref v) = self.php_metadata_namespace {
7924 ::buffa::encoding::Tag::new(
7925 44u32,
7926 ::buffa::encoding::WireType::LengthDelimited,
7927 )
7928 .encode(buf);
7929 ::buffa::types::encode_string(v, buf);
7930 }
7931 if let Some(ref v) = self.ruby_package {
7932 ::buffa::encoding::Tag::new(
7933 45u32,
7934 ::buffa::encoding::WireType::LengthDelimited,
7935 )
7936 .encode(buf);
7937 ::buffa::types::encode_string(v, buf);
7938 }
7939 if self.features.is_set() {
7940 ::buffa::encoding::Tag::new(
7941 50u32,
7942 ::buffa::encoding::WireType::LengthDelimited,
7943 )
7944 .encode(buf);
7945 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
7946 self.features.write_to(__cache, buf);
7947 }
7948 for v in &self.uninterpreted_option {
7949 ::buffa::encoding::Tag::new(
7950 999u32,
7951 ::buffa::encoding::WireType::LengthDelimited,
7952 )
7953 .encode(buf);
7954 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
7955 v.write_to(__cache, buf);
7956 }
7957 self.__buffa_unknown_fields.write_to(buf);
7958 }
7959 fn merge_field(
7960 &mut self,
7961 tag: ::buffa::encoding::Tag,
7962 buf: &mut impl ::buffa::bytes::Buf,
7963 depth: u32,
7964 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7965 #[allow(unused_imports)]
7966 use ::buffa::bytes::Buf as _;
7967 #[allow(unused_imports)]
7968 use ::buffa::Enumeration as _;
7969 match tag.field_number() {
7970 1u32 => {
7971 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
7972 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7973 field_number: 1u32,
7974 expected: 2u8,
7975 actual: tag.wire_type() as u8,
7976 });
7977 }
7978 ::buffa::types::merge_string(
7979 self
7980 .java_package
7981 .get_or_insert_with(::buffa::alloc::string::String::new),
7982 buf,
7983 )?;
7984 }
7985 8u32 => {
7986 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
7987 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7988 field_number: 8u32,
7989 expected: 2u8,
7990 actual: tag.wire_type() as u8,
7991 });
7992 }
7993 ::buffa::types::merge_string(
7994 self
7995 .java_outer_classname
7996 .get_or_insert_with(::buffa::alloc::string::String::new),
7997 buf,
7998 )?;
7999 }
8000 9u32 => {
8001 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8002 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8003 field_number: 9u32,
8004 expected: 0u8,
8005 actual: tag.wire_type() as u8,
8006 });
8007 }
8008 let __raw = ::buffa::types::decode_int32(buf)?;
8009 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
8010 __raw,
8011 ) {
8012 self.optimize_for = ::core::option::Option::Some(__v);
8013 } else {
8014 self.__buffa_unknown_fields
8015 .push(::buffa::UnknownField {
8016 number: 9u32,
8017 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
8018 });
8019 }
8020 }
8021 10u32 => {
8022 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8023 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8024 field_number: 10u32,
8025 expected: 0u8,
8026 actual: tag.wire_type() as u8,
8027 });
8028 }
8029 self.java_multiple_files = ::core::option::Option::Some(
8030 ::buffa::types::decode_bool(buf)?,
8031 );
8032 }
8033 11u32 => {
8034 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8035 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8036 field_number: 11u32,
8037 expected: 2u8,
8038 actual: tag.wire_type() as u8,
8039 });
8040 }
8041 ::buffa::types::merge_string(
8042 self
8043 .go_package
8044 .get_or_insert_with(::buffa::alloc::string::String::new),
8045 buf,
8046 )?;
8047 }
8048 16u32 => {
8049 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8050 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8051 field_number: 16u32,
8052 expected: 0u8,
8053 actual: tag.wire_type() as u8,
8054 });
8055 }
8056 self.cc_generic_services = ::core::option::Option::Some(
8057 ::buffa::types::decode_bool(buf)?,
8058 );
8059 }
8060 17u32 => {
8061 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8062 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8063 field_number: 17u32,
8064 expected: 0u8,
8065 actual: tag.wire_type() as u8,
8066 });
8067 }
8068 self.java_generic_services = ::core::option::Option::Some(
8069 ::buffa::types::decode_bool(buf)?,
8070 );
8071 }
8072 18u32 => {
8073 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8074 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8075 field_number: 18u32,
8076 expected: 0u8,
8077 actual: tag.wire_type() as u8,
8078 });
8079 }
8080 self.py_generic_services = ::core::option::Option::Some(
8081 ::buffa::types::decode_bool(buf)?,
8082 );
8083 }
8084 20u32 => {
8085 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8086 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8087 field_number: 20u32,
8088 expected: 0u8,
8089 actual: tag.wire_type() as u8,
8090 });
8091 }
8092 self.java_generate_equals_and_hash = ::core::option::Option::Some(
8093 ::buffa::types::decode_bool(buf)?,
8094 );
8095 }
8096 23u32 => {
8097 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8098 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8099 field_number: 23u32,
8100 expected: 0u8,
8101 actual: tag.wire_type() as u8,
8102 });
8103 }
8104 self.deprecated = ::core::option::Option::Some(
8105 ::buffa::types::decode_bool(buf)?,
8106 );
8107 }
8108 27u32 => {
8109 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8110 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8111 field_number: 27u32,
8112 expected: 0u8,
8113 actual: tag.wire_type() as u8,
8114 });
8115 }
8116 self.java_string_check_utf8 = ::core::option::Option::Some(
8117 ::buffa::types::decode_bool(buf)?,
8118 );
8119 }
8120 31u32 => {
8121 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
8122 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8123 field_number: 31u32,
8124 expected: 0u8,
8125 actual: tag.wire_type() as u8,
8126 });
8127 }
8128 self.cc_enable_arenas = ::core::option::Option::Some(
8129 ::buffa::types::decode_bool(buf)?,
8130 );
8131 }
8132 36u32 => {
8133 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8134 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8135 field_number: 36u32,
8136 expected: 2u8,
8137 actual: tag.wire_type() as u8,
8138 });
8139 }
8140 ::buffa::types::merge_string(
8141 self
8142 .objc_class_prefix
8143 .get_or_insert_with(::buffa::alloc::string::String::new),
8144 buf,
8145 )?;
8146 }
8147 37u32 => {
8148 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8149 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8150 field_number: 37u32,
8151 expected: 2u8,
8152 actual: tag.wire_type() as u8,
8153 });
8154 }
8155 ::buffa::types::merge_string(
8156 self
8157 .csharp_namespace
8158 .get_or_insert_with(::buffa::alloc::string::String::new),
8159 buf,
8160 )?;
8161 }
8162 39u32 => {
8163 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8164 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8165 field_number: 39u32,
8166 expected: 2u8,
8167 actual: tag.wire_type() as u8,
8168 });
8169 }
8170 ::buffa::types::merge_string(
8171 self
8172 .swift_prefix
8173 .get_or_insert_with(::buffa::alloc::string::String::new),
8174 buf,
8175 )?;
8176 }
8177 40u32 => {
8178 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8179 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8180 field_number: 40u32,
8181 expected: 2u8,
8182 actual: tag.wire_type() as u8,
8183 });
8184 }
8185 ::buffa::types::merge_string(
8186 self
8187 .php_class_prefix
8188 .get_or_insert_with(::buffa::alloc::string::String::new),
8189 buf,
8190 )?;
8191 }
8192 41u32 => {
8193 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8194 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8195 field_number: 41u32,
8196 expected: 2u8,
8197 actual: tag.wire_type() as u8,
8198 });
8199 }
8200 ::buffa::types::merge_string(
8201 self
8202 .php_namespace
8203 .get_or_insert_with(::buffa::alloc::string::String::new),
8204 buf,
8205 )?;
8206 }
8207 44u32 => {
8208 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8209 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8210 field_number: 44u32,
8211 expected: 2u8,
8212 actual: tag.wire_type() as u8,
8213 });
8214 }
8215 ::buffa::types::merge_string(
8216 self
8217 .php_metadata_namespace
8218 .get_or_insert_with(::buffa::alloc::string::String::new),
8219 buf,
8220 )?;
8221 }
8222 45u32 => {
8223 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8224 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8225 field_number: 45u32,
8226 expected: 2u8,
8227 actual: tag.wire_type() as u8,
8228 });
8229 }
8230 ::buffa::types::merge_string(
8231 self
8232 .ruby_package
8233 .get_or_insert_with(::buffa::alloc::string::String::new),
8234 buf,
8235 )?;
8236 }
8237 50u32 => {
8238 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8239 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8240 field_number: 50u32,
8241 expected: 2u8,
8242 actual: tag.wire_type() as u8,
8243 });
8244 }
8245 ::buffa::Message::merge_length_delimited(
8246 self.features.get_or_insert_default(),
8247 buf,
8248 depth,
8249 )?;
8250 }
8251 999u32 => {
8252 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
8253 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
8254 field_number: 999u32,
8255 expected: 2u8,
8256 actual: tag.wire_type() as u8,
8257 });
8258 }
8259 let mut elem = ::core::default::Default::default();
8260 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
8261 self.uninterpreted_option.push(elem);
8262 }
8263 _ => {
8264 self.__buffa_unknown_fields
8265 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
8266 }
8267 }
8268 ::core::result::Result::Ok(())
8269 }
8270 fn clear(&mut self) {
8271 self.java_package = ::core::option::Option::None;
8272 self.java_outer_classname = ::core::option::Option::None;
8273 self.optimize_for = ::core::option::Option::None;
8274 self.java_multiple_files = ::core::option::Option::None;
8275 self.go_package = ::core::option::Option::None;
8276 self.cc_generic_services = ::core::option::Option::None;
8277 self.java_generic_services = ::core::option::Option::None;
8278 self.py_generic_services = ::core::option::Option::None;
8279 self.java_generate_equals_and_hash = ::core::option::Option::None;
8280 self.deprecated = ::core::option::Option::None;
8281 self.java_string_check_utf8 = ::core::option::Option::None;
8282 self.cc_enable_arenas = ::core::option::Option::None;
8283 self.objc_class_prefix = ::core::option::Option::None;
8284 self.csharp_namespace = ::core::option::Option::None;
8285 self.swift_prefix = ::core::option::Option::None;
8286 self.php_class_prefix = ::core::option::Option::None;
8287 self.php_namespace = ::core::option::Option::None;
8288 self.php_metadata_namespace = ::core::option::Option::None;
8289 self.ruby_package = ::core::option::Option::None;
8290 self.features = ::buffa::MessageField::none();
8291 self.uninterpreted_option.clear();
8292 self.__buffa_unknown_fields.clear();
8293 }
8294}
8295impl ::buffa::ExtensionSet for FileOptions {
8296 const PROTO_FQN: &'static str = "google.protobuf.FileOptions";
8297 fn unknown_fields(&self) -> &::buffa::UnknownFields {
8298 &self.__buffa_unknown_fields
8299 }
8300 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
8301 &mut self.__buffa_unknown_fields
8302 }
8303}
8304#[cfg(feature = "text")]
8305impl ::buffa::text::TextFormat for FileOptions {
8306 fn encode_text(
8307 &self,
8308 enc: &mut ::buffa::text::TextEncoder<'_>,
8309 ) -> ::core::fmt::Result {
8310 #[allow(unused_imports)]
8311 use ::buffa::Enumeration as _;
8312 if let ::core::option::Option::Some(ref __v) = self.java_package {
8313 enc.write_field_name("java_package")?;
8314 enc.write_string(__v)?;
8315 }
8316 if let ::core::option::Option::Some(ref __v) = self.java_outer_classname {
8317 enc.write_field_name("java_outer_classname")?;
8318 enc.write_string(__v)?;
8319 }
8320 if let ::core::option::Option::Some(ref __v) = self.java_multiple_files {
8321 enc.write_field_name("java_multiple_files")?;
8322 enc.write_bool(*__v)?;
8323 }
8324 if let ::core::option::Option::Some(ref __v) = self.java_generate_equals_and_hash
8325 {
8326 enc.write_field_name("java_generate_equals_and_hash")?;
8327 enc.write_bool(*__v)?;
8328 }
8329 if let ::core::option::Option::Some(ref __v) = self.java_string_check_utf8 {
8330 enc.write_field_name("java_string_check_utf8")?;
8331 enc.write_bool(*__v)?;
8332 }
8333 if let ::core::option::Option::Some(ref __v) = self.optimize_for {
8334 enc.write_field_name("optimize_for")?;
8335 enc.write_enum_name(__v.proto_name())?;
8336 }
8337 if let ::core::option::Option::Some(ref __v) = self.go_package {
8338 enc.write_field_name("go_package")?;
8339 enc.write_string(__v)?;
8340 }
8341 if let ::core::option::Option::Some(ref __v) = self.cc_generic_services {
8342 enc.write_field_name("cc_generic_services")?;
8343 enc.write_bool(*__v)?;
8344 }
8345 if let ::core::option::Option::Some(ref __v) = self.java_generic_services {
8346 enc.write_field_name("java_generic_services")?;
8347 enc.write_bool(*__v)?;
8348 }
8349 if let ::core::option::Option::Some(ref __v) = self.py_generic_services {
8350 enc.write_field_name("py_generic_services")?;
8351 enc.write_bool(*__v)?;
8352 }
8353 if let ::core::option::Option::Some(ref __v) = self.deprecated {
8354 enc.write_field_name("deprecated")?;
8355 enc.write_bool(*__v)?;
8356 }
8357 if let ::core::option::Option::Some(ref __v) = self.cc_enable_arenas {
8358 enc.write_field_name("cc_enable_arenas")?;
8359 enc.write_bool(*__v)?;
8360 }
8361 if let ::core::option::Option::Some(ref __v) = self.objc_class_prefix {
8362 enc.write_field_name("objc_class_prefix")?;
8363 enc.write_string(__v)?;
8364 }
8365 if let ::core::option::Option::Some(ref __v) = self.csharp_namespace {
8366 enc.write_field_name("csharp_namespace")?;
8367 enc.write_string(__v)?;
8368 }
8369 if let ::core::option::Option::Some(ref __v) = self.swift_prefix {
8370 enc.write_field_name("swift_prefix")?;
8371 enc.write_string(__v)?;
8372 }
8373 if let ::core::option::Option::Some(ref __v) = self.php_class_prefix {
8374 enc.write_field_name("php_class_prefix")?;
8375 enc.write_string(__v)?;
8376 }
8377 if let ::core::option::Option::Some(ref __v) = self.php_namespace {
8378 enc.write_field_name("php_namespace")?;
8379 enc.write_string(__v)?;
8380 }
8381 if let ::core::option::Option::Some(ref __v) = self.php_metadata_namespace {
8382 enc.write_field_name("php_metadata_namespace")?;
8383 enc.write_string(__v)?;
8384 }
8385 if let ::core::option::Option::Some(ref __v) = self.ruby_package {
8386 enc.write_field_name("ruby_package")?;
8387 enc.write_string(__v)?;
8388 }
8389 if self.features.is_set() {
8390 enc.write_field_name("features")?;
8391 enc.write_message(&*self.features)?;
8392 }
8393 for __v in &self.uninterpreted_option {
8394 enc.write_field_name("uninterpreted_option")?;
8395 enc.write_message(__v)?;
8396 }
8397 enc.write_extension_fields(
8398 "google.protobuf.FileOptions",
8399 &self.__buffa_unknown_fields,
8400 )?;
8401 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
8402 ::core::result::Result::Ok(())
8403 }
8404 fn merge_text(
8405 &mut self,
8406 dec: &mut ::buffa::text::TextDecoder<'_>,
8407 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
8408 #[allow(unused_imports)]
8409 use ::buffa::Enumeration as _;
8410 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
8411 match __name {
8412 "java_package" => {
8413 self.java_package = ::core::option::Option::Some(
8414 dec.read_string()?.into_owned(),
8415 );
8416 }
8417 "java_outer_classname" => {
8418 self.java_outer_classname = ::core::option::Option::Some(
8419 dec.read_string()?.into_owned(),
8420 );
8421 }
8422 "java_multiple_files" => {
8423 self.java_multiple_files = ::core::option::Option::Some(
8424 dec.read_bool()?,
8425 );
8426 }
8427 "java_generate_equals_and_hash" => {
8428 self.java_generate_equals_and_hash = ::core::option::Option::Some(
8429 dec.read_bool()?,
8430 );
8431 }
8432 "java_string_check_utf8" => {
8433 self.java_string_check_utf8 = ::core::option::Option::Some(
8434 dec.read_bool()?,
8435 );
8436 }
8437 "optimize_for" => {
8438 self.optimize_for = ::core::option::Option::Some(
8439 dec.read_closed_enum_by_name::<file_options::OptimizeMode>()?,
8440 );
8441 }
8442 "go_package" => {
8443 self.go_package = ::core::option::Option::Some(
8444 dec.read_string()?.into_owned(),
8445 );
8446 }
8447 "cc_generic_services" => {
8448 self.cc_generic_services = ::core::option::Option::Some(
8449 dec.read_bool()?,
8450 );
8451 }
8452 "java_generic_services" => {
8453 self.java_generic_services = ::core::option::Option::Some(
8454 dec.read_bool()?,
8455 );
8456 }
8457 "py_generic_services" => {
8458 self.py_generic_services = ::core::option::Option::Some(
8459 dec.read_bool()?,
8460 );
8461 }
8462 "deprecated" => {
8463 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
8464 }
8465 "cc_enable_arenas" => {
8466 self.cc_enable_arenas = ::core::option::Option::Some(
8467 dec.read_bool()?,
8468 );
8469 }
8470 "objc_class_prefix" => {
8471 self.objc_class_prefix = ::core::option::Option::Some(
8472 dec.read_string()?.into_owned(),
8473 );
8474 }
8475 "csharp_namespace" => {
8476 self.csharp_namespace = ::core::option::Option::Some(
8477 dec.read_string()?.into_owned(),
8478 );
8479 }
8480 "swift_prefix" => {
8481 self.swift_prefix = ::core::option::Option::Some(
8482 dec.read_string()?.into_owned(),
8483 );
8484 }
8485 "php_class_prefix" => {
8486 self.php_class_prefix = ::core::option::Option::Some(
8487 dec.read_string()?.into_owned(),
8488 );
8489 }
8490 "php_namespace" => {
8491 self.php_namespace = ::core::option::Option::Some(
8492 dec.read_string()?.into_owned(),
8493 );
8494 }
8495 "php_metadata_namespace" => {
8496 self.php_metadata_namespace = ::core::option::Option::Some(
8497 dec.read_string()?.into_owned(),
8498 );
8499 }
8500 "ruby_package" => {
8501 self.ruby_package = ::core::option::Option::Some(
8502 dec.read_string()?.into_owned(),
8503 );
8504 }
8505 "features" => dec.merge_message(self.features.get_or_insert_default())?,
8506 "uninterpreted_option" => {
8507 dec.read_repeated_into(
8508 &mut self.uninterpreted_option,
8509 |__d| {
8510 let mut __m = ::core::default::Default::default();
8511 __d.merge_message(&mut __m)?;
8512 ::core::result::Result::Ok(__m)
8513 },
8514 )?
8515 }
8516 __name if __name.starts_with('[') => {
8517 for __r in dec.read_extension(__name, "google.protobuf.FileOptions")?
8518 {
8519 self.__buffa_unknown_fields.push(__r);
8520 }
8521 }
8522 _ => dec.skip_value()?,
8523 }
8524 }
8525 ::core::result::Result::Ok(())
8526 }
8527}
8528#[cfg(feature = "json")]
8529impl<'de> serde::Deserialize<'de> for FileOptions {
8530 fn deserialize<D: serde::Deserializer<'de>>(
8531 d: D,
8532 ) -> ::core::result::Result<Self, D::Error> {
8533 struct _V;
8534 impl<'de> serde::de::Visitor<'de> for _V {
8535 type Value = FileOptions;
8536 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
8537 f.write_str("struct FileOptions")
8538 }
8539 #[allow(clippy::field_reassign_with_default)]
8540 fn visit_map<A: serde::de::MapAccess<'de>>(
8541 self,
8542 mut map: A,
8543 ) -> ::core::result::Result<FileOptions, A::Error> {
8544 let mut __f_java_package: ::core::option::Option<
8545 ::core::option::Option<::buffa::alloc::string::String>,
8546 > = None;
8547 let mut __f_java_outer_classname: ::core::option::Option<
8548 ::core::option::Option<::buffa::alloc::string::String>,
8549 > = None;
8550 let mut __f_java_multiple_files: ::core::option::Option<
8551 ::core::option::Option<bool>,
8552 > = None;
8553 let mut __f_java_generate_equals_and_hash: ::core::option::Option<
8554 ::core::option::Option<bool>,
8555 > = None;
8556 let mut __f_java_string_check_utf8: ::core::option::Option<
8557 ::core::option::Option<bool>,
8558 > = None;
8559 let mut __f_optimize_for: ::core::option::Option<
8560 ::core::option::Option<file_options::OptimizeMode>,
8561 > = None;
8562 let mut __f_go_package: ::core::option::Option<
8563 ::core::option::Option<::buffa::alloc::string::String>,
8564 > = None;
8565 let mut __f_cc_generic_services: ::core::option::Option<
8566 ::core::option::Option<bool>,
8567 > = None;
8568 let mut __f_java_generic_services: ::core::option::Option<
8569 ::core::option::Option<bool>,
8570 > = None;
8571 let mut __f_py_generic_services: ::core::option::Option<
8572 ::core::option::Option<bool>,
8573 > = None;
8574 let mut __f_deprecated: ::core::option::Option<
8575 ::core::option::Option<bool>,
8576 > = None;
8577 let mut __f_cc_enable_arenas: ::core::option::Option<
8578 ::core::option::Option<bool>,
8579 > = None;
8580 let mut __f_objc_class_prefix: ::core::option::Option<
8581 ::core::option::Option<::buffa::alloc::string::String>,
8582 > = None;
8583 let mut __f_csharp_namespace: ::core::option::Option<
8584 ::core::option::Option<::buffa::alloc::string::String>,
8585 > = None;
8586 let mut __f_swift_prefix: ::core::option::Option<
8587 ::core::option::Option<::buffa::alloc::string::String>,
8588 > = None;
8589 let mut __f_php_class_prefix: ::core::option::Option<
8590 ::core::option::Option<::buffa::alloc::string::String>,
8591 > = None;
8592 let mut __f_php_namespace: ::core::option::Option<
8593 ::core::option::Option<::buffa::alloc::string::String>,
8594 > = None;
8595 let mut __f_php_metadata_namespace: ::core::option::Option<
8596 ::core::option::Option<::buffa::alloc::string::String>,
8597 > = None;
8598 let mut __f_ruby_package: ::core::option::Option<
8599 ::core::option::Option<::buffa::alloc::string::String>,
8600 > = None;
8601 let mut __f_features: ::core::option::Option<
8602 ::buffa::MessageField<FeatureSet>,
8603 > = None;
8604 let mut __f_uninterpreted_option: ::core::option::Option<
8605 ::buffa::alloc::vec::Vec<UninterpretedOption>,
8606 > = None;
8607 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
8608 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
8609 match key.as_str() {
8610 "javaPackage" | "java_package" => {
8611 __f_java_package = Some(
8612 map
8613 .next_value::<
8614 ::core::option::Option<::buffa::alloc::string::String>,
8615 >()?,
8616 );
8617 }
8618 "javaOuterClassname" | "java_outer_classname" => {
8619 __f_java_outer_classname = Some(
8620 map
8621 .next_value::<
8622 ::core::option::Option<::buffa::alloc::string::String>,
8623 >()?,
8624 );
8625 }
8626 "javaMultipleFiles" | "java_multiple_files" => {
8627 __f_java_multiple_files = Some(
8628 map.next_value::<::core::option::Option<bool>>()?,
8629 );
8630 }
8631 "javaGenerateEqualsAndHash"
8632 | "java_generate_equals_and_hash" => {
8633 __f_java_generate_equals_and_hash = Some(
8634 map.next_value::<::core::option::Option<bool>>()?,
8635 );
8636 }
8637 "javaStringCheckUtf8" | "java_string_check_utf8" => {
8638 __f_java_string_check_utf8 = Some(
8639 map.next_value::<::core::option::Option<bool>>()?,
8640 );
8641 }
8642 "optimizeFor" | "optimize_for" => {
8643 __f_optimize_for = Some({
8644 struct _S;
8645 impl<'de> serde::de::DeserializeSeed<'de> for _S {
8646 type Value = ::core::option::Option<
8647 file_options::OptimizeMode,
8648 >;
8649 fn deserialize<D: serde::Deserializer<'de>>(
8650 self,
8651 d: D,
8652 ) -> ::core::result::Result<
8653 ::core::option::Option<file_options::OptimizeMode>,
8654 D::Error,
8655 > {
8656 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
8657 }
8658 }
8659 map.next_value_seed(_S)?
8660 });
8661 }
8662 "goPackage" | "go_package" => {
8663 __f_go_package = Some(
8664 map
8665 .next_value::<
8666 ::core::option::Option<::buffa::alloc::string::String>,
8667 >()?,
8668 );
8669 }
8670 "ccGenericServices" | "cc_generic_services" => {
8671 __f_cc_generic_services = Some(
8672 map.next_value::<::core::option::Option<bool>>()?,
8673 );
8674 }
8675 "javaGenericServices" | "java_generic_services" => {
8676 __f_java_generic_services = Some(
8677 map.next_value::<::core::option::Option<bool>>()?,
8678 );
8679 }
8680 "pyGenericServices" | "py_generic_services" => {
8681 __f_py_generic_services = Some(
8682 map.next_value::<::core::option::Option<bool>>()?,
8683 );
8684 }
8685 "deprecated" => {
8686 __f_deprecated = Some(
8687 map.next_value::<::core::option::Option<bool>>()?,
8688 );
8689 }
8690 "ccEnableArenas" | "cc_enable_arenas" => {
8691 __f_cc_enable_arenas = Some(
8692 map.next_value::<::core::option::Option<bool>>()?,
8693 );
8694 }
8695 "objcClassPrefix" | "objc_class_prefix" => {
8696 __f_objc_class_prefix = Some(
8697 map
8698 .next_value::<
8699 ::core::option::Option<::buffa::alloc::string::String>,
8700 >()?,
8701 );
8702 }
8703 "csharpNamespace" | "csharp_namespace" => {
8704 __f_csharp_namespace = Some(
8705 map
8706 .next_value::<
8707 ::core::option::Option<::buffa::alloc::string::String>,
8708 >()?,
8709 );
8710 }
8711 "swiftPrefix" | "swift_prefix" => {
8712 __f_swift_prefix = Some(
8713 map
8714 .next_value::<
8715 ::core::option::Option<::buffa::alloc::string::String>,
8716 >()?,
8717 );
8718 }
8719 "phpClassPrefix" | "php_class_prefix" => {
8720 __f_php_class_prefix = Some(
8721 map
8722 .next_value::<
8723 ::core::option::Option<::buffa::alloc::string::String>,
8724 >()?,
8725 );
8726 }
8727 "phpNamespace" | "php_namespace" => {
8728 __f_php_namespace = Some(
8729 map
8730 .next_value::<
8731 ::core::option::Option<::buffa::alloc::string::String>,
8732 >()?,
8733 );
8734 }
8735 "phpMetadataNamespace" | "php_metadata_namespace" => {
8736 __f_php_metadata_namespace = Some(
8737 map
8738 .next_value::<
8739 ::core::option::Option<::buffa::alloc::string::String>,
8740 >()?,
8741 );
8742 }
8743 "rubyPackage" | "ruby_package" => {
8744 __f_ruby_package = Some(
8745 map
8746 .next_value::<
8747 ::core::option::Option<::buffa::alloc::string::String>,
8748 >()?,
8749 );
8750 }
8751 "features" => {
8752 __f_features = Some(
8753 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
8754 );
8755 }
8756 "uninterpretedOption" | "uninterpreted_option" => {
8757 __f_uninterpreted_option = Some({
8758 struct _S;
8759 impl<'de> serde::de::DeserializeSeed<'de> for _S {
8760 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
8761 fn deserialize<D: serde::Deserializer<'de>>(
8762 self,
8763 d: D,
8764 ) -> ::core::result::Result<
8765 ::buffa::alloc::vec::Vec<UninterpretedOption>,
8766 D::Error,
8767 > {
8768 ::buffa::json_helpers::null_as_default(d)
8769 }
8770 }
8771 map.next_value_seed(_S)?
8772 });
8773 }
8774 __k if __k.starts_with('[') => {
8775 let __v: ::buffa::serde_json::Value = map.next_value()?;
8776 match ::buffa::extension_registry::deserialize_extension_key(
8777 "google.protobuf.FileOptions",
8778 __k,
8779 __v,
8780 ) {
8781 ::core::option::Option::Some(
8782 ::core::result::Result::Ok(__recs),
8783 ) => {
8784 for __rec in __recs {
8785 __ext_records.push(__rec);
8786 }
8787 }
8788 ::core::option::Option::Some(
8789 ::core::result::Result::Err(__e),
8790 ) => {
8791 return ::core::result::Result::Err(
8792 <A::Error as ::serde::de::Error>::custom(__e),
8793 );
8794 }
8795 ::core::option::Option::None => {}
8796 }
8797 }
8798 _ => {
8799 map.next_value::<serde::de::IgnoredAny>()?;
8800 }
8801 }
8802 }
8803 let mut __r = <FileOptions as ::core::default::Default>::default();
8804 if let ::core::option::Option::Some(v) = __f_java_package {
8805 __r.java_package = v;
8806 }
8807 if let ::core::option::Option::Some(v) = __f_java_outer_classname {
8808 __r.java_outer_classname = v;
8809 }
8810 if let ::core::option::Option::Some(v) = __f_java_multiple_files {
8811 __r.java_multiple_files = v;
8812 }
8813 if let ::core::option::Option::Some(v) = __f_java_generate_equals_and_hash {
8814 __r.java_generate_equals_and_hash = v;
8815 }
8816 if let ::core::option::Option::Some(v) = __f_java_string_check_utf8 {
8817 __r.java_string_check_utf8 = v;
8818 }
8819 if let ::core::option::Option::Some(v) = __f_optimize_for {
8820 __r.optimize_for = v;
8821 }
8822 if let ::core::option::Option::Some(v) = __f_go_package {
8823 __r.go_package = v;
8824 }
8825 if let ::core::option::Option::Some(v) = __f_cc_generic_services {
8826 __r.cc_generic_services = v;
8827 }
8828 if let ::core::option::Option::Some(v) = __f_java_generic_services {
8829 __r.java_generic_services = v;
8830 }
8831 if let ::core::option::Option::Some(v) = __f_py_generic_services {
8832 __r.py_generic_services = v;
8833 }
8834 if let ::core::option::Option::Some(v) = __f_deprecated {
8835 __r.deprecated = v;
8836 }
8837 if let ::core::option::Option::Some(v) = __f_cc_enable_arenas {
8838 __r.cc_enable_arenas = v;
8839 }
8840 if let ::core::option::Option::Some(v) = __f_objc_class_prefix {
8841 __r.objc_class_prefix = v;
8842 }
8843 if let ::core::option::Option::Some(v) = __f_csharp_namespace {
8844 __r.csharp_namespace = v;
8845 }
8846 if let ::core::option::Option::Some(v) = __f_swift_prefix {
8847 __r.swift_prefix = v;
8848 }
8849 if let ::core::option::Option::Some(v) = __f_php_class_prefix {
8850 __r.php_class_prefix = v;
8851 }
8852 if let ::core::option::Option::Some(v) = __f_php_namespace {
8853 __r.php_namespace = v;
8854 }
8855 if let ::core::option::Option::Some(v) = __f_php_metadata_namespace {
8856 __r.php_metadata_namespace = v;
8857 }
8858 if let ::core::option::Option::Some(v) = __f_ruby_package {
8859 __r.ruby_package = v;
8860 }
8861 if let ::core::option::Option::Some(v) = __f_features {
8862 __r.features = v;
8863 }
8864 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
8865 __r.uninterpreted_option = v;
8866 }
8867 for __rec in __ext_records {
8868 __r.__buffa_unknown_fields.push(__rec);
8869 }
8870 Ok(__r)
8871 }
8872 }
8873 d.deserialize_map(_V)
8874 }
8875}
8876#[cfg(feature = "json")]
8877impl ::buffa::json_helpers::ProtoElemJson for FileOptions {
8878 fn serialize_proto_json<S: ::serde::Serializer>(
8879 v: &Self,
8880 s: S,
8881 ) -> ::core::result::Result<S::Ok, S::Error> {
8882 ::serde::Serialize::serialize(v, s)
8883 }
8884 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
8885 d: D,
8886 ) -> ::core::result::Result<Self, D::Error> {
8887 <Self as ::serde::Deserialize>::deserialize(d)
8888 }
8889}
8890#[doc(hidden)]
8891#[derive(Clone, Debug, Default, PartialEq)]
8892#[repr(transparent)]
8893#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
8894pub struct __FileOptionsExtJson(pub ::buffa::UnknownFields);
8895impl ::core::ops::Deref for __FileOptionsExtJson {
8896 type Target = ::buffa::UnknownFields;
8897 fn deref(&self) -> &::buffa::UnknownFields {
8898 &self.0
8899 }
8900}
8901impl ::core::ops::DerefMut for __FileOptionsExtJson {
8902 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
8903 &mut self.0
8904 }
8905}
8906impl ::core::convert::From<::buffa::UnknownFields> for __FileOptionsExtJson {
8907 fn from(u: ::buffa::UnknownFields) -> Self {
8908 Self(u)
8909 }
8910}
8911#[cfg(feature = "json")]
8912impl ::serde::Serialize for __FileOptionsExtJson {
8913 fn serialize<S: ::serde::Serializer>(
8914 &self,
8915 s: S,
8916 ) -> ::core::result::Result<S::Ok, S::Error> {
8917 ::buffa::extension_registry::serialize_extensions(
8918 "google.protobuf.FileOptions",
8919 &self.0,
8920 s,
8921 )
8922 }
8923}
8924#[cfg(feature = "json")]
8925impl<'de> ::serde::Deserialize<'de> for __FileOptionsExtJson {
8926 fn deserialize<D: ::serde::Deserializer<'de>>(
8927 d: D,
8928 ) -> ::core::result::Result<Self, D::Error> {
8929 ::buffa::extension_registry::deserialize_extensions(
8930 "google.protobuf.FileOptions",
8931 d,
8932 )
8933 .map(Self)
8934 }
8935}
8936#[cfg(feature = "json")]
8937#[doc(hidden)]
8938pub const __FILE_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
8939 type_url: "type.googleapis.com/google.protobuf.FileOptions",
8940 to_json: ::buffa::type_registry::any_to_json::<FileOptions>,
8941 from_json: ::buffa::type_registry::any_from_json::<FileOptions>,
8942 is_wkt: false,
8943};
8944#[cfg(feature = "text")]
8945#[doc(hidden)]
8946pub const __FILE_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
8947 type_url: "type.googleapis.com/google.protobuf.FileOptions",
8948 text_encode: ::buffa::type_registry::any_encode_text::<FileOptions>,
8949 text_merge: ::buffa::type_registry::any_merge_text::<FileOptions>,
8950};
8951pub mod file_options {
8952 #[allow(unused_imports)]
8953 use super::*;
8954 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
8956 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
8957 #[repr(i32)]
8958 pub enum OptimizeMode {
8959 SPEED = 1i32,
8961 CODE_SIZE = 2i32,
8965 LITE_RUNTIME = 3i32,
8967 }
8968 impl ::core::default::Default for OptimizeMode {
8969 fn default() -> Self {
8970 Self::SPEED
8971 }
8972 }
8973 #[cfg(feature = "json")]
8974 const _: () = {
8975 impl ::serde::Serialize for OptimizeMode {
8976 fn serialize<S: ::serde::Serializer>(
8977 &self,
8978 s: S,
8979 ) -> ::core::result::Result<S::Ok, S::Error> {
8980 s.serialize_str(::buffa::Enumeration::proto_name(self))
8981 }
8982 }
8983 impl<'de> ::serde::Deserialize<'de> for OptimizeMode {
8984 fn deserialize<D: ::serde::Deserializer<'de>>(
8985 d: D,
8986 ) -> ::core::result::Result<Self, D::Error> {
8987 struct _V;
8988 impl ::serde::de::Visitor<'_> for _V {
8989 type Value = OptimizeMode;
8990 fn expecting(
8991 &self,
8992 f: &mut ::core::fmt::Formatter<'_>,
8993 ) -> ::core::fmt::Result {
8994 f.write_str(
8995 concat!(
8996 "a string, integer, or null for ", stringify!(OptimizeMode)
8997 ),
8998 )
8999 }
9000 fn visit_str<E: ::serde::de::Error>(
9001 self,
9002 v: &str,
9003 ) -> ::core::result::Result<OptimizeMode, E> {
9004 <OptimizeMode as ::buffa::Enumeration>::from_proto_name(v)
9005 .ok_or_else(|| {
9006 ::serde::de::Error::unknown_variant(v, &[])
9007 })
9008 }
9009 fn visit_i64<E: ::serde::de::Error>(
9010 self,
9011 v: i64,
9012 ) -> ::core::result::Result<OptimizeMode, E> {
9013 let v32 = i32::try_from(v)
9014 .map_err(|_| {
9015 ::serde::de::Error::custom(
9016 ::buffa::alloc::format!("enum value {v} out of i32 range"),
9017 )
9018 })?;
9019 <OptimizeMode as ::buffa::Enumeration>::from_i32(v32)
9020 .ok_or_else(|| {
9021 ::serde::de::Error::custom(
9022 ::buffa::alloc::format!("unknown enum value {v32}"),
9023 )
9024 })
9025 }
9026 fn visit_u64<E: ::serde::de::Error>(
9027 self,
9028 v: u64,
9029 ) -> ::core::result::Result<OptimizeMode, E> {
9030 let v32 = i32::try_from(v)
9031 .map_err(|_| {
9032 ::serde::de::Error::custom(
9033 ::buffa::alloc::format!("enum value {v} out of i32 range"),
9034 )
9035 })?;
9036 <OptimizeMode as ::buffa::Enumeration>::from_i32(v32)
9037 .ok_or_else(|| {
9038 ::serde::de::Error::custom(
9039 ::buffa::alloc::format!("unknown enum value {v32}"),
9040 )
9041 })
9042 }
9043 fn visit_unit<E: ::serde::de::Error>(
9044 self,
9045 ) -> ::core::result::Result<OptimizeMode, E> {
9046 ::core::result::Result::Ok(::core::default::Default::default())
9047 }
9048 }
9049 d.deserialize_any(_V)
9050 }
9051 }
9052 impl ::buffa::json_helpers::ProtoElemJson for OptimizeMode {
9053 fn serialize_proto_json<S: ::serde::Serializer>(
9054 v: &Self,
9055 s: S,
9056 ) -> ::core::result::Result<S::Ok, S::Error> {
9057 ::serde::Serialize::serialize(v, s)
9058 }
9059 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
9060 d: D,
9061 ) -> ::core::result::Result<Self, D::Error> {
9062 <Self as ::serde::Deserialize>::deserialize(d)
9063 }
9064 }
9065 };
9066 impl ::buffa::Enumeration for OptimizeMode {
9067 fn from_i32(value: i32) -> ::core::option::Option<Self> {
9068 match value {
9069 1i32 => ::core::option::Option::Some(Self::SPEED),
9070 2i32 => ::core::option::Option::Some(Self::CODE_SIZE),
9071 3i32 => ::core::option::Option::Some(Self::LITE_RUNTIME),
9072 _ => ::core::option::Option::None,
9073 }
9074 }
9075 fn to_i32(&self) -> i32 {
9076 *self as i32
9077 }
9078 fn proto_name(&self) -> &'static str {
9079 match self {
9080 Self::SPEED => "SPEED",
9081 Self::CODE_SIZE => "CODE_SIZE",
9082 Self::LITE_RUNTIME => "LITE_RUNTIME",
9083 }
9084 }
9085 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
9086 match name {
9087 "SPEED" => ::core::option::Option::Some(Self::SPEED),
9088 "CODE_SIZE" => ::core::option::Option::Some(Self::CODE_SIZE),
9089 "LITE_RUNTIME" => ::core::option::Option::Some(Self::LITE_RUNTIME),
9090 _ => ::core::option::Option::None,
9091 }
9092 }
9093 fn values() -> &'static [Self] {
9094 &[Self::SPEED, Self::CODE_SIZE, Self::LITE_RUNTIME]
9095 }
9096 }
9097}
9098#[derive(Clone, PartialEq, Default)]
9099#[cfg_attr(feature = "json", derive(::serde::Serialize))]
9100#[cfg_attr(feature = "json", serde(default))]
9101#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
9102pub struct MessageOptions {
9103 #[cfg_attr(
9126 feature = "json",
9127 serde(
9128 rename = "messageSetWireFormat",
9129 alias = "message_set_wire_format",
9130 skip_serializing_if = "::core::option::Option::is_none"
9131 )
9132 )]
9133 pub message_set_wire_format: ::core::option::Option<bool>,
9134 #[cfg_attr(
9140 feature = "json",
9141 serde(
9142 rename = "noStandardDescriptorAccessor",
9143 alias = "no_standard_descriptor_accessor",
9144 skip_serializing_if = "::core::option::Option::is_none"
9145 )
9146 )]
9147 pub no_standard_descriptor_accessor: ::core::option::Option<bool>,
9148 #[cfg_attr(
9155 feature = "json",
9156 serde(
9157 rename = "deprecated",
9158 skip_serializing_if = "::core::option::Option::is_none"
9159 )
9160 )]
9161 pub deprecated: ::core::option::Option<bool>,
9162 #[cfg_attr(
9190 feature = "json",
9191 serde(
9192 rename = "mapEntry",
9193 alias = "map_entry",
9194 skip_serializing_if = "::core::option::Option::is_none"
9195 )
9196 )]
9197 pub map_entry: ::core::option::Option<bool>,
9198 #[cfg_attr(
9211 feature = "json",
9212 serde(
9213 rename = "deprecatedLegacyJsonFieldConflicts",
9214 alias = "deprecated_legacy_json_field_conflicts",
9215 skip_serializing_if = "::core::option::Option::is_none"
9216 )
9217 )]
9218 pub deprecated_legacy_json_field_conflicts: ::core::option::Option<bool>,
9219 #[cfg_attr(
9226 feature = "json",
9227 serde(
9228 rename = "features",
9229 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
9230 )
9231 )]
9232 pub features: ::buffa::MessageField<FeatureSet>,
9233 #[cfg_attr(
9237 feature = "json",
9238 serde(
9239 rename = "uninterpretedOption",
9240 alias = "uninterpreted_option",
9241 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
9242 deserialize_with = "::buffa::json_helpers::null_as_default"
9243 )
9244 )]
9245 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
9246 #[cfg_attr(feature = "json", serde(flatten))]
9247 #[doc(hidden)]
9248 pub __buffa_unknown_fields: __MessageOptionsExtJson,
9249}
9250impl ::core::fmt::Debug for MessageOptions {
9251 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
9252 f.debug_struct("MessageOptions")
9253 .field("message_set_wire_format", &self.message_set_wire_format)
9254 .field(
9255 "no_standard_descriptor_accessor",
9256 &self.no_standard_descriptor_accessor,
9257 )
9258 .field("deprecated", &self.deprecated)
9259 .field("map_entry", &self.map_entry)
9260 .field(
9261 "deprecated_legacy_json_field_conflicts",
9262 &self.deprecated_legacy_json_field_conflicts,
9263 )
9264 .field("features", &self.features)
9265 .field("uninterpreted_option", &self.uninterpreted_option)
9266 .finish()
9267 }
9268}
9269impl MessageOptions {
9270 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MessageOptions";
9275}
9276impl MessageOptions {
9277 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9278 #[inline]
9279 pub fn with_message_set_wire_format(mut self, value: bool) -> Self {
9281 self.message_set_wire_format = Some(value);
9282 self
9283 }
9284 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9285 #[inline]
9286 pub fn with_no_standard_descriptor_accessor(mut self, value: bool) -> Self {
9288 self.no_standard_descriptor_accessor = Some(value);
9289 self
9290 }
9291 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9292 #[inline]
9293 pub fn with_deprecated(mut self, value: bool) -> Self {
9295 self.deprecated = Some(value);
9296 self
9297 }
9298 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9299 #[inline]
9300 pub fn with_map_entry(mut self, value: bool) -> Self {
9302 self.map_entry = Some(value);
9303 self
9304 }
9305 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
9306 #[inline]
9307 pub fn with_deprecated_legacy_json_field_conflicts(mut self, value: bool) -> Self {
9309 self.deprecated_legacy_json_field_conflicts = Some(value);
9310 self
9311 }
9312}
9313impl ::buffa::DefaultInstance for MessageOptions {
9314 fn default_instance() -> &'static Self {
9315 static VALUE: ::buffa::__private::OnceBox<MessageOptions> = ::buffa::__private::OnceBox::new();
9316 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
9317 }
9318}
9319impl ::buffa::MessageName for MessageOptions {
9320 const PACKAGE: &'static str = "google.protobuf";
9321 const NAME: &'static str = "MessageOptions";
9322 const FULL_NAME: &'static str = "google.protobuf.MessageOptions";
9323 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MessageOptions";
9324}
9325impl ::buffa::Message for MessageOptions {
9326 #[allow(clippy::let_and_return)]
9332 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
9333 #[allow(unused_imports)]
9334 use ::buffa::Enumeration as _;
9335 let mut size = 0u32;
9336 if self.message_set_wire_format.is_some() {
9337 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
9338 }
9339 if self.no_standard_descriptor_accessor.is_some() {
9340 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
9341 }
9342 if self.deprecated.is_some() {
9343 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
9344 }
9345 if self.map_entry.is_some() {
9346 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
9347 }
9348 if self.deprecated_legacy_json_field_conflicts.is_some() {
9349 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
9350 }
9351 if self.features.is_set() {
9352 let __slot = __cache.reserve();
9353 let inner_size = self.features.compute_size(__cache);
9354 __cache.set(__slot, inner_size);
9355 size
9356 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9357 + inner_size;
9358 }
9359 for v in &self.uninterpreted_option {
9360 let __slot = __cache.reserve();
9361 let inner_size = v.compute_size(__cache);
9362 __cache.set(__slot, inner_size);
9363 size
9364 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
9365 + inner_size;
9366 }
9367 size += self.__buffa_unknown_fields.encoded_len() as u32;
9368 size
9369 }
9370 fn write_to(
9371 &self,
9372 __cache: &mut ::buffa::SizeCache,
9373 buf: &mut impl ::buffa::bytes::BufMut,
9374 ) {
9375 #[allow(unused_imports)]
9376 use ::buffa::Enumeration as _;
9377 if let Some(v) = self.message_set_wire_format {
9378 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
9379 .encode(buf);
9380 ::buffa::types::encode_bool(v, buf);
9381 }
9382 if let Some(v) = self.no_standard_descriptor_accessor {
9383 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
9384 .encode(buf);
9385 ::buffa::types::encode_bool(v, buf);
9386 }
9387 if let Some(v) = self.deprecated {
9388 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
9389 .encode(buf);
9390 ::buffa::types::encode_bool(v, buf);
9391 }
9392 if let Some(v) = self.map_entry {
9393 ::buffa::encoding::Tag::new(7u32, ::buffa::encoding::WireType::Varint)
9394 .encode(buf);
9395 ::buffa::types::encode_bool(v, buf);
9396 }
9397 if let Some(v) = self.deprecated_legacy_json_field_conflicts {
9398 ::buffa::encoding::Tag::new(11u32, ::buffa::encoding::WireType::Varint)
9399 .encode(buf);
9400 ::buffa::types::encode_bool(v, buf);
9401 }
9402 if self.features.is_set() {
9403 ::buffa::encoding::Tag::new(
9404 12u32,
9405 ::buffa::encoding::WireType::LengthDelimited,
9406 )
9407 .encode(buf);
9408 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
9409 self.features.write_to(__cache, buf);
9410 }
9411 for v in &self.uninterpreted_option {
9412 ::buffa::encoding::Tag::new(
9413 999u32,
9414 ::buffa::encoding::WireType::LengthDelimited,
9415 )
9416 .encode(buf);
9417 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
9418 v.write_to(__cache, buf);
9419 }
9420 self.__buffa_unknown_fields.write_to(buf);
9421 }
9422 fn merge_field(
9423 &mut self,
9424 tag: ::buffa::encoding::Tag,
9425 buf: &mut impl ::buffa::bytes::Buf,
9426 depth: u32,
9427 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
9428 #[allow(unused_imports)]
9429 use ::buffa::bytes::Buf as _;
9430 #[allow(unused_imports)]
9431 use ::buffa::Enumeration as _;
9432 match tag.field_number() {
9433 1u32 => {
9434 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
9435 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9436 field_number: 1u32,
9437 expected: 0u8,
9438 actual: tag.wire_type() as u8,
9439 });
9440 }
9441 self.message_set_wire_format = ::core::option::Option::Some(
9442 ::buffa::types::decode_bool(buf)?,
9443 );
9444 }
9445 2u32 => {
9446 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
9447 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9448 field_number: 2u32,
9449 expected: 0u8,
9450 actual: tag.wire_type() as u8,
9451 });
9452 }
9453 self.no_standard_descriptor_accessor = ::core::option::Option::Some(
9454 ::buffa::types::decode_bool(buf)?,
9455 );
9456 }
9457 3u32 => {
9458 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
9459 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9460 field_number: 3u32,
9461 expected: 0u8,
9462 actual: tag.wire_type() as u8,
9463 });
9464 }
9465 self.deprecated = ::core::option::Option::Some(
9466 ::buffa::types::decode_bool(buf)?,
9467 );
9468 }
9469 7u32 => {
9470 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
9471 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9472 field_number: 7u32,
9473 expected: 0u8,
9474 actual: tag.wire_type() as u8,
9475 });
9476 }
9477 self.map_entry = ::core::option::Option::Some(
9478 ::buffa::types::decode_bool(buf)?,
9479 );
9480 }
9481 11u32 => {
9482 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
9483 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9484 field_number: 11u32,
9485 expected: 0u8,
9486 actual: tag.wire_type() as u8,
9487 });
9488 }
9489 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::Some(
9490 ::buffa::types::decode_bool(buf)?,
9491 );
9492 }
9493 12u32 => {
9494 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
9495 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9496 field_number: 12u32,
9497 expected: 2u8,
9498 actual: tag.wire_type() as u8,
9499 });
9500 }
9501 ::buffa::Message::merge_length_delimited(
9502 self.features.get_or_insert_default(),
9503 buf,
9504 depth,
9505 )?;
9506 }
9507 999u32 => {
9508 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
9509 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
9510 field_number: 999u32,
9511 expected: 2u8,
9512 actual: tag.wire_type() as u8,
9513 });
9514 }
9515 let mut elem = ::core::default::Default::default();
9516 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
9517 self.uninterpreted_option.push(elem);
9518 }
9519 _ => {
9520 self.__buffa_unknown_fields
9521 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
9522 }
9523 }
9524 ::core::result::Result::Ok(())
9525 }
9526 fn clear(&mut self) {
9527 self.message_set_wire_format = ::core::option::Option::None;
9528 self.no_standard_descriptor_accessor = ::core::option::Option::None;
9529 self.deprecated = ::core::option::Option::None;
9530 self.map_entry = ::core::option::Option::None;
9531 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::None;
9532 self.features = ::buffa::MessageField::none();
9533 self.uninterpreted_option.clear();
9534 self.__buffa_unknown_fields.clear();
9535 }
9536}
9537impl ::buffa::ExtensionSet for MessageOptions {
9538 const PROTO_FQN: &'static str = "google.protobuf.MessageOptions";
9539 fn unknown_fields(&self) -> &::buffa::UnknownFields {
9540 &self.__buffa_unknown_fields
9541 }
9542 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
9543 &mut self.__buffa_unknown_fields
9544 }
9545}
9546#[cfg(feature = "text")]
9547impl ::buffa::text::TextFormat for MessageOptions {
9548 fn encode_text(
9549 &self,
9550 enc: &mut ::buffa::text::TextEncoder<'_>,
9551 ) -> ::core::fmt::Result {
9552 #[allow(unused_imports)]
9553 use ::buffa::Enumeration as _;
9554 if let ::core::option::Option::Some(ref __v) = self.message_set_wire_format {
9555 enc.write_field_name("message_set_wire_format")?;
9556 enc.write_bool(*__v)?;
9557 }
9558 if let ::core::option::Option::Some(ref __v) = self
9559 .no_standard_descriptor_accessor
9560 {
9561 enc.write_field_name("no_standard_descriptor_accessor")?;
9562 enc.write_bool(*__v)?;
9563 }
9564 if let ::core::option::Option::Some(ref __v) = self.deprecated {
9565 enc.write_field_name("deprecated")?;
9566 enc.write_bool(*__v)?;
9567 }
9568 if let ::core::option::Option::Some(ref __v) = self.map_entry {
9569 enc.write_field_name("map_entry")?;
9570 enc.write_bool(*__v)?;
9571 }
9572 if let ::core::option::Option::Some(ref __v) = self
9573 .deprecated_legacy_json_field_conflicts
9574 {
9575 enc.write_field_name("deprecated_legacy_json_field_conflicts")?;
9576 enc.write_bool(*__v)?;
9577 }
9578 if self.features.is_set() {
9579 enc.write_field_name("features")?;
9580 enc.write_message(&*self.features)?;
9581 }
9582 for __v in &self.uninterpreted_option {
9583 enc.write_field_name("uninterpreted_option")?;
9584 enc.write_message(__v)?;
9585 }
9586 enc.write_extension_fields(
9587 "google.protobuf.MessageOptions",
9588 &self.__buffa_unknown_fields,
9589 )?;
9590 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
9591 ::core::result::Result::Ok(())
9592 }
9593 fn merge_text(
9594 &mut self,
9595 dec: &mut ::buffa::text::TextDecoder<'_>,
9596 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
9597 #[allow(unused_imports)]
9598 use ::buffa::Enumeration as _;
9599 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
9600 match __name {
9601 "message_set_wire_format" => {
9602 self.message_set_wire_format = ::core::option::Option::Some(
9603 dec.read_bool()?,
9604 );
9605 }
9606 "no_standard_descriptor_accessor" => {
9607 self.no_standard_descriptor_accessor = ::core::option::Option::Some(
9608 dec.read_bool()?,
9609 );
9610 }
9611 "deprecated" => {
9612 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
9613 }
9614 "map_entry" => {
9615 self.map_entry = ::core::option::Option::Some(dec.read_bool()?);
9616 }
9617 "deprecated_legacy_json_field_conflicts" => {
9618 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::Some(
9619 dec.read_bool()?,
9620 );
9621 }
9622 "features" => dec.merge_message(self.features.get_or_insert_default())?,
9623 "uninterpreted_option" => {
9624 dec.read_repeated_into(
9625 &mut self.uninterpreted_option,
9626 |__d| {
9627 let mut __m = ::core::default::Default::default();
9628 __d.merge_message(&mut __m)?;
9629 ::core::result::Result::Ok(__m)
9630 },
9631 )?
9632 }
9633 __name if __name.starts_with('[') => {
9634 for __r in dec
9635 .read_extension(__name, "google.protobuf.MessageOptions")?
9636 {
9637 self.__buffa_unknown_fields.push(__r);
9638 }
9639 }
9640 _ => dec.skip_value()?,
9641 }
9642 }
9643 ::core::result::Result::Ok(())
9644 }
9645}
9646#[cfg(feature = "json")]
9647impl<'de> serde::Deserialize<'de> for MessageOptions {
9648 fn deserialize<D: serde::Deserializer<'de>>(
9649 d: D,
9650 ) -> ::core::result::Result<Self, D::Error> {
9651 struct _V;
9652 impl<'de> serde::de::Visitor<'de> for _V {
9653 type Value = MessageOptions;
9654 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9655 f.write_str("struct MessageOptions")
9656 }
9657 #[allow(clippy::field_reassign_with_default)]
9658 fn visit_map<A: serde::de::MapAccess<'de>>(
9659 self,
9660 mut map: A,
9661 ) -> ::core::result::Result<MessageOptions, A::Error> {
9662 let mut __f_message_set_wire_format: ::core::option::Option<
9663 ::core::option::Option<bool>,
9664 > = None;
9665 let mut __f_no_standard_descriptor_accessor: ::core::option::Option<
9666 ::core::option::Option<bool>,
9667 > = None;
9668 let mut __f_deprecated: ::core::option::Option<
9669 ::core::option::Option<bool>,
9670 > = None;
9671 let mut __f_map_entry: ::core::option::Option<
9672 ::core::option::Option<bool>,
9673 > = None;
9674 let mut __f_deprecated_legacy_json_field_conflicts: ::core::option::Option<
9675 ::core::option::Option<bool>,
9676 > = None;
9677 let mut __f_features: ::core::option::Option<
9678 ::buffa::MessageField<FeatureSet>,
9679 > = None;
9680 let mut __f_uninterpreted_option: ::core::option::Option<
9681 ::buffa::alloc::vec::Vec<UninterpretedOption>,
9682 > = None;
9683 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
9684 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
9685 match key.as_str() {
9686 "messageSetWireFormat" | "message_set_wire_format" => {
9687 __f_message_set_wire_format = Some(
9688 map.next_value::<::core::option::Option<bool>>()?,
9689 );
9690 }
9691 "noStandardDescriptorAccessor"
9692 | "no_standard_descriptor_accessor" => {
9693 __f_no_standard_descriptor_accessor = Some(
9694 map.next_value::<::core::option::Option<bool>>()?,
9695 );
9696 }
9697 "deprecated" => {
9698 __f_deprecated = Some(
9699 map.next_value::<::core::option::Option<bool>>()?,
9700 );
9701 }
9702 "mapEntry" | "map_entry" => {
9703 __f_map_entry = Some(
9704 map.next_value::<::core::option::Option<bool>>()?,
9705 );
9706 }
9707 "deprecatedLegacyJsonFieldConflicts"
9708 | "deprecated_legacy_json_field_conflicts" => {
9709 __f_deprecated_legacy_json_field_conflicts = Some(
9710 map.next_value::<::core::option::Option<bool>>()?,
9711 );
9712 }
9713 "features" => {
9714 __f_features = Some(
9715 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
9716 );
9717 }
9718 "uninterpretedOption" | "uninterpreted_option" => {
9719 __f_uninterpreted_option = Some({
9720 struct _S;
9721 impl<'de> serde::de::DeserializeSeed<'de> for _S {
9722 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
9723 fn deserialize<D: serde::Deserializer<'de>>(
9724 self,
9725 d: D,
9726 ) -> ::core::result::Result<
9727 ::buffa::alloc::vec::Vec<UninterpretedOption>,
9728 D::Error,
9729 > {
9730 ::buffa::json_helpers::null_as_default(d)
9731 }
9732 }
9733 map.next_value_seed(_S)?
9734 });
9735 }
9736 __k if __k.starts_with('[') => {
9737 let __v: ::buffa::serde_json::Value = map.next_value()?;
9738 match ::buffa::extension_registry::deserialize_extension_key(
9739 "google.protobuf.MessageOptions",
9740 __k,
9741 __v,
9742 ) {
9743 ::core::option::Option::Some(
9744 ::core::result::Result::Ok(__recs),
9745 ) => {
9746 for __rec in __recs {
9747 __ext_records.push(__rec);
9748 }
9749 }
9750 ::core::option::Option::Some(
9751 ::core::result::Result::Err(__e),
9752 ) => {
9753 return ::core::result::Result::Err(
9754 <A::Error as ::serde::de::Error>::custom(__e),
9755 );
9756 }
9757 ::core::option::Option::None => {}
9758 }
9759 }
9760 _ => {
9761 map.next_value::<serde::de::IgnoredAny>()?;
9762 }
9763 }
9764 }
9765 let mut __r = <MessageOptions as ::core::default::Default>::default();
9766 if let ::core::option::Option::Some(v) = __f_message_set_wire_format {
9767 __r.message_set_wire_format = v;
9768 }
9769 if let ::core::option::Option::Some(v) = __f_no_standard_descriptor_accessor {
9770 __r.no_standard_descriptor_accessor = v;
9771 }
9772 if let ::core::option::Option::Some(v) = __f_deprecated {
9773 __r.deprecated = v;
9774 }
9775 if let ::core::option::Option::Some(v) = __f_map_entry {
9776 __r.map_entry = v;
9777 }
9778 if let ::core::option::Option::Some(v) = __f_deprecated_legacy_json_field_conflicts {
9779 __r.deprecated_legacy_json_field_conflicts = v;
9780 }
9781 if let ::core::option::Option::Some(v) = __f_features {
9782 __r.features = v;
9783 }
9784 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
9785 __r.uninterpreted_option = v;
9786 }
9787 for __rec in __ext_records {
9788 __r.__buffa_unknown_fields.push(__rec);
9789 }
9790 Ok(__r)
9791 }
9792 }
9793 d.deserialize_map(_V)
9794 }
9795}
9796#[cfg(feature = "json")]
9797impl ::buffa::json_helpers::ProtoElemJson for MessageOptions {
9798 fn serialize_proto_json<S: ::serde::Serializer>(
9799 v: &Self,
9800 s: S,
9801 ) -> ::core::result::Result<S::Ok, S::Error> {
9802 ::serde::Serialize::serialize(v, s)
9803 }
9804 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
9805 d: D,
9806 ) -> ::core::result::Result<Self, D::Error> {
9807 <Self as ::serde::Deserialize>::deserialize(d)
9808 }
9809}
9810#[doc(hidden)]
9811#[derive(Clone, Debug, Default, PartialEq)]
9812#[repr(transparent)]
9813#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
9814pub struct __MessageOptionsExtJson(pub ::buffa::UnknownFields);
9815impl ::core::ops::Deref for __MessageOptionsExtJson {
9816 type Target = ::buffa::UnknownFields;
9817 fn deref(&self) -> &::buffa::UnknownFields {
9818 &self.0
9819 }
9820}
9821impl ::core::ops::DerefMut for __MessageOptionsExtJson {
9822 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
9823 &mut self.0
9824 }
9825}
9826impl ::core::convert::From<::buffa::UnknownFields> for __MessageOptionsExtJson {
9827 fn from(u: ::buffa::UnknownFields) -> Self {
9828 Self(u)
9829 }
9830}
9831#[cfg(feature = "json")]
9832impl ::serde::Serialize for __MessageOptionsExtJson {
9833 fn serialize<S: ::serde::Serializer>(
9834 &self,
9835 s: S,
9836 ) -> ::core::result::Result<S::Ok, S::Error> {
9837 ::buffa::extension_registry::serialize_extensions(
9838 "google.protobuf.MessageOptions",
9839 &self.0,
9840 s,
9841 )
9842 }
9843}
9844#[cfg(feature = "json")]
9845impl<'de> ::serde::Deserialize<'de> for __MessageOptionsExtJson {
9846 fn deserialize<D: ::serde::Deserializer<'de>>(
9847 d: D,
9848 ) -> ::core::result::Result<Self, D::Error> {
9849 ::buffa::extension_registry::deserialize_extensions(
9850 "google.protobuf.MessageOptions",
9851 d,
9852 )
9853 .map(Self)
9854 }
9855}
9856#[cfg(feature = "json")]
9857#[doc(hidden)]
9858pub const __MESSAGE_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
9859 type_url: "type.googleapis.com/google.protobuf.MessageOptions",
9860 to_json: ::buffa::type_registry::any_to_json::<MessageOptions>,
9861 from_json: ::buffa::type_registry::any_from_json::<MessageOptions>,
9862 is_wkt: false,
9863};
9864#[cfg(feature = "text")]
9865#[doc(hidden)]
9866pub const __MESSAGE_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
9867 type_url: "type.googleapis.com/google.protobuf.MessageOptions",
9868 text_encode: ::buffa::type_registry::any_encode_text::<MessageOptions>,
9869 text_merge: ::buffa::type_registry::any_merge_text::<MessageOptions>,
9870};
9871#[derive(Clone, PartialEq, Default)]
9872#[cfg_attr(feature = "json", derive(::serde::Serialize))]
9873#[cfg_attr(feature = "json", serde(default))]
9874#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
9875pub struct FieldOptions {
9876 #[cfg_attr(
9886 feature = "json",
9887 serde(
9888 rename = "ctype",
9889 with = "::buffa::json_helpers::opt_closed_enum",
9890 skip_serializing_if = "::core::option::Option::is_none"
9891 )
9892 )]
9893 pub ctype: ::core::option::Option<field_options::CType>,
9894 #[cfg_attr(
9904 feature = "json",
9905 serde(rename = "packed", skip_serializing_if = "::core::option::Option::is_none")
9906 )]
9907 pub packed: ::core::option::Option<bool>,
9908 #[cfg_attr(
9922 feature = "json",
9923 serde(
9924 rename = "jstype",
9925 with = "::buffa::json_helpers::opt_closed_enum",
9926 skip_serializing_if = "::core::option::Option::is_none"
9927 )
9928 )]
9929 pub jstype: ::core::option::Option<field_options::JSType>,
9930 #[cfg_attr(
9955 feature = "json",
9956 serde(rename = "lazy", skip_serializing_if = "::core::option::Option::is_none")
9957 )]
9958 pub lazy: ::core::option::Option<bool>,
9959 #[cfg_attr(
9965 feature = "json",
9966 serde(
9967 rename = "unverifiedLazy",
9968 alias = "unverified_lazy",
9969 skip_serializing_if = "::core::option::Option::is_none"
9970 )
9971 )]
9972 pub unverified_lazy: ::core::option::Option<bool>,
9973 #[cfg_attr(
9980 feature = "json",
9981 serde(
9982 rename = "deprecated",
9983 skip_serializing_if = "::core::option::Option::is_none"
9984 )
9985 )]
9986 pub deprecated: ::core::option::Option<bool>,
9987 #[cfg_attr(
9992 feature = "json",
9993 serde(rename = "weak", skip_serializing_if = "::core::option::Option::is_none")
9994 )]
9995 pub weak: ::core::option::Option<bool>,
9996 #[cfg_attr(
10001 feature = "json",
10002 serde(
10003 rename = "debugRedact",
10004 alias = "debug_redact",
10005 skip_serializing_if = "::core::option::Option::is_none"
10006 )
10007 )]
10008 pub debug_redact: ::core::option::Option<bool>,
10009 #[cfg_attr(
10011 feature = "json",
10012 serde(
10013 rename = "retention",
10014 with = "::buffa::json_helpers::opt_closed_enum",
10015 skip_serializing_if = "::core::option::Option::is_none"
10016 )
10017 )]
10018 pub retention: ::core::option::Option<field_options::OptionRetention>,
10019 #[cfg_attr(
10021 feature = "json",
10022 serde(
10023 rename = "targets",
10024 with = "::buffa::json_helpers::repeated_closed_enum",
10025 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec"
10026 )
10027 )]
10028 pub targets: ::buffa::alloc::vec::Vec<field_options::OptionTargetType>,
10029 #[cfg_attr(
10031 feature = "json",
10032 serde(
10033 rename = "editionDefaults",
10034 alias = "edition_defaults",
10035 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
10036 deserialize_with = "::buffa::json_helpers::null_as_default"
10037 )
10038 )]
10039 pub edition_defaults: ::buffa::alloc::vec::Vec<field_options::EditionDefault>,
10040 #[cfg_attr(
10047 feature = "json",
10048 serde(
10049 rename = "features",
10050 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
10051 )
10052 )]
10053 pub features: ::buffa::MessageField<FeatureSet>,
10054 #[cfg_attr(
10056 feature = "json",
10057 serde(
10058 rename = "featureSupport",
10059 alias = "feature_support",
10060 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
10061 )
10062 )]
10063 pub feature_support: ::buffa::MessageField<field_options::FeatureSupport>,
10064 #[cfg_attr(
10068 feature = "json",
10069 serde(
10070 rename = "uninterpretedOption",
10071 alias = "uninterpreted_option",
10072 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
10073 deserialize_with = "::buffa::json_helpers::null_as_default"
10074 )
10075 )]
10076 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
10077 #[cfg_attr(feature = "json", serde(flatten))]
10078 #[doc(hidden)]
10079 pub __buffa_unknown_fields: __FieldOptionsExtJson,
10080}
10081impl ::core::fmt::Debug for FieldOptions {
10082 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
10083 f.debug_struct("FieldOptions")
10084 .field("ctype", &self.ctype)
10085 .field("packed", &self.packed)
10086 .field("jstype", &self.jstype)
10087 .field("lazy", &self.lazy)
10088 .field("unverified_lazy", &self.unverified_lazy)
10089 .field("deprecated", &self.deprecated)
10090 .field("weak", &self.weak)
10091 .field("debug_redact", &self.debug_redact)
10092 .field("retention", &self.retention)
10093 .field("targets", &self.targets)
10094 .field("edition_defaults", &self.edition_defaults)
10095 .field("features", &self.features)
10096 .field("feature_support", &self.feature_support)
10097 .field("uninterpreted_option", &self.uninterpreted_option)
10098 .finish()
10099 }
10100}
10101impl FieldOptions {
10102 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions";
10107}
10108impl FieldOptions {
10109 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10110 #[inline]
10111 pub fn with_ctype(mut self, value: impl Into<field_options::CType>) -> Self {
10113 self.ctype = Some(value.into());
10114 self
10115 }
10116 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10117 #[inline]
10118 pub fn with_packed(mut self, value: bool) -> Self {
10120 self.packed = Some(value);
10121 self
10122 }
10123 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10124 #[inline]
10125 pub fn with_jstype(mut self, value: impl Into<field_options::JSType>) -> Self {
10127 self.jstype = Some(value.into());
10128 self
10129 }
10130 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10131 #[inline]
10132 pub fn with_lazy(mut self, value: bool) -> Self {
10134 self.lazy = Some(value);
10135 self
10136 }
10137 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10138 #[inline]
10139 pub fn with_unverified_lazy(mut self, value: bool) -> Self {
10141 self.unverified_lazy = Some(value);
10142 self
10143 }
10144 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10145 #[inline]
10146 pub fn with_deprecated(mut self, value: bool) -> Self {
10148 self.deprecated = Some(value);
10149 self
10150 }
10151 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10152 #[inline]
10153 pub fn with_weak(mut self, value: bool) -> Self {
10155 self.weak = Some(value);
10156 self
10157 }
10158 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10159 #[inline]
10160 pub fn with_debug_redact(mut self, value: bool) -> Self {
10162 self.debug_redact = Some(value);
10163 self
10164 }
10165 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
10166 #[inline]
10167 pub fn with_retention(
10169 mut self,
10170 value: impl Into<field_options::OptionRetention>,
10171 ) -> Self {
10172 self.retention = Some(value.into());
10173 self
10174 }
10175}
10176impl ::buffa::DefaultInstance for FieldOptions {
10177 fn default_instance() -> &'static Self {
10178 static VALUE: ::buffa::__private::OnceBox<FieldOptions> = ::buffa::__private::OnceBox::new();
10179 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
10180 }
10181}
10182impl ::buffa::MessageName for FieldOptions {
10183 const PACKAGE: &'static str = "google.protobuf";
10184 const NAME: &'static str = "FieldOptions";
10185 const FULL_NAME: &'static str = "google.protobuf.FieldOptions";
10186 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions";
10187}
10188impl ::buffa::Message for FieldOptions {
10189 #[allow(clippy::let_and_return)]
10195 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
10196 #[allow(unused_imports)]
10197 use ::buffa::Enumeration as _;
10198 let mut size = 0u32;
10199 if let Some(ref v) = self.ctype {
10200 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
10201 }
10202 if self.packed.is_some() {
10203 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10204 }
10205 if self.deprecated.is_some() {
10206 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10207 }
10208 if self.lazy.is_some() {
10209 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10210 }
10211 if let Some(ref v) = self.jstype {
10212 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
10213 }
10214 if self.weak.is_some() {
10215 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10216 }
10217 if self.unverified_lazy.is_some() {
10218 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10219 }
10220 if self.debug_redact.is_some() {
10221 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
10222 }
10223 if let Some(ref v) = self.retention {
10224 size += 2u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
10225 }
10226 for v in &self.targets {
10227 size += 2u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
10228 }
10229 for v in &self.edition_defaults {
10230 let __slot = __cache.reserve();
10231 let inner_size = v.compute_size(__cache);
10232 __cache.set(__slot, inner_size);
10233 size
10234 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10235 + inner_size;
10236 }
10237 if self.features.is_set() {
10238 let __slot = __cache.reserve();
10239 let inner_size = self.features.compute_size(__cache);
10240 __cache.set(__slot, inner_size);
10241 size
10242 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10243 + inner_size;
10244 }
10245 if self.feature_support.is_set() {
10246 let __slot = __cache.reserve();
10247 let inner_size = self.feature_support.compute_size(__cache);
10248 __cache.set(__slot, inner_size);
10249 size
10250 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10251 + inner_size;
10252 }
10253 for v in &self.uninterpreted_option {
10254 let __slot = __cache.reserve();
10255 let inner_size = v.compute_size(__cache);
10256 __cache.set(__slot, inner_size);
10257 size
10258 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
10259 + inner_size;
10260 }
10261 size += self.__buffa_unknown_fields.encoded_len() as u32;
10262 size
10263 }
10264 fn write_to(
10265 &self,
10266 __cache: &mut ::buffa::SizeCache,
10267 buf: &mut impl ::buffa::bytes::BufMut,
10268 ) {
10269 #[allow(unused_imports)]
10270 use ::buffa::Enumeration as _;
10271 if let Some(ref v) = self.ctype {
10272 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
10273 .encode(buf);
10274 ::buffa::types::encode_int32(v.to_i32(), buf);
10275 }
10276 if let Some(v) = self.packed {
10277 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
10278 .encode(buf);
10279 ::buffa::types::encode_bool(v, buf);
10280 }
10281 if let Some(v) = self.deprecated {
10282 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
10283 .encode(buf);
10284 ::buffa::types::encode_bool(v, buf);
10285 }
10286 if let Some(v) = self.lazy {
10287 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
10288 .encode(buf);
10289 ::buffa::types::encode_bool(v, buf);
10290 }
10291 if let Some(ref v) = self.jstype {
10292 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
10293 .encode(buf);
10294 ::buffa::types::encode_int32(v.to_i32(), buf);
10295 }
10296 if let Some(v) = self.weak {
10297 ::buffa::encoding::Tag::new(10u32, ::buffa::encoding::WireType::Varint)
10298 .encode(buf);
10299 ::buffa::types::encode_bool(v, buf);
10300 }
10301 if let Some(v) = self.unverified_lazy {
10302 ::buffa::encoding::Tag::new(15u32, ::buffa::encoding::WireType::Varint)
10303 .encode(buf);
10304 ::buffa::types::encode_bool(v, buf);
10305 }
10306 if let Some(v) = self.debug_redact {
10307 ::buffa::encoding::Tag::new(16u32, ::buffa::encoding::WireType::Varint)
10308 .encode(buf);
10309 ::buffa::types::encode_bool(v, buf);
10310 }
10311 if let Some(ref v) = self.retention {
10312 ::buffa::encoding::Tag::new(17u32, ::buffa::encoding::WireType::Varint)
10313 .encode(buf);
10314 ::buffa::types::encode_int32(v.to_i32(), buf);
10315 }
10316 for v in &self.targets {
10317 ::buffa::encoding::Tag::new(19u32, ::buffa::encoding::WireType::Varint)
10318 .encode(buf);
10319 ::buffa::types::encode_int32(v.to_i32(), buf);
10320 }
10321 for v in &self.edition_defaults {
10322 ::buffa::encoding::Tag::new(
10323 20u32,
10324 ::buffa::encoding::WireType::LengthDelimited,
10325 )
10326 .encode(buf);
10327 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
10328 v.write_to(__cache, buf);
10329 }
10330 if self.features.is_set() {
10331 ::buffa::encoding::Tag::new(
10332 21u32,
10333 ::buffa::encoding::WireType::LengthDelimited,
10334 )
10335 .encode(buf);
10336 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
10337 self.features.write_to(__cache, buf);
10338 }
10339 if self.feature_support.is_set() {
10340 ::buffa::encoding::Tag::new(
10341 22u32,
10342 ::buffa::encoding::WireType::LengthDelimited,
10343 )
10344 .encode(buf);
10345 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
10346 self.feature_support.write_to(__cache, buf);
10347 }
10348 for v in &self.uninterpreted_option {
10349 ::buffa::encoding::Tag::new(
10350 999u32,
10351 ::buffa::encoding::WireType::LengthDelimited,
10352 )
10353 .encode(buf);
10354 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
10355 v.write_to(__cache, buf);
10356 }
10357 self.__buffa_unknown_fields.write_to(buf);
10358 }
10359 fn merge_field(
10360 &mut self,
10361 tag: ::buffa::encoding::Tag,
10362 buf: &mut impl ::buffa::bytes::Buf,
10363 depth: u32,
10364 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
10365 #[allow(unused_imports)]
10366 use ::buffa::bytes::Buf as _;
10367 #[allow(unused_imports)]
10368 use ::buffa::Enumeration as _;
10369 match tag.field_number() {
10370 1u32 => {
10371 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10372 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10373 field_number: 1u32,
10374 expected: 0u8,
10375 actual: tag.wire_type() as u8,
10376 });
10377 }
10378 let __raw = ::buffa::types::decode_int32(buf)?;
10379 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
10380 __raw,
10381 ) {
10382 self.ctype = ::core::option::Option::Some(__v);
10383 } else {
10384 self.__buffa_unknown_fields
10385 .push(::buffa::UnknownField {
10386 number: 1u32,
10387 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
10388 });
10389 }
10390 }
10391 2u32 => {
10392 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10393 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10394 field_number: 2u32,
10395 expected: 0u8,
10396 actual: tag.wire_type() as u8,
10397 });
10398 }
10399 self.packed = ::core::option::Option::Some(
10400 ::buffa::types::decode_bool(buf)?,
10401 );
10402 }
10403 3u32 => {
10404 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10405 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10406 field_number: 3u32,
10407 expected: 0u8,
10408 actual: tag.wire_type() as u8,
10409 });
10410 }
10411 self.deprecated = ::core::option::Option::Some(
10412 ::buffa::types::decode_bool(buf)?,
10413 );
10414 }
10415 5u32 => {
10416 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10417 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10418 field_number: 5u32,
10419 expected: 0u8,
10420 actual: tag.wire_type() as u8,
10421 });
10422 }
10423 self.lazy = ::core::option::Option::Some(
10424 ::buffa::types::decode_bool(buf)?,
10425 );
10426 }
10427 6u32 => {
10428 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10429 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10430 field_number: 6u32,
10431 expected: 0u8,
10432 actual: tag.wire_type() as u8,
10433 });
10434 }
10435 let __raw = ::buffa::types::decode_int32(buf)?;
10436 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
10437 __raw,
10438 ) {
10439 self.jstype = ::core::option::Option::Some(__v);
10440 } else {
10441 self.__buffa_unknown_fields
10442 .push(::buffa::UnknownField {
10443 number: 6u32,
10444 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
10445 });
10446 }
10447 }
10448 10u32 => {
10449 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10450 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10451 field_number: 10u32,
10452 expected: 0u8,
10453 actual: tag.wire_type() as u8,
10454 });
10455 }
10456 self.weak = ::core::option::Option::Some(
10457 ::buffa::types::decode_bool(buf)?,
10458 );
10459 }
10460 15u32 => {
10461 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10462 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10463 field_number: 15u32,
10464 expected: 0u8,
10465 actual: tag.wire_type() as u8,
10466 });
10467 }
10468 self.unverified_lazy = ::core::option::Option::Some(
10469 ::buffa::types::decode_bool(buf)?,
10470 );
10471 }
10472 16u32 => {
10473 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10474 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10475 field_number: 16u32,
10476 expected: 0u8,
10477 actual: tag.wire_type() as u8,
10478 });
10479 }
10480 self.debug_redact = ::core::option::Option::Some(
10481 ::buffa::types::decode_bool(buf)?,
10482 );
10483 }
10484 17u32 => {
10485 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
10486 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10487 field_number: 17u32,
10488 expected: 0u8,
10489 actual: tag.wire_type() as u8,
10490 });
10491 }
10492 let __raw = ::buffa::types::decode_int32(buf)?;
10493 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
10494 __raw,
10495 ) {
10496 self.retention = ::core::option::Option::Some(__v);
10497 } else {
10498 self.__buffa_unknown_fields
10499 .push(::buffa::UnknownField {
10500 number: 17u32,
10501 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
10502 });
10503 }
10504 }
10505 19u32 => {
10506 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
10507 let len = ::buffa::encoding::decode_varint(buf)?;
10508 let len = usize::try_from(len)
10509 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
10510 if buf.remaining() < len {
10511 return ::core::result::Result::Err(
10512 ::buffa::DecodeError::UnexpectedEof,
10513 );
10514 }
10515 self.targets.reserve(len);
10516 let mut limited = buf.take(len);
10517 while limited.has_remaining() {
10518 let __raw = ::buffa::types::decode_int32(&mut limited)?;
10519 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
10520 __raw,
10521 ) {
10522 self.targets.push(__v);
10523 } else {
10524 self.__buffa_unknown_fields
10525 .push(::buffa::UnknownField {
10526 number: 19u32,
10527 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
10528 });
10529 }
10530 }
10531 let leftover = limited.remaining();
10532 if leftover > 0 {
10533 limited.advance(leftover);
10534 }
10535 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
10536 let __raw = ::buffa::types::decode_int32(buf)?;
10537 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
10538 __raw,
10539 ) {
10540 self.targets.push(__v);
10541 } else {
10542 self.__buffa_unknown_fields
10543 .push(::buffa::UnknownField {
10544 number: 19u32,
10545 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
10546 });
10547 }
10548 } else {
10549 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10550 field_number: 19u32,
10551 expected: 2u8,
10552 actual: tag.wire_type() as u8,
10553 });
10554 }
10555 }
10556 20u32 => {
10557 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
10558 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10559 field_number: 20u32,
10560 expected: 2u8,
10561 actual: tag.wire_type() as u8,
10562 });
10563 }
10564 let mut elem = ::core::default::Default::default();
10565 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
10566 self.edition_defaults.push(elem);
10567 }
10568 21u32 => {
10569 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
10570 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10571 field_number: 21u32,
10572 expected: 2u8,
10573 actual: tag.wire_type() as u8,
10574 });
10575 }
10576 ::buffa::Message::merge_length_delimited(
10577 self.features.get_or_insert_default(),
10578 buf,
10579 depth,
10580 )?;
10581 }
10582 22u32 => {
10583 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
10584 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10585 field_number: 22u32,
10586 expected: 2u8,
10587 actual: tag.wire_type() as u8,
10588 });
10589 }
10590 ::buffa::Message::merge_length_delimited(
10591 self.feature_support.get_or_insert_default(),
10592 buf,
10593 depth,
10594 )?;
10595 }
10596 999u32 => {
10597 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
10598 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
10599 field_number: 999u32,
10600 expected: 2u8,
10601 actual: tag.wire_type() as u8,
10602 });
10603 }
10604 let mut elem = ::core::default::Default::default();
10605 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
10606 self.uninterpreted_option.push(elem);
10607 }
10608 _ => {
10609 self.__buffa_unknown_fields
10610 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
10611 }
10612 }
10613 ::core::result::Result::Ok(())
10614 }
10615 fn clear(&mut self) {
10616 self.ctype = ::core::option::Option::None;
10617 self.packed = ::core::option::Option::None;
10618 self.deprecated = ::core::option::Option::None;
10619 self.lazy = ::core::option::Option::None;
10620 self.jstype = ::core::option::Option::None;
10621 self.weak = ::core::option::Option::None;
10622 self.unverified_lazy = ::core::option::Option::None;
10623 self.debug_redact = ::core::option::Option::None;
10624 self.retention = ::core::option::Option::None;
10625 self.targets.clear();
10626 self.edition_defaults.clear();
10627 self.features = ::buffa::MessageField::none();
10628 self.feature_support = ::buffa::MessageField::none();
10629 self.uninterpreted_option.clear();
10630 self.__buffa_unknown_fields.clear();
10631 }
10632}
10633impl ::buffa::ExtensionSet for FieldOptions {
10634 const PROTO_FQN: &'static str = "google.protobuf.FieldOptions";
10635 fn unknown_fields(&self) -> &::buffa::UnknownFields {
10636 &self.__buffa_unknown_fields
10637 }
10638 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
10639 &mut self.__buffa_unknown_fields
10640 }
10641}
10642#[cfg(feature = "text")]
10643impl ::buffa::text::TextFormat for FieldOptions {
10644 fn encode_text(
10645 &self,
10646 enc: &mut ::buffa::text::TextEncoder<'_>,
10647 ) -> ::core::fmt::Result {
10648 #[allow(unused_imports)]
10649 use ::buffa::Enumeration as _;
10650 if let ::core::option::Option::Some(ref __v) = self.ctype {
10651 enc.write_field_name("ctype")?;
10652 enc.write_enum_name(__v.proto_name())?;
10653 }
10654 if let ::core::option::Option::Some(ref __v) = self.packed {
10655 enc.write_field_name("packed")?;
10656 enc.write_bool(*__v)?;
10657 }
10658 if let ::core::option::Option::Some(ref __v) = self.jstype {
10659 enc.write_field_name("jstype")?;
10660 enc.write_enum_name(__v.proto_name())?;
10661 }
10662 if let ::core::option::Option::Some(ref __v) = self.lazy {
10663 enc.write_field_name("lazy")?;
10664 enc.write_bool(*__v)?;
10665 }
10666 if let ::core::option::Option::Some(ref __v) = self.unverified_lazy {
10667 enc.write_field_name("unverified_lazy")?;
10668 enc.write_bool(*__v)?;
10669 }
10670 if let ::core::option::Option::Some(ref __v) = self.deprecated {
10671 enc.write_field_name("deprecated")?;
10672 enc.write_bool(*__v)?;
10673 }
10674 if let ::core::option::Option::Some(ref __v) = self.weak {
10675 enc.write_field_name("weak")?;
10676 enc.write_bool(*__v)?;
10677 }
10678 if let ::core::option::Option::Some(ref __v) = self.debug_redact {
10679 enc.write_field_name("debug_redact")?;
10680 enc.write_bool(*__v)?;
10681 }
10682 if let ::core::option::Option::Some(ref __v) = self.retention {
10683 enc.write_field_name("retention")?;
10684 enc.write_enum_name(__v.proto_name())?;
10685 }
10686 if self.features.is_set() {
10687 enc.write_field_name("features")?;
10688 enc.write_message(&*self.features)?;
10689 }
10690 if self.feature_support.is_set() {
10691 enc.write_field_name("feature_support")?;
10692 enc.write_message(&*self.feature_support)?;
10693 }
10694 for __v in &self.targets {
10695 enc.write_field_name("targets")?;
10696 enc.write_enum_name(__v.proto_name())?;
10697 }
10698 for __v in &self.edition_defaults {
10699 enc.write_field_name("edition_defaults")?;
10700 enc.write_message(__v)?;
10701 }
10702 for __v in &self.uninterpreted_option {
10703 enc.write_field_name("uninterpreted_option")?;
10704 enc.write_message(__v)?;
10705 }
10706 enc.write_extension_fields(
10707 "google.protobuf.FieldOptions",
10708 &self.__buffa_unknown_fields,
10709 )?;
10710 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
10711 ::core::result::Result::Ok(())
10712 }
10713 fn merge_text(
10714 &mut self,
10715 dec: &mut ::buffa::text::TextDecoder<'_>,
10716 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
10717 #[allow(unused_imports)]
10718 use ::buffa::Enumeration as _;
10719 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
10720 match __name {
10721 "ctype" => {
10722 self.ctype = ::core::option::Option::Some(
10723 dec.read_closed_enum_by_name::<field_options::CType>()?,
10724 );
10725 }
10726 "packed" => self.packed = ::core::option::Option::Some(dec.read_bool()?),
10727 "jstype" => {
10728 self.jstype = ::core::option::Option::Some(
10729 dec.read_closed_enum_by_name::<field_options::JSType>()?,
10730 );
10731 }
10732 "lazy" => self.lazy = ::core::option::Option::Some(dec.read_bool()?),
10733 "unverified_lazy" => {
10734 self.unverified_lazy = ::core::option::Option::Some(dec.read_bool()?);
10735 }
10736 "deprecated" => {
10737 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
10738 }
10739 "weak" => self.weak = ::core::option::Option::Some(dec.read_bool()?),
10740 "debug_redact" => {
10741 self.debug_redact = ::core::option::Option::Some(dec.read_bool()?);
10742 }
10743 "retention" => {
10744 self.retention = ::core::option::Option::Some(
10745 dec.read_closed_enum_by_name::<field_options::OptionRetention>()?,
10746 );
10747 }
10748 "features" => dec.merge_message(self.features.get_or_insert_default())?,
10749 "feature_support" => {
10750 dec.merge_message(self.feature_support.get_or_insert_default())?
10751 }
10752 "targets" => {
10753 dec.read_repeated_into(
10754 &mut self.targets,
10755 |__d| {
10756 __d
10757 .read_closed_enum_by_name::<
10758 field_options::OptionTargetType,
10759 >()
10760 },
10761 )?
10762 }
10763 "edition_defaults" => {
10764 dec.read_repeated_into(
10765 &mut self.edition_defaults,
10766 |__d| {
10767 let mut __m = ::core::default::Default::default();
10768 __d.merge_message(&mut __m)?;
10769 ::core::result::Result::Ok(__m)
10770 },
10771 )?
10772 }
10773 "uninterpreted_option" => {
10774 dec.read_repeated_into(
10775 &mut self.uninterpreted_option,
10776 |__d| {
10777 let mut __m = ::core::default::Default::default();
10778 __d.merge_message(&mut __m)?;
10779 ::core::result::Result::Ok(__m)
10780 },
10781 )?
10782 }
10783 __name if __name.starts_with('[') => {
10784 for __r in dec
10785 .read_extension(__name, "google.protobuf.FieldOptions")?
10786 {
10787 self.__buffa_unknown_fields.push(__r);
10788 }
10789 }
10790 _ => dec.skip_value()?,
10791 }
10792 }
10793 ::core::result::Result::Ok(())
10794 }
10795}
10796#[cfg(feature = "json")]
10797impl<'de> serde::Deserialize<'de> for FieldOptions {
10798 fn deserialize<D: serde::Deserializer<'de>>(
10799 d: D,
10800 ) -> ::core::result::Result<Self, D::Error> {
10801 struct _V;
10802 impl<'de> serde::de::Visitor<'de> for _V {
10803 type Value = FieldOptions;
10804 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
10805 f.write_str("struct FieldOptions")
10806 }
10807 #[allow(clippy::field_reassign_with_default)]
10808 fn visit_map<A: serde::de::MapAccess<'de>>(
10809 self,
10810 mut map: A,
10811 ) -> ::core::result::Result<FieldOptions, A::Error> {
10812 let mut __f_ctype: ::core::option::Option<
10813 ::core::option::Option<field_options::CType>,
10814 > = None;
10815 let mut __f_packed: ::core::option::Option<
10816 ::core::option::Option<bool>,
10817 > = None;
10818 let mut __f_jstype: ::core::option::Option<
10819 ::core::option::Option<field_options::JSType>,
10820 > = None;
10821 let mut __f_lazy: ::core::option::Option<::core::option::Option<bool>> = None;
10822 let mut __f_unverified_lazy: ::core::option::Option<
10823 ::core::option::Option<bool>,
10824 > = None;
10825 let mut __f_deprecated: ::core::option::Option<
10826 ::core::option::Option<bool>,
10827 > = None;
10828 let mut __f_weak: ::core::option::Option<::core::option::Option<bool>> = None;
10829 let mut __f_debug_redact: ::core::option::Option<
10830 ::core::option::Option<bool>,
10831 > = None;
10832 let mut __f_retention: ::core::option::Option<
10833 ::core::option::Option<field_options::OptionRetention>,
10834 > = None;
10835 let mut __f_targets: ::core::option::Option<
10836 ::buffa::alloc::vec::Vec<field_options::OptionTargetType>,
10837 > = None;
10838 let mut __f_edition_defaults: ::core::option::Option<
10839 ::buffa::alloc::vec::Vec<field_options::EditionDefault>,
10840 > = None;
10841 let mut __f_features: ::core::option::Option<
10842 ::buffa::MessageField<FeatureSet>,
10843 > = None;
10844 let mut __f_feature_support: ::core::option::Option<
10845 ::buffa::MessageField<field_options::FeatureSupport>,
10846 > = None;
10847 let mut __f_uninterpreted_option: ::core::option::Option<
10848 ::buffa::alloc::vec::Vec<UninterpretedOption>,
10849 > = None;
10850 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
10851 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
10852 match key.as_str() {
10853 "ctype" => {
10854 __f_ctype = Some({
10855 struct _S;
10856 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10857 type Value = ::core::option::Option<field_options::CType>;
10858 fn deserialize<D: serde::Deserializer<'de>>(
10859 self,
10860 d: D,
10861 ) -> ::core::result::Result<
10862 ::core::option::Option<field_options::CType>,
10863 D::Error,
10864 > {
10865 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
10866 }
10867 }
10868 map.next_value_seed(_S)?
10869 });
10870 }
10871 "packed" => {
10872 __f_packed = Some(
10873 map.next_value::<::core::option::Option<bool>>()?,
10874 );
10875 }
10876 "jstype" => {
10877 __f_jstype = Some({
10878 struct _S;
10879 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10880 type Value = ::core::option::Option<field_options::JSType>;
10881 fn deserialize<D: serde::Deserializer<'de>>(
10882 self,
10883 d: D,
10884 ) -> ::core::result::Result<
10885 ::core::option::Option<field_options::JSType>,
10886 D::Error,
10887 > {
10888 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
10889 }
10890 }
10891 map.next_value_seed(_S)?
10892 });
10893 }
10894 "lazy" => {
10895 __f_lazy = Some(
10896 map.next_value::<::core::option::Option<bool>>()?,
10897 );
10898 }
10899 "unverifiedLazy" | "unverified_lazy" => {
10900 __f_unverified_lazy = Some(
10901 map.next_value::<::core::option::Option<bool>>()?,
10902 );
10903 }
10904 "deprecated" => {
10905 __f_deprecated = Some(
10906 map.next_value::<::core::option::Option<bool>>()?,
10907 );
10908 }
10909 "weak" => {
10910 __f_weak = Some(
10911 map.next_value::<::core::option::Option<bool>>()?,
10912 );
10913 }
10914 "debugRedact" | "debug_redact" => {
10915 __f_debug_redact = Some(
10916 map.next_value::<::core::option::Option<bool>>()?,
10917 );
10918 }
10919 "retention" => {
10920 __f_retention = Some({
10921 struct _S;
10922 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10923 type Value = ::core::option::Option<
10924 field_options::OptionRetention,
10925 >;
10926 fn deserialize<D: serde::Deserializer<'de>>(
10927 self,
10928 d: D,
10929 ) -> ::core::result::Result<
10930 ::core::option::Option<field_options::OptionRetention>,
10931 D::Error,
10932 > {
10933 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
10934 }
10935 }
10936 map.next_value_seed(_S)?
10937 });
10938 }
10939 "targets" => {
10940 __f_targets = Some({
10941 struct _S;
10942 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10943 type Value = ::buffa::alloc::vec::Vec<
10944 field_options::OptionTargetType,
10945 >;
10946 fn deserialize<D: serde::Deserializer<'de>>(
10947 self,
10948 d: D,
10949 ) -> ::core::result::Result<
10950 ::buffa::alloc::vec::Vec<field_options::OptionTargetType>,
10951 D::Error,
10952 > {
10953 ::buffa::json_helpers::repeated_closed_enum::deserialize(d)
10954 }
10955 }
10956 map.next_value_seed(_S)?
10957 });
10958 }
10959 "editionDefaults" | "edition_defaults" => {
10960 __f_edition_defaults = Some({
10961 struct _S;
10962 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10963 type Value = ::buffa::alloc::vec::Vec<
10964 field_options::EditionDefault,
10965 >;
10966 fn deserialize<D: serde::Deserializer<'de>>(
10967 self,
10968 d: D,
10969 ) -> ::core::result::Result<
10970 ::buffa::alloc::vec::Vec<field_options::EditionDefault>,
10971 D::Error,
10972 > {
10973 ::buffa::json_helpers::null_as_default(d)
10974 }
10975 }
10976 map.next_value_seed(_S)?
10977 });
10978 }
10979 "features" => {
10980 __f_features = Some(
10981 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
10982 );
10983 }
10984 "featureSupport" | "feature_support" => {
10985 __f_feature_support = Some(
10986 map
10987 .next_value::<
10988 ::buffa::MessageField<field_options::FeatureSupport>,
10989 >()?,
10990 );
10991 }
10992 "uninterpretedOption" | "uninterpreted_option" => {
10993 __f_uninterpreted_option = Some({
10994 struct _S;
10995 impl<'de> serde::de::DeserializeSeed<'de> for _S {
10996 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
10997 fn deserialize<D: serde::Deserializer<'de>>(
10998 self,
10999 d: D,
11000 ) -> ::core::result::Result<
11001 ::buffa::alloc::vec::Vec<UninterpretedOption>,
11002 D::Error,
11003 > {
11004 ::buffa::json_helpers::null_as_default(d)
11005 }
11006 }
11007 map.next_value_seed(_S)?
11008 });
11009 }
11010 __k if __k.starts_with('[') => {
11011 let __v: ::buffa::serde_json::Value = map.next_value()?;
11012 match ::buffa::extension_registry::deserialize_extension_key(
11013 "google.protobuf.FieldOptions",
11014 __k,
11015 __v,
11016 ) {
11017 ::core::option::Option::Some(
11018 ::core::result::Result::Ok(__recs),
11019 ) => {
11020 for __rec in __recs {
11021 __ext_records.push(__rec);
11022 }
11023 }
11024 ::core::option::Option::Some(
11025 ::core::result::Result::Err(__e),
11026 ) => {
11027 return ::core::result::Result::Err(
11028 <A::Error as ::serde::de::Error>::custom(__e),
11029 );
11030 }
11031 ::core::option::Option::None => {}
11032 }
11033 }
11034 _ => {
11035 map.next_value::<serde::de::IgnoredAny>()?;
11036 }
11037 }
11038 }
11039 let mut __r = <FieldOptions as ::core::default::Default>::default();
11040 if let ::core::option::Option::Some(v) = __f_ctype {
11041 __r.ctype = v;
11042 }
11043 if let ::core::option::Option::Some(v) = __f_packed {
11044 __r.packed = v;
11045 }
11046 if let ::core::option::Option::Some(v) = __f_jstype {
11047 __r.jstype = v;
11048 }
11049 if let ::core::option::Option::Some(v) = __f_lazy {
11050 __r.lazy = v;
11051 }
11052 if let ::core::option::Option::Some(v) = __f_unverified_lazy {
11053 __r.unverified_lazy = v;
11054 }
11055 if let ::core::option::Option::Some(v) = __f_deprecated {
11056 __r.deprecated = v;
11057 }
11058 if let ::core::option::Option::Some(v) = __f_weak {
11059 __r.weak = v;
11060 }
11061 if let ::core::option::Option::Some(v) = __f_debug_redact {
11062 __r.debug_redact = v;
11063 }
11064 if let ::core::option::Option::Some(v) = __f_retention {
11065 __r.retention = v;
11066 }
11067 if let ::core::option::Option::Some(v) = __f_targets {
11068 __r.targets = v;
11069 }
11070 if let ::core::option::Option::Some(v) = __f_edition_defaults {
11071 __r.edition_defaults = v;
11072 }
11073 if let ::core::option::Option::Some(v) = __f_features {
11074 __r.features = v;
11075 }
11076 if let ::core::option::Option::Some(v) = __f_feature_support {
11077 __r.feature_support = v;
11078 }
11079 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
11080 __r.uninterpreted_option = v;
11081 }
11082 for __rec in __ext_records {
11083 __r.__buffa_unknown_fields.push(__rec);
11084 }
11085 Ok(__r)
11086 }
11087 }
11088 d.deserialize_map(_V)
11089 }
11090}
11091#[cfg(feature = "json")]
11092impl ::buffa::json_helpers::ProtoElemJson for FieldOptions {
11093 fn serialize_proto_json<S: ::serde::Serializer>(
11094 v: &Self,
11095 s: S,
11096 ) -> ::core::result::Result<S::Ok, S::Error> {
11097 ::serde::Serialize::serialize(v, s)
11098 }
11099 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
11100 d: D,
11101 ) -> ::core::result::Result<Self, D::Error> {
11102 <Self as ::serde::Deserialize>::deserialize(d)
11103 }
11104}
11105#[doc(hidden)]
11106#[derive(Clone, Debug, Default, PartialEq)]
11107#[repr(transparent)]
11108#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11109pub struct __FieldOptionsExtJson(pub ::buffa::UnknownFields);
11110impl ::core::ops::Deref for __FieldOptionsExtJson {
11111 type Target = ::buffa::UnknownFields;
11112 fn deref(&self) -> &::buffa::UnknownFields {
11113 &self.0
11114 }
11115}
11116impl ::core::ops::DerefMut for __FieldOptionsExtJson {
11117 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
11118 &mut self.0
11119 }
11120}
11121impl ::core::convert::From<::buffa::UnknownFields> for __FieldOptionsExtJson {
11122 fn from(u: ::buffa::UnknownFields) -> Self {
11123 Self(u)
11124 }
11125}
11126#[cfg(feature = "json")]
11127impl ::serde::Serialize for __FieldOptionsExtJson {
11128 fn serialize<S: ::serde::Serializer>(
11129 &self,
11130 s: S,
11131 ) -> ::core::result::Result<S::Ok, S::Error> {
11132 ::buffa::extension_registry::serialize_extensions(
11133 "google.protobuf.FieldOptions",
11134 &self.0,
11135 s,
11136 )
11137 }
11138}
11139#[cfg(feature = "json")]
11140impl<'de> ::serde::Deserialize<'de> for __FieldOptionsExtJson {
11141 fn deserialize<D: ::serde::Deserializer<'de>>(
11142 d: D,
11143 ) -> ::core::result::Result<Self, D::Error> {
11144 ::buffa::extension_registry::deserialize_extensions(
11145 "google.protobuf.FieldOptions",
11146 d,
11147 )
11148 .map(Self)
11149 }
11150}
11151#[cfg(feature = "json")]
11152#[doc(hidden)]
11153pub const __FIELD_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
11154 type_url: "type.googleapis.com/google.protobuf.FieldOptions",
11155 to_json: ::buffa::type_registry::any_to_json::<FieldOptions>,
11156 from_json: ::buffa::type_registry::any_from_json::<FieldOptions>,
11157 is_wkt: false,
11158};
11159#[cfg(feature = "text")]
11160#[doc(hidden)]
11161pub const __FIELD_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
11162 type_url: "type.googleapis.com/google.protobuf.FieldOptions",
11163 text_encode: ::buffa::type_registry::any_encode_text::<FieldOptions>,
11164 text_merge: ::buffa::type_registry::any_merge_text::<FieldOptions>,
11165};
11166pub mod field_options {
11167 #[allow(unused_imports)]
11168 use super::*;
11169 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
11170 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11171 #[repr(i32)]
11172 pub enum CType {
11173 STRING = 0i32,
11175 CORD = 1i32,
11182 STRING_PIECE = 2i32,
11183 }
11184 impl ::core::default::Default for CType {
11185 fn default() -> Self {
11186 Self::STRING
11187 }
11188 }
11189 #[cfg(feature = "json")]
11190 const _: () = {
11191 impl ::serde::Serialize for CType {
11192 fn serialize<S: ::serde::Serializer>(
11193 &self,
11194 s: S,
11195 ) -> ::core::result::Result<S::Ok, S::Error> {
11196 s.serialize_str(::buffa::Enumeration::proto_name(self))
11197 }
11198 }
11199 impl<'de> ::serde::Deserialize<'de> for CType {
11200 fn deserialize<D: ::serde::Deserializer<'de>>(
11201 d: D,
11202 ) -> ::core::result::Result<Self, D::Error> {
11203 struct _V;
11204 impl ::serde::de::Visitor<'_> for _V {
11205 type Value = CType;
11206 fn expecting(
11207 &self,
11208 f: &mut ::core::fmt::Formatter<'_>,
11209 ) -> ::core::fmt::Result {
11210 f.write_str(
11211 concat!("a string, integer, or null for ", stringify!(CType)),
11212 )
11213 }
11214 fn visit_str<E: ::serde::de::Error>(
11215 self,
11216 v: &str,
11217 ) -> ::core::result::Result<CType, E> {
11218 <CType as ::buffa::Enumeration>::from_proto_name(v)
11219 .ok_or_else(|| {
11220 ::serde::de::Error::unknown_variant(v, &[])
11221 })
11222 }
11223 fn visit_i64<E: ::serde::de::Error>(
11224 self,
11225 v: i64,
11226 ) -> ::core::result::Result<CType, E> {
11227 let v32 = i32::try_from(v)
11228 .map_err(|_| {
11229 ::serde::de::Error::custom(
11230 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11231 )
11232 })?;
11233 <CType as ::buffa::Enumeration>::from_i32(v32)
11234 .ok_or_else(|| {
11235 ::serde::de::Error::custom(
11236 ::buffa::alloc::format!("unknown enum value {v32}"),
11237 )
11238 })
11239 }
11240 fn visit_u64<E: ::serde::de::Error>(
11241 self,
11242 v: u64,
11243 ) -> ::core::result::Result<CType, E> {
11244 let v32 = i32::try_from(v)
11245 .map_err(|_| {
11246 ::serde::de::Error::custom(
11247 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11248 )
11249 })?;
11250 <CType as ::buffa::Enumeration>::from_i32(v32)
11251 .ok_or_else(|| {
11252 ::serde::de::Error::custom(
11253 ::buffa::alloc::format!("unknown enum value {v32}"),
11254 )
11255 })
11256 }
11257 fn visit_unit<E: ::serde::de::Error>(
11258 self,
11259 ) -> ::core::result::Result<CType, E> {
11260 ::core::result::Result::Ok(::core::default::Default::default())
11261 }
11262 }
11263 d.deserialize_any(_V)
11264 }
11265 }
11266 impl ::buffa::json_helpers::ProtoElemJson for CType {
11267 fn serialize_proto_json<S: ::serde::Serializer>(
11268 v: &Self,
11269 s: S,
11270 ) -> ::core::result::Result<S::Ok, S::Error> {
11271 ::serde::Serialize::serialize(v, s)
11272 }
11273 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
11274 d: D,
11275 ) -> ::core::result::Result<Self, D::Error> {
11276 <Self as ::serde::Deserialize>::deserialize(d)
11277 }
11278 }
11279 };
11280 impl ::buffa::Enumeration for CType {
11281 fn from_i32(value: i32) -> ::core::option::Option<Self> {
11282 match value {
11283 0i32 => ::core::option::Option::Some(Self::STRING),
11284 1i32 => ::core::option::Option::Some(Self::CORD),
11285 2i32 => ::core::option::Option::Some(Self::STRING_PIECE),
11286 _ => ::core::option::Option::None,
11287 }
11288 }
11289 fn to_i32(&self) -> i32 {
11290 *self as i32
11291 }
11292 fn proto_name(&self) -> &'static str {
11293 match self {
11294 Self::STRING => "STRING",
11295 Self::CORD => "CORD",
11296 Self::STRING_PIECE => "STRING_PIECE",
11297 }
11298 }
11299 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
11300 match name {
11301 "STRING" => ::core::option::Option::Some(Self::STRING),
11302 "CORD" => ::core::option::Option::Some(Self::CORD),
11303 "STRING_PIECE" => ::core::option::Option::Some(Self::STRING_PIECE),
11304 _ => ::core::option::Option::None,
11305 }
11306 }
11307 fn values() -> &'static [Self] {
11308 &[Self::STRING, Self::CORD, Self::STRING_PIECE]
11309 }
11310 }
11311 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
11312 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11313 #[repr(i32)]
11314 pub enum JSType {
11315 JS_NORMAL = 0i32,
11317 JS_STRING = 1i32,
11319 JS_NUMBER = 2i32,
11321 }
11322 impl ::core::default::Default for JSType {
11323 fn default() -> Self {
11324 Self::JS_NORMAL
11325 }
11326 }
11327 #[cfg(feature = "json")]
11328 const _: () = {
11329 impl ::serde::Serialize for JSType {
11330 fn serialize<S: ::serde::Serializer>(
11331 &self,
11332 s: S,
11333 ) -> ::core::result::Result<S::Ok, S::Error> {
11334 s.serialize_str(::buffa::Enumeration::proto_name(self))
11335 }
11336 }
11337 impl<'de> ::serde::Deserialize<'de> for JSType {
11338 fn deserialize<D: ::serde::Deserializer<'de>>(
11339 d: D,
11340 ) -> ::core::result::Result<Self, D::Error> {
11341 struct _V;
11342 impl ::serde::de::Visitor<'_> for _V {
11343 type Value = JSType;
11344 fn expecting(
11345 &self,
11346 f: &mut ::core::fmt::Formatter<'_>,
11347 ) -> ::core::fmt::Result {
11348 f.write_str(
11349 concat!(
11350 "a string, integer, or null for ", stringify!(JSType)
11351 ),
11352 )
11353 }
11354 fn visit_str<E: ::serde::de::Error>(
11355 self,
11356 v: &str,
11357 ) -> ::core::result::Result<JSType, E> {
11358 <JSType as ::buffa::Enumeration>::from_proto_name(v)
11359 .ok_or_else(|| {
11360 ::serde::de::Error::unknown_variant(v, &[])
11361 })
11362 }
11363 fn visit_i64<E: ::serde::de::Error>(
11364 self,
11365 v: i64,
11366 ) -> ::core::result::Result<JSType, E> {
11367 let v32 = i32::try_from(v)
11368 .map_err(|_| {
11369 ::serde::de::Error::custom(
11370 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11371 )
11372 })?;
11373 <JSType as ::buffa::Enumeration>::from_i32(v32)
11374 .ok_or_else(|| {
11375 ::serde::de::Error::custom(
11376 ::buffa::alloc::format!("unknown enum value {v32}"),
11377 )
11378 })
11379 }
11380 fn visit_u64<E: ::serde::de::Error>(
11381 self,
11382 v: u64,
11383 ) -> ::core::result::Result<JSType, E> {
11384 let v32 = i32::try_from(v)
11385 .map_err(|_| {
11386 ::serde::de::Error::custom(
11387 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11388 )
11389 })?;
11390 <JSType as ::buffa::Enumeration>::from_i32(v32)
11391 .ok_or_else(|| {
11392 ::serde::de::Error::custom(
11393 ::buffa::alloc::format!("unknown enum value {v32}"),
11394 )
11395 })
11396 }
11397 fn visit_unit<E: ::serde::de::Error>(
11398 self,
11399 ) -> ::core::result::Result<JSType, E> {
11400 ::core::result::Result::Ok(::core::default::Default::default())
11401 }
11402 }
11403 d.deserialize_any(_V)
11404 }
11405 }
11406 impl ::buffa::json_helpers::ProtoElemJson for JSType {
11407 fn serialize_proto_json<S: ::serde::Serializer>(
11408 v: &Self,
11409 s: S,
11410 ) -> ::core::result::Result<S::Ok, S::Error> {
11411 ::serde::Serialize::serialize(v, s)
11412 }
11413 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
11414 d: D,
11415 ) -> ::core::result::Result<Self, D::Error> {
11416 <Self as ::serde::Deserialize>::deserialize(d)
11417 }
11418 }
11419 };
11420 impl ::buffa::Enumeration for JSType {
11421 fn from_i32(value: i32) -> ::core::option::Option<Self> {
11422 match value {
11423 0i32 => ::core::option::Option::Some(Self::JS_NORMAL),
11424 1i32 => ::core::option::Option::Some(Self::JS_STRING),
11425 2i32 => ::core::option::Option::Some(Self::JS_NUMBER),
11426 _ => ::core::option::Option::None,
11427 }
11428 }
11429 fn to_i32(&self) -> i32 {
11430 *self as i32
11431 }
11432 fn proto_name(&self) -> &'static str {
11433 match self {
11434 Self::JS_NORMAL => "JS_NORMAL",
11435 Self::JS_STRING => "JS_STRING",
11436 Self::JS_NUMBER => "JS_NUMBER",
11437 }
11438 }
11439 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
11440 match name {
11441 "JS_NORMAL" => ::core::option::Option::Some(Self::JS_NORMAL),
11442 "JS_STRING" => ::core::option::Option::Some(Self::JS_STRING),
11443 "JS_NUMBER" => ::core::option::Option::Some(Self::JS_NUMBER),
11444 _ => ::core::option::Option::None,
11445 }
11446 }
11447 fn values() -> &'static [Self] {
11448 &[Self::JS_NORMAL, Self::JS_STRING, Self::JS_NUMBER]
11449 }
11450 }
11451 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
11453 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11454 #[repr(i32)]
11455 pub enum OptionRetention {
11456 RETENTION_UNKNOWN = 0i32,
11457 RETENTION_RUNTIME = 1i32,
11458 RETENTION_SOURCE = 2i32,
11459 }
11460 impl ::core::default::Default for OptionRetention {
11461 fn default() -> Self {
11462 Self::RETENTION_UNKNOWN
11463 }
11464 }
11465 #[cfg(feature = "json")]
11466 const _: () = {
11467 impl ::serde::Serialize for OptionRetention {
11468 fn serialize<S: ::serde::Serializer>(
11469 &self,
11470 s: S,
11471 ) -> ::core::result::Result<S::Ok, S::Error> {
11472 s.serialize_str(::buffa::Enumeration::proto_name(self))
11473 }
11474 }
11475 impl<'de> ::serde::Deserialize<'de> for OptionRetention {
11476 fn deserialize<D: ::serde::Deserializer<'de>>(
11477 d: D,
11478 ) -> ::core::result::Result<Self, D::Error> {
11479 struct _V;
11480 impl ::serde::de::Visitor<'_> for _V {
11481 type Value = OptionRetention;
11482 fn expecting(
11483 &self,
11484 f: &mut ::core::fmt::Formatter<'_>,
11485 ) -> ::core::fmt::Result {
11486 f.write_str(
11487 concat!(
11488 "a string, integer, or null for ",
11489 stringify!(OptionRetention)
11490 ),
11491 )
11492 }
11493 fn visit_str<E: ::serde::de::Error>(
11494 self,
11495 v: &str,
11496 ) -> ::core::result::Result<OptionRetention, E> {
11497 <OptionRetention as ::buffa::Enumeration>::from_proto_name(v)
11498 .ok_or_else(|| {
11499 ::serde::de::Error::unknown_variant(v, &[])
11500 })
11501 }
11502 fn visit_i64<E: ::serde::de::Error>(
11503 self,
11504 v: i64,
11505 ) -> ::core::result::Result<OptionRetention, E> {
11506 let v32 = i32::try_from(v)
11507 .map_err(|_| {
11508 ::serde::de::Error::custom(
11509 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11510 )
11511 })?;
11512 <OptionRetention as ::buffa::Enumeration>::from_i32(v32)
11513 .ok_or_else(|| {
11514 ::serde::de::Error::custom(
11515 ::buffa::alloc::format!("unknown enum value {v32}"),
11516 )
11517 })
11518 }
11519 fn visit_u64<E: ::serde::de::Error>(
11520 self,
11521 v: u64,
11522 ) -> ::core::result::Result<OptionRetention, E> {
11523 let v32 = i32::try_from(v)
11524 .map_err(|_| {
11525 ::serde::de::Error::custom(
11526 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11527 )
11528 })?;
11529 <OptionRetention as ::buffa::Enumeration>::from_i32(v32)
11530 .ok_or_else(|| {
11531 ::serde::de::Error::custom(
11532 ::buffa::alloc::format!("unknown enum value {v32}"),
11533 )
11534 })
11535 }
11536 fn visit_unit<E: ::serde::de::Error>(
11537 self,
11538 ) -> ::core::result::Result<OptionRetention, E> {
11539 ::core::result::Result::Ok(::core::default::Default::default())
11540 }
11541 }
11542 d.deserialize_any(_V)
11543 }
11544 }
11545 impl ::buffa::json_helpers::ProtoElemJson for OptionRetention {
11546 fn serialize_proto_json<S: ::serde::Serializer>(
11547 v: &Self,
11548 s: S,
11549 ) -> ::core::result::Result<S::Ok, S::Error> {
11550 ::serde::Serialize::serialize(v, s)
11551 }
11552 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
11553 d: D,
11554 ) -> ::core::result::Result<Self, D::Error> {
11555 <Self as ::serde::Deserialize>::deserialize(d)
11556 }
11557 }
11558 };
11559 impl ::buffa::Enumeration for OptionRetention {
11560 fn from_i32(value: i32) -> ::core::option::Option<Self> {
11561 match value {
11562 0i32 => ::core::option::Option::Some(Self::RETENTION_UNKNOWN),
11563 1i32 => ::core::option::Option::Some(Self::RETENTION_RUNTIME),
11564 2i32 => ::core::option::Option::Some(Self::RETENTION_SOURCE),
11565 _ => ::core::option::Option::None,
11566 }
11567 }
11568 fn to_i32(&self) -> i32 {
11569 *self as i32
11570 }
11571 fn proto_name(&self) -> &'static str {
11572 match self {
11573 Self::RETENTION_UNKNOWN => "RETENTION_UNKNOWN",
11574 Self::RETENTION_RUNTIME => "RETENTION_RUNTIME",
11575 Self::RETENTION_SOURCE => "RETENTION_SOURCE",
11576 }
11577 }
11578 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
11579 match name {
11580 "RETENTION_UNKNOWN" => {
11581 ::core::option::Option::Some(Self::RETENTION_UNKNOWN)
11582 }
11583 "RETENTION_RUNTIME" => {
11584 ::core::option::Option::Some(Self::RETENTION_RUNTIME)
11585 }
11586 "RETENTION_SOURCE" => {
11587 ::core::option::Option::Some(Self::RETENTION_SOURCE)
11588 }
11589 _ => ::core::option::Option::None,
11590 }
11591 }
11592 fn values() -> &'static [Self] {
11593 &[Self::RETENTION_UNKNOWN, Self::RETENTION_RUNTIME, Self::RETENTION_SOURCE]
11594 }
11595 }
11596 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
11600 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11601 #[repr(i32)]
11602 pub enum OptionTargetType {
11603 TARGET_TYPE_UNKNOWN = 0i32,
11604 TARGET_TYPE_FILE = 1i32,
11605 TARGET_TYPE_EXTENSION_RANGE = 2i32,
11606 TARGET_TYPE_MESSAGE = 3i32,
11607 TARGET_TYPE_FIELD = 4i32,
11608 TARGET_TYPE_ONEOF = 5i32,
11609 TARGET_TYPE_ENUM = 6i32,
11610 TARGET_TYPE_ENUM_ENTRY = 7i32,
11611 TARGET_TYPE_SERVICE = 8i32,
11612 TARGET_TYPE_METHOD = 9i32,
11613 }
11614 impl ::core::default::Default for OptionTargetType {
11615 fn default() -> Self {
11616 Self::TARGET_TYPE_UNKNOWN
11617 }
11618 }
11619 #[cfg(feature = "json")]
11620 const _: () = {
11621 impl ::serde::Serialize for OptionTargetType {
11622 fn serialize<S: ::serde::Serializer>(
11623 &self,
11624 s: S,
11625 ) -> ::core::result::Result<S::Ok, S::Error> {
11626 s.serialize_str(::buffa::Enumeration::proto_name(self))
11627 }
11628 }
11629 impl<'de> ::serde::Deserialize<'de> for OptionTargetType {
11630 fn deserialize<D: ::serde::Deserializer<'de>>(
11631 d: D,
11632 ) -> ::core::result::Result<Self, D::Error> {
11633 struct _V;
11634 impl ::serde::de::Visitor<'_> for _V {
11635 type Value = OptionTargetType;
11636 fn expecting(
11637 &self,
11638 f: &mut ::core::fmt::Formatter<'_>,
11639 ) -> ::core::fmt::Result {
11640 f.write_str(
11641 concat!(
11642 "a string, integer, or null for ",
11643 stringify!(OptionTargetType)
11644 ),
11645 )
11646 }
11647 fn visit_str<E: ::serde::de::Error>(
11648 self,
11649 v: &str,
11650 ) -> ::core::result::Result<OptionTargetType, E> {
11651 <OptionTargetType as ::buffa::Enumeration>::from_proto_name(v)
11652 .ok_or_else(|| {
11653 ::serde::de::Error::unknown_variant(v, &[])
11654 })
11655 }
11656 fn visit_i64<E: ::serde::de::Error>(
11657 self,
11658 v: i64,
11659 ) -> ::core::result::Result<OptionTargetType, E> {
11660 let v32 = i32::try_from(v)
11661 .map_err(|_| {
11662 ::serde::de::Error::custom(
11663 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11664 )
11665 })?;
11666 <OptionTargetType as ::buffa::Enumeration>::from_i32(v32)
11667 .ok_or_else(|| {
11668 ::serde::de::Error::custom(
11669 ::buffa::alloc::format!("unknown enum value {v32}"),
11670 )
11671 })
11672 }
11673 fn visit_u64<E: ::serde::de::Error>(
11674 self,
11675 v: u64,
11676 ) -> ::core::result::Result<OptionTargetType, E> {
11677 let v32 = i32::try_from(v)
11678 .map_err(|_| {
11679 ::serde::de::Error::custom(
11680 ::buffa::alloc::format!("enum value {v} out of i32 range"),
11681 )
11682 })?;
11683 <OptionTargetType as ::buffa::Enumeration>::from_i32(v32)
11684 .ok_or_else(|| {
11685 ::serde::de::Error::custom(
11686 ::buffa::alloc::format!("unknown enum value {v32}"),
11687 )
11688 })
11689 }
11690 fn visit_unit<E: ::serde::de::Error>(
11691 self,
11692 ) -> ::core::result::Result<OptionTargetType, E> {
11693 ::core::result::Result::Ok(::core::default::Default::default())
11694 }
11695 }
11696 d.deserialize_any(_V)
11697 }
11698 }
11699 impl ::buffa::json_helpers::ProtoElemJson for OptionTargetType {
11700 fn serialize_proto_json<S: ::serde::Serializer>(
11701 v: &Self,
11702 s: S,
11703 ) -> ::core::result::Result<S::Ok, S::Error> {
11704 ::serde::Serialize::serialize(v, s)
11705 }
11706 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
11707 d: D,
11708 ) -> ::core::result::Result<Self, D::Error> {
11709 <Self as ::serde::Deserialize>::deserialize(d)
11710 }
11711 }
11712 };
11713 impl ::buffa::Enumeration for OptionTargetType {
11714 fn from_i32(value: i32) -> ::core::option::Option<Self> {
11715 match value {
11716 0i32 => ::core::option::Option::Some(Self::TARGET_TYPE_UNKNOWN),
11717 1i32 => ::core::option::Option::Some(Self::TARGET_TYPE_FILE),
11718 2i32 => ::core::option::Option::Some(Self::TARGET_TYPE_EXTENSION_RANGE),
11719 3i32 => ::core::option::Option::Some(Self::TARGET_TYPE_MESSAGE),
11720 4i32 => ::core::option::Option::Some(Self::TARGET_TYPE_FIELD),
11721 5i32 => ::core::option::Option::Some(Self::TARGET_TYPE_ONEOF),
11722 6i32 => ::core::option::Option::Some(Self::TARGET_TYPE_ENUM),
11723 7i32 => ::core::option::Option::Some(Self::TARGET_TYPE_ENUM_ENTRY),
11724 8i32 => ::core::option::Option::Some(Self::TARGET_TYPE_SERVICE),
11725 9i32 => ::core::option::Option::Some(Self::TARGET_TYPE_METHOD),
11726 _ => ::core::option::Option::None,
11727 }
11728 }
11729 fn to_i32(&self) -> i32 {
11730 *self as i32
11731 }
11732 fn proto_name(&self) -> &'static str {
11733 match self {
11734 Self::TARGET_TYPE_UNKNOWN => "TARGET_TYPE_UNKNOWN",
11735 Self::TARGET_TYPE_FILE => "TARGET_TYPE_FILE",
11736 Self::TARGET_TYPE_EXTENSION_RANGE => "TARGET_TYPE_EXTENSION_RANGE",
11737 Self::TARGET_TYPE_MESSAGE => "TARGET_TYPE_MESSAGE",
11738 Self::TARGET_TYPE_FIELD => "TARGET_TYPE_FIELD",
11739 Self::TARGET_TYPE_ONEOF => "TARGET_TYPE_ONEOF",
11740 Self::TARGET_TYPE_ENUM => "TARGET_TYPE_ENUM",
11741 Self::TARGET_TYPE_ENUM_ENTRY => "TARGET_TYPE_ENUM_ENTRY",
11742 Self::TARGET_TYPE_SERVICE => "TARGET_TYPE_SERVICE",
11743 Self::TARGET_TYPE_METHOD => "TARGET_TYPE_METHOD",
11744 }
11745 }
11746 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
11747 match name {
11748 "TARGET_TYPE_UNKNOWN" => {
11749 ::core::option::Option::Some(Self::TARGET_TYPE_UNKNOWN)
11750 }
11751 "TARGET_TYPE_FILE" => {
11752 ::core::option::Option::Some(Self::TARGET_TYPE_FILE)
11753 }
11754 "TARGET_TYPE_EXTENSION_RANGE" => {
11755 ::core::option::Option::Some(Self::TARGET_TYPE_EXTENSION_RANGE)
11756 }
11757 "TARGET_TYPE_MESSAGE" => {
11758 ::core::option::Option::Some(Self::TARGET_TYPE_MESSAGE)
11759 }
11760 "TARGET_TYPE_FIELD" => {
11761 ::core::option::Option::Some(Self::TARGET_TYPE_FIELD)
11762 }
11763 "TARGET_TYPE_ONEOF" => {
11764 ::core::option::Option::Some(Self::TARGET_TYPE_ONEOF)
11765 }
11766 "TARGET_TYPE_ENUM" => {
11767 ::core::option::Option::Some(Self::TARGET_TYPE_ENUM)
11768 }
11769 "TARGET_TYPE_ENUM_ENTRY" => {
11770 ::core::option::Option::Some(Self::TARGET_TYPE_ENUM_ENTRY)
11771 }
11772 "TARGET_TYPE_SERVICE" => {
11773 ::core::option::Option::Some(Self::TARGET_TYPE_SERVICE)
11774 }
11775 "TARGET_TYPE_METHOD" => {
11776 ::core::option::Option::Some(Self::TARGET_TYPE_METHOD)
11777 }
11778 _ => ::core::option::Option::None,
11779 }
11780 }
11781 fn values() -> &'static [Self] {
11782 &[
11783 Self::TARGET_TYPE_UNKNOWN,
11784 Self::TARGET_TYPE_FILE,
11785 Self::TARGET_TYPE_EXTENSION_RANGE,
11786 Self::TARGET_TYPE_MESSAGE,
11787 Self::TARGET_TYPE_FIELD,
11788 Self::TARGET_TYPE_ONEOF,
11789 Self::TARGET_TYPE_ENUM,
11790 Self::TARGET_TYPE_ENUM_ENTRY,
11791 Self::TARGET_TYPE_SERVICE,
11792 Self::TARGET_TYPE_METHOD,
11793 ]
11794 }
11795 }
11796 #[derive(Clone, PartialEq, Default)]
11797 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
11798 #[cfg_attr(feature = "json", serde(default))]
11799 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
11800 pub struct EditionDefault {
11801 #[cfg_attr(
11803 feature = "json",
11804 serde(
11805 rename = "edition",
11806 with = "::buffa::json_helpers::opt_closed_enum",
11807 skip_serializing_if = "::core::option::Option::is_none"
11808 )
11809 )]
11810 pub edition: ::core::option::Option<super::Edition>,
11811 #[cfg_attr(
11815 feature = "json",
11816 serde(
11817 rename = "value",
11818 skip_serializing_if = "::core::option::Option::is_none"
11819 )
11820 )]
11821 pub value: ::core::option::Option<::buffa::alloc::string::String>,
11822 #[cfg_attr(feature = "json", serde(skip))]
11823 #[doc(hidden)]
11824 pub __buffa_unknown_fields: ::buffa::UnknownFields,
11825 }
11826 impl ::core::fmt::Debug for EditionDefault {
11827 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
11828 f.debug_struct("EditionDefault")
11829 .field("edition", &self.edition)
11830 .field("value", &self.value)
11831 .finish()
11832 }
11833 }
11834 impl EditionDefault {
11835 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault";
11840 }
11841 impl EditionDefault {
11842 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
11843 #[inline]
11844 pub fn with_edition(mut self, value: impl Into<super::Edition>) -> Self {
11846 self.edition = Some(value.into());
11847 self
11848 }
11849 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
11850 #[inline]
11851 pub fn with_value(
11853 mut self,
11854 value: impl Into<::buffa::alloc::string::String>,
11855 ) -> Self {
11856 self.value = Some(value.into());
11857 self
11858 }
11859 }
11860 impl ::buffa::DefaultInstance for EditionDefault {
11861 fn default_instance() -> &'static Self {
11862 static VALUE: ::buffa::__private::OnceBox<EditionDefault> = ::buffa::__private::OnceBox::new();
11863 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
11864 }
11865 }
11866 impl ::buffa::MessageName for EditionDefault {
11867 const PACKAGE: &'static str = "google.protobuf";
11868 const NAME: &'static str = "FieldOptions.EditionDefault";
11869 const FULL_NAME: &'static str = "google.protobuf.FieldOptions.EditionDefault";
11870 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault";
11871 }
11872 impl ::buffa::Message for EditionDefault {
11873 #[allow(clippy::let_and_return)]
11879 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
11880 #[allow(unused_imports)]
11881 use ::buffa::Enumeration as _;
11882 let mut size = 0u32;
11883 if let Some(ref v) = self.value {
11884 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
11885 }
11886 if let Some(ref v) = self.edition {
11887 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
11888 }
11889 size += self.__buffa_unknown_fields.encoded_len() as u32;
11890 size
11891 }
11892 fn write_to(
11893 &self,
11894 _cache: &mut ::buffa::SizeCache,
11895 buf: &mut impl ::buffa::bytes::BufMut,
11896 ) {
11897 #[allow(unused_imports)]
11898 use ::buffa::Enumeration as _;
11899 if let Some(ref v) = self.value {
11900 ::buffa::encoding::Tag::new(
11901 2u32,
11902 ::buffa::encoding::WireType::LengthDelimited,
11903 )
11904 .encode(buf);
11905 ::buffa::types::encode_string(v, buf);
11906 }
11907 if let Some(ref v) = self.edition {
11908 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
11909 .encode(buf);
11910 ::buffa::types::encode_int32(v.to_i32(), buf);
11911 }
11912 self.__buffa_unknown_fields.write_to(buf);
11913 }
11914 fn merge_field(
11915 &mut self,
11916 tag: ::buffa::encoding::Tag,
11917 buf: &mut impl ::buffa::bytes::Buf,
11918 depth: u32,
11919 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
11920 #[allow(unused_imports)]
11921 use ::buffa::bytes::Buf as _;
11922 #[allow(unused_imports)]
11923 use ::buffa::Enumeration as _;
11924 match tag.field_number() {
11925 2u32 => {
11926 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
11927 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
11928 field_number: 2u32,
11929 expected: 2u8,
11930 actual: tag.wire_type() as u8,
11931 });
11932 }
11933 ::buffa::types::merge_string(
11934 self
11935 .value
11936 .get_or_insert_with(::buffa::alloc::string::String::new),
11937 buf,
11938 )?;
11939 }
11940 3u32 => {
11941 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
11942 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
11943 field_number: 3u32,
11944 expected: 0u8,
11945 actual: tag.wire_type() as u8,
11946 });
11947 }
11948 let __raw = ::buffa::types::decode_int32(buf)?;
11949 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
11950 __raw,
11951 ) {
11952 self.edition = ::core::option::Option::Some(__v);
11953 } else {
11954 self.__buffa_unknown_fields
11955 .push(::buffa::UnknownField {
11956 number: 3u32,
11957 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
11958 });
11959 }
11960 }
11961 _ => {
11962 self.__buffa_unknown_fields
11963 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
11964 }
11965 }
11966 ::core::result::Result::Ok(())
11967 }
11968 fn clear(&mut self) {
11969 self.value = ::core::option::Option::None;
11970 self.edition = ::core::option::Option::None;
11971 self.__buffa_unknown_fields.clear();
11972 }
11973 }
11974 impl ::buffa::ExtensionSet for EditionDefault {
11975 const PROTO_FQN: &'static str = "google.protobuf.FieldOptions.EditionDefault";
11976 fn unknown_fields(&self) -> &::buffa::UnknownFields {
11977 &self.__buffa_unknown_fields
11978 }
11979 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
11980 &mut self.__buffa_unknown_fields
11981 }
11982 }
11983 #[cfg(feature = "text")]
11984 impl ::buffa::text::TextFormat for EditionDefault {
11985 fn encode_text(
11986 &self,
11987 enc: &mut ::buffa::text::TextEncoder<'_>,
11988 ) -> ::core::fmt::Result {
11989 #[allow(unused_imports)]
11990 use ::buffa::Enumeration as _;
11991 if let ::core::option::Option::Some(ref __v) = self.edition {
11992 enc.write_field_name("edition")?;
11993 enc.write_enum_name(__v.proto_name())?;
11994 }
11995 if let ::core::option::Option::Some(ref __v) = self.value {
11996 enc.write_field_name("value")?;
11997 enc.write_string(__v)?;
11998 }
11999 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
12000 ::core::result::Result::Ok(())
12001 }
12002 fn merge_text(
12003 &mut self,
12004 dec: &mut ::buffa::text::TextDecoder<'_>,
12005 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
12006 #[allow(unused_imports)]
12007 use ::buffa::Enumeration as _;
12008 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
12009 match __name {
12010 "edition" => {
12011 self.edition = ::core::option::Option::Some(
12012 dec.read_closed_enum_by_name::<super::Edition>()?,
12013 );
12014 }
12015 "value" => {
12016 self.value = ::core::option::Option::Some(
12017 dec.read_string()?.into_owned(),
12018 );
12019 }
12020 _ => dec.skip_value()?,
12021 }
12022 }
12023 ::core::result::Result::Ok(())
12024 }
12025 }
12026 #[cfg(feature = "json")]
12027 impl ::buffa::json_helpers::ProtoElemJson for EditionDefault {
12028 fn serialize_proto_json<S: ::serde::Serializer>(
12029 v: &Self,
12030 s: S,
12031 ) -> ::core::result::Result<S::Ok, S::Error> {
12032 ::serde::Serialize::serialize(v, s)
12033 }
12034 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
12035 d: D,
12036 ) -> ::core::result::Result<Self, D::Error> {
12037 <Self as ::serde::Deserialize>::deserialize(d)
12038 }
12039 }
12040 #[cfg(feature = "json")]
12041 #[doc(hidden)]
12042 pub const __EDITION_DEFAULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
12043 type_url: "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault",
12044 to_json: ::buffa::type_registry::any_to_json::<EditionDefault>,
12045 from_json: ::buffa::type_registry::any_from_json::<EditionDefault>,
12046 is_wkt: false,
12047 };
12048 #[cfg(feature = "text")]
12049 #[doc(hidden)]
12050 pub const __EDITION_DEFAULT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
12051 type_url: "type.googleapis.com/google.protobuf.FieldOptions.EditionDefault",
12052 text_encode: ::buffa::type_registry::any_encode_text::<EditionDefault>,
12053 text_merge: ::buffa::type_registry::any_merge_text::<EditionDefault>,
12054 };
12055 #[derive(Clone, PartialEq, Default)]
12057 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
12058 #[cfg_attr(feature = "json", serde(default))]
12059 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12060 pub struct FeatureSupport {
12061 #[cfg_attr(
12067 feature = "json",
12068 serde(
12069 rename = "editionIntroduced",
12070 alias = "edition_introduced",
12071 with = "::buffa::json_helpers::opt_closed_enum",
12072 skip_serializing_if = "::core::option::Option::is_none"
12073 )
12074 )]
12075 pub edition_introduced: ::core::option::Option<super::Edition>,
12076 #[cfg_attr(
12081 feature = "json",
12082 serde(
12083 rename = "editionDeprecated",
12084 alias = "edition_deprecated",
12085 with = "::buffa::json_helpers::opt_closed_enum",
12086 skip_serializing_if = "::core::option::Option::is_none"
12087 )
12088 )]
12089 pub edition_deprecated: ::core::option::Option<super::Edition>,
12090 #[cfg_attr(
12095 feature = "json",
12096 serde(
12097 rename = "deprecationWarning",
12098 alias = "deprecation_warning",
12099 skip_serializing_if = "::core::option::Option::is_none"
12100 )
12101 )]
12102 pub deprecation_warning: ::core::option::Option<::buffa::alloc::string::String>,
12103 #[cfg_attr(
12109 feature = "json",
12110 serde(
12111 rename = "editionRemoved",
12112 alias = "edition_removed",
12113 with = "::buffa::json_helpers::opt_closed_enum",
12114 skip_serializing_if = "::core::option::Option::is_none"
12115 )
12116 )]
12117 pub edition_removed: ::core::option::Option<super::Edition>,
12118 #[cfg_attr(feature = "json", serde(skip))]
12119 #[doc(hidden)]
12120 pub __buffa_unknown_fields: ::buffa::UnknownFields,
12121 }
12122 impl ::core::fmt::Debug for FeatureSupport {
12123 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
12124 f.debug_struct("FeatureSupport")
12125 .field("edition_introduced", &self.edition_introduced)
12126 .field("edition_deprecated", &self.edition_deprecated)
12127 .field("deprecation_warning", &self.deprecation_warning)
12128 .field("edition_removed", &self.edition_removed)
12129 .finish()
12130 }
12131 }
12132 impl FeatureSupport {
12133 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport";
12138 }
12139 impl FeatureSupport {
12140 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12141 #[inline]
12142 pub fn with_edition_introduced(
12144 mut self,
12145 value: impl Into<super::Edition>,
12146 ) -> Self {
12147 self.edition_introduced = Some(value.into());
12148 self
12149 }
12150 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12151 #[inline]
12152 pub fn with_edition_deprecated(
12154 mut self,
12155 value: impl Into<super::Edition>,
12156 ) -> Self {
12157 self.edition_deprecated = Some(value.into());
12158 self
12159 }
12160 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12161 #[inline]
12162 pub fn with_deprecation_warning(
12164 mut self,
12165 value: impl Into<::buffa::alloc::string::String>,
12166 ) -> Self {
12167 self.deprecation_warning = Some(value.into());
12168 self
12169 }
12170 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12171 #[inline]
12172 pub fn with_edition_removed(mut self, value: impl Into<super::Edition>) -> Self {
12174 self.edition_removed = Some(value.into());
12175 self
12176 }
12177 }
12178 impl ::buffa::DefaultInstance for FeatureSupport {
12179 fn default_instance() -> &'static Self {
12180 static VALUE: ::buffa::__private::OnceBox<FeatureSupport> = ::buffa::__private::OnceBox::new();
12181 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
12182 }
12183 }
12184 impl ::buffa::MessageName for FeatureSupport {
12185 const PACKAGE: &'static str = "google.protobuf";
12186 const NAME: &'static str = "FieldOptions.FeatureSupport";
12187 const FULL_NAME: &'static str = "google.protobuf.FieldOptions.FeatureSupport";
12188 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport";
12189 }
12190 impl ::buffa::Message for FeatureSupport {
12191 #[allow(clippy::let_and_return)]
12197 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
12198 #[allow(unused_imports)]
12199 use ::buffa::Enumeration as _;
12200 let mut size = 0u32;
12201 if let Some(ref v) = self.edition_introduced {
12202 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
12203 }
12204 if let Some(ref v) = self.edition_deprecated {
12205 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
12206 }
12207 if let Some(ref v) = self.deprecation_warning {
12208 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
12209 }
12210 if let Some(ref v) = self.edition_removed {
12211 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
12212 }
12213 size += self.__buffa_unknown_fields.encoded_len() as u32;
12214 size
12215 }
12216 fn write_to(
12217 &self,
12218 _cache: &mut ::buffa::SizeCache,
12219 buf: &mut impl ::buffa::bytes::BufMut,
12220 ) {
12221 #[allow(unused_imports)]
12222 use ::buffa::Enumeration as _;
12223 if let Some(ref v) = self.edition_introduced {
12224 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
12225 .encode(buf);
12226 ::buffa::types::encode_int32(v.to_i32(), buf);
12227 }
12228 if let Some(ref v) = self.edition_deprecated {
12229 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
12230 .encode(buf);
12231 ::buffa::types::encode_int32(v.to_i32(), buf);
12232 }
12233 if let Some(ref v) = self.deprecation_warning {
12234 ::buffa::encoding::Tag::new(
12235 3u32,
12236 ::buffa::encoding::WireType::LengthDelimited,
12237 )
12238 .encode(buf);
12239 ::buffa::types::encode_string(v, buf);
12240 }
12241 if let Some(ref v) = self.edition_removed {
12242 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
12243 .encode(buf);
12244 ::buffa::types::encode_int32(v.to_i32(), buf);
12245 }
12246 self.__buffa_unknown_fields.write_to(buf);
12247 }
12248 fn merge_field(
12249 &mut self,
12250 tag: ::buffa::encoding::Tag,
12251 buf: &mut impl ::buffa::bytes::Buf,
12252 depth: u32,
12253 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
12254 #[allow(unused_imports)]
12255 use ::buffa::bytes::Buf as _;
12256 #[allow(unused_imports)]
12257 use ::buffa::Enumeration as _;
12258 match tag.field_number() {
12259 1u32 => {
12260 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
12261 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12262 field_number: 1u32,
12263 expected: 0u8,
12264 actual: tag.wire_type() as u8,
12265 });
12266 }
12267 let __raw = ::buffa::types::decode_int32(buf)?;
12268 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
12269 __raw,
12270 ) {
12271 self.edition_introduced = ::core::option::Option::Some(__v);
12272 } else {
12273 self.__buffa_unknown_fields
12274 .push(::buffa::UnknownField {
12275 number: 1u32,
12276 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
12277 });
12278 }
12279 }
12280 2u32 => {
12281 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
12282 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12283 field_number: 2u32,
12284 expected: 0u8,
12285 actual: tag.wire_type() as u8,
12286 });
12287 }
12288 let __raw = ::buffa::types::decode_int32(buf)?;
12289 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
12290 __raw,
12291 ) {
12292 self.edition_deprecated = ::core::option::Option::Some(__v);
12293 } else {
12294 self.__buffa_unknown_fields
12295 .push(::buffa::UnknownField {
12296 number: 2u32,
12297 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
12298 });
12299 }
12300 }
12301 3u32 => {
12302 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
12303 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12304 field_number: 3u32,
12305 expected: 2u8,
12306 actual: tag.wire_type() as u8,
12307 });
12308 }
12309 ::buffa::types::merge_string(
12310 self
12311 .deprecation_warning
12312 .get_or_insert_with(::buffa::alloc::string::String::new),
12313 buf,
12314 )?;
12315 }
12316 4u32 => {
12317 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
12318 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12319 field_number: 4u32,
12320 expected: 0u8,
12321 actual: tag.wire_type() as u8,
12322 });
12323 }
12324 let __raw = ::buffa::types::decode_int32(buf)?;
12325 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
12326 __raw,
12327 ) {
12328 self.edition_removed = ::core::option::Option::Some(__v);
12329 } else {
12330 self.__buffa_unknown_fields
12331 .push(::buffa::UnknownField {
12332 number: 4u32,
12333 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
12334 });
12335 }
12336 }
12337 _ => {
12338 self.__buffa_unknown_fields
12339 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
12340 }
12341 }
12342 ::core::result::Result::Ok(())
12343 }
12344 fn clear(&mut self) {
12345 self.edition_introduced = ::core::option::Option::None;
12346 self.edition_deprecated = ::core::option::Option::None;
12347 self.deprecation_warning = ::core::option::Option::None;
12348 self.edition_removed = ::core::option::Option::None;
12349 self.__buffa_unknown_fields.clear();
12350 }
12351 }
12352 impl ::buffa::ExtensionSet for FeatureSupport {
12353 const PROTO_FQN: &'static str = "google.protobuf.FieldOptions.FeatureSupport";
12354 fn unknown_fields(&self) -> &::buffa::UnknownFields {
12355 &self.__buffa_unknown_fields
12356 }
12357 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
12358 &mut self.__buffa_unknown_fields
12359 }
12360 }
12361 #[cfg(feature = "text")]
12362 impl ::buffa::text::TextFormat for FeatureSupport {
12363 fn encode_text(
12364 &self,
12365 enc: &mut ::buffa::text::TextEncoder<'_>,
12366 ) -> ::core::fmt::Result {
12367 #[allow(unused_imports)]
12368 use ::buffa::Enumeration as _;
12369 if let ::core::option::Option::Some(ref __v) = self.edition_introduced {
12370 enc.write_field_name("edition_introduced")?;
12371 enc.write_enum_name(__v.proto_name())?;
12372 }
12373 if let ::core::option::Option::Some(ref __v) = self.edition_deprecated {
12374 enc.write_field_name("edition_deprecated")?;
12375 enc.write_enum_name(__v.proto_name())?;
12376 }
12377 if let ::core::option::Option::Some(ref __v) = self.deprecation_warning {
12378 enc.write_field_name("deprecation_warning")?;
12379 enc.write_string(__v)?;
12380 }
12381 if let ::core::option::Option::Some(ref __v) = self.edition_removed {
12382 enc.write_field_name("edition_removed")?;
12383 enc.write_enum_name(__v.proto_name())?;
12384 }
12385 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
12386 ::core::result::Result::Ok(())
12387 }
12388 fn merge_text(
12389 &mut self,
12390 dec: &mut ::buffa::text::TextDecoder<'_>,
12391 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
12392 #[allow(unused_imports)]
12393 use ::buffa::Enumeration as _;
12394 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
12395 match __name {
12396 "edition_introduced" => {
12397 self.edition_introduced = ::core::option::Option::Some(
12398 dec.read_closed_enum_by_name::<super::Edition>()?,
12399 );
12400 }
12401 "edition_deprecated" => {
12402 self.edition_deprecated = ::core::option::Option::Some(
12403 dec.read_closed_enum_by_name::<super::Edition>()?,
12404 );
12405 }
12406 "deprecation_warning" => {
12407 self.deprecation_warning = ::core::option::Option::Some(
12408 dec.read_string()?.into_owned(),
12409 );
12410 }
12411 "edition_removed" => {
12412 self.edition_removed = ::core::option::Option::Some(
12413 dec.read_closed_enum_by_name::<super::Edition>()?,
12414 );
12415 }
12416 _ => dec.skip_value()?,
12417 }
12418 }
12419 ::core::result::Result::Ok(())
12420 }
12421 }
12422 #[cfg(feature = "json")]
12423 impl ::buffa::json_helpers::ProtoElemJson for FeatureSupport {
12424 fn serialize_proto_json<S: ::serde::Serializer>(
12425 v: &Self,
12426 s: S,
12427 ) -> ::core::result::Result<S::Ok, S::Error> {
12428 ::serde::Serialize::serialize(v, s)
12429 }
12430 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
12431 d: D,
12432 ) -> ::core::result::Result<Self, D::Error> {
12433 <Self as ::serde::Deserialize>::deserialize(d)
12434 }
12435 }
12436 #[cfg(feature = "json")]
12437 #[doc(hidden)]
12438 pub const __FEATURE_SUPPORT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
12439 type_url: "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport",
12440 to_json: ::buffa::type_registry::any_to_json::<FeatureSupport>,
12441 from_json: ::buffa::type_registry::any_from_json::<FeatureSupport>,
12442 is_wkt: false,
12443 };
12444 #[cfg(feature = "text")]
12445 #[doc(hidden)]
12446 pub const __FEATURE_SUPPORT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
12447 type_url: "type.googleapis.com/google.protobuf.FieldOptions.FeatureSupport",
12448 text_encode: ::buffa::type_registry::any_encode_text::<FeatureSupport>,
12449 text_merge: ::buffa::type_registry::any_merge_text::<FeatureSupport>,
12450 };
12451 #[cfg(feature = "views")]
12452 #[doc(inline)]
12453 pub use super::__buffa::view::field_options::EditionDefaultView;
12454 #[cfg(feature = "views")]
12455 #[doc(inline)]
12456 pub use super::__buffa::view::field_options::FeatureSupportView;
12457}
12458#[derive(Clone, PartialEq, Default)]
12459#[cfg_attr(feature = "json", derive(::serde::Serialize))]
12460#[cfg_attr(feature = "json", serde(default))]
12461#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12462pub struct OneofOptions {
12463 #[cfg_attr(
12470 feature = "json",
12471 serde(
12472 rename = "features",
12473 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
12474 )
12475 )]
12476 pub features: ::buffa::MessageField<FeatureSet>,
12477 #[cfg_attr(
12481 feature = "json",
12482 serde(
12483 rename = "uninterpretedOption",
12484 alias = "uninterpreted_option",
12485 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
12486 deserialize_with = "::buffa::json_helpers::null_as_default"
12487 )
12488 )]
12489 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
12490 #[cfg_attr(feature = "json", serde(flatten))]
12491 #[doc(hidden)]
12492 pub __buffa_unknown_fields: __OneofOptionsExtJson,
12493}
12494impl ::core::fmt::Debug for OneofOptions {
12495 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
12496 f.debug_struct("OneofOptions")
12497 .field("features", &self.features)
12498 .field("uninterpreted_option", &self.uninterpreted_option)
12499 .finish()
12500 }
12501}
12502impl OneofOptions {
12503 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.OneofOptions";
12508}
12509impl ::buffa::DefaultInstance for OneofOptions {
12510 fn default_instance() -> &'static Self {
12511 static VALUE: ::buffa::__private::OnceBox<OneofOptions> = ::buffa::__private::OnceBox::new();
12512 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
12513 }
12514}
12515impl ::buffa::MessageName for OneofOptions {
12516 const PACKAGE: &'static str = "google.protobuf";
12517 const NAME: &'static str = "OneofOptions";
12518 const FULL_NAME: &'static str = "google.protobuf.OneofOptions";
12519 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.OneofOptions";
12520}
12521impl ::buffa::Message for OneofOptions {
12522 #[allow(clippy::let_and_return)]
12528 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
12529 #[allow(unused_imports)]
12530 use ::buffa::Enumeration as _;
12531 let mut size = 0u32;
12532 if self.features.is_set() {
12533 let __slot = __cache.reserve();
12534 let inner_size = self.features.compute_size(__cache);
12535 __cache.set(__slot, inner_size);
12536 size
12537 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12538 + inner_size;
12539 }
12540 for v in &self.uninterpreted_option {
12541 let __slot = __cache.reserve();
12542 let inner_size = v.compute_size(__cache);
12543 __cache.set(__slot, inner_size);
12544 size
12545 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
12546 + inner_size;
12547 }
12548 size += self.__buffa_unknown_fields.encoded_len() as u32;
12549 size
12550 }
12551 fn write_to(
12552 &self,
12553 __cache: &mut ::buffa::SizeCache,
12554 buf: &mut impl ::buffa::bytes::BufMut,
12555 ) {
12556 #[allow(unused_imports)]
12557 use ::buffa::Enumeration as _;
12558 if self.features.is_set() {
12559 ::buffa::encoding::Tag::new(
12560 1u32,
12561 ::buffa::encoding::WireType::LengthDelimited,
12562 )
12563 .encode(buf);
12564 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
12565 self.features.write_to(__cache, buf);
12566 }
12567 for v in &self.uninterpreted_option {
12568 ::buffa::encoding::Tag::new(
12569 999u32,
12570 ::buffa::encoding::WireType::LengthDelimited,
12571 )
12572 .encode(buf);
12573 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
12574 v.write_to(__cache, buf);
12575 }
12576 self.__buffa_unknown_fields.write_to(buf);
12577 }
12578 fn merge_field(
12579 &mut self,
12580 tag: ::buffa::encoding::Tag,
12581 buf: &mut impl ::buffa::bytes::Buf,
12582 depth: u32,
12583 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
12584 #[allow(unused_imports)]
12585 use ::buffa::bytes::Buf as _;
12586 #[allow(unused_imports)]
12587 use ::buffa::Enumeration as _;
12588 match tag.field_number() {
12589 1u32 => {
12590 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
12591 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12592 field_number: 1u32,
12593 expected: 2u8,
12594 actual: tag.wire_type() as u8,
12595 });
12596 }
12597 ::buffa::Message::merge_length_delimited(
12598 self.features.get_or_insert_default(),
12599 buf,
12600 depth,
12601 )?;
12602 }
12603 999u32 => {
12604 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
12605 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
12606 field_number: 999u32,
12607 expected: 2u8,
12608 actual: tag.wire_type() as u8,
12609 });
12610 }
12611 let mut elem = ::core::default::Default::default();
12612 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
12613 self.uninterpreted_option.push(elem);
12614 }
12615 _ => {
12616 self.__buffa_unknown_fields
12617 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
12618 }
12619 }
12620 ::core::result::Result::Ok(())
12621 }
12622 fn clear(&mut self) {
12623 self.features = ::buffa::MessageField::none();
12624 self.uninterpreted_option.clear();
12625 self.__buffa_unknown_fields.clear();
12626 }
12627}
12628impl ::buffa::ExtensionSet for OneofOptions {
12629 const PROTO_FQN: &'static str = "google.protobuf.OneofOptions";
12630 fn unknown_fields(&self) -> &::buffa::UnknownFields {
12631 &self.__buffa_unknown_fields
12632 }
12633 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
12634 &mut self.__buffa_unknown_fields
12635 }
12636}
12637#[cfg(feature = "text")]
12638impl ::buffa::text::TextFormat for OneofOptions {
12639 fn encode_text(
12640 &self,
12641 enc: &mut ::buffa::text::TextEncoder<'_>,
12642 ) -> ::core::fmt::Result {
12643 #[allow(unused_imports)]
12644 use ::buffa::Enumeration as _;
12645 if self.features.is_set() {
12646 enc.write_field_name("features")?;
12647 enc.write_message(&*self.features)?;
12648 }
12649 for __v in &self.uninterpreted_option {
12650 enc.write_field_name("uninterpreted_option")?;
12651 enc.write_message(__v)?;
12652 }
12653 enc.write_extension_fields(
12654 "google.protobuf.OneofOptions",
12655 &self.__buffa_unknown_fields,
12656 )?;
12657 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
12658 ::core::result::Result::Ok(())
12659 }
12660 fn merge_text(
12661 &mut self,
12662 dec: &mut ::buffa::text::TextDecoder<'_>,
12663 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
12664 #[allow(unused_imports)]
12665 use ::buffa::Enumeration as _;
12666 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
12667 match __name {
12668 "features" => dec.merge_message(self.features.get_or_insert_default())?,
12669 "uninterpreted_option" => {
12670 dec.read_repeated_into(
12671 &mut self.uninterpreted_option,
12672 |__d| {
12673 let mut __m = ::core::default::Default::default();
12674 __d.merge_message(&mut __m)?;
12675 ::core::result::Result::Ok(__m)
12676 },
12677 )?
12678 }
12679 __name if __name.starts_with('[') => {
12680 for __r in dec
12681 .read_extension(__name, "google.protobuf.OneofOptions")?
12682 {
12683 self.__buffa_unknown_fields.push(__r);
12684 }
12685 }
12686 _ => dec.skip_value()?,
12687 }
12688 }
12689 ::core::result::Result::Ok(())
12690 }
12691}
12692#[cfg(feature = "json")]
12693impl<'de> serde::Deserialize<'de> for OneofOptions {
12694 fn deserialize<D: serde::Deserializer<'de>>(
12695 d: D,
12696 ) -> ::core::result::Result<Self, D::Error> {
12697 struct _V;
12698 impl<'de> serde::de::Visitor<'de> for _V {
12699 type Value = OneofOptions;
12700 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
12701 f.write_str("struct OneofOptions")
12702 }
12703 #[allow(clippy::field_reassign_with_default)]
12704 fn visit_map<A: serde::de::MapAccess<'de>>(
12705 self,
12706 mut map: A,
12707 ) -> ::core::result::Result<OneofOptions, A::Error> {
12708 let mut __f_features: ::core::option::Option<
12709 ::buffa::MessageField<FeatureSet>,
12710 > = None;
12711 let mut __f_uninterpreted_option: ::core::option::Option<
12712 ::buffa::alloc::vec::Vec<UninterpretedOption>,
12713 > = None;
12714 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
12715 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
12716 match key.as_str() {
12717 "features" => {
12718 __f_features = Some(
12719 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
12720 );
12721 }
12722 "uninterpretedOption" | "uninterpreted_option" => {
12723 __f_uninterpreted_option = Some({
12724 struct _S;
12725 impl<'de> serde::de::DeserializeSeed<'de> for _S {
12726 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
12727 fn deserialize<D: serde::Deserializer<'de>>(
12728 self,
12729 d: D,
12730 ) -> ::core::result::Result<
12731 ::buffa::alloc::vec::Vec<UninterpretedOption>,
12732 D::Error,
12733 > {
12734 ::buffa::json_helpers::null_as_default(d)
12735 }
12736 }
12737 map.next_value_seed(_S)?
12738 });
12739 }
12740 __k if __k.starts_with('[') => {
12741 let __v: ::buffa::serde_json::Value = map.next_value()?;
12742 match ::buffa::extension_registry::deserialize_extension_key(
12743 "google.protobuf.OneofOptions",
12744 __k,
12745 __v,
12746 ) {
12747 ::core::option::Option::Some(
12748 ::core::result::Result::Ok(__recs),
12749 ) => {
12750 for __rec in __recs {
12751 __ext_records.push(__rec);
12752 }
12753 }
12754 ::core::option::Option::Some(
12755 ::core::result::Result::Err(__e),
12756 ) => {
12757 return ::core::result::Result::Err(
12758 <A::Error as ::serde::de::Error>::custom(__e),
12759 );
12760 }
12761 ::core::option::Option::None => {}
12762 }
12763 }
12764 _ => {
12765 map.next_value::<serde::de::IgnoredAny>()?;
12766 }
12767 }
12768 }
12769 let mut __r = <OneofOptions as ::core::default::Default>::default();
12770 if let ::core::option::Option::Some(v) = __f_features {
12771 __r.features = v;
12772 }
12773 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
12774 __r.uninterpreted_option = v;
12775 }
12776 for __rec in __ext_records {
12777 __r.__buffa_unknown_fields.push(__rec);
12778 }
12779 Ok(__r)
12780 }
12781 }
12782 d.deserialize_map(_V)
12783 }
12784}
12785#[cfg(feature = "json")]
12786impl ::buffa::json_helpers::ProtoElemJson for OneofOptions {
12787 fn serialize_proto_json<S: ::serde::Serializer>(
12788 v: &Self,
12789 s: S,
12790 ) -> ::core::result::Result<S::Ok, S::Error> {
12791 ::serde::Serialize::serialize(v, s)
12792 }
12793 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
12794 d: D,
12795 ) -> ::core::result::Result<Self, D::Error> {
12796 <Self as ::serde::Deserialize>::deserialize(d)
12797 }
12798}
12799#[doc(hidden)]
12800#[derive(Clone, Debug, Default, PartialEq)]
12801#[repr(transparent)]
12802#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12803pub struct __OneofOptionsExtJson(pub ::buffa::UnknownFields);
12804impl ::core::ops::Deref for __OneofOptionsExtJson {
12805 type Target = ::buffa::UnknownFields;
12806 fn deref(&self) -> &::buffa::UnknownFields {
12807 &self.0
12808 }
12809}
12810impl ::core::ops::DerefMut for __OneofOptionsExtJson {
12811 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
12812 &mut self.0
12813 }
12814}
12815impl ::core::convert::From<::buffa::UnknownFields> for __OneofOptionsExtJson {
12816 fn from(u: ::buffa::UnknownFields) -> Self {
12817 Self(u)
12818 }
12819}
12820#[cfg(feature = "json")]
12821impl ::serde::Serialize for __OneofOptionsExtJson {
12822 fn serialize<S: ::serde::Serializer>(
12823 &self,
12824 s: S,
12825 ) -> ::core::result::Result<S::Ok, S::Error> {
12826 ::buffa::extension_registry::serialize_extensions(
12827 "google.protobuf.OneofOptions",
12828 &self.0,
12829 s,
12830 )
12831 }
12832}
12833#[cfg(feature = "json")]
12834impl<'de> ::serde::Deserialize<'de> for __OneofOptionsExtJson {
12835 fn deserialize<D: ::serde::Deserializer<'de>>(
12836 d: D,
12837 ) -> ::core::result::Result<Self, D::Error> {
12838 ::buffa::extension_registry::deserialize_extensions(
12839 "google.protobuf.OneofOptions",
12840 d,
12841 )
12842 .map(Self)
12843 }
12844}
12845#[cfg(feature = "json")]
12846#[doc(hidden)]
12847pub const __ONEOF_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
12848 type_url: "type.googleapis.com/google.protobuf.OneofOptions",
12849 to_json: ::buffa::type_registry::any_to_json::<OneofOptions>,
12850 from_json: ::buffa::type_registry::any_from_json::<OneofOptions>,
12851 is_wkt: false,
12852};
12853#[cfg(feature = "text")]
12854#[doc(hidden)]
12855pub const __ONEOF_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
12856 type_url: "type.googleapis.com/google.protobuf.OneofOptions",
12857 text_encode: ::buffa::type_registry::any_encode_text::<OneofOptions>,
12858 text_merge: ::buffa::type_registry::any_merge_text::<OneofOptions>,
12859};
12860#[derive(Clone, PartialEq, Default)]
12861#[cfg_attr(feature = "json", derive(::serde::Serialize))]
12862#[cfg_attr(feature = "json", serde(default))]
12863#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12864pub struct EnumOptions {
12865 #[cfg_attr(
12870 feature = "json",
12871 serde(
12872 rename = "allowAlias",
12873 alias = "allow_alias",
12874 skip_serializing_if = "::core::option::Option::is_none"
12875 )
12876 )]
12877 pub allow_alias: ::core::option::Option<bool>,
12878 #[cfg_attr(
12885 feature = "json",
12886 serde(
12887 rename = "deprecated",
12888 skip_serializing_if = "::core::option::Option::is_none"
12889 )
12890 )]
12891 pub deprecated: ::core::option::Option<bool>,
12892 #[cfg_attr(
12901 feature = "json",
12902 serde(
12903 rename = "deprecatedLegacyJsonFieldConflicts",
12904 alias = "deprecated_legacy_json_field_conflicts",
12905 skip_serializing_if = "::core::option::Option::is_none"
12906 )
12907 )]
12908 pub deprecated_legacy_json_field_conflicts: ::core::option::Option<bool>,
12909 #[cfg_attr(
12916 feature = "json",
12917 serde(
12918 rename = "features",
12919 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
12920 )
12921 )]
12922 pub features: ::buffa::MessageField<FeatureSet>,
12923 #[cfg_attr(
12927 feature = "json",
12928 serde(
12929 rename = "uninterpretedOption",
12930 alias = "uninterpreted_option",
12931 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
12932 deserialize_with = "::buffa::json_helpers::null_as_default"
12933 )
12934 )]
12935 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
12936 #[cfg_attr(feature = "json", serde(flatten))]
12937 #[doc(hidden)]
12938 pub __buffa_unknown_fields: __EnumOptionsExtJson,
12939}
12940impl ::core::fmt::Debug for EnumOptions {
12941 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
12942 f.debug_struct("EnumOptions")
12943 .field("allow_alias", &self.allow_alias)
12944 .field("deprecated", &self.deprecated)
12945 .field(
12946 "deprecated_legacy_json_field_conflicts",
12947 &self.deprecated_legacy_json_field_conflicts,
12948 )
12949 .field("features", &self.features)
12950 .field("uninterpreted_option", &self.uninterpreted_option)
12951 .finish()
12952 }
12953}
12954impl EnumOptions {
12955 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumOptions";
12960}
12961impl EnumOptions {
12962 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12963 #[inline]
12964 pub fn with_allow_alias(mut self, value: bool) -> Self {
12966 self.allow_alias = Some(value);
12967 self
12968 }
12969 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12970 #[inline]
12971 pub fn with_deprecated(mut self, value: bool) -> Self {
12973 self.deprecated = Some(value);
12974 self
12975 }
12976 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
12977 #[inline]
12978 pub fn with_deprecated_legacy_json_field_conflicts(mut self, value: bool) -> Self {
12980 self.deprecated_legacy_json_field_conflicts = Some(value);
12981 self
12982 }
12983}
12984impl ::buffa::DefaultInstance for EnumOptions {
12985 fn default_instance() -> &'static Self {
12986 static VALUE: ::buffa::__private::OnceBox<EnumOptions> = ::buffa::__private::OnceBox::new();
12987 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
12988 }
12989}
12990impl ::buffa::MessageName for EnumOptions {
12991 const PACKAGE: &'static str = "google.protobuf";
12992 const NAME: &'static str = "EnumOptions";
12993 const FULL_NAME: &'static str = "google.protobuf.EnumOptions";
12994 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumOptions";
12995}
12996impl ::buffa::Message for EnumOptions {
12997 #[allow(clippy::let_and_return)]
13003 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13004 #[allow(unused_imports)]
13005 use ::buffa::Enumeration as _;
13006 let mut size = 0u32;
13007 if self.allow_alias.is_some() {
13008 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13009 }
13010 if self.deprecated.is_some() {
13011 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13012 }
13013 if self.deprecated_legacy_json_field_conflicts.is_some() {
13014 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13015 }
13016 if self.features.is_set() {
13017 let __slot = __cache.reserve();
13018 let inner_size = self.features.compute_size(__cache);
13019 __cache.set(__slot, inner_size);
13020 size
13021 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13022 + inner_size;
13023 }
13024 for v in &self.uninterpreted_option {
13025 let __slot = __cache.reserve();
13026 let inner_size = v.compute_size(__cache);
13027 __cache.set(__slot, inner_size);
13028 size
13029 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13030 + inner_size;
13031 }
13032 size += self.__buffa_unknown_fields.encoded_len() as u32;
13033 size
13034 }
13035 fn write_to(
13036 &self,
13037 __cache: &mut ::buffa::SizeCache,
13038 buf: &mut impl ::buffa::bytes::BufMut,
13039 ) {
13040 #[allow(unused_imports)]
13041 use ::buffa::Enumeration as _;
13042 if let Some(v) = self.allow_alias {
13043 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
13044 .encode(buf);
13045 ::buffa::types::encode_bool(v, buf);
13046 }
13047 if let Some(v) = self.deprecated {
13048 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
13049 .encode(buf);
13050 ::buffa::types::encode_bool(v, buf);
13051 }
13052 if let Some(v) = self.deprecated_legacy_json_field_conflicts {
13053 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
13054 .encode(buf);
13055 ::buffa::types::encode_bool(v, buf);
13056 }
13057 if self.features.is_set() {
13058 ::buffa::encoding::Tag::new(
13059 7u32,
13060 ::buffa::encoding::WireType::LengthDelimited,
13061 )
13062 .encode(buf);
13063 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
13064 self.features.write_to(__cache, buf);
13065 }
13066 for v in &self.uninterpreted_option {
13067 ::buffa::encoding::Tag::new(
13068 999u32,
13069 ::buffa::encoding::WireType::LengthDelimited,
13070 )
13071 .encode(buf);
13072 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
13073 v.write_to(__cache, buf);
13074 }
13075 self.__buffa_unknown_fields.write_to(buf);
13076 }
13077 fn merge_field(
13078 &mut self,
13079 tag: ::buffa::encoding::Tag,
13080 buf: &mut impl ::buffa::bytes::Buf,
13081 depth: u32,
13082 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
13083 #[allow(unused_imports)]
13084 use ::buffa::bytes::Buf as _;
13085 #[allow(unused_imports)]
13086 use ::buffa::Enumeration as _;
13087 match tag.field_number() {
13088 2u32 => {
13089 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
13090 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13091 field_number: 2u32,
13092 expected: 0u8,
13093 actual: tag.wire_type() as u8,
13094 });
13095 }
13096 self.allow_alias = ::core::option::Option::Some(
13097 ::buffa::types::decode_bool(buf)?,
13098 );
13099 }
13100 3u32 => {
13101 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
13102 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13103 field_number: 3u32,
13104 expected: 0u8,
13105 actual: tag.wire_type() as u8,
13106 });
13107 }
13108 self.deprecated = ::core::option::Option::Some(
13109 ::buffa::types::decode_bool(buf)?,
13110 );
13111 }
13112 6u32 => {
13113 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
13114 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13115 field_number: 6u32,
13116 expected: 0u8,
13117 actual: tag.wire_type() as u8,
13118 });
13119 }
13120 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::Some(
13121 ::buffa::types::decode_bool(buf)?,
13122 );
13123 }
13124 7u32 => {
13125 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
13126 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13127 field_number: 7u32,
13128 expected: 2u8,
13129 actual: tag.wire_type() as u8,
13130 });
13131 }
13132 ::buffa::Message::merge_length_delimited(
13133 self.features.get_or_insert_default(),
13134 buf,
13135 depth,
13136 )?;
13137 }
13138 999u32 => {
13139 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
13140 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13141 field_number: 999u32,
13142 expected: 2u8,
13143 actual: tag.wire_type() as u8,
13144 });
13145 }
13146 let mut elem = ::core::default::Default::default();
13147 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
13148 self.uninterpreted_option.push(elem);
13149 }
13150 _ => {
13151 self.__buffa_unknown_fields
13152 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
13153 }
13154 }
13155 ::core::result::Result::Ok(())
13156 }
13157 fn clear(&mut self) {
13158 self.allow_alias = ::core::option::Option::None;
13159 self.deprecated = ::core::option::Option::None;
13160 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::None;
13161 self.features = ::buffa::MessageField::none();
13162 self.uninterpreted_option.clear();
13163 self.__buffa_unknown_fields.clear();
13164 }
13165}
13166impl ::buffa::ExtensionSet for EnumOptions {
13167 const PROTO_FQN: &'static str = "google.protobuf.EnumOptions";
13168 fn unknown_fields(&self) -> &::buffa::UnknownFields {
13169 &self.__buffa_unknown_fields
13170 }
13171 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
13172 &mut self.__buffa_unknown_fields
13173 }
13174}
13175#[cfg(feature = "text")]
13176impl ::buffa::text::TextFormat for EnumOptions {
13177 fn encode_text(
13178 &self,
13179 enc: &mut ::buffa::text::TextEncoder<'_>,
13180 ) -> ::core::fmt::Result {
13181 #[allow(unused_imports)]
13182 use ::buffa::Enumeration as _;
13183 if let ::core::option::Option::Some(ref __v) = self.allow_alias {
13184 enc.write_field_name("allow_alias")?;
13185 enc.write_bool(*__v)?;
13186 }
13187 if let ::core::option::Option::Some(ref __v) = self.deprecated {
13188 enc.write_field_name("deprecated")?;
13189 enc.write_bool(*__v)?;
13190 }
13191 if let ::core::option::Option::Some(ref __v) = self
13192 .deprecated_legacy_json_field_conflicts
13193 {
13194 enc.write_field_name("deprecated_legacy_json_field_conflicts")?;
13195 enc.write_bool(*__v)?;
13196 }
13197 if self.features.is_set() {
13198 enc.write_field_name("features")?;
13199 enc.write_message(&*self.features)?;
13200 }
13201 for __v in &self.uninterpreted_option {
13202 enc.write_field_name("uninterpreted_option")?;
13203 enc.write_message(__v)?;
13204 }
13205 enc.write_extension_fields(
13206 "google.protobuf.EnumOptions",
13207 &self.__buffa_unknown_fields,
13208 )?;
13209 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
13210 ::core::result::Result::Ok(())
13211 }
13212 fn merge_text(
13213 &mut self,
13214 dec: &mut ::buffa::text::TextDecoder<'_>,
13215 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
13216 #[allow(unused_imports)]
13217 use ::buffa::Enumeration as _;
13218 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
13219 match __name {
13220 "allow_alias" => {
13221 self.allow_alias = ::core::option::Option::Some(dec.read_bool()?);
13222 }
13223 "deprecated" => {
13224 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
13225 }
13226 "deprecated_legacy_json_field_conflicts" => {
13227 self.deprecated_legacy_json_field_conflicts = ::core::option::Option::Some(
13228 dec.read_bool()?,
13229 );
13230 }
13231 "features" => dec.merge_message(self.features.get_or_insert_default())?,
13232 "uninterpreted_option" => {
13233 dec.read_repeated_into(
13234 &mut self.uninterpreted_option,
13235 |__d| {
13236 let mut __m = ::core::default::Default::default();
13237 __d.merge_message(&mut __m)?;
13238 ::core::result::Result::Ok(__m)
13239 },
13240 )?
13241 }
13242 __name if __name.starts_with('[') => {
13243 for __r in dec.read_extension(__name, "google.protobuf.EnumOptions")?
13244 {
13245 self.__buffa_unknown_fields.push(__r);
13246 }
13247 }
13248 _ => dec.skip_value()?,
13249 }
13250 }
13251 ::core::result::Result::Ok(())
13252 }
13253}
13254#[cfg(feature = "json")]
13255impl<'de> serde::Deserialize<'de> for EnumOptions {
13256 fn deserialize<D: serde::Deserializer<'de>>(
13257 d: D,
13258 ) -> ::core::result::Result<Self, D::Error> {
13259 struct _V;
13260 impl<'de> serde::de::Visitor<'de> for _V {
13261 type Value = EnumOptions;
13262 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13263 f.write_str("struct EnumOptions")
13264 }
13265 #[allow(clippy::field_reassign_with_default)]
13266 fn visit_map<A: serde::de::MapAccess<'de>>(
13267 self,
13268 mut map: A,
13269 ) -> ::core::result::Result<EnumOptions, A::Error> {
13270 let mut __f_allow_alias: ::core::option::Option<
13271 ::core::option::Option<bool>,
13272 > = None;
13273 let mut __f_deprecated: ::core::option::Option<
13274 ::core::option::Option<bool>,
13275 > = None;
13276 let mut __f_deprecated_legacy_json_field_conflicts: ::core::option::Option<
13277 ::core::option::Option<bool>,
13278 > = None;
13279 let mut __f_features: ::core::option::Option<
13280 ::buffa::MessageField<FeatureSet>,
13281 > = None;
13282 let mut __f_uninterpreted_option: ::core::option::Option<
13283 ::buffa::alloc::vec::Vec<UninterpretedOption>,
13284 > = None;
13285 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
13286 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
13287 match key.as_str() {
13288 "allowAlias" | "allow_alias" => {
13289 __f_allow_alias = Some(
13290 map.next_value::<::core::option::Option<bool>>()?,
13291 );
13292 }
13293 "deprecated" => {
13294 __f_deprecated = Some(
13295 map.next_value::<::core::option::Option<bool>>()?,
13296 );
13297 }
13298 "deprecatedLegacyJsonFieldConflicts"
13299 | "deprecated_legacy_json_field_conflicts" => {
13300 __f_deprecated_legacy_json_field_conflicts = Some(
13301 map.next_value::<::core::option::Option<bool>>()?,
13302 );
13303 }
13304 "features" => {
13305 __f_features = Some(
13306 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
13307 );
13308 }
13309 "uninterpretedOption" | "uninterpreted_option" => {
13310 __f_uninterpreted_option = Some({
13311 struct _S;
13312 impl<'de> serde::de::DeserializeSeed<'de> for _S {
13313 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
13314 fn deserialize<D: serde::Deserializer<'de>>(
13315 self,
13316 d: D,
13317 ) -> ::core::result::Result<
13318 ::buffa::alloc::vec::Vec<UninterpretedOption>,
13319 D::Error,
13320 > {
13321 ::buffa::json_helpers::null_as_default(d)
13322 }
13323 }
13324 map.next_value_seed(_S)?
13325 });
13326 }
13327 __k if __k.starts_with('[') => {
13328 let __v: ::buffa::serde_json::Value = map.next_value()?;
13329 match ::buffa::extension_registry::deserialize_extension_key(
13330 "google.protobuf.EnumOptions",
13331 __k,
13332 __v,
13333 ) {
13334 ::core::option::Option::Some(
13335 ::core::result::Result::Ok(__recs),
13336 ) => {
13337 for __rec in __recs {
13338 __ext_records.push(__rec);
13339 }
13340 }
13341 ::core::option::Option::Some(
13342 ::core::result::Result::Err(__e),
13343 ) => {
13344 return ::core::result::Result::Err(
13345 <A::Error as ::serde::de::Error>::custom(__e),
13346 );
13347 }
13348 ::core::option::Option::None => {}
13349 }
13350 }
13351 _ => {
13352 map.next_value::<serde::de::IgnoredAny>()?;
13353 }
13354 }
13355 }
13356 let mut __r = <EnumOptions as ::core::default::Default>::default();
13357 if let ::core::option::Option::Some(v) = __f_allow_alias {
13358 __r.allow_alias = v;
13359 }
13360 if let ::core::option::Option::Some(v) = __f_deprecated {
13361 __r.deprecated = v;
13362 }
13363 if let ::core::option::Option::Some(v) = __f_deprecated_legacy_json_field_conflicts {
13364 __r.deprecated_legacy_json_field_conflicts = v;
13365 }
13366 if let ::core::option::Option::Some(v) = __f_features {
13367 __r.features = v;
13368 }
13369 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
13370 __r.uninterpreted_option = v;
13371 }
13372 for __rec in __ext_records {
13373 __r.__buffa_unknown_fields.push(__rec);
13374 }
13375 Ok(__r)
13376 }
13377 }
13378 d.deserialize_map(_V)
13379 }
13380}
13381#[cfg(feature = "json")]
13382impl ::buffa::json_helpers::ProtoElemJson for EnumOptions {
13383 fn serialize_proto_json<S: ::serde::Serializer>(
13384 v: &Self,
13385 s: S,
13386 ) -> ::core::result::Result<S::Ok, S::Error> {
13387 ::serde::Serialize::serialize(v, s)
13388 }
13389 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
13390 d: D,
13391 ) -> ::core::result::Result<Self, D::Error> {
13392 <Self as ::serde::Deserialize>::deserialize(d)
13393 }
13394}
13395#[doc(hidden)]
13396#[derive(Clone, Debug, Default, PartialEq)]
13397#[repr(transparent)]
13398#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
13399pub struct __EnumOptionsExtJson(pub ::buffa::UnknownFields);
13400impl ::core::ops::Deref for __EnumOptionsExtJson {
13401 type Target = ::buffa::UnknownFields;
13402 fn deref(&self) -> &::buffa::UnknownFields {
13403 &self.0
13404 }
13405}
13406impl ::core::ops::DerefMut for __EnumOptionsExtJson {
13407 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
13408 &mut self.0
13409 }
13410}
13411impl ::core::convert::From<::buffa::UnknownFields> for __EnumOptionsExtJson {
13412 fn from(u: ::buffa::UnknownFields) -> Self {
13413 Self(u)
13414 }
13415}
13416#[cfg(feature = "json")]
13417impl ::serde::Serialize for __EnumOptionsExtJson {
13418 fn serialize<S: ::serde::Serializer>(
13419 &self,
13420 s: S,
13421 ) -> ::core::result::Result<S::Ok, S::Error> {
13422 ::buffa::extension_registry::serialize_extensions(
13423 "google.protobuf.EnumOptions",
13424 &self.0,
13425 s,
13426 )
13427 }
13428}
13429#[cfg(feature = "json")]
13430impl<'de> ::serde::Deserialize<'de> for __EnumOptionsExtJson {
13431 fn deserialize<D: ::serde::Deserializer<'de>>(
13432 d: D,
13433 ) -> ::core::result::Result<Self, D::Error> {
13434 ::buffa::extension_registry::deserialize_extensions(
13435 "google.protobuf.EnumOptions",
13436 d,
13437 )
13438 .map(Self)
13439 }
13440}
13441#[cfg(feature = "json")]
13442#[doc(hidden)]
13443pub const __ENUM_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
13444 type_url: "type.googleapis.com/google.protobuf.EnumOptions",
13445 to_json: ::buffa::type_registry::any_to_json::<EnumOptions>,
13446 from_json: ::buffa::type_registry::any_from_json::<EnumOptions>,
13447 is_wkt: false,
13448};
13449#[cfg(feature = "text")]
13450#[doc(hidden)]
13451pub const __ENUM_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
13452 type_url: "type.googleapis.com/google.protobuf.EnumOptions",
13453 text_encode: ::buffa::type_registry::any_encode_text::<EnumOptions>,
13454 text_merge: ::buffa::type_registry::any_merge_text::<EnumOptions>,
13455};
13456#[derive(Clone, PartialEq, Default)]
13457#[cfg_attr(feature = "json", derive(::serde::Serialize))]
13458#[cfg_attr(feature = "json", serde(default))]
13459#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
13460pub struct EnumValueOptions {
13461 #[cfg_attr(
13468 feature = "json",
13469 serde(
13470 rename = "deprecated",
13471 skip_serializing_if = "::core::option::Option::is_none"
13472 )
13473 )]
13474 pub deprecated: ::core::option::Option<bool>,
13475 #[cfg_attr(
13482 feature = "json",
13483 serde(
13484 rename = "features",
13485 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
13486 )
13487 )]
13488 pub features: ::buffa::MessageField<FeatureSet>,
13489 #[cfg_attr(
13495 feature = "json",
13496 serde(
13497 rename = "debugRedact",
13498 alias = "debug_redact",
13499 skip_serializing_if = "::core::option::Option::is_none"
13500 )
13501 )]
13502 pub debug_redact: ::core::option::Option<bool>,
13503 #[cfg_attr(
13507 feature = "json",
13508 serde(
13509 rename = "featureSupport",
13510 alias = "feature_support",
13511 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
13512 )
13513 )]
13514 pub feature_support: ::buffa::MessageField<field_options::FeatureSupport>,
13515 #[cfg_attr(
13519 feature = "json",
13520 serde(
13521 rename = "uninterpretedOption",
13522 alias = "uninterpreted_option",
13523 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
13524 deserialize_with = "::buffa::json_helpers::null_as_default"
13525 )
13526 )]
13527 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
13528 #[cfg_attr(feature = "json", serde(flatten))]
13529 #[doc(hidden)]
13530 pub __buffa_unknown_fields: __EnumValueOptionsExtJson,
13531}
13532impl ::core::fmt::Debug for EnumValueOptions {
13533 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
13534 f.debug_struct("EnumValueOptions")
13535 .field("deprecated", &self.deprecated)
13536 .field("features", &self.features)
13537 .field("debug_redact", &self.debug_redact)
13538 .field("feature_support", &self.feature_support)
13539 .field("uninterpreted_option", &self.uninterpreted_option)
13540 .finish()
13541 }
13542}
13543impl EnumValueOptions {
13544 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValueOptions";
13549}
13550impl EnumValueOptions {
13551 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
13552 #[inline]
13553 pub fn with_deprecated(mut self, value: bool) -> Self {
13555 self.deprecated = Some(value);
13556 self
13557 }
13558 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
13559 #[inline]
13560 pub fn with_debug_redact(mut self, value: bool) -> Self {
13562 self.debug_redact = Some(value);
13563 self
13564 }
13565}
13566impl ::buffa::DefaultInstance for EnumValueOptions {
13567 fn default_instance() -> &'static Self {
13568 static VALUE: ::buffa::__private::OnceBox<EnumValueOptions> = ::buffa::__private::OnceBox::new();
13569 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
13570 }
13571}
13572impl ::buffa::MessageName for EnumValueOptions {
13573 const PACKAGE: &'static str = "google.protobuf";
13574 const NAME: &'static str = "EnumValueOptions";
13575 const FULL_NAME: &'static str = "google.protobuf.EnumValueOptions";
13576 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValueOptions";
13577}
13578impl ::buffa::Message for EnumValueOptions {
13579 #[allow(clippy::let_and_return)]
13585 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
13586 #[allow(unused_imports)]
13587 use ::buffa::Enumeration as _;
13588 let mut size = 0u32;
13589 if self.deprecated.is_some() {
13590 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13591 }
13592 if self.features.is_set() {
13593 let __slot = __cache.reserve();
13594 let inner_size = self.features.compute_size(__cache);
13595 __cache.set(__slot, inner_size);
13596 size
13597 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13598 + inner_size;
13599 }
13600 if self.debug_redact.is_some() {
13601 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
13602 }
13603 if self.feature_support.is_set() {
13604 let __slot = __cache.reserve();
13605 let inner_size = self.feature_support.compute_size(__cache);
13606 __cache.set(__slot, inner_size);
13607 size
13608 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13609 + inner_size;
13610 }
13611 for v in &self.uninterpreted_option {
13612 let __slot = __cache.reserve();
13613 let inner_size = v.compute_size(__cache);
13614 __cache.set(__slot, inner_size);
13615 size
13616 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
13617 + inner_size;
13618 }
13619 size += self.__buffa_unknown_fields.encoded_len() as u32;
13620 size
13621 }
13622 fn write_to(
13623 &self,
13624 __cache: &mut ::buffa::SizeCache,
13625 buf: &mut impl ::buffa::bytes::BufMut,
13626 ) {
13627 #[allow(unused_imports)]
13628 use ::buffa::Enumeration as _;
13629 if let Some(v) = self.deprecated {
13630 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
13631 .encode(buf);
13632 ::buffa::types::encode_bool(v, buf);
13633 }
13634 if self.features.is_set() {
13635 ::buffa::encoding::Tag::new(
13636 2u32,
13637 ::buffa::encoding::WireType::LengthDelimited,
13638 )
13639 .encode(buf);
13640 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
13641 self.features.write_to(__cache, buf);
13642 }
13643 if let Some(v) = self.debug_redact {
13644 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
13645 .encode(buf);
13646 ::buffa::types::encode_bool(v, buf);
13647 }
13648 if self.feature_support.is_set() {
13649 ::buffa::encoding::Tag::new(
13650 4u32,
13651 ::buffa::encoding::WireType::LengthDelimited,
13652 )
13653 .encode(buf);
13654 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
13655 self.feature_support.write_to(__cache, buf);
13656 }
13657 for v in &self.uninterpreted_option {
13658 ::buffa::encoding::Tag::new(
13659 999u32,
13660 ::buffa::encoding::WireType::LengthDelimited,
13661 )
13662 .encode(buf);
13663 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
13664 v.write_to(__cache, buf);
13665 }
13666 self.__buffa_unknown_fields.write_to(buf);
13667 }
13668 fn merge_field(
13669 &mut self,
13670 tag: ::buffa::encoding::Tag,
13671 buf: &mut impl ::buffa::bytes::Buf,
13672 depth: u32,
13673 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
13674 #[allow(unused_imports)]
13675 use ::buffa::bytes::Buf as _;
13676 #[allow(unused_imports)]
13677 use ::buffa::Enumeration as _;
13678 match tag.field_number() {
13679 1u32 => {
13680 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
13681 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13682 field_number: 1u32,
13683 expected: 0u8,
13684 actual: tag.wire_type() as u8,
13685 });
13686 }
13687 self.deprecated = ::core::option::Option::Some(
13688 ::buffa::types::decode_bool(buf)?,
13689 );
13690 }
13691 2u32 => {
13692 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
13693 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13694 field_number: 2u32,
13695 expected: 2u8,
13696 actual: tag.wire_type() as u8,
13697 });
13698 }
13699 ::buffa::Message::merge_length_delimited(
13700 self.features.get_or_insert_default(),
13701 buf,
13702 depth,
13703 )?;
13704 }
13705 3u32 => {
13706 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
13707 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13708 field_number: 3u32,
13709 expected: 0u8,
13710 actual: tag.wire_type() as u8,
13711 });
13712 }
13713 self.debug_redact = ::core::option::Option::Some(
13714 ::buffa::types::decode_bool(buf)?,
13715 );
13716 }
13717 4u32 => {
13718 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
13719 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13720 field_number: 4u32,
13721 expected: 2u8,
13722 actual: tag.wire_type() as u8,
13723 });
13724 }
13725 ::buffa::Message::merge_length_delimited(
13726 self.feature_support.get_or_insert_default(),
13727 buf,
13728 depth,
13729 )?;
13730 }
13731 999u32 => {
13732 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
13733 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
13734 field_number: 999u32,
13735 expected: 2u8,
13736 actual: tag.wire_type() as u8,
13737 });
13738 }
13739 let mut elem = ::core::default::Default::default();
13740 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
13741 self.uninterpreted_option.push(elem);
13742 }
13743 _ => {
13744 self.__buffa_unknown_fields
13745 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
13746 }
13747 }
13748 ::core::result::Result::Ok(())
13749 }
13750 fn clear(&mut self) {
13751 self.deprecated = ::core::option::Option::None;
13752 self.features = ::buffa::MessageField::none();
13753 self.debug_redact = ::core::option::Option::None;
13754 self.feature_support = ::buffa::MessageField::none();
13755 self.uninterpreted_option.clear();
13756 self.__buffa_unknown_fields.clear();
13757 }
13758}
13759impl ::buffa::ExtensionSet for EnumValueOptions {
13760 const PROTO_FQN: &'static str = "google.protobuf.EnumValueOptions";
13761 fn unknown_fields(&self) -> &::buffa::UnknownFields {
13762 &self.__buffa_unknown_fields
13763 }
13764 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
13765 &mut self.__buffa_unknown_fields
13766 }
13767}
13768#[cfg(feature = "text")]
13769impl ::buffa::text::TextFormat for EnumValueOptions {
13770 fn encode_text(
13771 &self,
13772 enc: &mut ::buffa::text::TextEncoder<'_>,
13773 ) -> ::core::fmt::Result {
13774 #[allow(unused_imports)]
13775 use ::buffa::Enumeration as _;
13776 if let ::core::option::Option::Some(ref __v) = self.deprecated {
13777 enc.write_field_name("deprecated")?;
13778 enc.write_bool(*__v)?;
13779 }
13780 if self.features.is_set() {
13781 enc.write_field_name("features")?;
13782 enc.write_message(&*self.features)?;
13783 }
13784 if let ::core::option::Option::Some(ref __v) = self.debug_redact {
13785 enc.write_field_name("debug_redact")?;
13786 enc.write_bool(*__v)?;
13787 }
13788 if self.feature_support.is_set() {
13789 enc.write_field_name("feature_support")?;
13790 enc.write_message(&*self.feature_support)?;
13791 }
13792 for __v in &self.uninterpreted_option {
13793 enc.write_field_name("uninterpreted_option")?;
13794 enc.write_message(__v)?;
13795 }
13796 enc.write_extension_fields(
13797 "google.protobuf.EnumValueOptions",
13798 &self.__buffa_unknown_fields,
13799 )?;
13800 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
13801 ::core::result::Result::Ok(())
13802 }
13803 fn merge_text(
13804 &mut self,
13805 dec: &mut ::buffa::text::TextDecoder<'_>,
13806 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
13807 #[allow(unused_imports)]
13808 use ::buffa::Enumeration as _;
13809 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
13810 match __name {
13811 "deprecated" => {
13812 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
13813 }
13814 "features" => dec.merge_message(self.features.get_or_insert_default())?,
13815 "debug_redact" => {
13816 self.debug_redact = ::core::option::Option::Some(dec.read_bool()?);
13817 }
13818 "feature_support" => {
13819 dec.merge_message(self.feature_support.get_or_insert_default())?
13820 }
13821 "uninterpreted_option" => {
13822 dec.read_repeated_into(
13823 &mut self.uninterpreted_option,
13824 |__d| {
13825 let mut __m = ::core::default::Default::default();
13826 __d.merge_message(&mut __m)?;
13827 ::core::result::Result::Ok(__m)
13828 },
13829 )?
13830 }
13831 __name if __name.starts_with('[') => {
13832 for __r in dec
13833 .read_extension(__name, "google.protobuf.EnumValueOptions")?
13834 {
13835 self.__buffa_unknown_fields.push(__r);
13836 }
13837 }
13838 _ => dec.skip_value()?,
13839 }
13840 }
13841 ::core::result::Result::Ok(())
13842 }
13843}
13844#[cfg(feature = "json")]
13845impl<'de> serde::Deserialize<'de> for EnumValueOptions {
13846 fn deserialize<D: serde::Deserializer<'de>>(
13847 d: D,
13848 ) -> ::core::result::Result<Self, D::Error> {
13849 struct _V;
13850 impl<'de> serde::de::Visitor<'de> for _V {
13851 type Value = EnumValueOptions;
13852 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13853 f.write_str("struct EnumValueOptions")
13854 }
13855 #[allow(clippy::field_reassign_with_default)]
13856 fn visit_map<A: serde::de::MapAccess<'de>>(
13857 self,
13858 mut map: A,
13859 ) -> ::core::result::Result<EnumValueOptions, A::Error> {
13860 let mut __f_deprecated: ::core::option::Option<
13861 ::core::option::Option<bool>,
13862 > = None;
13863 let mut __f_features: ::core::option::Option<
13864 ::buffa::MessageField<FeatureSet>,
13865 > = None;
13866 let mut __f_debug_redact: ::core::option::Option<
13867 ::core::option::Option<bool>,
13868 > = None;
13869 let mut __f_feature_support: ::core::option::Option<
13870 ::buffa::MessageField<field_options::FeatureSupport>,
13871 > = None;
13872 let mut __f_uninterpreted_option: ::core::option::Option<
13873 ::buffa::alloc::vec::Vec<UninterpretedOption>,
13874 > = None;
13875 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
13876 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
13877 match key.as_str() {
13878 "deprecated" => {
13879 __f_deprecated = Some(
13880 map.next_value::<::core::option::Option<bool>>()?,
13881 );
13882 }
13883 "features" => {
13884 __f_features = Some(
13885 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
13886 );
13887 }
13888 "debugRedact" | "debug_redact" => {
13889 __f_debug_redact = Some(
13890 map.next_value::<::core::option::Option<bool>>()?,
13891 );
13892 }
13893 "featureSupport" | "feature_support" => {
13894 __f_feature_support = Some(
13895 map
13896 .next_value::<
13897 ::buffa::MessageField<field_options::FeatureSupport>,
13898 >()?,
13899 );
13900 }
13901 "uninterpretedOption" | "uninterpreted_option" => {
13902 __f_uninterpreted_option = Some({
13903 struct _S;
13904 impl<'de> serde::de::DeserializeSeed<'de> for _S {
13905 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
13906 fn deserialize<D: serde::Deserializer<'de>>(
13907 self,
13908 d: D,
13909 ) -> ::core::result::Result<
13910 ::buffa::alloc::vec::Vec<UninterpretedOption>,
13911 D::Error,
13912 > {
13913 ::buffa::json_helpers::null_as_default(d)
13914 }
13915 }
13916 map.next_value_seed(_S)?
13917 });
13918 }
13919 __k if __k.starts_with('[') => {
13920 let __v: ::buffa::serde_json::Value = map.next_value()?;
13921 match ::buffa::extension_registry::deserialize_extension_key(
13922 "google.protobuf.EnumValueOptions",
13923 __k,
13924 __v,
13925 ) {
13926 ::core::option::Option::Some(
13927 ::core::result::Result::Ok(__recs),
13928 ) => {
13929 for __rec in __recs {
13930 __ext_records.push(__rec);
13931 }
13932 }
13933 ::core::option::Option::Some(
13934 ::core::result::Result::Err(__e),
13935 ) => {
13936 return ::core::result::Result::Err(
13937 <A::Error as ::serde::de::Error>::custom(__e),
13938 );
13939 }
13940 ::core::option::Option::None => {}
13941 }
13942 }
13943 _ => {
13944 map.next_value::<serde::de::IgnoredAny>()?;
13945 }
13946 }
13947 }
13948 let mut __r = <EnumValueOptions as ::core::default::Default>::default();
13949 if let ::core::option::Option::Some(v) = __f_deprecated {
13950 __r.deprecated = v;
13951 }
13952 if let ::core::option::Option::Some(v) = __f_features {
13953 __r.features = v;
13954 }
13955 if let ::core::option::Option::Some(v) = __f_debug_redact {
13956 __r.debug_redact = v;
13957 }
13958 if let ::core::option::Option::Some(v) = __f_feature_support {
13959 __r.feature_support = v;
13960 }
13961 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
13962 __r.uninterpreted_option = v;
13963 }
13964 for __rec in __ext_records {
13965 __r.__buffa_unknown_fields.push(__rec);
13966 }
13967 Ok(__r)
13968 }
13969 }
13970 d.deserialize_map(_V)
13971 }
13972}
13973#[cfg(feature = "json")]
13974impl ::buffa::json_helpers::ProtoElemJson for EnumValueOptions {
13975 fn serialize_proto_json<S: ::serde::Serializer>(
13976 v: &Self,
13977 s: S,
13978 ) -> ::core::result::Result<S::Ok, S::Error> {
13979 ::serde::Serialize::serialize(v, s)
13980 }
13981 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
13982 d: D,
13983 ) -> ::core::result::Result<Self, D::Error> {
13984 <Self as ::serde::Deserialize>::deserialize(d)
13985 }
13986}
13987#[doc(hidden)]
13988#[derive(Clone, Debug, Default, PartialEq)]
13989#[repr(transparent)]
13990#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
13991pub struct __EnumValueOptionsExtJson(pub ::buffa::UnknownFields);
13992impl ::core::ops::Deref for __EnumValueOptionsExtJson {
13993 type Target = ::buffa::UnknownFields;
13994 fn deref(&self) -> &::buffa::UnknownFields {
13995 &self.0
13996 }
13997}
13998impl ::core::ops::DerefMut for __EnumValueOptionsExtJson {
13999 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
14000 &mut self.0
14001 }
14002}
14003impl ::core::convert::From<::buffa::UnknownFields> for __EnumValueOptionsExtJson {
14004 fn from(u: ::buffa::UnknownFields) -> Self {
14005 Self(u)
14006 }
14007}
14008#[cfg(feature = "json")]
14009impl ::serde::Serialize for __EnumValueOptionsExtJson {
14010 fn serialize<S: ::serde::Serializer>(
14011 &self,
14012 s: S,
14013 ) -> ::core::result::Result<S::Ok, S::Error> {
14014 ::buffa::extension_registry::serialize_extensions(
14015 "google.protobuf.EnumValueOptions",
14016 &self.0,
14017 s,
14018 )
14019 }
14020}
14021#[cfg(feature = "json")]
14022impl<'de> ::serde::Deserialize<'de> for __EnumValueOptionsExtJson {
14023 fn deserialize<D: ::serde::Deserializer<'de>>(
14024 d: D,
14025 ) -> ::core::result::Result<Self, D::Error> {
14026 ::buffa::extension_registry::deserialize_extensions(
14027 "google.protobuf.EnumValueOptions",
14028 d,
14029 )
14030 .map(Self)
14031 }
14032}
14033#[cfg(feature = "json")]
14034#[doc(hidden)]
14035pub const __ENUM_VALUE_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
14036 type_url: "type.googleapis.com/google.protobuf.EnumValueOptions",
14037 to_json: ::buffa::type_registry::any_to_json::<EnumValueOptions>,
14038 from_json: ::buffa::type_registry::any_from_json::<EnumValueOptions>,
14039 is_wkt: false,
14040};
14041#[cfg(feature = "text")]
14042#[doc(hidden)]
14043pub const __ENUM_VALUE_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
14044 type_url: "type.googleapis.com/google.protobuf.EnumValueOptions",
14045 text_encode: ::buffa::type_registry::any_encode_text::<EnumValueOptions>,
14046 text_merge: ::buffa::type_registry::any_merge_text::<EnumValueOptions>,
14047};
14048#[derive(Clone, PartialEq, Default)]
14049#[cfg_attr(feature = "json", derive(::serde::Serialize))]
14050#[cfg_attr(feature = "json", serde(default))]
14051#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
14052pub struct ServiceOptions {
14053 #[cfg_attr(
14060 feature = "json",
14061 serde(
14062 rename = "features",
14063 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
14064 )
14065 )]
14066 pub features: ::buffa::MessageField<FeatureSet>,
14067 #[cfg_attr(
14079 feature = "json",
14080 serde(
14081 rename = "deprecated",
14082 skip_serializing_if = "::core::option::Option::is_none"
14083 )
14084 )]
14085 pub deprecated: ::core::option::Option<bool>,
14086 #[cfg_attr(
14090 feature = "json",
14091 serde(
14092 rename = "uninterpretedOption",
14093 alias = "uninterpreted_option",
14094 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
14095 deserialize_with = "::buffa::json_helpers::null_as_default"
14096 )
14097 )]
14098 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
14099 #[cfg_attr(feature = "json", serde(flatten))]
14100 #[doc(hidden)]
14101 pub __buffa_unknown_fields: __ServiceOptionsExtJson,
14102}
14103impl ::core::fmt::Debug for ServiceOptions {
14104 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
14105 f.debug_struct("ServiceOptions")
14106 .field("features", &self.features)
14107 .field("deprecated", &self.deprecated)
14108 .field("uninterpreted_option", &self.uninterpreted_option)
14109 .finish()
14110 }
14111}
14112impl ServiceOptions {
14113 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ServiceOptions";
14118}
14119impl ServiceOptions {
14120 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
14121 #[inline]
14122 pub fn with_deprecated(mut self, value: bool) -> Self {
14124 self.deprecated = Some(value);
14125 self
14126 }
14127}
14128impl ::buffa::DefaultInstance for ServiceOptions {
14129 fn default_instance() -> &'static Self {
14130 static VALUE: ::buffa::__private::OnceBox<ServiceOptions> = ::buffa::__private::OnceBox::new();
14131 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
14132 }
14133}
14134impl ::buffa::MessageName for ServiceOptions {
14135 const PACKAGE: &'static str = "google.protobuf";
14136 const NAME: &'static str = "ServiceOptions";
14137 const FULL_NAME: &'static str = "google.protobuf.ServiceOptions";
14138 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.ServiceOptions";
14139}
14140impl ::buffa::Message for ServiceOptions {
14141 #[allow(clippy::let_and_return)]
14147 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14148 #[allow(unused_imports)]
14149 use ::buffa::Enumeration as _;
14150 let mut size = 0u32;
14151 if self.deprecated.is_some() {
14152 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14153 }
14154 if self.features.is_set() {
14155 let __slot = __cache.reserve();
14156 let inner_size = self.features.compute_size(__cache);
14157 __cache.set(__slot, inner_size);
14158 size
14159 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14160 + inner_size;
14161 }
14162 for v in &self.uninterpreted_option {
14163 let __slot = __cache.reserve();
14164 let inner_size = v.compute_size(__cache);
14165 __cache.set(__slot, inner_size);
14166 size
14167 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14168 + inner_size;
14169 }
14170 size += self.__buffa_unknown_fields.encoded_len() as u32;
14171 size
14172 }
14173 fn write_to(
14174 &self,
14175 __cache: &mut ::buffa::SizeCache,
14176 buf: &mut impl ::buffa::bytes::BufMut,
14177 ) {
14178 #[allow(unused_imports)]
14179 use ::buffa::Enumeration as _;
14180 if let Some(v) = self.deprecated {
14181 ::buffa::encoding::Tag::new(33u32, ::buffa::encoding::WireType::Varint)
14182 .encode(buf);
14183 ::buffa::types::encode_bool(v, buf);
14184 }
14185 if self.features.is_set() {
14186 ::buffa::encoding::Tag::new(
14187 34u32,
14188 ::buffa::encoding::WireType::LengthDelimited,
14189 )
14190 .encode(buf);
14191 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
14192 self.features.write_to(__cache, buf);
14193 }
14194 for v in &self.uninterpreted_option {
14195 ::buffa::encoding::Tag::new(
14196 999u32,
14197 ::buffa::encoding::WireType::LengthDelimited,
14198 )
14199 .encode(buf);
14200 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
14201 v.write_to(__cache, buf);
14202 }
14203 self.__buffa_unknown_fields.write_to(buf);
14204 }
14205 fn merge_field(
14206 &mut self,
14207 tag: ::buffa::encoding::Tag,
14208 buf: &mut impl ::buffa::bytes::Buf,
14209 depth: u32,
14210 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
14211 #[allow(unused_imports)]
14212 use ::buffa::bytes::Buf as _;
14213 #[allow(unused_imports)]
14214 use ::buffa::Enumeration as _;
14215 match tag.field_number() {
14216 33u32 => {
14217 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
14218 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14219 field_number: 33u32,
14220 expected: 0u8,
14221 actual: tag.wire_type() as u8,
14222 });
14223 }
14224 self.deprecated = ::core::option::Option::Some(
14225 ::buffa::types::decode_bool(buf)?,
14226 );
14227 }
14228 34u32 => {
14229 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
14230 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14231 field_number: 34u32,
14232 expected: 2u8,
14233 actual: tag.wire_type() as u8,
14234 });
14235 }
14236 ::buffa::Message::merge_length_delimited(
14237 self.features.get_or_insert_default(),
14238 buf,
14239 depth,
14240 )?;
14241 }
14242 999u32 => {
14243 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
14244 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14245 field_number: 999u32,
14246 expected: 2u8,
14247 actual: tag.wire_type() as u8,
14248 });
14249 }
14250 let mut elem = ::core::default::Default::default();
14251 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
14252 self.uninterpreted_option.push(elem);
14253 }
14254 _ => {
14255 self.__buffa_unknown_fields
14256 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
14257 }
14258 }
14259 ::core::result::Result::Ok(())
14260 }
14261 fn clear(&mut self) {
14262 self.deprecated = ::core::option::Option::None;
14263 self.features = ::buffa::MessageField::none();
14264 self.uninterpreted_option.clear();
14265 self.__buffa_unknown_fields.clear();
14266 }
14267}
14268impl ::buffa::ExtensionSet for ServiceOptions {
14269 const PROTO_FQN: &'static str = "google.protobuf.ServiceOptions";
14270 fn unknown_fields(&self) -> &::buffa::UnknownFields {
14271 &self.__buffa_unknown_fields
14272 }
14273 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
14274 &mut self.__buffa_unknown_fields
14275 }
14276}
14277#[cfg(feature = "text")]
14278impl ::buffa::text::TextFormat for ServiceOptions {
14279 fn encode_text(
14280 &self,
14281 enc: &mut ::buffa::text::TextEncoder<'_>,
14282 ) -> ::core::fmt::Result {
14283 #[allow(unused_imports)]
14284 use ::buffa::Enumeration as _;
14285 if self.features.is_set() {
14286 enc.write_field_name("features")?;
14287 enc.write_message(&*self.features)?;
14288 }
14289 if let ::core::option::Option::Some(ref __v) = self.deprecated {
14290 enc.write_field_name("deprecated")?;
14291 enc.write_bool(*__v)?;
14292 }
14293 for __v in &self.uninterpreted_option {
14294 enc.write_field_name("uninterpreted_option")?;
14295 enc.write_message(__v)?;
14296 }
14297 enc.write_extension_fields(
14298 "google.protobuf.ServiceOptions",
14299 &self.__buffa_unknown_fields,
14300 )?;
14301 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
14302 ::core::result::Result::Ok(())
14303 }
14304 fn merge_text(
14305 &mut self,
14306 dec: &mut ::buffa::text::TextDecoder<'_>,
14307 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
14308 #[allow(unused_imports)]
14309 use ::buffa::Enumeration as _;
14310 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
14311 match __name {
14312 "features" => dec.merge_message(self.features.get_or_insert_default())?,
14313 "deprecated" => {
14314 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
14315 }
14316 "uninterpreted_option" => {
14317 dec.read_repeated_into(
14318 &mut self.uninterpreted_option,
14319 |__d| {
14320 let mut __m = ::core::default::Default::default();
14321 __d.merge_message(&mut __m)?;
14322 ::core::result::Result::Ok(__m)
14323 },
14324 )?
14325 }
14326 __name if __name.starts_with('[') => {
14327 for __r in dec
14328 .read_extension(__name, "google.protobuf.ServiceOptions")?
14329 {
14330 self.__buffa_unknown_fields.push(__r);
14331 }
14332 }
14333 _ => dec.skip_value()?,
14334 }
14335 }
14336 ::core::result::Result::Ok(())
14337 }
14338}
14339#[cfg(feature = "json")]
14340impl<'de> serde::Deserialize<'de> for ServiceOptions {
14341 fn deserialize<D: serde::Deserializer<'de>>(
14342 d: D,
14343 ) -> ::core::result::Result<Self, D::Error> {
14344 struct _V;
14345 impl<'de> serde::de::Visitor<'de> for _V {
14346 type Value = ServiceOptions;
14347 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
14348 f.write_str("struct ServiceOptions")
14349 }
14350 #[allow(clippy::field_reassign_with_default)]
14351 fn visit_map<A: serde::de::MapAccess<'de>>(
14352 self,
14353 mut map: A,
14354 ) -> ::core::result::Result<ServiceOptions, A::Error> {
14355 let mut __f_features: ::core::option::Option<
14356 ::buffa::MessageField<FeatureSet>,
14357 > = None;
14358 let mut __f_deprecated: ::core::option::Option<
14359 ::core::option::Option<bool>,
14360 > = None;
14361 let mut __f_uninterpreted_option: ::core::option::Option<
14362 ::buffa::alloc::vec::Vec<UninterpretedOption>,
14363 > = None;
14364 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
14365 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
14366 match key.as_str() {
14367 "features" => {
14368 __f_features = Some(
14369 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
14370 );
14371 }
14372 "deprecated" => {
14373 __f_deprecated = Some(
14374 map.next_value::<::core::option::Option<bool>>()?,
14375 );
14376 }
14377 "uninterpretedOption" | "uninterpreted_option" => {
14378 __f_uninterpreted_option = Some({
14379 struct _S;
14380 impl<'de> serde::de::DeserializeSeed<'de> for _S {
14381 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
14382 fn deserialize<D: serde::Deserializer<'de>>(
14383 self,
14384 d: D,
14385 ) -> ::core::result::Result<
14386 ::buffa::alloc::vec::Vec<UninterpretedOption>,
14387 D::Error,
14388 > {
14389 ::buffa::json_helpers::null_as_default(d)
14390 }
14391 }
14392 map.next_value_seed(_S)?
14393 });
14394 }
14395 __k if __k.starts_with('[') => {
14396 let __v: ::buffa::serde_json::Value = map.next_value()?;
14397 match ::buffa::extension_registry::deserialize_extension_key(
14398 "google.protobuf.ServiceOptions",
14399 __k,
14400 __v,
14401 ) {
14402 ::core::option::Option::Some(
14403 ::core::result::Result::Ok(__recs),
14404 ) => {
14405 for __rec in __recs {
14406 __ext_records.push(__rec);
14407 }
14408 }
14409 ::core::option::Option::Some(
14410 ::core::result::Result::Err(__e),
14411 ) => {
14412 return ::core::result::Result::Err(
14413 <A::Error as ::serde::de::Error>::custom(__e),
14414 );
14415 }
14416 ::core::option::Option::None => {}
14417 }
14418 }
14419 _ => {
14420 map.next_value::<serde::de::IgnoredAny>()?;
14421 }
14422 }
14423 }
14424 let mut __r = <ServiceOptions as ::core::default::Default>::default();
14425 if let ::core::option::Option::Some(v) = __f_features {
14426 __r.features = v;
14427 }
14428 if let ::core::option::Option::Some(v) = __f_deprecated {
14429 __r.deprecated = v;
14430 }
14431 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
14432 __r.uninterpreted_option = v;
14433 }
14434 for __rec in __ext_records {
14435 __r.__buffa_unknown_fields.push(__rec);
14436 }
14437 Ok(__r)
14438 }
14439 }
14440 d.deserialize_map(_V)
14441 }
14442}
14443#[cfg(feature = "json")]
14444impl ::buffa::json_helpers::ProtoElemJson for ServiceOptions {
14445 fn serialize_proto_json<S: ::serde::Serializer>(
14446 v: &Self,
14447 s: S,
14448 ) -> ::core::result::Result<S::Ok, S::Error> {
14449 ::serde::Serialize::serialize(v, s)
14450 }
14451 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
14452 d: D,
14453 ) -> ::core::result::Result<Self, D::Error> {
14454 <Self as ::serde::Deserialize>::deserialize(d)
14455 }
14456}
14457#[doc(hidden)]
14458#[derive(Clone, Debug, Default, PartialEq)]
14459#[repr(transparent)]
14460#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
14461pub struct __ServiceOptionsExtJson(pub ::buffa::UnknownFields);
14462impl ::core::ops::Deref for __ServiceOptionsExtJson {
14463 type Target = ::buffa::UnknownFields;
14464 fn deref(&self) -> &::buffa::UnknownFields {
14465 &self.0
14466 }
14467}
14468impl ::core::ops::DerefMut for __ServiceOptionsExtJson {
14469 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
14470 &mut self.0
14471 }
14472}
14473impl ::core::convert::From<::buffa::UnknownFields> for __ServiceOptionsExtJson {
14474 fn from(u: ::buffa::UnknownFields) -> Self {
14475 Self(u)
14476 }
14477}
14478#[cfg(feature = "json")]
14479impl ::serde::Serialize for __ServiceOptionsExtJson {
14480 fn serialize<S: ::serde::Serializer>(
14481 &self,
14482 s: S,
14483 ) -> ::core::result::Result<S::Ok, S::Error> {
14484 ::buffa::extension_registry::serialize_extensions(
14485 "google.protobuf.ServiceOptions",
14486 &self.0,
14487 s,
14488 )
14489 }
14490}
14491#[cfg(feature = "json")]
14492impl<'de> ::serde::Deserialize<'de> for __ServiceOptionsExtJson {
14493 fn deserialize<D: ::serde::Deserializer<'de>>(
14494 d: D,
14495 ) -> ::core::result::Result<Self, D::Error> {
14496 ::buffa::extension_registry::deserialize_extensions(
14497 "google.protobuf.ServiceOptions",
14498 d,
14499 )
14500 .map(Self)
14501 }
14502}
14503#[cfg(feature = "json")]
14504#[doc(hidden)]
14505pub const __SERVICE_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
14506 type_url: "type.googleapis.com/google.protobuf.ServiceOptions",
14507 to_json: ::buffa::type_registry::any_to_json::<ServiceOptions>,
14508 from_json: ::buffa::type_registry::any_from_json::<ServiceOptions>,
14509 is_wkt: false,
14510};
14511#[cfg(feature = "text")]
14512#[doc(hidden)]
14513pub const __SERVICE_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
14514 type_url: "type.googleapis.com/google.protobuf.ServiceOptions",
14515 text_encode: ::buffa::type_registry::any_encode_text::<ServiceOptions>,
14516 text_merge: ::buffa::type_registry::any_merge_text::<ServiceOptions>,
14517};
14518#[derive(Clone, PartialEq, Default)]
14519#[cfg_attr(feature = "json", derive(::serde::Serialize))]
14520#[cfg_attr(feature = "json", serde(default))]
14521#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
14522pub struct MethodOptions {
14523 #[cfg_attr(
14535 feature = "json",
14536 serde(
14537 rename = "deprecated",
14538 skip_serializing_if = "::core::option::Option::is_none"
14539 )
14540 )]
14541 pub deprecated: ::core::option::Option<bool>,
14542 #[cfg_attr(
14544 feature = "json",
14545 serde(
14546 rename = "idempotencyLevel",
14547 alias = "idempotency_level",
14548 with = "::buffa::json_helpers::opt_closed_enum",
14549 skip_serializing_if = "::core::option::Option::is_none"
14550 )
14551 )]
14552 pub idempotency_level: ::core::option::Option<method_options::IdempotencyLevel>,
14553 #[cfg_attr(
14560 feature = "json",
14561 serde(
14562 rename = "features",
14563 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
14564 )
14565 )]
14566 pub features: ::buffa::MessageField<FeatureSet>,
14567 #[cfg_attr(
14571 feature = "json",
14572 serde(
14573 rename = "uninterpretedOption",
14574 alias = "uninterpreted_option",
14575 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
14576 deserialize_with = "::buffa::json_helpers::null_as_default"
14577 )
14578 )]
14579 pub uninterpreted_option: ::buffa::alloc::vec::Vec<UninterpretedOption>,
14580 #[cfg_attr(feature = "json", serde(flatten))]
14581 #[doc(hidden)]
14582 pub __buffa_unknown_fields: __MethodOptionsExtJson,
14583}
14584impl ::core::fmt::Debug for MethodOptions {
14585 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
14586 f.debug_struct("MethodOptions")
14587 .field("deprecated", &self.deprecated)
14588 .field("idempotency_level", &self.idempotency_level)
14589 .field("features", &self.features)
14590 .field("uninterpreted_option", &self.uninterpreted_option)
14591 .finish()
14592 }
14593}
14594impl MethodOptions {
14595 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MethodOptions";
14600}
14601impl MethodOptions {
14602 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
14603 #[inline]
14604 pub fn with_deprecated(mut self, value: bool) -> Self {
14606 self.deprecated = Some(value);
14607 self
14608 }
14609 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
14610 #[inline]
14611 pub fn with_idempotency_level(
14613 mut self,
14614 value: impl Into<method_options::IdempotencyLevel>,
14615 ) -> Self {
14616 self.idempotency_level = Some(value.into());
14617 self
14618 }
14619}
14620impl ::buffa::DefaultInstance for MethodOptions {
14621 fn default_instance() -> &'static Self {
14622 static VALUE: ::buffa::__private::OnceBox<MethodOptions> = ::buffa::__private::OnceBox::new();
14623 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
14624 }
14625}
14626impl ::buffa::MessageName for MethodOptions {
14627 const PACKAGE: &'static str = "google.protobuf";
14628 const NAME: &'static str = "MethodOptions";
14629 const FULL_NAME: &'static str = "google.protobuf.MethodOptions";
14630 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.MethodOptions";
14631}
14632impl ::buffa::Message for MethodOptions {
14633 #[allow(clippy::let_and_return)]
14639 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
14640 #[allow(unused_imports)]
14641 use ::buffa::Enumeration as _;
14642 let mut size = 0u32;
14643 if self.deprecated.is_some() {
14644 size += 2u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
14645 }
14646 if let Some(ref v) = self.idempotency_level {
14647 size += 2u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
14648 }
14649 if self.features.is_set() {
14650 let __slot = __cache.reserve();
14651 let inner_size = self.features.compute_size(__cache);
14652 __cache.set(__slot, inner_size);
14653 size
14654 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14655 + inner_size;
14656 }
14657 for v in &self.uninterpreted_option {
14658 let __slot = __cache.reserve();
14659 let inner_size = v.compute_size(__cache);
14660 __cache.set(__slot, inner_size);
14661 size
14662 += 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
14663 + inner_size;
14664 }
14665 size += self.__buffa_unknown_fields.encoded_len() as u32;
14666 size
14667 }
14668 fn write_to(
14669 &self,
14670 __cache: &mut ::buffa::SizeCache,
14671 buf: &mut impl ::buffa::bytes::BufMut,
14672 ) {
14673 #[allow(unused_imports)]
14674 use ::buffa::Enumeration as _;
14675 if let Some(v) = self.deprecated {
14676 ::buffa::encoding::Tag::new(33u32, ::buffa::encoding::WireType::Varint)
14677 .encode(buf);
14678 ::buffa::types::encode_bool(v, buf);
14679 }
14680 if let Some(ref v) = self.idempotency_level {
14681 ::buffa::encoding::Tag::new(34u32, ::buffa::encoding::WireType::Varint)
14682 .encode(buf);
14683 ::buffa::types::encode_int32(v.to_i32(), buf);
14684 }
14685 if self.features.is_set() {
14686 ::buffa::encoding::Tag::new(
14687 35u32,
14688 ::buffa::encoding::WireType::LengthDelimited,
14689 )
14690 .encode(buf);
14691 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
14692 self.features.write_to(__cache, buf);
14693 }
14694 for v in &self.uninterpreted_option {
14695 ::buffa::encoding::Tag::new(
14696 999u32,
14697 ::buffa::encoding::WireType::LengthDelimited,
14698 )
14699 .encode(buf);
14700 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
14701 v.write_to(__cache, buf);
14702 }
14703 self.__buffa_unknown_fields.write_to(buf);
14704 }
14705 fn merge_field(
14706 &mut self,
14707 tag: ::buffa::encoding::Tag,
14708 buf: &mut impl ::buffa::bytes::Buf,
14709 depth: u32,
14710 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
14711 #[allow(unused_imports)]
14712 use ::buffa::bytes::Buf as _;
14713 #[allow(unused_imports)]
14714 use ::buffa::Enumeration as _;
14715 match tag.field_number() {
14716 33u32 => {
14717 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
14718 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14719 field_number: 33u32,
14720 expected: 0u8,
14721 actual: tag.wire_type() as u8,
14722 });
14723 }
14724 self.deprecated = ::core::option::Option::Some(
14725 ::buffa::types::decode_bool(buf)?,
14726 );
14727 }
14728 34u32 => {
14729 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
14730 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14731 field_number: 34u32,
14732 expected: 0u8,
14733 actual: tag.wire_type() as u8,
14734 });
14735 }
14736 let __raw = ::buffa::types::decode_int32(buf)?;
14737 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
14738 __raw,
14739 ) {
14740 self.idempotency_level = ::core::option::Option::Some(__v);
14741 } else {
14742 self.__buffa_unknown_fields
14743 .push(::buffa::UnknownField {
14744 number: 34u32,
14745 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
14746 });
14747 }
14748 }
14749 35u32 => {
14750 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
14751 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14752 field_number: 35u32,
14753 expected: 2u8,
14754 actual: tag.wire_type() as u8,
14755 });
14756 }
14757 ::buffa::Message::merge_length_delimited(
14758 self.features.get_or_insert_default(),
14759 buf,
14760 depth,
14761 )?;
14762 }
14763 999u32 => {
14764 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
14765 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
14766 field_number: 999u32,
14767 expected: 2u8,
14768 actual: tag.wire_type() as u8,
14769 });
14770 }
14771 let mut elem = ::core::default::Default::default();
14772 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
14773 self.uninterpreted_option.push(elem);
14774 }
14775 _ => {
14776 self.__buffa_unknown_fields
14777 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
14778 }
14779 }
14780 ::core::result::Result::Ok(())
14781 }
14782 fn clear(&mut self) {
14783 self.deprecated = ::core::option::Option::None;
14784 self.idempotency_level = ::core::option::Option::None;
14785 self.features = ::buffa::MessageField::none();
14786 self.uninterpreted_option.clear();
14787 self.__buffa_unknown_fields.clear();
14788 }
14789}
14790impl ::buffa::ExtensionSet for MethodOptions {
14791 const PROTO_FQN: &'static str = "google.protobuf.MethodOptions";
14792 fn unknown_fields(&self) -> &::buffa::UnknownFields {
14793 &self.__buffa_unknown_fields
14794 }
14795 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
14796 &mut self.__buffa_unknown_fields
14797 }
14798}
14799#[cfg(feature = "text")]
14800impl ::buffa::text::TextFormat for MethodOptions {
14801 fn encode_text(
14802 &self,
14803 enc: &mut ::buffa::text::TextEncoder<'_>,
14804 ) -> ::core::fmt::Result {
14805 #[allow(unused_imports)]
14806 use ::buffa::Enumeration as _;
14807 if let ::core::option::Option::Some(ref __v) = self.deprecated {
14808 enc.write_field_name("deprecated")?;
14809 enc.write_bool(*__v)?;
14810 }
14811 if let ::core::option::Option::Some(ref __v) = self.idempotency_level {
14812 enc.write_field_name("idempotency_level")?;
14813 enc.write_enum_name(__v.proto_name())?;
14814 }
14815 if self.features.is_set() {
14816 enc.write_field_name("features")?;
14817 enc.write_message(&*self.features)?;
14818 }
14819 for __v in &self.uninterpreted_option {
14820 enc.write_field_name("uninterpreted_option")?;
14821 enc.write_message(__v)?;
14822 }
14823 enc.write_extension_fields(
14824 "google.protobuf.MethodOptions",
14825 &self.__buffa_unknown_fields,
14826 )?;
14827 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
14828 ::core::result::Result::Ok(())
14829 }
14830 fn merge_text(
14831 &mut self,
14832 dec: &mut ::buffa::text::TextDecoder<'_>,
14833 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
14834 #[allow(unused_imports)]
14835 use ::buffa::Enumeration as _;
14836 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
14837 match __name {
14838 "deprecated" => {
14839 self.deprecated = ::core::option::Option::Some(dec.read_bool()?);
14840 }
14841 "idempotency_level" => {
14842 self.idempotency_level = ::core::option::Option::Some(
14843 dec
14844 .read_closed_enum_by_name::<
14845 method_options::IdempotencyLevel,
14846 >()?,
14847 );
14848 }
14849 "features" => dec.merge_message(self.features.get_or_insert_default())?,
14850 "uninterpreted_option" => {
14851 dec.read_repeated_into(
14852 &mut self.uninterpreted_option,
14853 |__d| {
14854 let mut __m = ::core::default::Default::default();
14855 __d.merge_message(&mut __m)?;
14856 ::core::result::Result::Ok(__m)
14857 },
14858 )?
14859 }
14860 __name if __name.starts_with('[') => {
14861 for __r in dec
14862 .read_extension(__name, "google.protobuf.MethodOptions")?
14863 {
14864 self.__buffa_unknown_fields.push(__r);
14865 }
14866 }
14867 _ => dec.skip_value()?,
14868 }
14869 }
14870 ::core::result::Result::Ok(())
14871 }
14872}
14873#[cfg(feature = "json")]
14874impl<'de> serde::Deserialize<'de> for MethodOptions {
14875 fn deserialize<D: serde::Deserializer<'de>>(
14876 d: D,
14877 ) -> ::core::result::Result<Self, D::Error> {
14878 struct _V;
14879 impl<'de> serde::de::Visitor<'de> for _V {
14880 type Value = MethodOptions;
14881 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
14882 f.write_str("struct MethodOptions")
14883 }
14884 #[allow(clippy::field_reassign_with_default)]
14885 fn visit_map<A: serde::de::MapAccess<'de>>(
14886 self,
14887 mut map: A,
14888 ) -> ::core::result::Result<MethodOptions, A::Error> {
14889 let mut __f_deprecated: ::core::option::Option<
14890 ::core::option::Option<bool>,
14891 > = None;
14892 let mut __f_idempotency_level: ::core::option::Option<
14893 ::core::option::Option<method_options::IdempotencyLevel>,
14894 > = None;
14895 let mut __f_features: ::core::option::Option<
14896 ::buffa::MessageField<FeatureSet>,
14897 > = None;
14898 let mut __f_uninterpreted_option: ::core::option::Option<
14899 ::buffa::alloc::vec::Vec<UninterpretedOption>,
14900 > = None;
14901 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
14902 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
14903 match key.as_str() {
14904 "deprecated" => {
14905 __f_deprecated = Some(
14906 map.next_value::<::core::option::Option<bool>>()?,
14907 );
14908 }
14909 "idempotencyLevel" | "idempotency_level" => {
14910 __f_idempotency_level = Some({
14911 struct _S;
14912 impl<'de> serde::de::DeserializeSeed<'de> for _S {
14913 type Value = ::core::option::Option<
14914 method_options::IdempotencyLevel,
14915 >;
14916 fn deserialize<D: serde::Deserializer<'de>>(
14917 self,
14918 d: D,
14919 ) -> ::core::result::Result<
14920 ::core::option::Option<method_options::IdempotencyLevel>,
14921 D::Error,
14922 > {
14923 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
14924 }
14925 }
14926 map.next_value_seed(_S)?
14927 });
14928 }
14929 "features" => {
14930 __f_features = Some(
14931 map.next_value::<::buffa::MessageField<FeatureSet>>()?,
14932 );
14933 }
14934 "uninterpretedOption" | "uninterpreted_option" => {
14935 __f_uninterpreted_option = Some({
14936 struct _S;
14937 impl<'de> serde::de::DeserializeSeed<'de> for _S {
14938 type Value = ::buffa::alloc::vec::Vec<UninterpretedOption>;
14939 fn deserialize<D: serde::Deserializer<'de>>(
14940 self,
14941 d: D,
14942 ) -> ::core::result::Result<
14943 ::buffa::alloc::vec::Vec<UninterpretedOption>,
14944 D::Error,
14945 > {
14946 ::buffa::json_helpers::null_as_default(d)
14947 }
14948 }
14949 map.next_value_seed(_S)?
14950 });
14951 }
14952 __k if __k.starts_with('[') => {
14953 let __v: ::buffa::serde_json::Value = map.next_value()?;
14954 match ::buffa::extension_registry::deserialize_extension_key(
14955 "google.protobuf.MethodOptions",
14956 __k,
14957 __v,
14958 ) {
14959 ::core::option::Option::Some(
14960 ::core::result::Result::Ok(__recs),
14961 ) => {
14962 for __rec in __recs {
14963 __ext_records.push(__rec);
14964 }
14965 }
14966 ::core::option::Option::Some(
14967 ::core::result::Result::Err(__e),
14968 ) => {
14969 return ::core::result::Result::Err(
14970 <A::Error as ::serde::de::Error>::custom(__e),
14971 );
14972 }
14973 ::core::option::Option::None => {}
14974 }
14975 }
14976 _ => {
14977 map.next_value::<serde::de::IgnoredAny>()?;
14978 }
14979 }
14980 }
14981 let mut __r = <MethodOptions as ::core::default::Default>::default();
14982 if let ::core::option::Option::Some(v) = __f_deprecated {
14983 __r.deprecated = v;
14984 }
14985 if let ::core::option::Option::Some(v) = __f_idempotency_level {
14986 __r.idempotency_level = v;
14987 }
14988 if let ::core::option::Option::Some(v) = __f_features {
14989 __r.features = v;
14990 }
14991 if let ::core::option::Option::Some(v) = __f_uninterpreted_option {
14992 __r.uninterpreted_option = v;
14993 }
14994 for __rec in __ext_records {
14995 __r.__buffa_unknown_fields.push(__rec);
14996 }
14997 Ok(__r)
14998 }
14999 }
15000 d.deserialize_map(_V)
15001 }
15002}
15003#[cfg(feature = "json")]
15004impl ::buffa::json_helpers::ProtoElemJson for MethodOptions {
15005 fn serialize_proto_json<S: ::serde::Serializer>(
15006 v: &Self,
15007 s: S,
15008 ) -> ::core::result::Result<S::Ok, S::Error> {
15009 ::serde::Serialize::serialize(v, s)
15010 }
15011 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
15012 d: D,
15013 ) -> ::core::result::Result<Self, D::Error> {
15014 <Self as ::serde::Deserialize>::deserialize(d)
15015 }
15016}
15017#[doc(hidden)]
15018#[derive(Clone, Debug, Default, PartialEq)]
15019#[repr(transparent)]
15020#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15021pub struct __MethodOptionsExtJson(pub ::buffa::UnknownFields);
15022impl ::core::ops::Deref for __MethodOptionsExtJson {
15023 type Target = ::buffa::UnknownFields;
15024 fn deref(&self) -> &::buffa::UnknownFields {
15025 &self.0
15026 }
15027}
15028impl ::core::ops::DerefMut for __MethodOptionsExtJson {
15029 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
15030 &mut self.0
15031 }
15032}
15033impl ::core::convert::From<::buffa::UnknownFields> for __MethodOptionsExtJson {
15034 fn from(u: ::buffa::UnknownFields) -> Self {
15035 Self(u)
15036 }
15037}
15038#[cfg(feature = "json")]
15039impl ::serde::Serialize for __MethodOptionsExtJson {
15040 fn serialize<S: ::serde::Serializer>(
15041 &self,
15042 s: S,
15043 ) -> ::core::result::Result<S::Ok, S::Error> {
15044 ::buffa::extension_registry::serialize_extensions(
15045 "google.protobuf.MethodOptions",
15046 &self.0,
15047 s,
15048 )
15049 }
15050}
15051#[cfg(feature = "json")]
15052impl<'de> ::serde::Deserialize<'de> for __MethodOptionsExtJson {
15053 fn deserialize<D: ::serde::Deserializer<'de>>(
15054 d: D,
15055 ) -> ::core::result::Result<Self, D::Error> {
15056 ::buffa::extension_registry::deserialize_extensions(
15057 "google.protobuf.MethodOptions",
15058 d,
15059 )
15060 .map(Self)
15061 }
15062}
15063#[cfg(feature = "json")]
15064#[doc(hidden)]
15065pub const __METHOD_OPTIONS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
15066 type_url: "type.googleapis.com/google.protobuf.MethodOptions",
15067 to_json: ::buffa::type_registry::any_to_json::<MethodOptions>,
15068 from_json: ::buffa::type_registry::any_from_json::<MethodOptions>,
15069 is_wkt: false,
15070};
15071#[cfg(feature = "text")]
15072#[doc(hidden)]
15073pub const __METHOD_OPTIONS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
15074 type_url: "type.googleapis.com/google.protobuf.MethodOptions",
15075 text_encode: ::buffa::type_registry::any_encode_text::<MethodOptions>,
15076 text_merge: ::buffa::type_registry::any_merge_text::<MethodOptions>,
15077};
15078pub mod method_options {
15079 #[allow(unused_imports)]
15080 use super::*;
15081 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
15085 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15086 #[repr(i32)]
15087 pub enum IdempotencyLevel {
15088 IDEMPOTENCY_UNKNOWN = 0i32,
15089 NO_SIDE_EFFECTS = 1i32,
15091 IDEMPOTENT = 2i32,
15093 }
15094 impl ::core::default::Default for IdempotencyLevel {
15095 fn default() -> Self {
15096 Self::IDEMPOTENCY_UNKNOWN
15097 }
15098 }
15099 #[cfg(feature = "json")]
15100 const _: () = {
15101 impl ::serde::Serialize for IdempotencyLevel {
15102 fn serialize<S: ::serde::Serializer>(
15103 &self,
15104 s: S,
15105 ) -> ::core::result::Result<S::Ok, S::Error> {
15106 s.serialize_str(::buffa::Enumeration::proto_name(self))
15107 }
15108 }
15109 impl<'de> ::serde::Deserialize<'de> for IdempotencyLevel {
15110 fn deserialize<D: ::serde::Deserializer<'de>>(
15111 d: D,
15112 ) -> ::core::result::Result<Self, D::Error> {
15113 struct _V;
15114 impl ::serde::de::Visitor<'_> for _V {
15115 type Value = IdempotencyLevel;
15116 fn expecting(
15117 &self,
15118 f: &mut ::core::fmt::Formatter<'_>,
15119 ) -> ::core::fmt::Result {
15120 f.write_str(
15121 concat!(
15122 "a string, integer, or null for ",
15123 stringify!(IdempotencyLevel)
15124 ),
15125 )
15126 }
15127 fn visit_str<E: ::serde::de::Error>(
15128 self,
15129 v: &str,
15130 ) -> ::core::result::Result<IdempotencyLevel, E> {
15131 <IdempotencyLevel as ::buffa::Enumeration>::from_proto_name(v)
15132 .ok_or_else(|| {
15133 ::serde::de::Error::unknown_variant(v, &[])
15134 })
15135 }
15136 fn visit_i64<E: ::serde::de::Error>(
15137 self,
15138 v: i64,
15139 ) -> ::core::result::Result<IdempotencyLevel, E> {
15140 let v32 = i32::try_from(v)
15141 .map_err(|_| {
15142 ::serde::de::Error::custom(
15143 ::buffa::alloc::format!("enum value {v} out of i32 range"),
15144 )
15145 })?;
15146 <IdempotencyLevel as ::buffa::Enumeration>::from_i32(v32)
15147 .ok_or_else(|| {
15148 ::serde::de::Error::custom(
15149 ::buffa::alloc::format!("unknown enum value {v32}"),
15150 )
15151 })
15152 }
15153 fn visit_u64<E: ::serde::de::Error>(
15154 self,
15155 v: u64,
15156 ) -> ::core::result::Result<IdempotencyLevel, E> {
15157 let v32 = i32::try_from(v)
15158 .map_err(|_| {
15159 ::serde::de::Error::custom(
15160 ::buffa::alloc::format!("enum value {v} out of i32 range"),
15161 )
15162 })?;
15163 <IdempotencyLevel as ::buffa::Enumeration>::from_i32(v32)
15164 .ok_or_else(|| {
15165 ::serde::de::Error::custom(
15166 ::buffa::alloc::format!("unknown enum value {v32}"),
15167 )
15168 })
15169 }
15170 fn visit_unit<E: ::serde::de::Error>(
15171 self,
15172 ) -> ::core::result::Result<IdempotencyLevel, E> {
15173 ::core::result::Result::Ok(::core::default::Default::default())
15174 }
15175 }
15176 d.deserialize_any(_V)
15177 }
15178 }
15179 impl ::buffa::json_helpers::ProtoElemJson for IdempotencyLevel {
15180 fn serialize_proto_json<S: ::serde::Serializer>(
15181 v: &Self,
15182 s: S,
15183 ) -> ::core::result::Result<S::Ok, S::Error> {
15184 ::serde::Serialize::serialize(v, s)
15185 }
15186 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
15187 d: D,
15188 ) -> ::core::result::Result<Self, D::Error> {
15189 <Self as ::serde::Deserialize>::deserialize(d)
15190 }
15191 }
15192 };
15193 impl ::buffa::Enumeration for IdempotencyLevel {
15194 fn from_i32(value: i32) -> ::core::option::Option<Self> {
15195 match value {
15196 0i32 => ::core::option::Option::Some(Self::IDEMPOTENCY_UNKNOWN),
15197 1i32 => ::core::option::Option::Some(Self::NO_SIDE_EFFECTS),
15198 2i32 => ::core::option::Option::Some(Self::IDEMPOTENT),
15199 _ => ::core::option::Option::None,
15200 }
15201 }
15202 fn to_i32(&self) -> i32 {
15203 *self as i32
15204 }
15205 fn proto_name(&self) -> &'static str {
15206 match self {
15207 Self::IDEMPOTENCY_UNKNOWN => "IDEMPOTENCY_UNKNOWN",
15208 Self::NO_SIDE_EFFECTS => "NO_SIDE_EFFECTS",
15209 Self::IDEMPOTENT => "IDEMPOTENT",
15210 }
15211 }
15212 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
15213 match name {
15214 "IDEMPOTENCY_UNKNOWN" => {
15215 ::core::option::Option::Some(Self::IDEMPOTENCY_UNKNOWN)
15216 }
15217 "NO_SIDE_EFFECTS" => ::core::option::Option::Some(Self::NO_SIDE_EFFECTS),
15218 "IDEMPOTENT" => ::core::option::Option::Some(Self::IDEMPOTENT),
15219 _ => ::core::option::Option::None,
15220 }
15221 }
15222 fn values() -> &'static [Self] {
15223 &[Self::IDEMPOTENCY_UNKNOWN, Self::NO_SIDE_EFFECTS, Self::IDEMPOTENT]
15224 }
15225 }
15226}
15227#[derive(Clone, PartialEq, Default)]
15234#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
15235#[cfg_attr(feature = "json", serde(default))]
15236#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15237pub struct UninterpretedOption {
15238 #[cfg_attr(
15240 feature = "json",
15241 serde(
15242 rename = "name",
15243 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
15244 deserialize_with = "::buffa::json_helpers::null_as_default"
15245 )
15246 )]
15247 pub name: ::buffa::alloc::vec::Vec<uninterpreted_option::NamePart>,
15248 #[cfg_attr(
15253 feature = "json",
15254 serde(
15255 rename = "identifierValue",
15256 alias = "identifier_value",
15257 skip_serializing_if = "::core::option::Option::is_none"
15258 )
15259 )]
15260 pub identifier_value: ::core::option::Option<::buffa::alloc::string::String>,
15261 #[cfg_attr(
15263 feature = "json",
15264 serde(
15265 rename = "positiveIntValue",
15266 alias = "positive_int_value",
15267 with = "::buffa::json_helpers::opt_uint64",
15268 skip_serializing_if = "::core::option::Option::is_none"
15269 )
15270 )]
15271 pub positive_int_value: ::core::option::Option<u64>,
15272 #[cfg_attr(
15274 feature = "json",
15275 serde(
15276 rename = "negativeIntValue",
15277 alias = "negative_int_value",
15278 with = "::buffa::json_helpers::opt_int64",
15279 skip_serializing_if = "::core::option::Option::is_none"
15280 )
15281 )]
15282 pub negative_int_value: ::core::option::Option<i64>,
15283 #[cfg_attr(
15285 feature = "json",
15286 serde(
15287 rename = "doubleValue",
15288 alias = "double_value",
15289 with = "::buffa::json_helpers::opt_double",
15290 skip_serializing_if = "::core::option::Option::is_none"
15291 )
15292 )]
15293 pub double_value: ::core::option::Option<f64>,
15294 #[cfg_attr(
15296 feature = "json",
15297 serde(
15298 rename = "stringValue",
15299 alias = "string_value",
15300 with = "::buffa::json_helpers::opt_bytes",
15301 skip_serializing_if = "::core::option::Option::is_none"
15302 )
15303 )]
15304 pub string_value: ::core::option::Option<::buffa::alloc::vec::Vec<u8>>,
15305 #[cfg_attr(
15307 feature = "json",
15308 serde(
15309 rename = "aggregateValue",
15310 alias = "aggregate_value",
15311 skip_serializing_if = "::core::option::Option::is_none"
15312 )
15313 )]
15314 pub aggregate_value: ::core::option::Option<::buffa::alloc::string::String>,
15315 #[cfg_attr(feature = "json", serde(skip))]
15316 #[doc(hidden)]
15317 pub __buffa_unknown_fields: ::buffa::UnknownFields,
15318}
15319impl ::core::fmt::Debug for UninterpretedOption {
15320 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
15321 f.debug_struct("UninterpretedOption")
15322 .field("name", &self.name)
15323 .field("identifier_value", &self.identifier_value)
15324 .field("positive_int_value", &self.positive_int_value)
15325 .field("negative_int_value", &self.negative_int_value)
15326 .field("double_value", &self.double_value)
15327 .field("string_value", &self.string_value)
15328 .field("aggregate_value", &self.aggregate_value)
15329 .finish()
15330 }
15331}
15332impl UninterpretedOption {
15333 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UninterpretedOption";
15338}
15339impl UninterpretedOption {
15340 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15341 #[inline]
15342 pub fn with_identifier_value(
15344 mut self,
15345 value: impl Into<::buffa::alloc::string::String>,
15346 ) -> Self {
15347 self.identifier_value = Some(value.into());
15348 self
15349 }
15350 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15351 #[inline]
15352 pub fn with_positive_int_value(mut self, value: u64) -> Self {
15354 self.positive_int_value = Some(value);
15355 self
15356 }
15357 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15358 #[inline]
15359 pub fn with_negative_int_value(mut self, value: i64) -> Self {
15361 self.negative_int_value = Some(value);
15362 self
15363 }
15364 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15365 #[inline]
15366 pub fn with_double_value(mut self, value: f64) -> Self {
15368 self.double_value = Some(value);
15369 self
15370 }
15371 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15372 #[inline]
15373 pub fn with_string_value(
15375 mut self,
15376 value: impl Into<::buffa::alloc::vec::Vec<u8>>,
15377 ) -> Self {
15378 self.string_value = Some(value.into());
15379 self
15380 }
15381 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
15382 #[inline]
15383 pub fn with_aggregate_value(
15385 mut self,
15386 value: impl Into<::buffa::alloc::string::String>,
15387 ) -> Self {
15388 self.aggregate_value = Some(value.into());
15389 self
15390 }
15391}
15392impl ::buffa::DefaultInstance for UninterpretedOption {
15393 fn default_instance() -> &'static Self {
15394 static VALUE: ::buffa::__private::OnceBox<UninterpretedOption> = ::buffa::__private::OnceBox::new();
15395 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
15396 }
15397}
15398impl ::buffa::MessageName for UninterpretedOption {
15399 const PACKAGE: &'static str = "google.protobuf";
15400 const NAME: &'static str = "UninterpretedOption";
15401 const FULL_NAME: &'static str = "google.protobuf.UninterpretedOption";
15402 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UninterpretedOption";
15403}
15404impl ::buffa::Message for UninterpretedOption {
15405 #[allow(clippy::let_and_return)]
15411 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
15412 #[allow(unused_imports)]
15413 use ::buffa::Enumeration as _;
15414 let mut size = 0u32;
15415 for v in &self.name {
15416 let __slot = __cache.reserve();
15417 let inner_size = v.compute_size(__cache);
15418 __cache.set(__slot, inner_size);
15419 size
15420 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
15421 + inner_size;
15422 }
15423 if let Some(ref v) = self.identifier_value {
15424 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
15425 }
15426 if let Some(v) = self.positive_int_value {
15427 size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
15428 }
15429 if let Some(v) = self.negative_int_value {
15430 size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
15431 }
15432 if self.double_value.is_some() {
15433 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
15434 }
15435 if let Some(ref v) = self.string_value {
15436 size += 1u32 + ::buffa::types::bytes_encoded_len(v) as u32;
15437 }
15438 if let Some(ref v) = self.aggregate_value {
15439 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
15440 }
15441 size += self.__buffa_unknown_fields.encoded_len() as u32;
15442 size
15443 }
15444 fn write_to(
15445 &self,
15446 __cache: &mut ::buffa::SizeCache,
15447 buf: &mut impl ::buffa::bytes::BufMut,
15448 ) {
15449 #[allow(unused_imports)]
15450 use ::buffa::Enumeration as _;
15451 for v in &self.name {
15452 ::buffa::encoding::Tag::new(
15453 2u32,
15454 ::buffa::encoding::WireType::LengthDelimited,
15455 )
15456 .encode(buf);
15457 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
15458 v.write_to(__cache, buf);
15459 }
15460 if let Some(ref v) = self.identifier_value {
15461 ::buffa::encoding::Tag::new(
15462 3u32,
15463 ::buffa::encoding::WireType::LengthDelimited,
15464 )
15465 .encode(buf);
15466 ::buffa::types::encode_string(v, buf);
15467 }
15468 if let Some(v) = self.positive_int_value {
15469 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
15470 .encode(buf);
15471 ::buffa::types::encode_uint64(v, buf);
15472 }
15473 if let Some(v) = self.negative_int_value {
15474 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
15475 .encode(buf);
15476 ::buffa::types::encode_int64(v, buf);
15477 }
15478 if let Some(v) = self.double_value {
15479 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Fixed64)
15480 .encode(buf);
15481 ::buffa::types::encode_double(v, buf);
15482 }
15483 if let Some(ref v) = self.string_value {
15484 ::buffa::encoding::Tag::new(
15485 7u32,
15486 ::buffa::encoding::WireType::LengthDelimited,
15487 )
15488 .encode(buf);
15489 ::buffa::types::encode_bytes(v, buf);
15490 }
15491 if let Some(ref v) = self.aggregate_value {
15492 ::buffa::encoding::Tag::new(
15493 8u32,
15494 ::buffa::encoding::WireType::LengthDelimited,
15495 )
15496 .encode(buf);
15497 ::buffa::types::encode_string(v, buf);
15498 }
15499 self.__buffa_unknown_fields.write_to(buf);
15500 }
15501 fn merge_field(
15502 &mut self,
15503 tag: ::buffa::encoding::Tag,
15504 buf: &mut impl ::buffa::bytes::Buf,
15505 depth: u32,
15506 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
15507 #[allow(unused_imports)]
15508 use ::buffa::bytes::Buf as _;
15509 #[allow(unused_imports)]
15510 use ::buffa::Enumeration as _;
15511 match tag.field_number() {
15512 2u32 => {
15513 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
15514 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15515 field_number: 2u32,
15516 expected: 2u8,
15517 actual: tag.wire_type() as u8,
15518 });
15519 }
15520 let mut elem = ::core::default::Default::default();
15521 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
15522 self.name.push(elem);
15523 }
15524 3u32 => {
15525 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
15526 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15527 field_number: 3u32,
15528 expected: 2u8,
15529 actual: tag.wire_type() as u8,
15530 });
15531 }
15532 ::buffa::types::merge_string(
15533 self
15534 .identifier_value
15535 .get_or_insert_with(::buffa::alloc::string::String::new),
15536 buf,
15537 )?;
15538 }
15539 4u32 => {
15540 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
15541 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15542 field_number: 4u32,
15543 expected: 0u8,
15544 actual: tag.wire_type() as u8,
15545 });
15546 }
15547 self.positive_int_value = ::core::option::Option::Some(
15548 ::buffa::types::decode_uint64(buf)?,
15549 );
15550 }
15551 5u32 => {
15552 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
15553 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15554 field_number: 5u32,
15555 expected: 0u8,
15556 actual: tag.wire_type() as u8,
15557 });
15558 }
15559 self.negative_int_value = ::core::option::Option::Some(
15560 ::buffa::types::decode_int64(buf)?,
15561 );
15562 }
15563 6u32 => {
15564 if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
15565 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15566 field_number: 6u32,
15567 expected: 1u8,
15568 actual: tag.wire_type() as u8,
15569 });
15570 }
15571 self.double_value = ::core::option::Option::Some(
15572 ::buffa::types::decode_double(buf)?,
15573 );
15574 }
15575 7u32 => {
15576 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
15577 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15578 field_number: 7u32,
15579 expected: 2u8,
15580 actual: tag.wire_type() as u8,
15581 });
15582 }
15583 ::buffa::types::merge_bytes(
15584 self.string_value.get_or_insert_with(::buffa::alloc::vec::Vec::new),
15585 buf,
15586 )?;
15587 }
15588 8u32 => {
15589 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
15590 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15591 field_number: 8u32,
15592 expected: 2u8,
15593 actual: tag.wire_type() as u8,
15594 });
15595 }
15596 ::buffa::types::merge_string(
15597 self
15598 .aggregate_value
15599 .get_or_insert_with(::buffa::alloc::string::String::new),
15600 buf,
15601 )?;
15602 }
15603 _ => {
15604 self.__buffa_unknown_fields
15605 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
15606 }
15607 }
15608 ::core::result::Result::Ok(())
15609 }
15610 fn clear(&mut self) {
15611 self.name.clear();
15612 self.identifier_value = ::core::option::Option::None;
15613 self.positive_int_value = ::core::option::Option::None;
15614 self.negative_int_value = ::core::option::Option::None;
15615 self.double_value = ::core::option::Option::None;
15616 self.string_value = ::core::option::Option::None;
15617 self.aggregate_value = ::core::option::Option::None;
15618 self.__buffa_unknown_fields.clear();
15619 }
15620}
15621impl ::buffa::ExtensionSet for UninterpretedOption {
15622 const PROTO_FQN: &'static str = "google.protobuf.UninterpretedOption";
15623 fn unknown_fields(&self) -> &::buffa::UnknownFields {
15624 &self.__buffa_unknown_fields
15625 }
15626 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
15627 &mut self.__buffa_unknown_fields
15628 }
15629}
15630#[cfg(feature = "text")]
15631impl ::buffa::text::TextFormat for UninterpretedOption {
15632 fn encode_text(
15633 &self,
15634 enc: &mut ::buffa::text::TextEncoder<'_>,
15635 ) -> ::core::fmt::Result {
15636 #[allow(unused_imports)]
15637 use ::buffa::Enumeration as _;
15638 if let ::core::option::Option::Some(ref __v) = self.identifier_value {
15639 enc.write_field_name("identifier_value")?;
15640 enc.write_string(__v)?;
15641 }
15642 if let ::core::option::Option::Some(ref __v) = self.positive_int_value {
15643 enc.write_field_name("positive_int_value")?;
15644 enc.write_u64(*__v)?;
15645 }
15646 if let ::core::option::Option::Some(ref __v) = self.negative_int_value {
15647 enc.write_field_name("negative_int_value")?;
15648 enc.write_i64(*__v)?;
15649 }
15650 if let ::core::option::Option::Some(ref __v) = self.double_value {
15651 enc.write_field_name("double_value")?;
15652 enc.write_f64(*__v)?;
15653 }
15654 if let ::core::option::Option::Some(ref __v) = self.string_value {
15655 enc.write_field_name("string_value")?;
15656 enc.write_bytes(__v)?;
15657 }
15658 if let ::core::option::Option::Some(ref __v) = self.aggregate_value {
15659 enc.write_field_name("aggregate_value")?;
15660 enc.write_string(__v)?;
15661 }
15662 for __v in &self.name {
15663 enc.write_field_name("name")?;
15664 enc.write_message(__v)?;
15665 }
15666 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
15667 ::core::result::Result::Ok(())
15668 }
15669 fn merge_text(
15670 &mut self,
15671 dec: &mut ::buffa::text::TextDecoder<'_>,
15672 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
15673 #[allow(unused_imports)]
15674 use ::buffa::Enumeration as _;
15675 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
15676 match __name {
15677 "identifier_value" => {
15678 self.identifier_value = ::core::option::Option::Some(
15679 dec.read_string()?.into_owned(),
15680 );
15681 }
15682 "positive_int_value" => {
15683 self.positive_int_value = ::core::option::Option::Some(
15684 dec.read_u64()?,
15685 );
15686 }
15687 "negative_int_value" => {
15688 self.negative_int_value = ::core::option::Option::Some(
15689 dec.read_i64()?,
15690 );
15691 }
15692 "double_value" => {
15693 self.double_value = ::core::option::Option::Some(dec.read_f64()?);
15694 }
15695 "string_value" => {
15696 self.string_value = ::core::option::Option::Some(dec.read_bytes()?);
15697 }
15698 "aggregate_value" => {
15699 self.aggregate_value = ::core::option::Option::Some(
15700 dec.read_string()?.into_owned(),
15701 );
15702 }
15703 "name" => {
15704 dec.read_repeated_into(
15705 &mut self.name,
15706 |__d| {
15707 let mut __m = ::core::default::Default::default();
15708 __d.merge_message(&mut __m)?;
15709 ::core::result::Result::Ok(__m)
15710 },
15711 )?
15712 }
15713 _ => dec.skip_value()?,
15714 }
15715 }
15716 ::core::result::Result::Ok(())
15717 }
15718}
15719#[cfg(feature = "json")]
15720impl ::buffa::json_helpers::ProtoElemJson for UninterpretedOption {
15721 fn serialize_proto_json<S: ::serde::Serializer>(
15722 v: &Self,
15723 s: S,
15724 ) -> ::core::result::Result<S::Ok, S::Error> {
15725 ::serde::Serialize::serialize(v, s)
15726 }
15727 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
15728 d: D,
15729 ) -> ::core::result::Result<Self, D::Error> {
15730 <Self as ::serde::Deserialize>::deserialize(d)
15731 }
15732}
15733#[cfg(feature = "json")]
15734#[doc(hidden)]
15735pub const __UNINTERPRETED_OPTION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
15736 type_url: "type.googleapis.com/google.protobuf.UninterpretedOption",
15737 to_json: ::buffa::type_registry::any_to_json::<UninterpretedOption>,
15738 from_json: ::buffa::type_registry::any_from_json::<UninterpretedOption>,
15739 is_wkt: false,
15740};
15741#[cfg(feature = "text")]
15742#[doc(hidden)]
15743pub const __UNINTERPRETED_OPTION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
15744 type_url: "type.googleapis.com/google.protobuf.UninterpretedOption",
15745 text_encode: ::buffa::type_registry::any_encode_text::<UninterpretedOption>,
15746 text_merge: ::buffa::type_registry::any_merge_text::<UninterpretedOption>,
15747};
15748pub mod uninterpreted_option {
15749 #[allow(unused_imports)]
15750 use super::*;
15751 #[derive(Clone, PartialEq, Default)]
15757 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
15758 #[cfg_attr(feature = "json", serde(default))]
15759 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15760 pub struct NamePart {
15761 #[cfg_attr(
15763 feature = "json",
15764 serde(
15765 rename = "namePart",
15766 alias = "name_part",
15767 with = "::buffa::json_helpers::proto_string"
15768 )
15769 )]
15770 pub name_part: ::buffa::alloc::string::String,
15771 #[cfg_attr(
15773 feature = "json",
15774 serde(
15775 rename = "isExtension",
15776 alias = "is_extension",
15777 with = "::buffa::json_helpers::proto_bool"
15778 )
15779 )]
15780 pub is_extension: bool,
15781 #[cfg_attr(feature = "json", serde(skip))]
15782 #[doc(hidden)]
15783 pub __buffa_unknown_fields: ::buffa::UnknownFields,
15784 }
15785 impl ::core::fmt::Debug for NamePart {
15786 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
15787 f.debug_struct("NamePart")
15788 .field("name_part", &self.name_part)
15789 .field("is_extension", &self.is_extension)
15790 .finish()
15791 }
15792 }
15793 impl NamePart {
15794 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart";
15799 }
15800 impl ::buffa::DefaultInstance for NamePart {
15801 fn default_instance() -> &'static Self {
15802 static VALUE: ::buffa::__private::OnceBox<NamePart> = ::buffa::__private::OnceBox::new();
15803 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
15804 }
15805 }
15806 impl ::buffa::MessageName for NamePart {
15807 const PACKAGE: &'static str = "google.protobuf";
15808 const NAME: &'static str = "UninterpretedOption.NamePart";
15809 const FULL_NAME: &'static str = "google.protobuf.UninterpretedOption.NamePart";
15810 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart";
15811 }
15812 impl ::buffa::Message for NamePart {
15813 #[allow(clippy::let_and_return)]
15819 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
15820 #[allow(unused_imports)]
15821 use ::buffa::Enumeration as _;
15822 let mut size = 0u32;
15823 size += 1u32 + ::buffa::types::string_encoded_len(&self.name_part) as u32;
15824 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
15825 size += self.__buffa_unknown_fields.encoded_len() as u32;
15826 size
15827 }
15828 fn write_to(
15829 &self,
15830 _cache: &mut ::buffa::SizeCache,
15831 buf: &mut impl ::buffa::bytes::BufMut,
15832 ) {
15833 #[allow(unused_imports)]
15834 use ::buffa::Enumeration as _;
15835 ::buffa::encoding::Tag::new(
15836 1u32,
15837 ::buffa::encoding::WireType::LengthDelimited,
15838 )
15839 .encode(buf);
15840 ::buffa::types::encode_string(&self.name_part, buf);
15841 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
15842 .encode(buf);
15843 ::buffa::types::encode_bool(self.is_extension, buf);
15844 self.__buffa_unknown_fields.write_to(buf);
15845 }
15846 fn merge_field(
15847 &mut self,
15848 tag: ::buffa::encoding::Tag,
15849 buf: &mut impl ::buffa::bytes::Buf,
15850 depth: u32,
15851 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
15852 #[allow(unused_imports)]
15853 use ::buffa::bytes::Buf as _;
15854 #[allow(unused_imports)]
15855 use ::buffa::Enumeration as _;
15856 match tag.field_number() {
15857 1u32 => {
15858 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
15859 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15860 field_number: 1u32,
15861 expected: 2u8,
15862 actual: tag.wire_type() as u8,
15863 });
15864 }
15865 ::buffa::types::merge_string(&mut self.name_part, buf)?;
15866 }
15867 2u32 => {
15868 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
15869 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
15870 field_number: 2u32,
15871 expected: 0u8,
15872 actual: tag.wire_type() as u8,
15873 });
15874 }
15875 self.is_extension = ::buffa::types::decode_bool(buf)?;
15876 }
15877 _ => {
15878 self.__buffa_unknown_fields
15879 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
15880 }
15881 }
15882 ::core::result::Result::Ok(())
15883 }
15884 fn clear(&mut self) {
15885 self.name_part.clear();
15886 self.is_extension = false;
15887 self.__buffa_unknown_fields.clear();
15888 }
15889 }
15890 impl ::buffa::ExtensionSet for NamePart {
15891 const PROTO_FQN: &'static str = "google.protobuf.UninterpretedOption.NamePart";
15892 fn unknown_fields(&self) -> &::buffa::UnknownFields {
15893 &self.__buffa_unknown_fields
15894 }
15895 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
15896 &mut self.__buffa_unknown_fields
15897 }
15898 }
15899 #[cfg(feature = "text")]
15900 impl ::buffa::text::TextFormat for NamePart {
15901 fn encode_text(
15902 &self,
15903 enc: &mut ::buffa::text::TextEncoder<'_>,
15904 ) -> ::core::fmt::Result {
15905 #[allow(unused_imports)]
15906 use ::buffa::Enumeration as _;
15907 enc.write_field_name("name_part")?;
15908 enc.write_string(&self.name_part)?;
15909 enc.write_field_name("is_extension")?;
15910 enc.write_bool(self.is_extension)?;
15911 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
15912 ::core::result::Result::Ok(())
15913 }
15914 fn merge_text(
15915 &mut self,
15916 dec: &mut ::buffa::text::TextDecoder<'_>,
15917 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
15918 #[allow(unused_imports)]
15919 use ::buffa::Enumeration as _;
15920 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
15921 match __name {
15922 "name_part" => self.name_part = dec.read_string()?.into_owned(),
15923 "is_extension" => self.is_extension = dec.read_bool()?,
15924 _ => dec.skip_value()?,
15925 }
15926 }
15927 ::core::result::Result::Ok(())
15928 }
15929 }
15930 #[cfg(feature = "json")]
15931 impl ::buffa::json_helpers::ProtoElemJson for NamePart {
15932 fn serialize_proto_json<S: ::serde::Serializer>(
15933 v: &Self,
15934 s: S,
15935 ) -> ::core::result::Result<S::Ok, S::Error> {
15936 ::serde::Serialize::serialize(v, s)
15937 }
15938 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
15939 d: D,
15940 ) -> ::core::result::Result<Self, D::Error> {
15941 <Self as ::serde::Deserialize>::deserialize(d)
15942 }
15943 }
15944 #[cfg(feature = "json")]
15945 #[doc(hidden)]
15946 pub const __NAME_PART_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
15947 type_url: "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart",
15948 to_json: ::buffa::type_registry::any_to_json::<NamePart>,
15949 from_json: ::buffa::type_registry::any_from_json::<NamePart>,
15950 is_wkt: false,
15951 };
15952 #[cfg(feature = "text")]
15953 #[doc(hidden)]
15954 pub const __NAME_PART_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
15955 type_url: "type.googleapis.com/google.protobuf.UninterpretedOption.NamePart",
15956 text_encode: ::buffa::type_registry::any_encode_text::<NamePart>,
15957 text_merge: ::buffa::type_registry::any_merge_text::<NamePart>,
15958 };
15959 #[cfg(feature = "views")]
15960 #[doc(inline)]
15961 pub use super::__buffa::view::uninterpreted_option::NamePartView;
15962}
15963#[derive(Clone, PartialEq, Default)]
15973#[cfg_attr(feature = "json", derive(::serde::Serialize))]
15974#[cfg_attr(feature = "json", serde(default))]
15975#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15976pub struct FeatureSet {
15977 #[cfg_attr(
15979 feature = "json",
15980 serde(
15981 rename = "fieldPresence",
15982 alias = "field_presence",
15983 with = "::buffa::json_helpers::opt_closed_enum",
15984 skip_serializing_if = "::core::option::Option::is_none"
15985 )
15986 )]
15987 pub field_presence: ::core::option::Option<feature_set::FieldPresence>,
15988 #[cfg_attr(
15990 feature = "json",
15991 serde(
15992 rename = "enumType",
15993 alias = "enum_type",
15994 with = "::buffa::json_helpers::opt_closed_enum",
15995 skip_serializing_if = "::core::option::Option::is_none"
15996 )
15997 )]
15998 pub enum_type: ::core::option::Option<feature_set::EnumType>,
15999 #[cfg_attr(
16001 feature = "json",
16002 serde(
16003 rename = "repeatedFieldEncoding",
16004 alias = "repeated_field_encoding",
16005 with = "::buffa::json_helpers::opt_closed_enum",
16006 skip_serializing_if = "::core::option::Option::is_none"
16007 )
16008 )]
16009 pub repeated_field_encoding: ::core::option::Option<
16010 feature_set::RepeatedFieldEncoding,
16011 >,
16012 #[cfg_attr(
16014 feature = "json",
16015 serde(
16016 rename = "utf8Validation",
16017 alias = "utf8_validation",
16018 with = "::buffa::json_helpers::opt_closed_enum",
16019 skip_serializing_if = "::core::option::Option::is_none"
16020 )
16021 )]
16022 pub utf8_validation: ::core::option::Option<feature_set::Utf8Validation>,
16023 #[cfg_attr(
16025 feature = "json",
16026 serde(
16027 rename = "messageEncoding",
16028 alias = "message_encoding",
16029 with = "::buffa::json_helpers::opt_closed_enum",
16030 skip_serializing_if = "::core::option::Option::is_none"
16031 )
16032 )]
16033 pub message_encoding: ::core::option::Option<feature_set::MessageEncoding>,
16034 #[cfg_attr(
16036 feature = "json",
16037 serde(
16038 rename = "jsonFormat",
16039 alias = "json_format",
16040 with = "::buffa::json_helpers::opt_closed_enum",
16041 skip_serializing_if = "::core::option::Option::is_none"
16042 )
16043 )]
16044 pub json_format: ::core::option::Option<feature_set::JsonFormat>,
16045 #[cfg_attr(
16047 feature = "json",
16048 serde(
16049 rename = "enforceNamingStyle",
16050 alias = "enforce_naming_style",
16051 with = "::buffa::json_helpers::opt_closed_enum",
16052 skip_serializing_if = "::core::option::Option::is_none"
16053 )
16054 )]
16055 pub enforce_naming_style: ::core::option::Option<feature_set::EnforceNamingStyle>,
16056 #[cfg_attr(
16058 feature = "json",
16059 serde(
16060 rename = "defaultSymbolVisibility",
16061 alias = "default_symbol_visibility",
16062 with = "::buffa::json_helpers::opt_closed_enum",
16063 skip_serializing_if = "::core::option::Option::is_none"
16064 )
16065 )]
16066 pub default_symbol_visibility: ::core::option::Option<
16067 feature_set::visibility_feature::DefaultSymbolVisibility,
16068 >,
16069 #[cfg_attr(feature = "json", serde(flatten))]
16070 #[doc(hidden)]
16071 pub __buffa_unknown_fields: __FeatureSetExtJson,
16072}
16073impl ::core::fmt::Debug for FeatureSet {
16074 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
16075 f.debug_struct("FeatureSet")
16076 .field("field_presence", &self.field_presence)
16077 .field("enum_type", &self.enum_type)
16078 .field("repeated_field_encoding", &self.repeated_field_encoding)
16079 .field("utf8_validation", &self.utf8_validation)
16080 .field("message_encoding", &self.message_encoding)
16081 .field("json_format", &self.json_format)
16082 .field("enforce_naming_style", &self.enforce_naming_style)
16083 .field("default_symbol_visibility", &self.default_symbol_visibility)
16084 .finish()
16085 }
16086}
16087impl FeatureSet {
16088 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSet";
16093}
16094impl FeatureSet {
16095 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16096 #[inline]
16097 pub fn with_field_presence(
16099 mut self,
16100 value: impl Into<feature_set::FieldPresence>,
16101 ) -> Self {
16102 self.field_presence = Some(value.into());
16103 self
16104 }
16105 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16106 #[inline]
16107 pub fn with_enum_type(mut self, value: impl Into<feature_set::EnumType>) -> Self {
16109 self.enum_type = Some(value.into());
16110 self
16111 }
16112 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16113 #[inline]
16114 pub fn with_repeated_field_encoding(
16116 mut self,
16117 value: impl Into<feature_set::RepeatedFieldEncoding>,
16118 ) -> Self {
16119 self.repeated_field_encoding = Some(value.into());
16120 self
16121 }
16122 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16123 #[inline]
16124 pub fn with_utf8_validation(
16126 mut self,
16127 value: impl Into<feature_set::Utf8Validation>,
16128 ) -> Self {
16129 self.utf8_validation = Some(value.into());
16130 self
16131 }
16132 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16133 #[inline]
16134 pub fn with_message_encoding(
16136 mut self,
16137 value: impl Into<feature_set::MessageEncoding>,
16138 ) -> Self {
16139 self.message_encoding = Some(value.into());
16140 self
16141 }
16142 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16143 #[inline]
16144 pub fn with_json_format(
16146 mut self,
16147 value: impl Into<feature_set::JsonFormat>,
16148 ) -> Self {
16149 self.json_format = Some(value.into());
16150 self
16151 }
16152 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16153 #[inline]
16154 pub fn with_enforce_naming_style(
16156 mut self,
16157 value: impl Into<feature_set::EnforceNamingStyle>,
16158 ) -> Self {
16159 self.enforce_naming_style = Some(value.into());
16160 self
16161 }
16162 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
16163 #[inline]
16164 pub fn with_default_symbol_visibility(
16166 mut self,
16167 value: impl Into<feature_set::visibility_feature::DefaultSymbolVisibility>,
16168 ) -> Self {
16169 self.default_symbol_visibility = Some(value.into());
16170 self
16171 }
16172}
16173impl ::buffa::DefaultInstance for FeatureSet {
16174 fn default_instance() -> &'static Self {
16175 static VALUE: ::buffa::__private::OnceBox<FeatureSet> = ::buffa::__private::OnceBox::new();
16176 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
16177 }
16178}
16179impl ::buffa::MessageName for FeatureSet {
16180 const PACKAGE: &'static str = "google.protobuf";
16181 const NAME: &'static str = "FeatureSet";
16182 const FULL_NAME: &'static str = "google.protobuf.FeatureSet";
16183 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSet";
16184}
16185impl ::buffa::Message for FeatureSet {
16186 #[allow(clippy::let_and_return)]
16192 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
16193 #[allow(unused_imports)]
16194 use ::buffa::Enumeration as _;
16195 let mut size = 0u32;
16196 if let Some(ref v) = self.field_presence {
16197 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16198 }
16199 if let Some(ref v) = self.enum_type {
16200 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16201 }
16202 if let Some(ref v) = self.repeated_field_encoding {
16203 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16204 }
16205 if let Some(ref v) = self.utf8_validation {
16206 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16207 }
16208 if let Some(ref v) = self.message_encoding {
16209 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16210 }
16211 if let Some(ref v) = self.json_format {
16212 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16213 }
16214 if let Some(ref v) = self.enforce_naming_style {
16215 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16216 }
16217 if let Some(ref v) = self.default_symbol_visibility {
16218 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
16219 }
16220 size += self.__buffa_unknown_fields.encoded_len() as u32;
16221 size
16222 }
16223 fn write_to(
16224 &self,
16225 _cache: &mut ::buffa::SizeCache,
16226 buf: &mut impl ::buffa::bytes::BufMut,
16227 ) {
16228 #[allow(unused_imports)]
16229 use ::buffa::Enumeration as _;
16230 if let Some(ref v) = self.field_presence {
16231 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
16232 .encode(buf);
16233 ::buffa::types::encode_int32(v.to_i32(), buf);
16234 }
16235 if let Some(ref v) = self.enum_type {
16236 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
16237 .encode(buf);
16238 ::buffa::types::encode_int32(v.to_i32(), buf);
16239 }
16240 if let Some(ref v) = self.repeated_field_encoding {
16241 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
16242 .encode(buf);
16243 ::buffa::types::encode_int32(v.to_i32(), buf);
16244 }
16245 if let Some(ref v) = self.utf8_validation {
16246 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
16247 .encode(buf);
16248 ::buffa::types::encode_int32(v.to_i32(), buf);
16249 }
16250 if let Some(ref v) = self.message_encoding {
16251 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
16252 .encode(buf);
16253 ::buffa::types::encode_int32(v.to_i32(), buf);
16254 }
16255 if let Some(ref v) = self.json_format {
16256 ::buffa::encoding::Tag::new(6u32, ::buffa::encoding::WireType::Varint)
16257 .encode(buf);
16258 ::buffa::types::encode_int32(v.to_i32(), buf);
16259 }
16260 if let Some(ref v) = self.enforce_naming_style {
16261 ::buffa::encoding::Tag::new(7u32, ::buffa::encoding::WireType::Varint)
16262 .encode(buf);
16263 ::buffa::types::encode_int32(v.to_i32(), buf);
16264 }
16265 if let Some(ref v) = self.default_symbol_visibility {
16266 ::buffa::encoding::Tag::new(8u32, ::buffa::encoding::WireType::Varint)
16267 .encode(buf);
16268 ::buffa::types::encode_int32(v.to_i32(), buf);
16269 }
16270 self.__buffa_unknown_fields.write_to(buf);
16271 }
16272 fn merge_field(
16273 &mut self,
16274 tag: ::buffa::encoding::Tag,
16275 buf: &mut impl ::buffa::bytes::Buf,
16276 depth: u32,
16277 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
16278 #[allow(unused_imports)]
16279 use ::buffa::bytes::Buf as _;
16280 #[allow(unused_imports)]
16281 use ::buffa::Enumeration as _;
16282 match tag.field_number() {
16283 1u32 => {
16284 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16285 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16286 field_number: 1u32,
16287 expected: 0u8,
16288 actual: tag.wire_type() as u8,
16289 });
16290 }
16291 let __raw = ::buffa::types::decode_int32(buf)?;
16292 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16293 __raw,
16294 ) {
16295 self.field_presence = ::core::option::Option::Some(__v);
16296 } else {
16297 self.__buffa_unknown_fields
16298 .push(::buffa::UnknownField {
16299 number: 1u32,
16300 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16301 });
16302 }
16303 }
16304 2u32 => {
16305 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16306 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16307 field_number: 2u32,
16308 expected: 0u8,
16309 actual: tag.wire_type() as u8,
16310 });
16311 }
16312 let __raw = ::buffa::types::decode_int32(buf)?;
16313 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16314 __raw,
16315 ) {
16316 self.enum_type = ::core::option::Option::Some(__v);
16317 } else {
16318 self.__buffa_unknown_fields
16319 .push(::buffa::UnknownField {
16320 number: 2u32,
16321 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16322 });
16323 }
16324 }
16325 3u32 => {
16326 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16327 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16328 field_number: 3u32,
16329 expected: 0u8,
16330 actual: tag.wire_type() as u8,
16331 });
16332 }
16333 let __raw = ::buffa::types::decode_int32(buf)?;
16334 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16335 __raw,
16336 ) {
16337 self.repeated_field_encoding = ::core::option::Option::Some(__v);
16338 } else {
16339 self.__buffa_unknown_fields
16340 .push(::buffa::UnknownField {
16341 number: 3u32,
16342 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16343 });
16344 }
16345 }
16346 4u32 => {
16347 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16348 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16349 field_number: 4u32,
16350 expected: 0u8,
16351 actual: tag.wire_type() as u8,
16352 });
16353 }
16354 let __raw = ::buffa::types::decode_int32(buf)?;
16355 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16356 __raw,
16357 ) {
16358 self.utf8_validation = ::core::option::Option::Some(__v);
16359 } else {
16360 self.__buffa_unknown_fields
16361 .push(::buffa::UnknownField {
16362 number: 4u32,
16363 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16364 });
16365 }
16366 }
16367 5u32 => {
16368 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16369 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16370 field_number: 5u32,
16371 expected: 0u8,
16372 actual: tag.wire_type() as u8,
16373 });
16374 }
16375 let __raw = ::buffa::types::decode_int32(buf)?;
16376 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16377 __raw,
16378 ) {
16379 self.message_encoding = ::core::option::Option::Some(__v);
16380 } else {
16381 self.__buffa_unknown_fields
16382 .push(::buffa::UnknownField {
16383 number: 5u32,
16384 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16385 });
16386 }
16387 }
16388 6u32 => {
16389 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16390 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16391 field_number: 6u32,
16392 expected: 0u8,
16393 actual: tag.wire_type() as u8,
16394 });
16395 }
16396 let __raw = ::buffa::types::decode_int32(buf)?;
16397 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16398 __raw,
16399 ) {
16400 self.json_format = ::core::option::Option::Some(__v);
16401 } else {
16402 self.__buffa_unknown_fields
16403 .push(::buffa::UnknownField {
16404 number: 6u32,
16405 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16406 });
16407 }
16408 }
16409 7u32 => {
16410 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16411 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16412 field_number: 7u32,
16413 expected: 0u8,
16414 actual: tag.wire_type() as u8,
16415 });
16416 }
16417 let __raw = ::buffa::types::decode_int32(buf)?;
16418 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16419 __raw,
16420 ) {
16421 self.enforce_naming_style = ::core::option::Option::Some(__v);
16422 } else {
16423 self.__buffa_unknown_fields
16424 .push(::buffa::UnknownField {
16425 number: 7u32,
16426 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16427 });
16428 }
16429 }
16430 8u32 => {
16431 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
16432 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
16433 field_number: 8u32,
16434 expected: 0u8,
16435 actual: tag.wire_type() as u8,
16436 });
16437 }
16438 let __raw = ::buffa::types::decode_int32(buf)?;
16439 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
16440 __raw,
16441 ) {
16442 self.default_symbol_visibility = ::core::option::Option::Some(__v);
16443 } else {
16444 self.__buffa_unknown_fields
16445 .push(::buffa::UnknownField {
16446 number: 8u32,
16447 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
16448 });
16449 }
16450 }
16451 _ => {
16452 self.__buffa_unknown_fields
16453 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
16454 }
16455 }
16456 ::core::result::Result::Ok(())
16457 }
16458 fn clear(&mut self) {
16459 self.field_presence = ::core::option::Option::None;
16460 self.enum_type = ::core::option::Option::None;
16461 self.repeated_field_encoding = ::core::option::Option::None;
16462 self.utf8_validation = ::core::option::Option::None;
16463 self.message_encoding = ::core::option::Option::None;
16464 self.json_format = ::core::option::Option::None;
16465 self.enforce_naming_style = ::core::option::Option::None;
16466 self.default_symbol_visibility = ::core::option::Option::None;
16467 self.__buffa_unknown_fields.clear();
16468 }
16469}
16470impl ::buffa::ExtensionSet for FeatureSet {
16471 const PROTO_FQN: &'static str = "google.protobuf.FeatureSet";
16472 fn unknown_fields(&self) -> &::buffa::UnknownFields {
16473 &self.__buffa_unknown_fields
16474 }
16475 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
16476 &mut self.__buffa_unknown_fields
16477 }
16478}
16479#[cfg(feature = "text")]
16480impl ::buffa::text::TextFormat for FeatureSet {
16481 fn encode_text(
16482 &self,
16483 enc: &mut ::buffa::text::TextEncoder<'_>,
16484 ) -> ::core::fmt::Result {
16485 #[allow(unused_imports)]
16486 use ::buffa::Enumeration as _;
16487 if let ::core::option::Option::Some(ref __v) = self.field_presence {
16488 enc.write_field_name("field_presence")?;
16489 enc.write_enum_name(__v.proto_name())?;
16490 }
16491 if let ::core::option::Option::Some(ref __v) = self.enum_type {
16492 enc.write_field_name("enum_type")?;
16493 enc.write_enum_name(__v.proto_name())?;
16494 }
16495 if let ::core::option::Option::Some(ref __v) = self.repeated_field_encoding {
16496 enc.write_field_name("repeated_field_encoding")?;
16497 enc.write_enum_name(__v.proto_name())?;
16498 }
16499 if let ::core::option::Option::Some(ref __v) = self.utf8_validation {
16500 enc.write_field_name("utf8_validation")?;
16501 enc.write_enum_name(__v.proto_name())?;
16502 }
16503 if let ::core::option::Option::Some(ref __v) = self.message_encoding {
16504 enc.write_field_name("message_encoding")?;
16505 enc.write_enum_name(__v.proto_name())?;
16506 }
16507 if let ::core::option::Option::Some(ref __v) = self.json_format {
16508 enc.write_field_name("json_format")?;
16509 enc.write_enum_name(__v.proto_name())?;
16510 }
16511 if let ::core::option::Option::Some(ref __v) = self.enforce_naming_style {
16512 enc.write_field_name("enforce_naming_style")?;
16513 enc.write_enum_name(__v.proto_name())?;
16514 }
16515 if let ::core::option::Option::Some(ref __v) = self.default_symbol_visibility {
16516 enc.write_field_name("default_symbol_visibility")?;
16517 enc.write_enum_name(__v.proto_name())?;
16518 }
16519 enc.write_extension_fields(
16520 "google.protobuf.FeatureSet",
16521 &self.__buffa_unknown_fields,
16522 )?;
16523 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
16524 ::core::result::Result::Ok(())
16525 }
16526 fn merge_text(
16527 &mut self,
16528 dec: &mut ::buffa::text::TextDecoder<'_>,
16529 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
16530 #[allow(unused_imports)]
16531 use ::buffa::Enumeration as _;
16532 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
16533 match __name {
16534 "field_presence" => {
16535 self.field_presence = ::core::option::Option::Some(
16536 dec.read_closed_enum_by_name::<feature_set::FieldPresence>()?,
16537 );
16538 }
16539 "enum_type" => {
16540 self.enum_type = ::core::option::Option::Some(
16541 dec.read_closed_enum_by_name::<feature_set::EnumType>()?,
16542 );
16543 }
16544 "repeated_field_encoding" => {
16545 self.repeated_field_encoding = ::core::option::Option::Some(
16546 dec
16547 .read_closed_enum_by_name::<
16548 feature_set::RepeatedFieldEncoding,
16549 >()?,
16550 );
16551 }
16552 "utf8_validation" => {
16553 self.utf8_validation = ::core::option::Option::Some(
16554 dec.read_closed_enum_by_name::<feature_set::Utf8Validation>()?,
16555 );
16556 }
16557 "message_encoding" => {
16558 self.message_encoding = ::core::option::Option::Some(
16559 dec.read_closed_enum_by_name::<feature_set::MessageEncoding>()?,
16560 );
16561 }
16562 "json_format" => {
16563 self.json_format = ::core::option::Option::Some(
16564 dec.read_closed_enum_by_name::<feature_set::JsonFormat>()?,
16565 );
16566 }
16567 "enforce_naming_style" => {
16568 self.enforce_naming_style = ::core::option::Option::Some(
16569 dec
16570 .read_closed_enum_by_name::<
16571 feature_set::EnforceNamingStyle,
16572 >()?,
16573 );
16574 }
16575 "default_symbol_visibility" => {
16576 self.default_symbol_visibility = ::core::option::Option::Some(
16577 dec
16578 .read_closed_enum_by_name::<
16579 feature_set::visibility_feature::DefaultSymbolVisibility,
16580 >()?,
16581 );
16582 }
16583 __name if __name.starts_with('[') => {
16584 for __r in dec.read_extension(__name, "google.protobuf.FeatureSet")?
16585 {
16586 self.__buffa_unknown_fields.push(__r);
16587 }
16588 }
16589 _ => dec.skip_value()?,
16590 }
16591 }
16592 ::core::result::Result::Ok(())
16593 }
16594}
16595#[cfg(feature = "json")]
16596impl<'de> serde::Deserialize<'de> for FeatureSet {
16597 fn deserialize<D: serde::Deserializer<'de>>(
16598 d: D,
16599 ) -> ::core::result::Result<Self, D::Error> {
16600 struct _V;
16601 impl<'de> serde::de::Visitor<'de> for _V {
16602 type Value = FeatureSet;
16603 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16604 f.write_str("struct FeatureSet")
16605 }
16606 #[allow(clippy::field_reassign_with_default)]
16607 fn visit_map<A: serde::de::MapAccess<'de>>(
16608 self,
16609 mut map: A,
16610 ) -> ::core::result::Result<FeatureSet, A::Error> {
16611 let mut __f_field_presence: ::core::option::Option<
16612 ::core::option::Option<feature_set::FieldPresence>,
16613 > = None;
16614 let mut __f_enum_type: ::core::option::Option<
16615 ::core::option::Option<feature_set::EnumType>,
16616 > = None;
16617 let mut __f_repeated_field_encoding: ::core::option::Option<
16618 ::core::option::Option<feature_set::RepeatedFieldEncoding>,
16619 > = None;
16620 let mut __f_utf8_validation: ::core::option::Option<
16621 ::core::option::Option<feature_set::Utf8Validation>,
16622 > = None;
16623 let mut __f_message_encoding: ::core::option::Option<
16624 ::core::option::Option<feature_set::MessageEncoding>,
16625 > = None;
16626 let mut __f_json_format: ::core::option::Option<
16627 ::core::option::Option<feature_set::JsonFormat>,
16628 > = None;
16629 let mut __f_enforce_naming_style: ::core::option::Option<
16630 ::core::option::Option<feature_set::EnforceNamingStyle>,
16631 > = None;
16632 let mut __f_default_symbol_visibility: ::core::option::Option<
16633 ::core::option::Option<
16634 feature_set::visibility_feature::DefaultSymbolVisibility,
16635 >,
16636 > = None;
16637 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
16638 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
16639 match key.as_str() {
16640 "fieldPresence" | "field_presence" => {
16641 __f_field_presence = Some({
16642 struct _S;
16643 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16644 type Value = ::core::option::Option<
16645 feature_set::FieldPresence,
16646 >;
16647 fn deserialize<D: serde::Deserializer<'de>>(
16648 self,
16649 d: D,
16650 ) -> ::core::result::Result<
16651 ::core::option::Option<feature_set::FieldPresence>,
16652 D::Error,
16653 > {
16654 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16655 }
16656 }
16657 map.next_value_seed(_S)?
16658 });
16659 }
16660 "enumType" | "enum_type" => {
16661 __f_enum_type = Some({
16662 struct _S;
16663 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16664 type Value = ::core::option::Option<feature_set::EnumType>;
16665 fn deserialize<D: serde::Deserializer<'de>>(
16666 self,
16667 d: D,
16668 ) -> ::core::result::Result<
16669 ::core::option::Option<feature_set::EnumType>,
16670 D::Error,
16671 > {
16672 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16673 }
16674 }
16675 map.next_value_seed(_S)?
16676 });
16677 }
16678 "repeatedFieldEncoding" | "repeated_field_encoding" => {
16679 __f_repeated_field_encoding = Some({
16680 struct _S;
16681 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16682 type Value = ::core::option::Option<
16683 feature_set::RepeatedFieldEncoding,
16684 >;
16685 fn deserialize<D: serde::Deserializer<'de>>(
16686 self,
16687 d: D,
16688 ) -> ::core::result::Result<
16689 ::core::option::Option<feature_set::RepeatedFieldEncoding>,
16690 D::Error,
16691 > {
16692 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16693 }
16694 }
16695 map.next_value_seed(_S)?
16696 });
16697 }
16698 "utf8Validation" | "utf8_validation" => {
16699 __f_utf8_validation = Some({
16700 struct _S;
16701 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16702 type Value = ::core::option::Option<
16703 feature_set::Utf8Validation,
16704 >;
16705 fn deserialize<D: serde::Deserializer<'de>>(
16706 self,
16707 d: D,
16708 ) -> ::core::result::Result<
16709 ::core::option::Option<feature_set::Utf8Validation>,
16710 D::Error,
16711 > {
16712 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16713 }
16714 }
16715 map.next_value_seed(_S)?
16716 });
16717 }
16718 "messageEncoding" | "message_encoding" => {
16719 __f_message_encoding = Some({
16720 struct _S;
16721 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16722 type Value = ::core::option::Option<
16723 feature_set::MessageEncoding,
16724 >;
16725 fn deserialize<D: serde::Deserializer<'de>>(
16726 self,
16727 d: D,
16728 ) -> ::core::result::Result<
16729 ::core::option::Option<feature_set::MessageEncoding>,
16730 D::Error,
16731 > {
16732 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16733 }
16734 }
16735 map.next_value_seed(_S)?
16736 });
16737 }
16738 "jsonFormat" | "json_format" => {
16739 __f_json_format = Some({
16740 struct _S;
16741 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16742 type Value = ::core::option::Option<
16743 feature_set::JsonFormat,
16744 >;
16745 fn deserialize<D: serde::Deserializer<'de>>(
16746 self,
16747 d: D,
16748 ) -> ::core::result::Result<
16749 ::core::option::Option<feature_set::JsonFormat>,
16750 D::Error,
16751 > {
16752 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16753 }
16754 }
16755 map.next_value_seed(_S)?
16756 });
16757 }
16758 "enforceNamingStyle" | "enforce_naming_style" => {
16759 __f_enforce_naming_style = Some({
16760 struct _S;
16761 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16762 type Value = ::core::option::Option<
16763 feature_set::EnforceNamingStyle,
16764 >;
16765 fn deserialize<D: serde::Deserializer<'de>>(
16766 self,
16767 d: D,
16768 ) -> ::core::result::Result<
16769 ::core::option::Option<feature_set::EnforceNamingStyle>,
16770 D::Error,
16771 > {
16772 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16773 }
16774 }
16775 map.next_value_seed(_S)?
16776 });
16777 }
16778 "defaultSymbolVisibility" | "default_symbol_visibility" => {
16779 __f_default_symbol_visibility = Some({
16780 struct _S;
16781 impl<'de> serde::de::DeserializeSeed<'de> for _S {
16782 type Value = ::core::option::Option<
16783 feature_set::visibility_feature::DefaultSymbolVisibility,
16784 >;
16785 fn deserialize<D: serde::Deserializer<'de>>(
16786 self,
16787 d: D,
16788 ) -> ::core::result::Result<
16789 ::core::option::Option<
16790 feature_set::visibility_feature::DefaultSymbolVisibility,
16791 >,
16792 D::Error,
16793 > {
16794 ::buffa::json_helpers::opt_closed_enum::deserialize(d)
16795 }
16796 }
16797 map.next_value_seed(_S)?
16798 });
16799 }
16800 __k if __k.starts_with('[') => {
16801 let __v: ::buffa::serde_json::Value = map.next_value()?;
16802 match ::buffa::extension_registry::deserialize_extension_key(
16803 "google.protobuf.FeatureSet",
16804 __k,
16805 __v,
16806 ) {
16807 ::core::option::Option::Some(
16808 ::core::result::Result::Ok(__recs),
16809 ) => {
16810 for __rec in __recs {
16811 __ext_records.push(__rec);
16812 }
16813 }
16814 ::core::option::Option::Some(
16815 ::core::result::Result::Err(__e),
16816 ) => {
16817 return ::core::result::Result::Err(
16818 <A::Error as ::serde::de::Error>::custom(__e),
16819 );
16820 }
16821 ::core::option::Option::None => {}
16822 }
16823 }
16824 _ => {
16825 map.next_value::<serde::de::IgnoredAny>()?;
16826 }
16827 }
16828 }
16829 let mut __r = <FeatureSet as ::core::default::Default>::default();
16830 if let ::core::option::Option::Some(v) = __f_field_presence {
16831 __r.field_presence = v;
16832 }
16833 if let ::core::option::Option::Some(v) = __f_enum_type {
16834 __r.enum_type = v;
16835 }
16836 if let ::core::option::Option::Some(v) = __f_repeated_field_encoding {
16837 __r.repeated_field_encoding = v;
16838 }
16839 if let ::core::option::Option::Some(v) = __f_utf8_validation {
16840 __r.utf8_validation = v;
16841 }
16842 if let ::core::option::Option::Some(v) = __f_message_encoding {
16843 __r.message_encoding = v;
16844 }
16845 if let ::core::option::Option::Some(v) = __f_json_format {
16846 __r.json_format = v;
16847 }
16848 if let ::core::option::Option::Some(v) = __f_enforce_naming_style {
16849 __r.enforce_naming_style = v;
16850 }
16851 if let ::core::option::Option::Some(v) = __f_default_symbol_visibility {
16852 __r.default_symbol_visibility = v;
16853 }
16854 for __rec in __ext_records {
16855 __r.__buffa_unknown_fields.push(__rec);
16856 }
16857 Ok(__r)
16858 }
16859 }
16860 d.deserialize_map(_V)
16861 }
16862}
16863#[cfg(feature = "json")]
16864impl ::buffa::json_helpers::ProtoElemJson for FeatureSet {
16865 fn serialize_proto_json<S: ::serde::Serializer>(
16866 v: &Self,
16867 s: S,
16868 ) -> ::core::result::Result<S::Ok, S::Error> {
16869 ::serde::Serialize::serialize(v, s)
16870 }
16871 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
16872 d: D,
16873 ) -> ::core::result::Result<Self, D::Error> {
16874 <Self as ::serde::Deserialize>::deserialize(d)
16875 }
16876}
16877#[doc(hidden)]
16878#[derive(Clone, Debug, Default, PartialEq)]
16879#[repr(transparent)]
16880#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
16881pub struct __FeatureSetExtJson(pub ::buffa::UnknownFields);
16882impl ::core::ops::Deref for __FeatureSetExtJson {
16883 type Target = ::buffa::UnknownFields;
16884 fn deref(&self) -> &::buffa::UnknownFields {
16885 &self.0
16886 }
16887}
16888impl ::core::ops::DerefMut for __FeatureSetExtJson {
16889 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
16890 &mut self.0
16891 }
16892}
16893impl ::core::convert::From<::buffa::UnknownFields> for __FeatureSetExtJson {
16894 fn from(u: ::buffa::UnknownFields) -> Self {
16895 Self(u)
16896 }
16897}
16898#[cfg(feature = "json")]
16899impl ::serde::Serialize for __FeatureSetExtJson {
16900 fn serialize<S: ::serde::Serializer>(
16901 &self,
16902 s: S,
16903 ) -> ::core::result::Result<S::Ok, S::Error> {
16904 ::buffa::extension_registry::serialize_extensions(
16905 "google.protobuf.FeatureSet",
16906 &self.0,
16907 s,
16908 )
16909 }
16910}
16911#[cfg(feature = "json")]
16912impl<'de> ::serde::Deserialize<'de> for __FeatureSetExtJson {
16913 fn deserialize<D: ::serde::Deserializer<'de>>(
16914 d: D,
16915 ) -> ::core::result::Result<Self, D::Error> {
16916 ::buffa::extension_registry::deserialize_extensions(
16917 "google.protobuf.FeatureSet",
16918 d,
16919 )
16920 .map(Self)
16921 }
16922}
16923#[cfg(feature = "json")]
16924#[doc(hidden)]
16925pub const __FEATURE_SET_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
16926 type_url: "type.googleapis.com/google.protobuf.FeatureSet",
16927 to_json: ::buffa::type_registry::any_to_json::<FeatureSet>,
16928 from_json: ::buffa::type_registry::any_from_json::<FeatureSet>,
16929 is_wkt: false,
16930};
16931#[cfg(feature = "text")]
16932#[doc(hidden)]
16933pub const __FEATURE_SET_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
16934 type_url: "type.googleapis.com/google.protobuf.FeatureSet",
16935 text_encode: ::buffa::type_registry::any_encode_text::<FeatureSet>,
16936 text_merge: ::buffa::type_registry::any_merge_text::<FeatureSet>,
16937};
16938pub mod feature_set {
16939 #[allow(unused_imports)]
16940 use super::*;
16941 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
16942 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
16943 #[repr(i32)]
16944 pub enum FieldPresence {
16945 FIELD_PRESENCE_UNKNOWN = 0i32,
16946 EXPLICIT = 1i32,
16947 IMPLICIT = 2i32,
16948 LEGACY_REQUIRED = 3i32,
16949 }
16950 impl ::core::default::Default for FieldPresence {
16951 fn default() -> Self {
16952 Self::FIELD_PRESENCE_UNKNOWN
16953 }
16954 }
16955 #[cfg(feature = "json")]
16956 const _: () = {
16957 impl ::serde::Serialize for FieldPresence {
16958 fn serialize<S: ::serde::Serializer>(
16959 &self,
16960 s: S,
16961 ) -> ::core::result::Result<S::Ok, S::Error> {
16962 s.serialize_str(::buffa::Enumeration::proto_name(self))
16963 }
16964 }
16965 impl<'de> ::serde::Deserialize<'de> for FieldPresence {
16966 fn deserialize<D: ::serde::Deserializer<'de>>(
16967 d: D,
16968 ) -> ::core::result::Result<Self, D::Error> {
16969 struct _V;
16970 impl ::serde::de::Visitor<'_> for _V {
16971 type Value = FieldPresence;
16972 fn expecting(
16973 &self,
16974 f: &mut ::core::fmt::Formatter<'_>,
16975 ) -> ::core::fmt::Result {
16976 f.write_str(
16977 concat!(
16978 "a string, integer, or null for ", stringify!(FieldPresence)
16979 ),
16980 )
16981 }
16982 fn visit_str<E: ::serde::de::Error>(
16983 self,
16984 v: &str,
16985 ) -> ::core::result::Result<FieldPresence, E> {
16986 <FieldPresence as ::buffa::Enumeration>::from_proto_name(v)
16987 .ok_or_else(|| {
16988 ::serde::de::Error::unknown_variant(v, &[])
16989 })
16990 }
16991 fn visit_i64<E: ::serde::de::Error>(
16992 self,
16993 v: i64,
16994 ) -> ::core::result::Result<FieldPresence, E> {
16995 let v32 = i32::try_from(v)
16996 .map_err(|_| {
16997 ::serde::de::Error::custom(
16998 ::buffa::alloc::format!("enum value {v} out of i32 range"),
16999 )
17000 })?;
17001 <FieldPresence as ::buffa::Enumeration>::from_i32(v32)
17002 .ok_or_else(|| {
17003 ::serde::de::Error::custom(
17004 ::buffa::alloc::format!("unknown enum value {v32}"),
17005 )
17006 })
17007 }
17008 fn visit_u64<E: ::serde::de::Error>(
17009 self,
17010 v: u64,
17011 ) -> ::core::result::Result<FieldPresence, E> {
17012 let v32 = i32::try_from(v)
17013 .map_err(|_| {
17014 ::serde::de::Error::custom(
17015 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17016 )
17017 })?;
17018 <FieldPresence as ::buffa::Enumeration>::from_i32(v32)
17019 .ok_or_else(|| {
17020 ::serde::de::Error::custom(
17021 ::buffa::alloc::format!("unknown enum value {v32}"),
17022 )
17023 })
17024 }
17025 fn visit_unit<E: ::serde::de::Error>(
17026 self,
17027 ) -> ::core::result::Result<FieldPresence, E> {
17028 ::core::result::Result::Ok(::core::default::Default::default())
17029 }
17030 }
17031 d.deserialize_any(_V)
17032 }
17033 }
17034 impl ::buffa::json_helpers::ProtoElemJson for FieldPresence {
17035 fn serialize_proto_json<S: ::serde::Serializer>(
17036 v: &Self,
17037 s: S,
17038 ) -> ::core::result::Result<S::Ok, S::Error> {
17039 ::serde::Serialize::serialize(v, s)
17040 }
17041 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17042 d: D,
17043 ) -> ::core::result::Result<Self, D::Error> {
17044 <Self as ::serde::Deserialize>::deserialize(d)
17045 }
17046 }
17047 };
17048 impl ::buffa::Enumeration for FieldPresence {
17049 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17050 match value {
17051 0i32 => ::core::option::Option::Some(Self::FIELD_PRESENCE_UNKNOWN),
17052 1i32 => ::core::option::Option::Some(Self::EXPLICIT),
17053 2i32 => ::core::option::Option::Some(Self::IMPLICIT),
17054 3i32 => ::core::option::Option::Some(Self::LEGACY_REQUIRED),
17055 _ => ::core::option::Option::None,
17056 }
17057 }
17058 fn to_i32(&self) -> i32 {
17059 *self as i32
17060 }
17061 fn proto_name(&self) -> &'static str {
17062 match self {
17063 Self::FIELD_PRESENCE_UNKNOWN => "FIELD_PRESENCE_UNKNOWN",
17064 Self::EXPLICIT => "EXPLICIT",
17065 Self::IMPLICIT => "IMPLICIT",
17066 Self::LEGACY_REQUIRED => "LEGACY_REQUIRED",
17067 }
17068 }
17069 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17070 match name {
17071 "FIELD_PRESENCE_UNKNOWN" => {
17072 ::core::option::Option::Some(Self::FIELD_PRESENCE_UNKNOWN)
17073 }
17074 "EXPLICIT" => ::core::option::Option::Some(Self::EXPLICIT),
17075 "IMPLICIT" => ::core::option::Option::Some(Self::IMPLICIT),
17076 "LEGACY_REQUIRED" => ::core::option::Option::Some(Self::LEGACY_REQUIRED),
17077 _ => ::core::option::Option::None,
17078 }
17079 }
17080 fn values() -> &'static [Self] {
17081 &[
17082 Self::FIELD_PRESENCE_UNKNOWN,
17083 Self::EXPLICIT,
17084 Self::IMPLICIT,
17085 Self::LEGACY_REQUIRED,
17086 ]
17087 }
17088 }
17089 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17090 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17091 #[repr(i32)]
17092 pub enum EnumType {
17093 ENUM_TYPE_UNKNOWN = 0i32,
17094 OPEN = 1i32,
17095 CLOSED = 2i32,
17096 }
17097 impl ::core::default::Default for EnumType {
17098 fn default() -> Self {
17099 Self::ENUM_TYPE_UNKNOWN
17100 }
17101 }
17102 #[cfg(feature = "json")]
17103 const _: () = {
17104 impl ::serde::Serialize for EnumType {
17105 fn serialize<S: ::serde::Serializer>(
17106 &self,
17107 s: S,
17108 ) -> ::core::result::Result<S::Ok, S::Error> {
17109 s.serialize_str(::buffa::Enumeration::proto_name(self))
17110 }
17111 }
17112 impl<'de> ::serde::Deserialize<'de> for EnumType {
17113 fn deserialize<D: ::serde::Deserializer<'de>>(
17114 d: D,
17115 ) -> ::core::result::Result<Self, D::Error> {
17116 struct _V;
17117 impl ::serde::de::Visitor<'_> for _V {
17118 type Value = EnumType;
17119 fn expecting(
17120 &self,
17121 f: &mut ::core::fmt::Formatter<'_>,
17122 ) -> ::core::fmt::Result {
17123 f.write_str(
17124 concat!(
17125 "a string, integer, or null for ", stringify!(EnumType)
17126 ),
17127 )
17128 }
17129 fn visit_str<E: ::serde::de::Error>(
17130 self,
17131 v: &str,
17132 ) -> ::core::result::Result<EnumType, E> {
17133 <EnumType as ::buffa::Enumeration>::from_proto_name(v)
17134 .ok_or_else(|| {
17135 ::serde::de::Error::unknown_variant(v, &[])
17136 })
17137 }
17138 fn visit_i64<E: ::serde::de::Error>(
17139 self,
17140 v: i64,
17141 ) -> ::core::result::Result<EnumType, E> {
17142 let v32 = i32::try_from(v)
17143 .map_err(|_| {
17144 ::serde::de::Error::custom(
17145 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17146 )
17147 })?;
17148 <EnumType as ::buffa::Enumeration>::from_i32(v32)
17149 .ok_or_else(|| {
17150 ::serde::de::Error::custom(
17151 ::buffa::alloc::format!("unknown enum value {v32}"),
17152 )
17153 })
17154 }
17155 fn visit_u64<E: ::serde::de::Error>(
17156 self,
17157 v: u64,
17158 ) -> ::core::result::Result<EnumType, E> {
17159 let v32 = i32::try_from(v)
17160 .map_err(|_| {
17161 ::serde::de::Error::custom(
17162 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17163 )
17164 })?;
17165 <EnumType as ::buffa::Enumeration>::from_i32(v32)
17166 .ok_or_else(|| {
17167 ::serde::de::Error::custom(
17168 ::buffa::alloc::format!("unknown enum value {v32}"),
17169 )
17170 })
17171 }
17172 fn visit_unit<E: ::serde::de::Error>(
17173 self,
17174 ) -> ::core::result::Result<EnumType, E> {
17175 ::core::result::Result::Ok(::core::default::Default::default())
17176 }
17177 }
17178 d.deserialize_any(_V)
17179 }
17180 }
17181 impl ::buffa::json_helpers::ProtoElemJson for EnumType {
17182 fn serialize_proto_json<S: ::serde::Serializer>(
17183 v: &Self,
17184 s: S,
17185 ) -> ::core::result::Result<S::Ok, S::Error> {
17186 ::serde::Serialize::serialize(v, s)
17187 }
17188 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17189 d: D,
17190 ) -> ::core::result::Result<Self, D::Error> {
17191 <Self as ::serde::Deserialize>::deserialize(d)
17192 }
17193 }
17194 };
17195 impl ::buffa::Enumeration for EnumType {
17196 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17197 match value {
17198 0i32 => ::core::option::Option::Some(Self::ENUM_TYPE_UNKNOWN),
17199 1i32 => ::core::option::Option::Some(Self::OPEN),
17200 2i32 => ::core::option::Option::Some(Self::CLOSED),
17201 _ => ::core::option::Option::None,
17202 }
17203 }
17204 fn to_i32(&self) -> i32 {
17205 *self as i32
17206 }
17207 fn proto_name(&self) -> &'static str {
17208 match self {
17209 Self::ENUM_TYPE_UNKNOWN => "ENUM_TYPE_UNKNOWN",
17210 Self::OPEN => "OPEN",
17211 Self::CLOSED => "CLOSED",
17212 }
17213 }
17214 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17215 match name {
17216 "ENUM_TYPE_UNKNOWN" => {
17217 ::core::option::Option::Some(Self::ENUM_TYPE_UNKNOWN)
17218 }
17219 "OPEN" => ::core::option::Option::Some(Self::OPEN),
17220 "CLOSED" => ::core::option::Option::Some(Self::CLOSED),
17221 _ => ::core::option::Option::None,
17222 }
17223 }
17224 fn values() -> &'static [Self] {
17225 &[Self::ENUM_TYPE_UNKNOWN, Self::OPEN, Self::CLOSED]
17226 }
17227 }
17228 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17229 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17230 #[repr(i32)]
17231 pub enum RepeatedFieldEncoding {
17232 REPEATED_FIELD_ENCODING_UNKNOWN = 0i32,
17233 PACKED = 1i32,
17234 EXPANDED = 2i32,
17235 }
17236 impl ::core::default::Default for RepeatedFieldEncoding {
17237 fn default() -> Self {
17238 Self::REPEATED_FIELD_ENCODING_UNKNOWN
17239 }
17240 }
17241 #[cfg(feature = "json")]
17242 const _: () = {
17243 impl ::serde::Serialize for RepeatedFieldEncoding {
17244 fn serialize<S: ::serde::Serializer>(
17245 &self,
17246 s: S,
17247 ) -> ::core::result::Result<S::Ok, S::Error> {
17248 s.serialize_str(::buffa::Enumeration::proto_name(self))
17249 }
17250 }
17251 impl<'de> ::serde::Deserialize<'de> for RepeatedFieldEncoding {
17252 fn deserialize<D: ::serde::Deserializer<'de>>(
17253 d: D,
17254 ) -> ::core::result::Result<Self, D::Error> {
17255 struct _V;
17256 impl ::serde::de::Visitor<'_> for _V {
17257 type Value = RepeatedFieldEncoding;
17258 fn expecting(
17259 &self,
17260 f: &mut ::core::fmt::Formatter<'_>,
17261 ) -> ::core::fmt::Result {
17262 f.write_str(
17263 concat!(
17264 "a string, integer, or null for ",
17265 stringify!(RepeatedFieldEncoding)
17266 ),
17267 )
17268 }
17269 fn visit_str<E: ::serde::de::Error>(
17270 self,
17271 v: &str,
17272 ) -> ::core::result::Result<RepeatedFieldEncoding, E> {
17273 <RepeatedFieldEncoding as ::buffa::Enumeration>::from_proto_name(
17274 v,
17275 )
17276 .ok_or_else(|| {
17277 ::serde::de::Error::unknown_variant(v, &[])
17278 })
17279 }
17280 fn visit_i64<E: ::serde::de::Error>(
17281 self,
17282 v: i64,
17283 ) -> ::core::result::Result<RepeatedFieldEncoding, E> {
17284 let v32 = i32::try_from(v)
17285 .map_err(|_| {
17286 ::serde::de::Error::custom(
17287 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17288 )
17289 })?;
17290 <RepeatedFieldEncoding as ::buffa::Enumeration>::from_i32(v32)
17291 .ok_or_else(|| {
17292 ::serde::de::Error::custom(
17293 ::buffa::alloc::format!("unknown enum value {v32}"),
17294 )
17295 })
17296 }
17297 fn visit_u64<E: ::serde::de::Error>(
17298 self,
17299 v: u64,
17300 ) -> ::core::result::Result<RepeatedFieldEncoding, E> {
17301 let v32 = i32::try_from(v)
17302 .map_err(|_| {
17303 ::serde::de::Error::custom(
17304 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17305 )
17306 })?;
17307 <RepeatedFieldEncoding as ::buffa::Enumeration>::from_i32(v32)
17308 .ok_or_else(|| {
17309 ::serde::de::Error::custom(
17310 ::buffa::alloc::format!("unknown enum value {v32}"),
17311 )
17312 })
17313 }
17314 fn visit_unit<E: ::serde::de::Error>(
17315 self,
17316 ) -> ::core::result::Result<RepeatedFieldEncoding, E> {
17317 ::core::result::Result::Ok(::core::default::Default::default())
17318 }
17319 }
17320 d.deserialize_any(_V)
17321 }
17322 }
17323 impl ::buffa::json_helpers::ProtoElemJson for RepeatedFieldEncoding {
17324 fn serialize_proto_json<S: ::serde::Serializer>(
17325 v: &Self,
17326 s: S,
17327 ) -> ::core::result::Result<S::Ok, S::Error> {
17328 ::serde::Serialize::serialize(v, s)
17329 }
17330 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17331 d: D,
17332 ) -> ::core::result::Result<Self, D::Error> {
17333 <Self as ::serde::Deserialize>::deserialize(d)
17334 }
17335 }
17336 };
17337 impl ::buffa::Enumeration for RepeatedFieldEncoding {
17338 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17339 match value {
17340 0i32 => {
17341 ::core::option::Option::Some(Self::REPEATED_FIELD_ENCODING_UNKNOWN)
17342 }
17343 1i32 => ::core::option::Option::Some(Self::PACKED),
17344 2i32 => ::core::option::Option::Some(Self::EXPANDED),
17345 _ => ::core::option::Option::None,
17346 }
17347 }
17348 fn to_i32(&self) -> i32 {
17349 *self as i32
17350 }
17351 fn proto_name(&self) -> &'static str {
17352 match self {
17353 Self::REPEATED_FIELD_ENCODING_UNKNOWN => {
17354 "REPEATED_FIELD_ENCODING_UNKNOWN"
17355 }
17356 Self::PACKED => "PACKED",
17357 Self::EXPANDED => "EXPANDED",
17358 }
17359 }
17360 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17361 match name {
17362 "REPEATED_FIELD_ENCODING_UNKNOWN" => {
17363 ::core::option::Option::Some(Self::REPEATED_FIELD_ENCODING_UNKNOWN)
17364 }
17365 "PACKED" => ::core::option::Option::Some(Self::PACKED),
17366 "EXPANDED" => ::core::option::Option::Some(Self::EXPANDED),
17367 _ => ::core::option::Option::None,
17368 }
17369 }
17370 fn values() -> &'static [Self] {
17371 &[Self::REPEATED_FIELD_ENCODING_UNKNOWN, Self::PACKED, Self::EXPANDED]
17372 }
17373 }
17374 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17375 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17376 #[repr(i32)]
17377 pub enum Utf8Validation {
17378 UTF8_VALIDATION_UNKNOWN = 0i32,
17379 VERIFY = 2i32,
17380 NONE = 3i32,
17381 }
17382 impl ::core::default::Default for Utf8Validation {
17383 fn default() -> Self {
17384 Self::UTF8_VALIDATION_UNKNOWN
17385 }
17386 }
17387 #[cfg(feature = "json")]
17388 const _: () = {
17389 impl ::serde::Serialize for Utf8Validation {
17390 fn serialize<S: ::serde::Serializer>(
17391 &self,
17392 s: S,
17393 ) -> ::core::result::Result<S::Ok, S::Error> {
17394 s.serialize_str(::buffa::Enumeration::proto_name(self))
17395 }
17396 }
17397 impl<'de> ::serde::Deserialize<'de> for Utf8Validation {
17398 fn deserialize<D: ::serde::Deserializer<'de>>(
17399 d: D,
17400 ) -> ::core::result::Result<Self, D::Error> {
17401 struct _V;
17402 impl ::serde::de::Visitor<'_> for _V {
17403 type Value = Utf8Validation;
17404 fn expecting(
17405 &self,
17406 f: &mut ::core::fmt::Formatter<'_>,
17407 ) -> ::core::fmt::Result {
17408 f.write_str(
17409 concat!(
17410 "a string, integer, or null for ",
17411 stringify!(Utf8Validation)
17412 ),
17413 )
17414 }
17415 fn visit_str<E: ::serde::de::Error>(
17416 self,
17417 v: &str,
17418 ) -> ::core::result::Result<Utf8Validation, E> {
17419 <Utf8Validation as ::buffa::Enumeration>::from_proto_name(v)
17420 .ok_or_else(|| {
17421 ::serde::de::Error::unknown_variant(v, &[])
17422 })
17423 }
17424 fn visit_i64<E: ::serde::de::Error>(
17425 self,
17426 v: i64,
17427 ) -> ::core::result::Result<Utf8Validation, E> {
17428 let v32 = i32::try_from(v)
17429 .map_err(|_| {
17430 ::serde::de::Error::custom(
17431 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17432 )
17433 })?;
17434 <Utf8Validation as ::buffa::Enumeration>::from_i32(v32)
17435 .ok_or_else(|| {
17436 ::serde::de::Error::custom(
17437 ::buffa::alloc::format!("unknown enum value {v32}"),
17438 )
17439 })
17440 }
17441 fn visit_u64<E: ::serde::de::Error>(
17442 self,
17443 v: u64,
17444 ) -> ::core::result::Result<Utf8Validation, E> {
17445 let v32 = i32::try_from(v)
17446 .map_err(|_| {
17447 ::serde::de::Error::custom(
17448 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17449 )
17450 })?;
17451 <Utf8Validation as ::buffa::Enumeration>::from_i32(v32)
17452 .ok_or_else(|| {
17453 ::serde::de::Error::custom(
17454 ::buffa::alloc::format!("unknown enum value {v32}"),
17455 )
17456 })
17457 }
17458 fn visit_unit<E: ::serde::de::Error>(
17459 self,
17460 ) -> ::core::result::Result<Utf8Validation, E> {
17461 ::core::result::Result::Ok(::core::default::Default::default())
17462 }
17463 }
17464 d.deserialize_any(_V)
17465 }
17466 }
17467 impl ::buffa::json_helpers::ProtoElemJson for Utf8Validation {
17468 fn serialize_proto_json<S: ::serde::Serializer>(
17469 v: &Self,
17470 s: S,
17471 ) -> ::core::result::Result<S::Ok, S::Error> {
17472 ::serde::Serialize::serialize(v, s)
17473 }
17474 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17475 d: D,
17476 ) -> ::core::result::Result<Self, D::Error> {
17477 <Self as ::serde::Deserialize>::deserialize(d)
17478 }
17479 }
17480 };
17481 impl ::buffa::Enumeration for Utf8Validation {
17482 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17483 match value {
17484 0i32 => ::core::option::Option::Some(Self::UTF8_VALIDATION_UNKNOWN),
17485 2i32 => ::core::option::Option::Some(Self::VERIFY),
17486 3i32 => ::core::option::Option::Some(Self::NONE),
17487 _ => ::core::option::Option::None,
17488 }
17489 }
17490 fn to_i32(&self) -> i32 {
17491 *self as i32
17492 }
17493 fn proto_name(&self) -> &'static str {
17494 match self {
17495 Self::UTF8_VALIDATION_UNKNOWN => "UTF8_VALIDATION_UNKNOWN",
17496 Self::VERIFY => "VERIFY",
17497 Self::NONE => "NONE",
17498 }
17499 }
17500 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17501 match name {
17502 "UTF8_VALIDATION_UNKNOWN" => {
17503 ::core::option::Option::Some(Self::UTF8_VALIDATION_UNKNOWN)
17504 }
17505 "VERIFY" => ::core::option::Option::Some(Self::VERIFY),
17506 "NONE" => ::core::option::Option::Some(Self::NONE),
17507 _ => ::core::option::Option::None,
17508 }
17509 }
17510 fn values() -> &'static [Self] {
17511 &[Self::UTF8_VALIDATION_UNKNOWN, Self::VERIFY, Self::NONE]
17512 }
17513 }
17514 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17515 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17516 #[repr(i32)]
17517 pub enum MessageEncoding {
17518 MESSAGE_ENCODING_UNKNOWN = 0i32,
17519 LENGTH_PREFIXED = 1i32,
17520 DELIMITED = 2i32,
17521 }
17522 impl ::core::default::Default for MessageEncoding {
17523 fn default() -> Self {
17524 Self::MESSAGE_ENCODING_UNKNOWN
17525 }
17526 }
17527 #[cfg(feature = "json")]
17528 const _: () = {
17529 impl ::serde::Serialize for MessageEncoding {
17530 fn serialize<S: ::serde::Serializer>(
17531 &self,
17532 s: S,
17533 ) -> ::core::result::Result<S::Ok, S::Error> {
17534 s.serialize_str(::buffa::Enumeration::proto_name(self))
17535 }
17536 }
17537 impl<'de> ::serde::Deserialize<'de> for MessageEncoding {
17538 fn deserialize<D: ::serde::Deserializer<'de>>(
17539 d: D,
17540 ) -> ::core::result::Result<Self, D::Error> {
17541 struct _V;
17542 impl ::serde::de::Visitor<'_> for _V {
17543 type Value = MessageEncoding;
17544 fn expecting(
17545 &self,
17546 f: &mut ::core::fmt::Formatter<'_>,
17547 ) -> ::core::fmt::Result {
17548 f.write_str(
17549 concat!(
17550 "a string, integer, or null for ",
17551 stringify!(MessageEncoding)
17552 ),
17553 )
17554 }
17555 fn visit_str<E: ::serde::de::Error>(
17556 self,
17557 v: &str,
17558 ) -> ::core::result::Result<MessageEncoding, E> {
17559 <MessageEncoding as ::buffa::Enumeration>::from_proto_name(v)
17560 .ok_or_else(|| {
17561 ::serde::de::Error::unknown_variant(v, &[])
17562 })
17563 }
17564 fn visit_i64<E: ::serde::de::Error>(
17565 self,
17566 v: i64,
17567 ) -> ::core::result::Result<MessageEncoding, E> {
17568 let v32 = i32::try_from(v)
17569 .map_err(|_| {
17570 ::serde::de::Error::custom(
17571 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17572 )
17573 })?;
17574 <MessageEncoding as ::buffa::Enumeration>::from_i32(v32)
17575 .ok_or_else(|| {
17576 ::serde::de::Error::custom(
17577 ::buffa::alloc::format!("unknown enum value {v32}"),
17578 )
17579 })
17580 }
17581 fn visit_u64<E: ::serde::de::Error>(
17582 self,
17583 v: u64,
17584 ) -> ::core::result::Result<MessageEncoding, E> {
17585 let v32 = i32::try_from(v)
17586 .map_err(|_| {
17587 ::serde::de::Error::custom(
17588 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17589 )
17590 })?;
17591 <MessageEncoding as ::buffa::Enumeration>::from_i32(v32)
17592 .ok_or_else(|| {
17593 ::serde::de::Error::custom(
17594 ::buffa::alloc::format!("unknown enum value {v32}"),
17595 )
17596 })
17597 }
17598 fn visit_unit<E: ::serde::de::Error>(
17599 self,
17600 ) -> ::core::result::Result<MessageEncoding, E> {
17601 ::core::result::Result::Ok(::core::default::Default::default())
17602 }
17603 }
17604 d.deserialize_any(_V)
17605 }
17606 }
17607 impl ::buffa::json_helpers::ProtoElemJson for MessageEncoding {
17608 fn serialize_proto_json<S: ::serde::Serializer>(
17609 v: &Self,
17610 s: S,
17611 ) -> ::core::result::Result<S::Ok, S::Error> {
17612 ::serde::Serialize::serialize(v, s)
17613 }
17614 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17615 d: D,
17616 ) -> ::core::result::Result<Self, D::Error> {
17617 <Self as ::serde::Deserialize>::deserialize(d)
17618 }
17619 }
17620 };
17621 impl ::buffa::Enumeration for MessageEncoding {
17622 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17623 match value {
17624 0i32 => ::core::option::Option::Some(Self::MESSAGE_ENCODING_UNKNOWN),
17625 1i32 => ::core::option::Option::Some(Self::LENGTH_PREFIXED),
17626 2i32 => ::core::option::Option::Some(Self::DELIMITED),
17627 _ => ::core::option::Option::None,
17628 }
17629 }
17630 fn to_i32(&self) -> i32 {
17631 *self as i32
17632 }
17633 fn proto_name(&self) -> &'static str {
17634 match self {
17635 Self::MESSAGE_ENCODING_UNKNOWN => "MESSAGE_ENCODING_UNKNOWN",
17636 Self::LENGTH_PREFIXED => "LENGTH_PREFIXED",
17637 Self::DELIMITED => "DELIMITED",
17638 }
17639 }
17640 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17641 match name {
17642 "MESSAGE_ENCODING_UNKNOWN" => {
17643 ::core::option::Option::Some(Self::MESSAGE_ENCODING_UNKNOWN)
17644 }
17645 "LENGTH_PREFIXED" => ::core::option::Option::Some(Self::LENGTH_PREFIXED),
17646 "DELIMITED" => ::core::option::Option::Some(Self::DELIMITED),
17647 _ => ::core::option::Option::None,
17648 }
17649 }
17650 fn values() -> &'static [Self] {
17651 &[Self::MESSAGE_ENCODING_UNKNOWN, Self::LENGTH_PREFIXED, Self::DELIMITED]
17652 }
17653 }
17654 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17655 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17656 #[repr(i32)]
17657 pub enum JsonFormat {
17658 JSON_FORMAT_UNKNOWN = 0i32,
17659 ALLOW = 1i32,
17660 LEGACY_BEST_EFFORT = 2i32,
17661 }
17662 impl ::core::default::Default for JsonFormat {
17663 fn default() -> Self {
17664 Self::JSON_FORMAT_UNKNOWN
17665 }
17666 }
17667 #[cfg(feature = "json")]
17668 const _: () = {
17669 impl ::serde::Serialize for JsonFormat {
17670 fn serialize<S: ::serde::Serializer>(
17671 &self,
17672 s: S,
17673 ) -> ::core::result::Result<S::Ok, S::Error> {
17674 s.serialize_str(::buffa::Enumeration::proto_name(self))
17675 }
17676 }
17677 impl<'de> ::serde::Deserialize<'de> for JsonFormat {
17678 fn deserialize<D: ::serde::Deserializer<'de>>(
17679 d: D,
17680 ) -> ::core::result::Result<Self, D::Error> {
17681 struct _V;
17682 impl ::serde::de::Visitor<'_> for _V {
17683 type Value = JsonFormat;
17684 fn expecting(
17685 &self,
17686 f: &mut ::core::fmt::Formatter<'_>,
17687 ) -> ::core::fmt::Result {
17688 f.write_str(
17689 concat!(
17690 "a string, integer, or null for ", stringify!(JsonFormat)
17691 ),
17692 )
17693 }
17694 fn visit_str<E: ::serde::de::Error>(
17695 self,
17696 v: &str,
17697 ) -> ::core::result::Result<JsonFormat, E> {
17698 <JsonFormat as ::buffa::Enumeration>::from_proto_name(v)
17699 .ok_or_else(|| {
17700 ::serde::de::Error::unknown_variant(v, &[])
17701 })
17702 }
17703 fn visit_i64<E: ::serde::de::Error>(
17704 self,
17705 v: i64,
17706 ) -> ::core::result::Result<JsonFormat, E> {
17707 let v32 = i32::try_from(v)
17708 .map_err(|_| {
17709 ::serde::de::Error::custom(
17710 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17711 )
17712 })?;
17713 <JsonFormat as ::buffa::Enumeration>::from_i32(v32)
17714 .ok_or_else(|| {
17715 ::serde::de::Error::custom(
17716 ::buffa::alloc::format!("unknown enum value {v32}"),
17717 )
17718 })
17719 }
17720 fn visit_u64<E: ::serde::de::Error>(
17721 self,
17722 v: u64,
17723 ) -> ::core::result::Result<JsonFormat, E> {
17724 let v32 = i32::try_from(v)
17725 .map_err(|_| {
17726 ::serde::de::Error::custom(
17727 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17728 )
17729 })?;
17730 <JsonFormat as ::buffa::Enumeration>::from_i32(v32)
17731 .ok_or_else(|| {
17732 ::serde::de::Error::custom(
17733 ::buffa::alloc::format!("unknown enum value {v32}"),
17734 )
17735 })
17736 }
17737 fn visit_unit<E: ::serde::de::Error>(
17738 self,
17739 ) -> ::core::result::Result<JsonFormat, E> {
17740 ::core::result::Result::Ok(::core::default::Default::default())
17741 }
17742 }
17743 d.deserialize_any(_V)
17744 }
17745 }
17746 impl ::buffa::json_helpers::ProtoElemJson for JsonFormat {
17747 fn serialize_proto_json<S: ::serde::Serializer>(
17748 v: &Self,
17749 s: S,
17750 ) -> ::core::result::Result<S::Ok, S::Error> {
17751 ::serde::Serialize::serialize(v, s)
17752 }
17753 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17754 d: D,
17755 ) -> ::core::result::Result<Self, D::Error> {
17756 <Self as ::serde::Deserialize>::deserialize(d)
17757 }
17758 }
17759 };
17760 impl ::buffa::Enumeration for JsonFormat {
17761 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17762 match value {
17763 0i32 => ::core::option::Option::Some(Self::JSON_FORMAT_UNKNOWN),
17764 1i32 => ::core::option::Option::Some(Self::ALLOW),
17765 2i32 => ::core::option::Option::Some(Self::LEGACY_BEST_EFFORT),
17766 _ => ::core::option::Option::None,
17767 }
17768 }
17769 fn to_i32(&self) -> i32 {
17770 *self as i32
17771 }
17772 fn proto_name(&self) -> &'static str {
17773 match self {
17774 Self::JSON_FORMAT_UNKNOWN => "JSON_FORMAT_UNKNOWN",
17775 Self::ALLOW => "ALLOW",
17776 Self::LEGACY_BEST_EFFORT => "LEGACY_BEST_EFFORT",
17777 }
17778 }
17779 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17780 match name {
17781 "JSON_FORMAT_UNKNOWN" => {
17782 ::core::option::Option::Some(Self::JSON_FORMAT_UNKNOWN)
17783 }
17784 "ALLOW" => ::core::option::Option::Some(Self::ALLOW),
17785 "LEGACY_BEST_EFFORT" => {
17786 ::core::option::Option::Some(Self::LEGACY_BEST_EFFORT)
17787 }
17788 _ => ::core::option::Option::None,
17789 }
17790 }
17791 fn values() -> &'static [Self] {
17792 &[Self::JSON_FORMAT_UNKNOWN, Self::ALLOW, Self::LEGACY_BEST_EFFORT]
17793 }
17794 }
17795 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
17796 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17797 #[repr(i32)]
17798 pub enum EnforceNamingStyle {
17799 ENFORCE_NAMING_STYLE_UNKNOWN = 0i32,
17800 STYLE2024 = 1i32,
17801 STYLE_LEGACY = 2i32,
17802 }
17803 impl ::core::default::Default for EnforceNamingStyle {
17804 fn default() -> Self {
17805 Self::ENFORCE_NAMING_STYLE_UNKNOWN
17806 }
17807 }
17808 #[cfg(feature = "json")]
17809 const _: () = {
17810 impl ::serde::Serialize for EnforceNamingStyle {
17811 fn serialize<S: ::serde::Serializer>(
17812 &self,
17813 s: S,
17814 ) -> ::core::result::Result<S::Ok, S::Error> {
17815 s.serialize_str(::buffa::Enumeration::proto_name(self))
17816 }
17817 }
17818 impl<'de> ::serde::Deserialize<'de> for EnforceNamingStyle {
17819 fn deserialize<D: ::serde::Deserializer<'de>>(
17820 d: D,
17821 ) -> ::core::result::Result<Self, D::Error> {
17822 struct _V;
17823 impl ::serde::de::Visitor<'_> for _V {
17824 type Value = EnforceNamingStyle;
17825 fn expecting(
17826 &self,
17827 f: &mut ::core::fmt::Formatter<'_>,
17828 ) -> ::core::fmt::Result {
17829 f.write_str(
17830 concat!(
17831 "a string, integer, or null for ",
17832 stringify!(EnforceNamingStyle)
17833 ),
17834 )
17835 }
17836 fn visit_str<E: ::serde::de::Error>(
17837 self,
17838 v: &str,
17839 ) -> ::core::result::Result<EnforceNamingStyle, E> {
17840 <EnforceNamingStyle as ::buffa::Enumeration>::from_proto_name(v)
17841 .ok_or_else(|| {
17842 ::serde::de::Error::unknown_variant(v, &[])
17843 })
17844 }
17845 fn visit_i64<E: ::serde::de::Error>(
17846 self,
17847 v: i64,
17848 ) -> ::core::result::Result<EnforceNamingStyle, E> {
17849 let v32 = i32::try_from(v)
17850 .map_err(|_| {
17851 ::serde::de::Error::custom(
17852 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17853 )
17854 })?;
17855 <EnforceNamingStyle as ::buffa::Enumeration>::from_i32(v32)
17856 .ok_or_else(|| {
17857 ::serde::de::Error::custom(
17858 ::buffa::alloc::format!("unknown enum value {v32}"),
17859 )
17860 })
17861 }
17862 fn visit_u64<E: ::serde::de::Error>(
17863 self,
17864 v: u64,
17865 ) -> ::core::result::Result<EnforceNamingStyle, E> {
17866 let v32 = i32::try_from(v)
17867 .map_err(|_| {
17868 ::serde::de::Error::custom(
17869 ::buffa::alloc::format!("enum value {v} out of i32 range"),
17870 )
17871 })?;
17872 <EnforceNamingStyle as ::buffa::Enumeration>::from_i32(v32)
17873 .ok_or_else(|| {
17874 ::serde::de::Error::custom(
17875 ::buffa::alloc::format!("unknown enum value {v32}"),
17876 )
17877 })
17878 }
17879 fn visit_unit<E: ::serde::de::Error>(
17880 self,
17881 ) -> ::core::result::Result<EnforceNamingStyle, E> {
17882 ::core::result::Result::Ok(::core::default::Default::default())
17883 }
17884 }
17885 d.deserialize_any(_V)
17886 }
17887 }
17888 impl ::buffa::json_helpers::ProtoElemJson for EnforceNamingStyle {
17889 fn serialize_proto_json<S: ::serde::Serializer>(
17890 v: &Self,
17891 s: S,
17892 ) -> ::core::result::Result<S::Ok, S::Error> {
17893 ::serde::Serialize::serialize(v, s)
17894 }
17895 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
17896 d: D,
17897 ) -> ::core::result::Result<Self, D::Error> {
17898 <Self as ::serde::Deserialize>::deserialize(d)
17899 }
17900 }
17901 };
17902 impl ::buffa::Enumeration for EnforceNamingStyle {
17903 fn from_i32(value: i32) -> ::core::option::Option<Self> {
17904 match value {
17905 0i32 => ::core::option::Option::Some(Self::ENFORCE_NAMING_STYLE_UNKNOWN),
17906 1i32 => ::core::option::Option::Some(Self::STYLE2024),
17907 2i32 => ::core::option::Option::Some(Self::STYLE_LEGACY),
17908 _ => ::core::option::Option::None,
17909 }
17910 }
17911 fn to_i32(&self) -> i32 {
17912 *self as i32
17913 }
17914 fn proto_name(&self) -> &'static str {
17915 match self {
17916 Self::ENFORCE_NAMING_STYLE_UNKNOWN => "ENFORCE_NAMING_STYLE_UNKNOWN",
17917 Self::STYLE2024 => "STYLE2024",
17918 Self::STYLE_LEGACY => "STYLE_LEGACY",
17919 }
17920 }
17921 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
17922 match name {
17923 "ENFORCE_NAMING_STYLE_UNKNOWN" => {
17924 ::core::option::Option::Some(Self::ENFORCE_NAMING_STYLE_UNKNOWN)
17925 }
17926 "STYLE2024" => ::core::option::Option::Some(Self::STYLE2024),
17927 "STYLE_LEGACY" => ::core::option::Option::Some(Self::STYLE_LEGACY),
17928 _ => ::core::option::Option::None,
17929 }
17930 }
17931 fn values() -> &'static [Self] {
17932 &[Self::ENFORCE_NAMING_STYLE_UNKNOWN, Self::STYLE2024, Self::STYLE_LEGACY]
17933 }
17934 }
17935 #[derive(Clone, PartialEq, Default)]
17936 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
17937 #[cfg_attr(feature = "json", serde(default))]
17938 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
17939 pub struct VisibilityFeature {
17940 #[cfg_attr(feature = "json", serde(skip))]
17941 #[doc(hidden)]
17942 pub __buffa_unknown_fields: ::buffa::UnknownFields,
17943 }
17944 impl ::core::fmt::Debug for VisibilityFeature {
17945 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
17946 f.debug_struct("VisibilityFeature").finish()
17947 }
17948 }
17949 impl VisibilityFeature {
17950 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSet.VisibilityFeature";
17955 }
17956 impl ::buffa::DefaultInstance for VisibilityFeature {
17957 fn default_instance() -> &'static Self {
17958 static VALUE: ::buffa::__private::OnceBox<VisibilityFeature> = ::buffa::__private::OnceBox::new();
17959 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
17960 }
17961 }
17962 impl ::buffa::MessageName for VisibilityFeature {
17963 const PACKAGE: &'static str = "google.protobuf";
17964 const NAME: &'static str = "FeatureSet.VisibilityFeature";
17965 const FULL_NAME: &'static str = "google.protobuf.FeatureSet.VisibilityFeature";
17966 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSet.VisibilityFeature";
17967 }
17968 impl ::buffa::Message for VisibilityFeature {
17969 #[allow(clippy::let_and_return)]
17975 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
17976 #[allow(unused_imports)]
17977 use ::buffa::Enumeration as _;
17978 let mut size = 0u32;
17979 size += self.__buffa_unknown_fields.encoded_len() as u32;
17980 size
17981 }
17982 fn write_to(
17983 &self,
17984 _cache: &mut ::buffa::SizeCache,
17985 buf: &mut impl ::buffa::bytes::BufMut,
17986 ) {
17987 #[allow(unused_imports)]
17988 use ::buffa::Enumeration as _;
17989 self.__buffa_unknown_fields.write_to(buf);
17990 }
17991 fn merge_field(
17992 &mut self,
17993 tag: ::buffa::encoding::Tag,
17994 buf: &mut impl ::buffa::bytes::Buf,
17995 depth: u32,
17996 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
17997 #[allow(unused_imports)]
17998 use ::buffa::bytes::Buf as _;
17999 #[allow(unused_imports)]
18000 use ::buffa::Enumeration as _;
18001 match tag.field_number() {
18002 _ => {
18003 self.__buffa_unknown_fields
18004 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
18005 }
18006 }
18007 ::core::result::Result::Ok(())
18008 }
18009 fn clear(&mut self) {
18010 self.__buffa_unknown_fields.clear();
18011 }
18012 }
18013 impl ::buffa::ExtensionSet for VisibilityFeature {
18014 const PROTO_FQN: &'static str = "google.protobuf.FeatureSet.VisibilityFeature";
18015 fn unknown_fields(&self) -> &::buffa::UnknownFields {
18016 &self.__buffa_unknown_fields
18017 }
18018 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
18019 &mut self.__buffa_unknown_fields
18020 }
18021 }
18022 #[cfg(feature = "text")]
18023 impl ::buffa::text::TextFormat for VisibilityFeature {
18024 fn encode_text(
18025 &self,
18026 enc: &mut ::buffa::text::TextEncoder<'_>,
18027 ) -> ::core::fmt::Result {
18028 #[allow(unused_imports)]
18029 use ::buffa::Enumeration as _;
18030 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
18031 ::core::result::Result::Ok(())
18032 }
18033 fn merge_text(
18034 &mut self,
18035 dec: &mut ::buffa::text::TextDecoder<'_>,
18036 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
18037 #[allow(unused_imports)]
18038 use ::buffa::Enumeration as _;
18039 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
18040 match __name {
18041 _ => dec.skip_value()?,
18042 }
18043 }
18044 ::core::result::Result::Ok(())
18045 }
18046 }
18047 #[cfg(feature = "json")]
18048 impl ::buffa::json_helpers::ProtoElemJson for VisibilityFeature {
18049 fn serialize_proto_json<S: ::serde::Serializer>(
18050 v: &Self,
18051 s: S,
18052 ) -> ::core::result::Result<S::Ok, S::Error> {
18053 ::serde::Serialize::serialize(v, s)
18054 }
18055 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
18056 d: D,
18057 ) -> ::core::result::Result<Self, D::Error> {
18058 <Self as ::serde::Deserialize>::deserialize(d)
18059 }
18060 }
18061 #[cfg(feature = "json")]
18062 #[doc(hidden)]
18063 pub const __VISIBILITY_FEATURE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
18064 type_url: "type.googleapis.com/google.protobuf.FeatureSet.VisibilityFeature",
18065 to_json: ::buffa::type_registry::any_to_json::<VisibilityFeature>,
18066 from_json: ::buffa::type_registry::any_from_json::<VisibilityFeature>,
18067 is_wkt: false,
18068 };
18069 #[cfg(feature = "text")]
18070 #[doc(hidden)]
18071 pub const __VISIBILITY_FEATURE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
18072 type_url: "type.googleapis.com/google.protobuf.FeatureSet.VisibilityFeature",
18073 text_encode: ::buffa::type_registry::any_encode_text::<VisibilityFeature>,
18074 text_merge: ::buffa::type_registry::any_merge_text::<VisibilityFeature>,
18075 };
18076 pub mod visibility_feature {
18077 #[allow(unused_imports)]
18078 use super::*;
18079 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
18080 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
18081 #[repr(i32)]
18082 pub enum DefaultSymbolVisibility {
18083 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0i32,
18084 EXPORT_ALL = 1i32,
18086 EXPORT_TOP_LEVEL = 2i32,
18088 LOCAL_ALL = 3i32,
18090 STRICT = 4i32,
18094 }
18095 impl ::core::default::Default for DefaultSymbolVisibility {
18096 fn default() -> Self {
18097 Self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN
18098 }
18099 }
18100 #[cfg(feature = "json")]
18101 const _: () = {
18102 impl ::serde::Serialize for DefaultSymbolVisibility {
18103 fn serialize<S: ::serde::Serializer>(
18104 &self,
18105 s: S,
18106 ) -> ::core::result::Result<S::Ok, S::Error> {
18107 s.serialize_str(::buffa::Enumeration::proto_name(self))
18108 }
18109 }
18110 impl<'de> ::serde::Deserialize<'de> for DefaultSymbolVisibility {
18111 fn deserialize<D: ::serde::Deserializer<'de>>(
18112 d: D,
18113 ) -> ::core::result::Result<Self, D::Error> {
18114 struct _V;
18115 impl ::serde::de::Visitor<'_> for _V {
18116 type Value = DefaultSymbolVisibility;
18117 fn expecting(
18118 &self,
18119 f: &mut ::core::fmt::Formatter<'_>,
18120 ) -> ::core::fmt::Result {
18121 f.write_str(
18122 concat!(
18123 "a string, integer, or null for ",
18124 stringify!(DefaultSymbolVisibility)
18125 ),
18126 )
18127 }
18128 fn visit_str<E: ::serde::de::Error>(
18129 self,
18130 v: &str,
18131 ) -> ::core::result::Result<DefaultSymbolVisibility, E> {
18132 <DefaultSymbolVisibility as ::buffa::Enumeration>::from_proto_name(
18133 v,
18134 )
18135 .ok_or_else(|| {
18136 ::serde::de::Error::unknown_variant(v, &[])
18137 })
18138 }
18139 fn visit_i64<E: ::serde::de::Error>(
18140 self,
18141 v: i64,
18142 ) -> ::core::result::Result<DefaultSymbolVisibility, E> {
18143 let v32 = i32::try_from(v)
18144 .map_err(|_| {
18145 ::serde::de::Error::custom(
18146 ::buffa::alloc::format!("enum value {v} out of i32 range"),
18147 )
18148 })?;
18149 <DefaultSymbolVisibility as ::buffa::Enumeration>::from_i32(
18150 v32,
18151 )
18152 .ok_or_else(|| {
18153 ::serde::de::Error::custom(
18154 ::buffa::alloc::format!("unknown enum value {v32}"),
18155 )
18156 })
18157 }
18158 fn visit_u64<E: ::serde::de::Error>(
18159 self,
18160 v: u64,
18161 ) -> ::core::result::Result<DefaultSymbolVisibility, E> {
18162 let v32 = i32::try_from(v)
18163 .map_err(|_| {
18164 ::serde::de::Error::custom(
18165 ::buffa::alloc::format!("enum value {v} out of i32 range"),
18166 )
18167 })?;
18168 <DefaultSymbolVisibility as ::buffa::Enumeration>::from_i32(
18169 v32,
18170 )
18171 .ok_or_else(|| {
18172 ::serde::de::Error::custom(
18173 ::buffa::alloc::format!("unknown enum value {v32}"),
18174 )
18175 })
18176 }
18177 fn visit_unit<E: ::serde::de::Error>(
18178 self,
18179 ) -> ::core::result::Result<DefaultSymbolVisibility, E> {
18180 ::core::result::Result::Ok(
18181 ::core::default::Default::default(),
18182 )
18183 }
18184 }
18185 d.deserialize_any(_V)
18186 }
18187 }
18188 impl ::buffa::json_helpers::ProtoElemJson for DefaultSymbolVisibility {
18189 fn serialize_proto_json<S: ::serde::Serializer>(
18190 v: &Self,
18191 s: S,
18192 ) -> ::core::result::Result<S::Ok, S::Error> {
18193 ::serde::Serialize::serialize(v, s)
18194 }
18195 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
18196 d: D,
18197 ) -> ::core::result::Result<Self, D::Error> {
18198 <Self as ::serde::Deserialize>::deserialize(d)
18199 }
18200 }
18201 };
18202 impl ::buffa::Enumeration for DefaultSymbolVisibility {
18203 fn from_i32(value: i32) -> ::core::option::Option<Self> {
18204 match value {
18205 0i32 => {
18206 ::core::option::Option::Some(
18207 Self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN,
18208 )
18209 }
18210 1i32 => ::core::option::Option::Some(Self::EXPORT_ALL),
18211 2i32 => ::core::option::Option::Some(Self::EXPORT_TOP_LEVEL),
18212 3i32 => ::core::option::Option::Some(Self::LOCAL_ALL),
18213 4i32 => ::core::option::Option::Some(Self::STRICT),
18214 _ => ::core::option::Option::None,
18215 }
18216 }
18217 fn to_i32(&self) -> i32 {
18218 *self as i32
18219 }
18220 fn proto_name(&self) -> &'static str {
18221 match self {
18222 Self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN => {
18223 "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"
18224 }
18225 Self::EXPORT_ALL => "EXPORT_ALL",
18226 Self::EXPORT_TOP_LEVEL => "EXPORT_TOP_LEVEL",
18227 Self::LOCAL_ALL => "LOCAL_ALL",
18228 Self::STRICT => "STRICT",
18229 }
18230 }
18231 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
18232 match name {
18233 "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" => {
18234 ::core::option::Option::Some(
18235 Self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN,
18236 )
18237 }
18238 "EXPORT_ALL" => ::core::option::Option::Some(Self::EXPORT_ALL),
18239 "EXPORT_TOP_LEVEL" => {
18240 ::core::option::Option::Some(Self::EXPORT_TOP_LEVEL)
18241 }
18242 "LOCAL_ALL" => ::core::option::Option::Some(Self::LOCAL_ALL),
18243 "STRICT" => ::core::option::Option::Some(Self::STRICT),
18244 _ => ::core::option::Option::None,
18245 }
18246 }
18247 fn values() -> &'static [Self] {
18248 &[
18249 Self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN,
18250 Self::EXPORT_ALL,
18251 Self::EXPORT_TOP_LEVEL,
18252 Self::LOCAL_ALL,
18253 Self::STRICT,
18254 ]
18255 }
18256 }
18257 }
18258 #[cfg(feature = "views")]
18259 #[doc(inline)]
18260 pub use super::__buffa::view::feature_set::VisibilityFeatureView;
18261}
18262#[derive(Clone, PartialEq, Default)]
18267#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
18268#[cfg_attr(feature = "json", serde(default))]
18269#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
18270pub struct FeatureSetDefaults {
18271 #[cfg_attr(
18273 feature = "json",
18274 serde(
18275 rename = "defaults",
18276 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
18277 deserialize_with = "::buffa::json_helpers::null_as_default"
18278 )
18279 )]
18280 pub defaults: ::buffa::alloc::vec::Vec<
18281 feature_set_defaults::FeatureSetEditionDefault,
18282 >,
18283 #[cfg_attr(
18288 feature = "json",
18289 serde(
18290 rename = "minimumEdition",
18291 alias = "minimum_edition",
18292 with = "::buffa::json_helpers::opt_closed_enum",
18293 skip_serializing_if = "::core::option::Option::is_none"
18294 )
18295 )]
18296 pub minimum_edition: ::core::option::Option<Edition>,
18297 #[cfg_attr(
18302 feature = "json",
18303 serde(
18304 rename = "maximumEdition",
18305 alias = "maximum_edition",
18306 with = "::buffa::json_helpers::opt_closed_enum",
18307 skip_serializing_if = "::core::option::Option::is_none"
18308 )
18309 )]
18310 pub maximum_edition: ::core::option::Option<Edition>,
18311 #[cfg_attr(feature = "json", serde(skip))]
18312 #[doc(hidden)]
18313 pub __buffa_unknown_fields: ::buffa::UnknownFields,
18314}
18315impl ::core::fmt::Debug for FeatureSetDefaults {
18316 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
18317 f.debug_struct("FeatureSetDefaults")
18318 .field("defaults", &self.defaults)
18319 .field("minimum_edition", &self.minimum_edition)
18320 .field("maximum_edition", &self.maximum_edition)
18321 .finish()
18322 }
18323}
18324impl FeatureSetDefaults {
18325 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSetDefaults";
18330}
18331impl FeatureSetDefaults {
18332 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
18333 #[inline]
18334 pub fn with_minimum_edition(mut self, value: impl Into<Edition>) -> Self {
18336 self.minimum_edition = Some(value.into());
18337 self
18338 }
18339 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
18340 #[inline]
18341 pub fn with_maximum_edition(mut self, value: impl Into<Edition>) -> Self {
18343 self.maximum_edition = Some(value.into());
18344 self
18345 }
18346}
18347impl ::buffa::DefaultInstance for FeatureSetDefaults {
18348 fn default_instance() -> &'static Self {
18349 static VALUE: ::buffa::__private::OnceBox<FeatureSetDefaults> = ::buffa::__private::OnceBox::new();
18350 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
18351 }
18352}
18353impl ::buffa::MessageName for FeatureSetDefaults {
18354 const PACKAGE: &'static str = "google.protobuf";
18355 const NAME: &'static str = "FeatureSetDefaults";
18356 const FULL_NAME: &'static str = "google.protobuf.FeatureSetDefaults";
18357 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSetDefaults";
18358}
18359impl ::buffa::Message for FeatureSetDefaults {
18360 #[allow(clippy::let_and_return)]
18366 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18367 #[allow(unused_imports)]
18368 use ::buffa::Enumeration as _;
18369 let mut size = 0u32;
18370 for v in &self.defaults {
18371 let __slot = __cache.reserve();
18372 let inner_size = v.compute_size(__cache);
18373 __cache.set(__slot, inner_size);
18374 size
18375 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18376 + inner_size;
18377 }
18378 if let Some(ref v) = self.minimum_edition {
18379 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
18380 }
18381 if let Some(ref v) = self.maximum_edition {
18382 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
18383 }
18384 size += self.__buffa_unknown_fields.encoded_len() as u32;
18385 size
18386 }
18387 fn write_to(
18388 &self,
18389 __cache: &mut ::buffa::SizeCache,
18390 buf: &mut impl ::buffa::bytes::BufMut,
18391 ) {
18392 #[allow(unused_imports)]
18393 use ::buffa::Enumeration as _;
18394 for v in &self.defaults {
18395 ::buffa::encoding::Tag::new(
18396 1u32,
18397 ::buffa::encoding::WireType::LengthDelimited,
18398 )
18399 .encode(buf);
18400 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
18401 v.write_to(__cache, buf);
18402 }
18403 if let Some(ref v) = self.minimum_edition {
18404 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
18405 .encode(buf);
18406 ::buffa::types::encode_int32(v.to_i32(), buf);
18407 }
18408 if let Some(ref v) = self.maximum_edition {
18409 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
18410 .encode(buf);
18411 ::buffa::types::encode_int32(v.to_i32(), buf);
18412 }
18413 self.__buffa_unknown_fields.write_to(buf);
18414 }
18415 fn merge_field(
18416 &mut self,
18417 tag: ::buffa::encoding::Tag,
18418 buf: &mut impl ::buffa::bytes::Buf,
18419 depth: u32,
18420 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
18421 #[allow(unused_imports)]
18422 use ::buffa::bytes::Buf as _;
18423 #[allow(unused_imports)]
18424 use ::buffa::Enumeration as _;
18425 match tag.field_number() {
18426 1u32 => {
18427 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
18428 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18429 field_number: 1u32,
18430 expected: 2u8,
18431 actual: tag.wire_type() as u8,
18432 });
18433 }
18434 let mut elem = ::core::default::Default::default();
18435 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
18436 self.defaults.push(elem);
18437 }
18438 4u32 => {
18439 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
18440 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18441 field_number: 4u32,
18442 expected: 0u8,
18443 actual: tag.wire_type() as u8,
18444 });
18445 }
18446 let __raw = ::buffa::types::decode_int32(buf)?;
18447 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
18448 __raw,
18449 ) {
18450 self.minimum_edition = ::core::option::Option::Some(__v);
18451 } else {
18452 self.__buffa_unknown_fields
18453 .push(::buffa::UnknownField {
18454 number: 4u32,
18455 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
18456 });
18457 }
18458 }
18459 5u32 => {
18460 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
18461 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18462 field_number: 5u32,
18463 expected: 0u8,
18464 actual: tag.wire_type() as u8,
18465 });
18466 }
18467 let __raw = ::buffa::types::decode_int32(buf)?;
18468 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
18469 __raw,
18470 ) {
18471 self.maximum_edition = ::core::option::Option::Some(__v);
18472 } else {
18473 self.__buffa_unknown_fields
18474 .push(::buffa::UnknownField {
18475 number: 5u32,
18476 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
18477 });
18478 }
18479 }
18480 _ => {
18481 self.__buffa_unknown_fields
18482 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
18483 }
18484 }
18485 ::core::result::Result::Ok(())
18486 }
18487 fn clear(&mut self) {
18488 self.defaults.clear();
18489 self.minimum_edition = ::core::option::Option::None;
18490 self.maximum_edition = ::core::option::Option::None;
18491 self.__buffa_unknown_fields.clear();
18492 }
18493}
18494impl ::buffa::ExtensionSet for FeatureSetDefaults {
18495 const PROTO_FQN: &'static str = "google.protobuf.FeatureSetDefaults";
18496 fn unknown_fields(&self) -> &::buffa::UnknownFields {
18497 &self.__buffa_unknown_fields
18498 }
18499 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
18500 &mut self.__buffa_unknown_fields
18501 }
18502}
18503#[cfg(feature = "text")]
18504impl ::buffa::text::TextFormat for FeatureSetDefaults {
18505 fn encode_text(
18506 &self,
18507 enc: &mut ::buffa::text::TextEncoder<'_>,
18508 ) -> ::core::fmt::Result {
18509 #[allow(unused_imports)]
18510 use ::buffa::Enumeration as _;
18511 if let ::core::option::Option::Some(ref __v) = self.minimum_edition {
18512 enc.write_field_name("minimum_edition")?;
18513 enc.write_enum_name(__v.proto_name())?;
18514 }
18515 if let ::core::option::Option::Some(ref __v) = self.maximum_edition {
18516 enc.write_field_name("maximum_edition")?;
18517 enc.write_enum_name(__v.proto_name())?;
18518 }
18519 for __v in &self.defaults {
18520 enc.write_field_name("defaults")?;
18521 enc.write_message(__v)?;
18522 }
18523 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
18524 ::core::result::Result::Ok(())
18525 }
18526 fn merge_text(
18527 &mut self,
18528 dec: &mut ::buffa::text::TextDecoder<'_>,
18529 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
18530 #[allow(unused_imports)]
18531 use ::buffa::Enumeration as _;
18532 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
18533 match __name {
18534 "minimum_edition" => {
18535 self.minimum_edition = ::core::option::Option::Some(
18536 dec.read_closed_enum_by_name::<Edition>()?,
18537 );
18538 }
18539 "maximum_edition" => {
18540 self.maximum_edition = ::core::option::Option::Some(
18541 dec.read_closed_enum_by_name::<Edition>()?,
18542 );
18543 }
18544 "defaults" => {
18545 dec.read_repeated_into(
18546 &mut self.defaults,
18547 |__d| {
18548 let mut __m = ::core::default::Default::default();
18549 __d.merge_message(&mut __m)?;
18550 ::core::result::Result::Ok(__m)
18551 },
18552 )?
18553 }
18554 _ => dec.skip_value()?,
18555 }
18556 }
18557 ::core::result::Result::Ok(())
18558 }
18559}
18560#[cfg(feature = "json")]
18561impl ::buffa::json_helpers::ProtoElemJson for FeatureSetDefaults {
18562 fn serialize_proto_json<S: ::serde::Serializer>(
18563 v: &Self,
18564 s: S,
18565 ) -> ::core::result::Result<S::Ok, S::Error> {
18566 ::serde::Serialize::serialize(v, s)
18567 }
18568 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
18569 d: D,
18570 ) -> ::core::result::Result<Self, D::Error> {
18571 <Self as ::serde::Deserialize>::deserialize(d)
18572 }
18573}
18574#[cfg(feature = "json")]
18575#[doc(hidden)]
18576pub const __FEATURE_SET_DEFAULTS_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
18577 type_url: "type.googleapis.com/google.protobuf.FeatureSetDefaults",
18578 to_json: ::buffa::type_registry::any_to_json::<FeatureSetDefaults>,
18579 from_json: ::buffa::type_registry::any_from_json::<FeatureSetDefaults>,
18580 is_wkt: false,
18581};
18582#[cfg(feature = "text")]
18583#[doc(hidden)]
18584pub const __FEATURE_SET_DEFAULTS_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
18585 type_url: "type.googleapis.com/google.protobuf.FeatureSetDefaults",
18586 text_encode: ::buffa::type_registry::any_encode_text::<FeatureSetDefaults>,
18587 text_merge: ::buffa::type_registry::any_merge_text::<FeatureSetDefaults>,
18588};
18589pub mod feature_set_defaults {
18590 #[allow(unused_imports)]
18591 use super::*;
18592 #[derive(Clone, PartialEq, Default)]
18597 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
18598 #[cfg_attr(feature = "json", serde(default))]
18599 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
18600 pub struct FeatureSetEditionDefault {
18601 #[cfg_attr(
18603 feature = "json",
18604 serde(
18605 rename = "edition",
18606 with = "::buffa::json_helpers::opt_closed_enum",
18607 skip_serializing_if = "::core::option::Option::is_none"
18608 )
18609 )]
18610 pub edition: ::core::option::Option<super::Edition>,
18611 #[cfg_attr(
18615 feature = "json",
18616 serde(
18617 rename = "overridableFeatures",
18618 alias = "overridable_features",
18619 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
18620 )
18621 )]
18622 pub overridable_features: ::buffa::MessageField<super::FeatureSet>,
18623 #[cfg_attr(
18627 feature = "json",
18628 serde(
18629 rename = "fixedFeatures",
18630 alias = "fixed_features",
18631 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
18632 )
18633 )]
18634 pub fixed_features: ::buffa::MessageField<super::FeatureSet>,
18635 #[cfg_attr(feature = "json", serde(skip))]
18636 #[doc(hidden)]
18637 pub __buffa_unknown_fields: ::buffa::UnknownFields,
18638 }
18639 impl ::core::fmt::Debug for FeatureSetEditionDefault {
18640 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
18641 f.debug_struct("FeatureSetEditionDefault")
18642 .field("edition", &self.edition)
18643 .field("overridable_features", &self.overridable_features)
18644 .field("fixed_features", &self.fixed_features)
18645 .finish()
18646 }
18647 }
18648 impl FeatureSetEditionDefault {
18649 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";
18654 }
18655 impl FeatureSetEditionDefault {
18656 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
18657 #[inline]
18658 pub fn with_edition(mut self, value: impl Into<super::Edition>) -> Self {
18660 self.edition = Some(value.into());
18661 self
18662 }
18663 }
18664 impl ::buffa::DefaultInstance for FeatureSetEditionDefault {
18665 fn default_instance() -> &'static Self {
18666 static VALUE: ::buffa::__private::OnceBox<FeatureSetEditionDefault> = ::buffa::__private::OnceBox::new();
18667 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
18668 }
18669 }
18670 impl ::buffa::MessageName for FeatureSetEditionDefault {
18671 const PACKAGE: &'static str = "google.protobuf";
18672 const NAME: &'static str = "FeatureSetDefaults.FeatureSetEditionDefault";
18673 const FULL_NAME: &'static str = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";
18674 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";
18675 }
18676 impl ::buffa::Message for FeatureSetEditionDefault {
18677 #[allow(clippy::let_and_return)]
18683 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
18684 #[allow(unused_imports)]
18685 use ::buffa::Enumeration as _;
18686 let mut size = 0u32;
18687 if let Some(ref v) = self.edition {
18688 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
18689 }
18690 if self.overridable_features.is_set() {
18691 let __slot = __cache.reserve();
18692 let inner_size = self.overridable_features.compute_size(__cache);
18693 __cache.set(__slot, inner_size);
18694 size
18695 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18696 + inner_size;
18697 }
18698 if self.fixed_features.is_set() {
18699 let __slot = __cache.reserve();
18700 let inner_size = self.fixed_features.compute_size(__cache);
18701 __cache.set(__slot, inner_size);
18702 size
18703 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
18704 + inner_size;
18705 }
18706 size += self.__buffa_unknown_fields.encoded_len() as u32;
18707 size
18708 }
18709 fn write_to(
18710 &self,
18711 __cache: &mut ::buffa::SizeCache,
18712 buf: &mut impl ::buffa::bytes::BufMut,
18713 ) {
18714 #[allow(unused_imports)]
18715 use ::buffa::Enumeration as _;
18716 if let Some(ref v) = self.edition {
18717 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
18718 .encode(buf);
18719 ::buffa::types::encode_int32(v.to_i32(), buf);
18720 }
18721 if self.overridable_features.is_set() {
18722 ::buffa::encoding::Tag::new(
18723 4u32,
18724 ::buffa::encoding::WireType::LengthDelimited,
18725 )
18726 .encode(buf);
18727 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
18728 self.overridable_features.write_to(__cache, buf);
18729 }
18730 if self.fixed_features.is_set() {
18731 ::buffa::encoding::Tag::new(
18732 5u32,
18733 ::buffa::encoding::WireType::LengthDelimited,
18734 )
18735 .encode(buf);
18736 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
18737 self.fixed_features.write_to(__cache, buf);
18738 }
18739 self.__buffa_unknown_fields.write_to(buf);
18740 }
18741 fn merge_field(
18742 &mut self,
18743 tag: ::buffa::encoding::Tag,
18744 buf: &mut impl ::buffa::bytes::Buf,
18745 depth: u32,
18746 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
18747 #[allow(unused_imports)]
18748 use ::buffa::bytes::Buf as _;
18749 #[allow(unused_imports)]
18750 use ::buffa::Enumeration as _;
18751 match tag.field_number() {
18752 3u32 => {
18753 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
18754 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18755 field_number: 3u32,
18756 expected: 0u8,
18757 actual: tag.wire_type() as u8,
18758 });
18759 }
18760 let __raw = ::buffa::types::decode_int32(buf)?;
18761 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
18762 __raw,
18763 ) {
18764 self.edition = ::core::option::Option::Some(__v);
18765 } else {
18766 self.__buffa_unknown_fields
18767 .push(::buffa::UnknownField {
18768 number: 3u32,
18769 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
18770 });
18771 }
18772 }
18773 4u32 => {
18774 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
18775 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18776 field_number: 4u32,
18777 expected: 2u8,
18778 actual: tag.wire_type() as u8,
18779 });
18780 }
18781 ::buffa::Message::merge_length_delimited(
18782 self.overridable_features.get_or_insert_default(),
18783 buf,
18784 depth,
18785 )?;
18786 }
18787 5u32 => {
18788 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
18789 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
18790 field_number: 5u32,
18791 expected: 2u8,
18792 actual: tag.wire_type() as u8,
18793 });
18794 }
18795 ::buffa::Message::merge_length_delimited(
18796 self.fixed_features.get_or_insert_default(),
18797 buf,
18798 depth,
18799 )?;
18800 }
18801 _ => {
18802 self.__buffa_unknown_fields
18803 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
18804 }
18805 }
18806 ::core::result::Result::Ok(())
18807 }
18808 fn clear(&mut self) {
18809 self.edition = ::core::option::Option::None;
18810 self.overridable_features = ::buffa::MessageField::none();
18811 self.fixed_features = ::buffa::MessageField::none();
18812 self.__buffa_unknown_fields.clear();
18813 }
18814 }
18815 impl ::buffa::ExtensionSet for FeatureSetEditionDefault {
18816 const PROTO_FQN: &'static str = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";
18817 fn unknown_fields(&self) -> &::buffa::UnknownFields {
18818 &self.__buffa_unknown_fields
18819 }
18820 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
18821 &mut self.__buffa_unknown_fields
18822 }
18823 }
18824 #[cfg(feature = "text")]
18825 impl ::buffa::text::TextFormat for FeatureSetEditionDefault {
18826 fn encode_text(
18827 &self,
18828 enc: &mut ::buffa::text::TextEncoder<'_>,
18829 ) -> ::core::fmt::Result {
18830 #[allow(unused_imports)]
18831 use ::buffa::Enumeration as _;
18832 if let ::core::option::Option::Some(ref __v) = self.edition {
18833 enc.write_field_name("edition")?;
18834 enc.write_enum_name(__v.proto_name())?;
18835 }
18836 if self.overridable_features.is_set() {
18837 enc.write_field_name("overridable_features")?;
18838 enc.write_message(&*self.overridable_features)?;
18839 }
18840 if self.fixed_features.is_set() {
18841 enc.write_field_name("fixed_features")?;
18842 enc.write_message(&*self.fixed_features)?;
18843 }
18844 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
18845 ::core::result::Result::Ok(())
18846 }
18847 fn merge_text(
18848 &mut self,
18849 dec: &mut ::buffa::text::TextDecoder<'_>,
18850 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
18851 #[allow(unused_imports)]
18852 use ::buffa::Enumeration as _;
18853 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
18854 match __name {
18855 "edition" => {
18856 self.edition = ::core::option::Option::Some(
18857 dec.read_closed_enum_by_name::<super::Edition>()?,
18858 );
18859 }
18860 "overridable_features" => {
18861 dec.merge_message(
18862 self.overridable_features.get_or_insert_default(),
18863 )?
18864 }
18865 "fixed_features" => {
18866 dec.merge_message(self.fixed_features.get_or_insert_default())?
18867 }
18868 _ => dec.skip_value()?,
18869 }
18870 }
18871 ::core::result::Result::Ok(())
18872 }
18873 }
18874 #[cfg(feature = "json")]
18875 impl ::buffa::json_helpers::ProtoElemJson for FeatureSetEditionDefault {
18876 fn serialize_proto_json<S: ::serde::Serializer>(
18877 v: &Self,
18878 s: S,
18879 ) -> ::core::result::Result<S::Ok, S::Error> {
18880 ::serde::Serialize::serialize(v, s)
18881 }
18882 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
18883 d: D,
18884 ) -> ::core::result::Result<Self, D::Error> {
18885 <Self as ::serde::Deserialize>::deserialize(d)
18886 }
18887 }
18888 #[cfg(feature = "json")]
18889 #[doc(hidden)]
18890 pub const __FEATURE_SET_EDITION_DEFAULT_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
18891 type_url: "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault",
18892 to_json: ::buffa::type_registry::any_to_json::<FeatureSetEditionDefault>,
18893 from_json: ::buffa::type_registry::any_from_json::<FeatureSetEditionDefault>,
18894 is_wkt: false,
18895 };
18896 #[cfg(feature = "text")]
18897 #[doc(hidden)]
18898 pub const __FEATURE_SET_EDITION_DEFAULT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
18899 type_url: "type.googleapis.com/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault",
18900 text_encode: ::buffa::type_registry::any_encode_text::<FeatureSetEditionDefault>,
18901 text_merge: ::buffa::type_registry::any_merge_text::<FeatureSetEditionDefault>,
18902 };
18903 #[cfg(feature = "views")]
18904 #[doc(inline)]
18905 pub use super::__buffa::view::feature_set_defaults::FeatureSetEditionDefaultView;
18906}
18907#[derive(Clone, PartialEq, Default)]
18913#[cfg_attr(feature = "json", derive(::serde::Serialize))]
18914#[cfg_attr(feature = "json", serde(default))]
18915#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
18916pub struct SourceCodeInfo {
18917 #[cfg_attr(
18965 feature = "json",
18966 serde(
18967 rename = "location",
18968 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
18969 deserialize_with = "::buffa::json_helpers::null_as_default"
18970 )
18971 )]
18972 pub location: ::buffa::alloc::vec::Vec<source_code_info::Location>,
18973 #[cfg_attr(feature = "json", serde(flatten))]
18974 #[doc(hidden)]
18975 pub __buffa_unknown_fields: __SourceCodeInfoExtJson,
18976}
18977impl ::core::fmt::Debug for SourceCodeInfo {
18978 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
18979 f.debug_struct("SourceCodeInfo").field("location", &self.location).finish()
18980 }
18981}
18982impl SourceCodeInfo {
18983 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceCodeInfo";
18988}
18989impl ::buffa::DefaultInstance for SourceCodeInfo {
18990 fn default_instance() -> &'static Self {
18991 static VALUE: ::buffa::__private::OnceBox<SourceCodeInfo> = ::buffa::__private::OnceBox::new();
18992 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
18993 }
18994}
18995impl ::buffa::MessageName for SourceCodeInfo {
18996 const PACKAGE: &'static str = "google.protobuf";
18997 const NAME: &'static str = "SourceCodeInfo";
18998 const FULL_NAME: &'static str = "google.protobuf.SourceCodeInfo";
18999 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceCodeInfo";
19000}
19001impl ::buffa::Message for SourceCodeInfo {
19002 #[allow(clippy::let_and_return)]
19008 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19009 #[allow(unused_imports)]
19010 use ::buffa::Enumeration as _;
19011 let mut size = 0u32;
19012 for v in &self.location {
19013 let __slot = __cache.reserve();
19014 let inner_size = v.compute_size(__cache);
19015 __cache.set(__slot, inner_size);
19016 size
19017 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19018 + inner_size;
19019 }
19020 size += self.__buffa_unknown_fields.encoded_len() as u32;
19021 size
19022 }
19023 fn write_to(
19024 &self,
19025 __cache: &mut ::buffa::SizeCache,
19026 buf: &mut impl ::buffa::bytes::BufMut,
19027 ) {
19028 #[allow(unused_imports)]
19029 use ::buffa::Enumeration as _;
19030 for v in &self.location {
19031 ::buffa::encoding::Tag::new(
19032 1u32,
19033 ::buffa::encoding::WireType::LengthDelimited,
19034 )
19035 .encode(buf);
19036 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
19037 v.write_to(__cache, buf);
19038 }
19039 self.__buffa_unknown_fields.write_to(buf);
19040 }
19041 fn merge_field(
19042 &mut self,
19043 tag: ::buffa::encoding::Tag,
19044 buf: &mut impl ::buffa::bytes::Buf,
19045 depth: u32,
19046 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
19047 #[allow(unused_imports)]
19048 use ::buffa::bytes::Buf as _;
19049 #[allow(unused_imports)]
19050 use ::buffa::Enumeration as _;
19051 match tag.field_number() {
19052 1u32 => {
19053 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
19054 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19055 field_number: 1u32,
19056 expected: 2u8,
19057 actual: tag.wire_type() as u8,
19058 });
19059 }
19060 let mut elem = ::core::default::Default::default();
19061 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
19062 self.location.push(elem);
19063 }
19064 _ => {
19065 self.__buffa_unknown_fields
19066 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
19067 }
19068 }
19069 ::core::result::Result::Ok(())
19070 }
19071 fn clear(&mut self) {
19072 self.location.clear();
19073 self.__buffa_unknown_fields.clear();
19074 }
19075}
19076impl ::buffa::ExtensionSet for SourceCodeInfo {
19077 const PROTO_FQN: &'static str = "google.protobuf.SourceCodeInfo";
19078 fn unknown_fields(&self) -> &::buffa::UnknownFields {
19079 &self.__buffa_unknown_fields
19080 }
19081 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
19082 &mut self.__buffa_unknown_fields
19083 }
19084}
19085#[cfg(feature = "text")]
19086impl ::buffa::text::TextFormat for SourceCodeInfo {
19087 fn encode_text(
19088 &self,
19089 enc: &mut ::buffa::text::TextEncoder<'_>,
19090 ) -> ::core::fmt::Result {
19091 #[allow(unused_imports)]
19092 use ::buffa::Enumeration as _;
19093 for __v in &self.location {
19094 enc.write_field_name("location")?;
19095 enc.write_message(__v)?;
19096 }
19097 enc.write_extension_fields(
19098 "google.protobuf.SourceCodeInfo",
19099 &self.__buffa_unknown_fields,
19100 )?;
19101 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
19102 ::core::result::Result::Ok(())
19103 }
19104 fn merge_text(
19105 &mut self,
19106 dec: &mut ::buffa::text::TextDecoder<'_>,
19107 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
19108 #[allow(unused_imports)]
19109 use ::buffa::Enumeration as _;
19110 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
19111 match __name {
19112 "location" => {
19113 dec.read_repeated_into(
19114 &mut self.location,
19115 |__d| {
19116 let mut __m = ::core::default::Default::default();
19117 __d.merge_message(&mut __m)?;
19118 ::core::result::Result::Ok(__m)
19119 },
19120 )?
19121 }
19122 __name if __name.starts_with('[') => {
19123 for __r in dec
19124 .read_extension(__name, "google.protobuf.SourceCodeInfo")?
19125 {
19126 self.__buffa_unknown_fields.push(__r);
19127 }
19128 }
19129 _ => dec.skip_value()?,
19130 }
19131 }
19132 ::core::result::Result::Ok(())
19133 }
19134}
19135#[cfg(feature = "json")]
19136impl<'de> serde::Deserialize<'de> for SourceCodeInfo {
19137 fn deserialize<D: serde::Deserializer<'de>>(
19138 d: D,
19139 ) -> ::core::result::Result<Self, D::Error> {
19140 struct _V;
19141 impl<'de> serde::de::Visitor<'de> for _V {
19142 type Value = SourceCodeInfo;
19143 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19144 f.write_str("struct SourceCodeInfo")
19145 }
19146 #[allow(clippy::field_reassign_with_default)]
19147 fn visit_map<A: serde::de::MapAccess<'de>>(
19148 self,
19149 mut map: A,
19150 ) -> ::core::result::Result<SourceCodeInfo, A::Error> {
19151 let mut __f_location: ::core::option::Option<
19152 ::buffa::alloc::vec::Vec<source_code_info::Location>,
19153 > = None;
19154 let mut __ext_records: ::buffa::alloc::vec::Vec<::buffa::UnknownField> = ::buffa::alloc::vec::Vec::new();
19155 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
19156 match key.as_str() {
19157 "location" => {
19158 __f_location = Some({
19159 struct _S;
19160 impl<'de> serde::de::DeserializeSeed<'de> for _S {
19161 type Value = ::buffa::alloc::vec::Vec<
19162 source_code_info::Location,
19163 >;
19164 fn deserialize<D: serde::Deserializer<'de>>(
19165 self,
19166 d: D,
19167 ) -> ::core::result::Result<
19168 ::buffa::alloc::vec::Vec<source_code_info::Location>,
19169 D::Error,
19170 > {
19171 ::buffa::json_helpers::null_as_default(d)
19172 }
19173 }
19174 map.next_value_seed(_S)?
19175 });
19176 }
19177 __k if __k.starts_with('[') => {
19178 let __v: ::buffa::serde_json::Value = map.next_value()?;
19179 match ::buffa::extension_registry::deserialize_extension_key(
19180 "google.protobuf.SourceCodeInfo",
19181 __k,
19182 __v,
19183 ) {
19184 ::core::option::Option::Some(
19185 ::core::result::Result::Ok(__recs),
19186 ) => {
19187 for __rec in __recs {
19188 __ext_records.push(__rec);
19189 }
19190 }
19191 ::core::option::Option::Some(
19192 ::core::result::Result::Err(__e),
19193 ) => {
19194 return ::core::result::Result::Err(
19195 <A::Error as ::serde::de::Error>::custom(__e),
19196 );
19197 }
19198 ::core::option::Option::None => {}
19199 }
19200 }
19201 _ => {
19202 map.next_value::<serde::de::IgnoredAny>()?;
19203 }
19204 }
19205 }
19206 let mut __r = <SourceCodeInfo as ::core::default::Default>::default();
19207 if let ::core::option::Option::Some(v) = __f_location {
19208 __r.location = v;
19209 }
19210 for __rec in __ext_records {
19211 __r.__buffa_unknown_fields.push(__rec);
19212 }
19213 Ok(__r)
19214 }
19215 }
19216 d.deserialize_map(_V)
19217 }
19218}
19219#[cfg(feature = "json")]
19220impl ::buffa::json_helpers::ProtoElemJson for SourceCodeInfo {
19221 fn serialize_proto_json<S: ::serde::Serializer>(
19222 v: &Self,
19223 s: S,
19224 ) -> ::core::result::Result<S::Ok, S::Error> {
19225 ::serde::Serialize::serialize(v, s)
19226 }
19227 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
19228 d: D,
19229 ) -> ::core::result::Result<Self, D::Error> {
19230 <Self as ::serde::Deserialize>::deserialize(d)
19231 }
19232}
19233#[doc(hidden)]
19234#[derive(Clone, Debug, Default, PartialEq)]
19235#[repr(transparent)]
19236#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
19237pub struct __SourceCodeInfoExtJson(pub ::buffa::UnknownFields);
19238impl ::core::ops::Deref for __SourceCodeInfoExtJson {
19239 type Target = ::buffa::UnknownFields;
19240 fn deref(&self) -> &::buffa::UnknownFields {
19241 &self.0
19242 }
19243}
19244impl ::core::ops::DerefMut for __SourceCodeInfoExtJson {
19245 fn deref_mut(&mut self) -> &mut ::buffa::UnknownFields {
19246 &mut self.0
19247 }
19248}
19249impl ::core::convert::From<::buffa::UnknownFields> for __SourceCodeInfoExtJson {
19250 fn from(u: ::buffa::UnknownFields) -> Self {
19251 Self(u)
19252 }
19253}
19254#[cfg(feature = "json")]
19255impl ::serde::Serialize for __SourceCodeInfoExtJson {
19256 fn serialize<S: ::serde::Serializer>(
19257 &self,
19258 s: S,
19259 ) -> ::core::result::Result<S::Ok, S::Error> {
19260 ::buffa::extension_registry::serialize_extensions(
19261 "google.protobuf.SourceCodeInfo",
19262 &self.0,
19263 s,
19264 )
19265 }
19266}
19267#[cfg(feature = "json")]
19268impl<'de> ::serde::Deserialize<'de> for __SourceCodeInfoExtJson {
19269 fn deserialize<D: ::serde::Deserializer<'de>>(
19270 d: D,
19271 ) -> ::core::result::Result<Self, D::Error> {
19272 ::buffa::extension_registry::deserialize_extensions(
19273 "google.protobuf.SourceCodeInfo",
19274 d,
19275 )
19276 .map(Self)
19277 }
19278}
19279#[cfg(feature = "json")]
19280#[doc(hidden)]
19281pub const __SOURCE_CODE_INFO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
19282 type_url: "type.googleapis.com/google.protobuf.SourceCodeInfo",
19283 to_json: ::buffa::type_registry::any_to_json::<SourceCodeInfo>,
19284 from_json: ::buffa::type_registry::any_from_json::<SourceCodeInfo>,
19285 is_wkt: false,
19286};
19287#[cfg(feature = "text")]
19288#[doc(hidden)]
19289pub const __SOURCE_CODE_INFO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
19290 type_url: "type.googleapis.com/google.protobuf.SourceCodeInfo",
19291 text_encode: ::buffa::type_registry::any_encode_text::<SourceCodeInfo>,
19292 text_merge: ::buffa::type_registry::any_merge_text::<SourceCodeInfo>,
19293};
19294pub mod source_code_info {
19295 #[allow(unused_imports)]
19296 use super::*;
19297 #[derive(Clone, PartialEq, Default)]
19298 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
19299 #[cfg_attr(feature = "json", serde(default))]
19300 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
19301 pub struct Location {
19302 #[cfg_attr(
19330 feature = "json",
19331 serde(
19332 rename = "path",
19333 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
19334 deserialize_with = "::buffa::json_helpers::null_as_default"
19335 )
19336 )]
19337 pub path: ::buffa::alloc::vec::Vec<i32>,
19338 #[cfg_attr(
19346 feature = "json",
19347 serde(
19348 rename = "span",
19349 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
19350 deserialize_with = "::buffa::json_helpers::null_as_default"
19351 )
19352 )]
19353 pub span: ::buffa::alloc::vec::Vec<i32>,
19354 #[cfg_attr(
19408 feature = "json",
19409 serde(
19410 rename = "leadingComments",
19411 alias = "leading_comments",
19412 skip_serializing_if = "::core::option::Option::is_none"
19413 )
19414 )]
19415 pub leading_comments: ::core::option::Option<::buffa::alloc::string::String>,
19416 #[cfg_attr(
19418 feature = "json",
19419 serde(
19420 rename = "trailingComments",
19421 alias = "trailing_comments",
19422 skip_serializing_if = "::core::option::Option::is_none"
19423 )
19424 )]
19425 pub trailing_comments: ::core::option::Option<::buffa::alloc::string::String>,
19426 #[cfg_attr(
19428 feature = "json",
19429 serde(
19430 rename = "leadingDetachedComments",
19431 alias = "leading_detached_comments",
19432 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
19433 deserialize_with = "::buffa::json_helpers::null_as_default"
19434 )
19435 )]
19436 pub leading_detached_comments: ::buffa::alloc::vec::Vec<
19437 ::buffa::alloc::string::String,
19438 >,
19439 #[cfg_attr(feature = "json", serde(skip))]
19440 #[doc(hidden)]
19441 pub __buffa_unknown_fields: ::buffa::UnknownFields,
19442 }
19443 impl ::core::fmt::Debug for Location {
19444 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
19445 f.debug_struct("Location")
19446 .field("path", &self.path)
19447 .field("span", &self.span)
19448 .field("leading_comments", &self.leading_comments)
19449 .field("trailing_comments", &self.trailing_comments)
19450 .field("leading_detached_comments", &self.leading_detached_comments)
19451 .finish()
19452 }
19453 }
19454 impl Location {
19455 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceCodeInfo.Location";
19460 }
19461 impl Location {
19462 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
19463 #[inline]
19464 pub fn with_leading_comments(
19466 mut self,
19467 value: impl Into<::buffa::alloc::string::String>,
19468 ) -> Self {
19469 self.leading_comments = Some(value.into());
19470 self
19471 }
19472 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
19473 #[inline]
19474 pub fn with_trailing_comments(
19476 mut self,
19477 value: impl Into<::buffa::alloc::string::String>,
19478 ) -> Self {
19479 self.trailing_comments = Some(value.into());
19480 self
19481 }
19482 }
19483 impl ::buffa::DefaultInstance for Location {
19484 fn default_instance() -> &'static Self {
19485 static VALUE: ::buffa::__private::OnceBox<Location> = ::buffa::__private::OnceBox::new();
19486 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
19487 }
19488 }
19489 impl ::buffa::MessageName for Location {
19490 const PACKAGE: &'static str = "google.protobuf";
19491 const NAME: &'static str = "SourceCodeInfo.Location";
19492 const FULL_NAME: &'static str = "google.protobuf.SourceCodeInfo.Location";
19493 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceCodeInfo.Location";
19494 }
19495 impl ::buffa::Message for Location {
19496 #[allow(clippy::let_and_return)]
19502 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
19503 #[allow(unused_imports)]
19504 use ::buffa::Enumeration as _;
19505 let mut size = 0u32;
19506 if !self.path.is_empty() {
19507 let payload: u32 = self
19508 .path
19509 .iter()
19510 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
19511 .sum::<u32>();
19512 size
19513 += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
19514 + payload;
19515 }
19516 if !self.span.is_empty() {
19517 let payload: u32 = self
19518 .span
19519 .iter()
19520 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
19521 .sum::<u32>();
19522 size
19523 += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
19524 + payload;
19525 }
19526 if let Some(ref v) = self.leading_comments {
19527 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
19528 }
19529 if let Some(ref v) = self.trailing_comments {
19530 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
19531 }
19532 for v in &self.leading_detached_comments {
19533 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
19534 }
19535 size += self.__buffa_unknown_fields.encoded_len() as u32;
19536 size
19537 }
19538 fn write_to(
19539 &self,
19540 _cache: &mut ::buffa::SizeCache,
19541 buf: &mut impl ::buffa::bytes::BufMut,
19542 ) {
19543 #[allow(unused_imports)]
19544 use ::buffa::Enumeration as _;
19545 if !self.path.is_empty() {
19546 let payload: u32 = self
19547 .path
19548 .iter()
19549 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
19550 .sum::<u32>();
19551 ::buffa::encoding::Tag::new(
19552 1u32,
19553 ::buffa::encoding::WireType::LengthDelimited,
19554 )
19555 .encode(buf);
19556 ::buffa::encoding::encode_varint(payload as u64, buf);
19557 for &v in &self.path {
19558 ::buffa::types::encode_int32(v, buf);
19559 }
19560 }
19561 if !self.span.is_empty() {
19562 let payload: u32 = self
19563 .span
19564 .iter()
19565 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
19566 .sum::<u32>();
19567 ::buffa::encoding::Tag::new(
19568 2u32,
19569 ::buffa::encoding::WireType::LengthDelimited,
19570 )
19571 .encode(buf);
19572 ::buffa::encoding::encode_varint(payload as u64, buf);
19573 for &v in &self.span {
19574 ::buffa::types::encode_int32(v, buf);
19575 }
19576 }
19577 if let Some(ref v) = self.leading_comments {
19578 ::buffa::encoding::Tag::new(
19579 3u32,
19580 ::buffa::encoding::WireType::LengthDelimited,
19581 )
19582 .encode(buf);
19583 ::buffa::types::encode_string(v, buf);
19584 }
19585 if let Some(ref v) = self.trailing_comments {
19586 ::buffa::encoding::Tag::new(
19587 4u32,
19588 ::buffa::encoding::WireType::LengthDelimited,
19589 )
19590 .encode(buf);
19591 ::buffa::types::encode_string(v, buf);
19592 }
19593 for v in &self.leading_detached_comments {
19594 ::buffa::encoding::Tag::new(
19595 6u32,
19596 ::buffa::encoding::WireType::LengthDelimited,
19597 )
19598 .encode(buf);
19599 ::buffa::types::encode_string(v, buf);
19600 }
19601 self.__buffa_unknown_fields.write_to(buf);
19602 }
19603 fn merge_field(
19604 &mut self,
19605 tag: ::buffa::encoding::Tag,
19606 buf: &mut impl ::buffa::bytes::Buf,
19607 depth: u32,
19608 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
19609 #[allow(unused_imports)]
19610 use ::buffa::bytes::Buf as _;
19611 #[allow(unused_imports)]
19612 use ::buffa::Enumeration as _;
19613 match tag.field_number() {
19614 1u32 => {
19615 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
19616 let len = ::buffa::encoding::decode_varint(buf)?;
19617 let len = usize::try_from(len)
19618 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
19619 if buf.remaining() < len {
19620 return ::core::result::Result::Err(
19621 ::buffa::DecodeError::UnexpectedEof,
19622 );
19623 }
19624 self.path.reserve(len);
19625 let mut limited = buf.take(len);
19626 while limited.has_remaining() {
19627 self.path.push(::buffa::types::decode_int32(&mut limited)?);
19628 }
19629 let leftover = limited.remaining();
19630 if leftover > 0 {
19631 limited.advance(leftover);
19632 }
19633 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
19634 self.path.push(::buffa::types::decode_int32(buf)?);
19635 } else {
19636 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19637 field_number: 1u32,
19638 expected: 2u8,
19639 actual: tag.wire_type() as u8,
19640 });
19641 }
19642 }
19643 2u32 => {
19644 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
19645 let len = ::buffa::encoding::decode_varint(buf)?;
19646 let len = usize::try_from(len)
19647 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
19648 if buf.remaining() < len {
19649 return ::core::result::Result::Err(
19650 ::buffa::DecodeError::UnexpectedEof,
19651 );
19652 }
19653 self.span.reserve(len);
19654 let mut limited = buf.take(len);
19655 while limited.has_remaining() {
19656 self.span.push(::buffa::types::decode_int32(&mut limited)?);
19657 }
19658 let leftover = limited.remaining();
19659 if leftover > 0 {
19660 limited.advance(leftover);
19661 }
19662 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
19663 self.span.push(::buffa::types::decode_int32(buf)?);
19664 } else {
19665 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19666 field_number: 2u32,
19667 expected: 2u8,
19668 actual: tag.wire_type() as u8,
19669 });
19670 }
19671 }
19672 3u32 => {
19673 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
19674 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19675 field_number: 3u32,
19676 expected: 2u8,
19677 actual: tag.wire_type() as u8,
19678 });
19679 }
19680 ::buffa::types::merge_string(
19681 self
19682 .leading_comments
19683 .get_or_insert_with(::buffa::alloc::string::String::new),
19684 buf,
19685 )?;
19686 }
19687 4u32 => {
19688 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
19689 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19690 field_number: 4u32,
19691 expected: 2u8,
19692 actual: tag.wire_type() as u8,
19693 });
19694 }
19695 ::buffa::types::merge_string(
19696 self
19697 .trailing_comments
19698 .get_or_insert_with(::buffa::alloc::string::String::new),
19699 buf,
19700 )?;
19701 }
19702 6u32 => {
19703 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
19704 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19705 field_number: 6u32,
19706 expected: 2u8,
19707 actual: tag.wire_type() as u8,
19708 });
19709 }
19710 self.leading_detached_comments
19711 .push(::buffa::types::decode_string(buf)?);
19712 }
19713 _ => {
19714 self.__buffa_unknown_fields
19715 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
19716 }
19717 }
19718 ::core::result::Result::Ok(())
19719 }
19720 fn clear(&mut self) {
19721 self.path.clear();
19722 self.span.clear();
19723 self.leading_comments = ::core::option::Option::None;
19724 self.trailing_comments = ::core::option::Option::None;
19725 self.leading_detached_comments.clear();
19726 self.__buffa_unknown_fields.clear();
19727 }
19728 }
19729 impl ::buffa::ExtensionSet for Location {
19730 const PROTO_FQN: &'static str = "google.protobuf.SourceCodeInfo.Location";
19731 fn unknown_fields(&self) -> &::buffa::UnknownFields {
19732 &self.__buffa_unknown_fields
19733 }
19734 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
19735 &mut self.__buffa_unknown_fields
19736 }
19737 }
19738 #[cfg(feature = "text")]
19739 impl ::buffa::text::TextFormat for Location {
19740 fn encode_text(
19741 &self,
19742 enc: &mut ::buffa::text::TextEncoder<'_>,
19743 ) -> ::core::fmt::Result {
19744 #[allow(unused_imports)]
19745 use ::buffa::Enumeration as _;
19746 if let ::core::option::Option::Some(ref __v) = self.leading_comments {
19747 enc.write_field_name("leading_comments")?;
19748 enc.write_string(__v)?;
19749 }
19750 if let ::core::option::Option::Some(ref __v) = self.trailing_comments {
19751 enc.write_field_name("trailing_comments")?;
19752 enc.write_string(__v)?;
19753 }
19754 for __v in &self.path {
19755 enc.write_field_name("path")?;
19756 enc.write_i32(*__v)?;
19757 }
19758 for __v in &self.span {
19759 enc.write_field_name("span")?;
19760 enc.write_i32(*__v)?;
19761 }
19762 for __v in &self.leading_detached_comments {
19763 enc.write_field_name("leading_detached_comments")?;
19764 enc.write_string(__v)?;
19765 }
19766 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
19767 ::core::result::Result::Ok(())
19768 }
19769 fn merge_text(
19770 &mut self,
19771 dec: &mut ::buffa::text::TextDecoder<'_>,
19772 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
19773 #[allow(unused_imports)]
19774 use ::buffa::Enumeration as _;
19775 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
19776 match __name {
19777 "leading_comments" => {
19778 self.leading_comments = ::core::option::Option::Some(
19779 dec.read_string()?.into_owned(),
19780 );
19781 }
19782 "trailing_comments" => {
19783 self.trailing_comments = ::core::option::Option::Some(
19784 dec.read_string()?.into_owned(),
19785 );
19786 }
19787 "path" => {
19788 dec.read_repeated_into(&mut self.path, |__d| __d.read_i32())?
19789 }
19790 "span" => {
19791 dec.read_repeated_into(&mut self.span, |__d| __d.read_i32())?
19792 }
19793 "leading_detached_comments" => {
19794 dec.read_repeated_into(
19795 &mut self.leading_detached_comments,
19796 |__d| ::core::result::Result::Ok(
19797 __d.read_string()?.into_owned(),
19798 ),
19799 )?
19800 }
19801 _ => dec.skip_value()?,
19802 }
19803 }
19804 ::core::result::Result::Ok(())
19805 }
19806 }
19807 #[cfg(feature = "json")]
19808 impl ::buffa::json_helpers::ProtoElemJson for Location {
19809 fn serialize_proto_json<S: ::serde::Serializer>(
19810 v: &Self,
19811 s: S,
19812 ) -> ::core::result::Result<S::Ok, S::Error> {
19813 ::serde::Serialize::serialize(v, s)
19814 }
19815 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
19816 d: D,
19817 ) -> ::core::result::Result<Self, D::Error> {
19818 <Self as ::serde::Deserialize>::deserialize(d)
19819 }
19820 }
19821 #[cfg(feature = "json")]
19822 #[doc(hidden)]
19823 pub const __LOCATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
19824 type_url: "type.googleapis.com/google.protobuf.SourceCodeInfo.Location",
19825 to_json: ::buffa::type_registry::any_to_json::<Location>,
19826 from_json: ::buffa::type_registry::any_from_json::<Location>,
19827 is_wkt: false,
19828 };
19829 #[cfg(feature = "text")]
19830 #[doc(hidden)]
19831 pub const __LOCATION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
19832 type_url: "type.googleapis.com/google.protobuf.SourceCodeInfo.Location",
19833 text_encode: ::buffa::type_registry::any_encode_text::<Location>,
19834 text_merge: ::buffa::type_registry::any_merge_text::<Location>,
19835 };
19836 #[cfg(feature = "views")]
19837 #[doc(inline)]
19838 pub use super::__buffa::view::source_code_info::LocationView;
19839}
19840#[derive(Clone, PartialEq, Default)]
19844#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
19845#[cfg_attr(feature = "json", serde(default))]
19846#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
19847pub struct GeneratedCodeInfo {
19848 #[cfg_attr(
19853 feature = "json",
19854 serde(
19855 rename = "annotation",
19856 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
19857 deserialize_with = "::buffa::json_helpers::null_as_default"
19858 )
19859 )]
19860 pub annotation: ::buffa::alloc::vec::Vec<generated_code_info::Annotation>,
19861 #[cfg_attr(feature = "json", serde(skip))]
19862 #[doc(hidden)]
19863 pub __buffa_unknown_fields: ::buffa::UnknownFields,
19864}
19865impl ::core::fmt::Debug for GeneratedCodeInfo {
19866 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
19867 f.debug_struct("GeneratedCodeInfo")
19868 .field("annotation", &self.annotation)
19869 .finish()
19870 }
19871}
19872impl GeneratedCodeInfo {
19873 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.GeneratedCodeInfo";
19878}
19879impl ::buffa::DefaultInstance for GeneratedCodeInfo {
19880 fn default_instance() -> &'static Self {
19881 static VALUE: ::buffa::__private::OnceBox<GeneratedCodeInfo> = ::buffa::__private::OnceBox::new();
19882 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
19883 }
19884}
19885impl ::buffa::MessageName for GeneratedCodeInfo {
19886 const PACKAGE: &'static str = "google.protobuf";
19887 const NAME: &'static str = "GeneratedCodeInfo";
19888 const FULL_NAME: &'static str = "google.protobuf.GeneratedCodeInfo";
19889 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.GeneratedCodeInfo";
19890}
19891impl ::buffa::Message for GeneratedCodeInfo {
19892 #[allow(clippy::let_and_return)]
19898 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
19899 #[allow(unused_imports)]
19900 use ::buffa::Enumeration as _;
19901 let mut size = 0u32;
19902 for v in &self.annotation {
19903 let __slot = __cache.reserve();
19904 let inner_size = v.compute_size(__cache);
19905 __cache.set(__slot, inner_size);
19906 size
19907 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
19908 + inner_size;
19909 }
19910 size += self.__buffa_unknown_fields.encoded_len() as u32;
19911 size
19912 }
19913 fn write_to(
19914 &self,
19915 __cache: &mut ::buffa::SizeCache,
19916 buf: &mut impl ::buffa::bytes::BufMut,
19917 ) {
19918 #[allow(unused_imports)]
19919 use ::buffa::Enumeration as _;
19920 for v in &self.annotation {
19921 ::buffa::encoding::Tag::new(
19922 1u32,
19923 ::buffa::encoding::WireType::LengthDelimited,
19924 )
19925 .encode(buf);
19926 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
19927 v.write_to(__cache, buf);
19928 }
19929 self.__buffa_unknown_fields.write_to(buf);
19930 }
19931 fn merge_field(
19932 &mut self,
19933 tag: ::buffa::encoding::Tag,
19934 buf: &mut impl ::buffa::bytes::Buf,
19935 depth: u32,
19936 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
19937 #[allow(unused_imports)]
19938 use ::buffa::bytes::Buf as _;
19939 #[allow(unused_imports)]
19940 use ::buffa::Enumeration as _;
19941 match tag.field_number() {
19942 1u32 => {
19943 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
19944 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
19945 field_number: 1u32,
19946 expected: 2u8,
19947 actual: tag.wire_type() as u8,
19948 });
19949 }
19950 let mut elem = ::core::default::Default::default();
19951 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
19952 self.annotation.push(elem);
19953 }
19954 _ => {
19955 self.__buffa_unknown_fields
19956 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
19957 }
19958 }
19959 ::core::result::Result::Ok(())
19960 }
19961 fn clear(&mut self) {
19962 self.annotation.clear();
19963 self.__buffa_unknown_fields.clear();
19964 }
19965}
19966impl ::buffa::ExtensionSet for GeneratedCodeInfo {
19967 const PROTO_FQN: &'static str = "google.protobuf.GeneratedCodeInfo";
19968 fn unknown_fields(&self) -> &::buffa::UnknownFields {
19969 &self.__buffa_unknown_fields
19970 }
19971 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
19972 &mut self.__buffa_unknown_fields
19973 }
19974}
19975#[cfg(feature = "text")]
19976impl ::buffa::text::TextFormat for GeneratedCodeInfo {
19977 fn encode_text(
19978 &self,
19979 enc: &mut ::buffa::text::TextEncoder<'_>,
19980 ) -> ::core::fmt::Result {
19981 #[allow(unused_imports)]
19982 use ::buffa::Enumeration as _;
19983 for __v in &self.annotation {
19984 enc.write_field_name("annotation")?;
19985 enc.write_message(__v)?;
19986 }
19987 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
19988 ::core::result::Result::Ok(())
19989 }
19990 fn merge_text(
19991 &mut self,
19992 dec: &mut ::buffa::text::TextDecoder<'_>,
19993 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
19994 #[allow(unused_imports)]
19995 use ::buffa::Enumeration as _;
19996 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
19997 match __name {
19998 "annotation" => {
19999 dec.read_repeated_into(
20000 &mut self.annotation,
20001 |__d| {
20002 let mut __m = ::core::default::Default::default();
20003 __d.merge_message(&mut __m)?;
20004 ::core::result::Result::Ok(__m)
20005 },
20006 )?
20007 }
20008 _ => dec.skip_value()?,
20009 }
20010 }
20011 ::core::result::Result::Ok(())
20012 }
20013}
20014#[cfg(feature = "json")]
20015impl ::buffa::json_helpers::ProtoElemJson for GeneratedCodeInfo {
20016 fn serialize_proto_json<S: ::serde::Serializer>(
20017 v: &Self,
20018 s: S,
20019 ) -> ::core::result::Result<S::Ok, S::Error> {
20020 ::serde::Serialize::serialize(v, s)
20021 }
20022 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
20023 d: D,
20024 ) -> ::core::result::Result<Self, D::Error> {
20025 <Self as ::serde::Deserialize>::deserialize(d)
20026 }
20027}
20028#[cfg(feature = "json")]
20029#[doc(hidden)]
20030pub const __GENERATED_CODE_INFO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
20031 type_url: "type.googleapis.com/google.protobuf.GeneratedCodeInfo",
20032 to_json: ::buffa::type_registry::any_to_json::<GeneratedCodeInfo>,
20033 from_json: ::buffa::type_registry::any_from_json::<GeneratedCodeInfo>,
20034 is_wkt: false,
20035};
20036#[cfg(feature = "text")]
20037#[doc(hidden)]
20038pub const __GENERATED_CODE_INFO_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
20039 type_url: "type.googleapis.com/google.protobuf.GeneratedCodeInfo",
20040 text_encode: ::buffa::type_registry::any_encode_text::<GeneratedCodeInfo>,
20041 text_merge: ::buffa::type_registry::any_merge_text::<GeneratedCodeInfo>,
20042};
20043pub mod generated_code_info {
20044 #[allow(unused_imports)]
20045 use super::*;
20046 #[derive(Clone, PartialEq, Default)]
20047 #[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
20048 #[cfg_attr(feature = "json", serde(default))]
20049 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
20050 pub struct Annotation {
20051 #[cfg_attr(
20056 feature = "json",
20057 serde(
20058 rename = "path",
20059 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
20060 deserialize_with = "::buffa::json_helpers::null_as_default"
20061 )
20062 )]
20063 pub path: ::buffa::alloc::vec::Vec<i32>,
20064 #[cfg_attr(
20068 feature = "json",
20069 serde(
20070 rename = "sourceFile",
20071 alias = "source_file",
20072 skip_serializing_if = "::core::option::Option::is_none"
20073 )
20074 )]
20075 pub source_file: ::core::option::Option<::buffa::alloc::string::String>,
20076 #[cfg_attr(
20081 feature = "json",
20082 serde(
20083 rename = "begin",
20084 with = "::buffa::json_helpers::opt_int32",
20085 skip_serializing_if = "::core::option::Option::is_none"
20086 )
20087 )]
20088 pub begin: ::core::option::Option<i32>,
20089 #[cfg_attr(
20095 feature = "json",
20096 serde(
20097 rename = "end",
20098 with = "::buffa::json_helpers::opt_int32",
20099 skip_serializing_if = "::core::option::Option::is_none"
20100 )
20101 )]
20102 pub end: ::core::option::Option<i32>,
20103 #[cfg_attr(
20105 feature = "json",
20106 serde(
20107 rename = "semantic",
20108 with = "::buffa::json_helpers::opt_closed_enum",
20109 skip_serializing_if = "::core::option::Option::is_none"
20110 )
20111 )]
20112 pub semantic: ::core::option::Option<
20113 super::generated_code_info::annotation::Semantic,
20114 >,
20115 #[cfg_attr(feature = "json", serde(skip))]
20116 #[doc(hidden)]
20117 pub __buffa_unknown_fields: ::buffa::UnknownFields,
20118 }
20119 impl ::core::fmt::Debug for Annotation {
20120 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
20121 f.debug_struct("Annotation")
20122 .field("path", &self.path)
20123 .field("source_file", &self.source_file)
20124 .field("begin", &self.begin)
20125 .field("end", &self.end)
20126 .field("semantic", &self.semantic)
20127 .finish()
20128 }
20129 }
20130 impl Annotation {
20131 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation";
20136 }
20137 impl Annotation {
20138 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
20139 #[inline]
20140 pub fn with_source_file(
20142 mut self,
20143 value: impl Into<::buffa::alloc::string::String>,
20144 ) -> Self {
20145 self.source_file = Some(value.into());
20146 self
20147 }
20148 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
20149 #[inline]
20150 pub fn with_begin(mut self, value: i32) -> Self {
20152 self.begin = Some(value);
20153 self
20154 }
20155 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
20156 #[inline]
20157 pub fn with_end(mut self, value: i32) -> Self {
20159 self.end = Some(value);
20160 self
20161 }
20162 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
20163 #[inline]
20164 pub fn with_semantic(
20166 mut self,
20167 value: impl Into<super::generated_code_info::annotation::Semantic>,
20168 ) -> Self {
20169 self.semantic = Some(value.into());
20170 self
20171 }
20172 }
20173 impl ::buffa::DefaultInstance for Annotation {
20174 fn default_instance() -> &'static Self {
20175 static VALUE: ::buffa::__private::OnceBox<Annotation> = ::buffa::__private::OnceBox::new();
20176 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
20177 }
20178 }
20179 impl ::buffa::MessageName for Annotation {
20180 const PACKAGE: &'static str = "google.protobuf";
20181 const NAME: &'static str = "GeneratedCodeInfo.Annotation";
20182 const FULL_NAME: &'static str = "google.protobuf.GeneratedCodeInfo.Annotation";
20183 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation";
20184 }
20185 impl ::buffa::Message for Annotation {
20186 #[allow(clippy::let_and_return)]
20192 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
20193 #[allow(unused_imports)]
20194 use ::buffa::Enumeration as _;
20195 let mut size = 0u32;
20196 if !self.path.is_empty() {
20197 let payload: u32 = self
20198 .path
20199 .iter()
20200 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
20201 .sum::<u32>();
20202 size
20203 += 1u32 + ::buffa::encoding::varint_len(payload as u64) as u32
20204 + payload;
20205 }
20206 if let Some(ref v) = self.source_file {
20207 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
20208 }
20209 if let Some(v) = self.begin {
20210 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
20211 }
20212 if let Some(v) = self.end {
20213 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
20214 }
20215 if let Some(ref v) = self.semantic {
20216 size += 1u32 + ::buffa::types::int32_encoded_len(v.to_i32()) as u32;
20217 }
20218 size += self.__buffa_unknown_fields.encoded_len() as u32;
20219 size
20220 }
20221 fn write_to(
20222 &self,
20223 _cache: &mut ::buffa::SizeCache,
20224 buf: &mut impl ::buffa::bytes::BufMut,
20225 ) {
20226 #[allow(unused_imports)]
20227 use ::buffa::Enumeration as _;
20228 if !self.path.is_empty() {
20229 let payload: u32 = self
20230 .path
20231 .iter()
20232 .map(|&v| ::buffa::types::int32_encoded_len(v) as u32)
20233 .sum::<u32>();
20234 ::buffa::encoding::Tag::new(
20235 1u32,
20236 ::buffa::encoding::WireType::LengthDelimited,
20237 )
20238 .encode(buf);
20239 ::buffa::encoding::encode_varint(payload as u64, buf);
20240 for &v in &self.path {
20241 ::buffa::types::encode_int32(v, buf);
20242 }
20243 }
20244 if let Some(ref v) = self.source_file {
20245 ::buffa::encoding::Tag::new(
20246 2u32,
20247 ::buffa::encoding::WireType::LengthDelimited,
20248 )
20249 .encode(buf);
20250 ::buffa::types::encode_string(v, buf);
20251 }
20252 if let Some(v) = self.begin {
20253 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
20254 .encode(buf);
20255 ::buffa::types::encode_int32(v, buf);
20256 }
20257 if let Some(v) = self.end {
20258 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
20259 .encode(buf);
20260 ::buffa::types::encode_int32(v, buf);
20261 }
20262 if let Some(ref v) = self.semantic {
20263 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
20264 .encode(buf);
20265 ::buffa::types::encode_int32(v.to_i32(), buf);
20266 }
20267 self.__buffa_unknown_fields.write_to(buf);
20268 }
20269 fn merge_field(
20270 &mut self,
20271 tag: ::buffa::encoding::Tag,
20272 buf: &mut impl ::buffa::bytes::Buf,
20273 depth: u32,
20274 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
20275 #[allow(unused_imports)]
20276 use ::buffa::bytes::Buf as _;
20277 #[allow(unused_imports)]
20278 use ::buffa::Enumeration as _;
20279 match tag.field_number() {
20280 1u32 => {
20281 if tag.wire_type() == ::buffa::encoding::WireType::LengthDelimited {
20282 let len = ::buffa::encoding::decode_varint(buf)?;
20283 let len = usize::try_from(len)
20284 .map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
20285 if buf.remaining() < len {
20286 return ::core::result::Result::Err(
20287 ::buffa::DecodeError::UnexpectedEof,
20288 );
20289 }
20290 self.path.reserve(len);
20291 let mut limited = buf.take(len);
20292 while limited.has_remaining() {
20293 self.path.push(::buffa::types::decode_int32(&mut limited)?);
20294 }
20295 let leftover = limited.remaining();
20296 if leftover > 0 {
20297 limited.advance(leftover);
20298 }
20299 } else if tag.wire_type() == ::buffa::encoding::WireType::Varint {
20300 self.path.push(::buffa::types::decode_int32(buf)?);
20301 } else {
20302 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
20303 field_number: 1u32,
20304 expected: 2u8,
20305 actual: tag.wire_type() as u8,
20306 });
20307 }
20308 }
20309 2u32 => {
20310 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
20311 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
20312 field_number: 2u32,
20313 expected: 2u8,
20314 actual: tag.wire_type() as u8,
20315 });
20316 }
20317 ::buffa::types::merge_string(
20318 self
20319 .source_file
20320 .get_or_insert_with(::buffa::alloc::string::String::new),
20321 buf,
20322 )?;
20323 }
20324 3u32 => {
20325 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
20326 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
20327 field_number: 3u32,
20328 expected: 0u8,
20329 actual: tag.wire_type() as u8,
20330 });
20331 }
20332 self.begin = ::core::option::Option::Some(
20333 ::buffa::types::decode_int32(buf)?,
20334 );
20335 }
20336 4u32 => {
20337 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
20338 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
20339 field_number: 4u32,
20340 expected: 0u8,
20341 actual: tag.wire_type() as u8,
20342 });
20343 }
20344 self.end = ::core::option::Option::Some(
20345 ::buffa::types::decode_int32(buf)?,
20346 );
20347 }
20348 5u32 => {
20349 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
20350 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
20351 field_number: 5u32,
20352 expected: 0u8,
20353 actual: tag.wire_type() as u8,
20354 });
20355 }
20356 let __raw = ::buffa::types::decode_int32(buf)?;
20357 if let ::core::option::Option::Some(__v) = ::buffa::Enumeration::from_i32(
20358 __raw,
20359 ) {
20360 self.semantic = ::core::option::Option::Some(__v);
20361 } else {
20362 self.__buffa_unknown_fields
20363 .push(::buffa::UnknownField {
20364 number: 5u32,
20365 data: ::buffa::UnknownFieldData::Varint(__raw as u64),
20366 });
20367 }
20368 }
20369 _ => {
20370 self.__buffa_unknown_fields
20371 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
20372 }
20373 }
20374 ::core::result::Result::Ok(())
20375 }
20376 fn clear(&mut self) {
20377 self.path.clear();
20378 self.source_file = ::core::option::Option::None;
20379 self.begin = ::core::option::Option::None;
20380 self.end = ::core::option::Option::None;
20381 self.semantic = ::core::option::Option::None;
20382 self.__buffa_unknown_fields.clear();
20383 }
20384 }
20385 impl ::buffa::ExtensionSet for Annotation {
20386 const PROTO_FQN: &'static str = "google.protobuf.GeneratedCodeInfo.Annotation";
20387 fn unknown_fields(&self) -> &::buffa::UnknownFields {
20388 &self.__buffa_unknown_fields
20389 }
20390 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
20391 &mut self.__buffa_unknown_fields
20392 }
20393 }
20394 #[cfg(feature = "text")]
20395 impl ::buffa::text::TextFormat for Annotation {
20396 fn encode_text(
20397 &self,
20398 enc: &mut ::buffa::text::TextEncoder<'_>,
20399 ) -> ::core::fmt::Result {
20400 #[allow(unused_imports)]
20401 use ::buffa::Enumeration as _;
20402 if let ::core::option::Option::Some(ref __v) = self.source_file {
20403 enc.write_field_name("source_file")?;
20404 enc.write_string(__v)?;
20405 }
20406 if let ::core::option::Option::Some(ref __v) = self.begin {
20407 enc.write_field_name("begin")?;
20408 enc.write_i32(*__v)?;
20409 }
20410 if let ::core::option::Option::Some(ref __v) = self.end {
20411 enc.write_field_name("end")?;
20412 enc.write_i32(*__v)?;
20413 }
20414 if let ::core::option::Option::Some(ref __v) = self.semantic {
20415 enc.write_field_name("semantic")?;
20416 enc.write_enum_name(__v.proto_name())?;
20417 }
20418 for __v in &self.path {
20419 enc.write_field_name("path")?;
20420 enc.write_i32(*__v)?;
20421 }
20422 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
20423 ::core::result::Result::Ok(())
20424 }
20425 fn merge_text(
20426 &mut self,
20427 dec: &mut ::buffa::text::TextDecoder<'_>,
20428 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
20429 #[allow(unused_imports)]
20430 use ::buffa::Enumeration as _;
20431 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
20432 match __name {
20433 "source_file" => {
20434 self.source_file = ::core::option::Option::Some(
20435 dec.read_string()?.into_owned(),
20436 );
20437 }
20438 "begin" => self.begin = ::core::option::Option::Some(dec.read_i32()?),
20439 "end" => self.end = ::core::option::Option::Some(dec.read_i32()?),
20440 "semantic" => {
20441 self.semantic = ::core::option::Option::Some(
20442 dec
20443 .read_closed_enum_by_name::<
20444 super::generated_code_info::annotation::Semantic,
20445 >()?,
20446 );
20447 }
20448 "path" => {
20449 dec.read_repeated_into(&mut self.path, |__d| __d.read_i32())?
20450 }
20451 _ => dec.skip_value()?,
20452 }
20453 }
20454 ::core::result::Result::Ok(())
20455 }
20456 }
20457 #[cfg(feature = "json")]
20458 impl ::buffa::json_helpers::ProtoElemJson for Annotation {
20459 fn serialize_proto_json<S: ::serde::Serializer>(
20460 v: &Self,
20461 s: S,
20462 ) -> ::core::result::Result<S::Ok, S::Error> {
20463 ::serde::Serialize::serialize(v, s)
20464 }
20465 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
20466 d: D,
20467 ) -> ::core::result::Result<Self, D::Error> {
20468 <Self as ::serde::Deserialize>::deserialize(d)
20469 }
20470 }
20471 #[cfg(feature = "json")]
20472 #[doc(hidden)]
20473 pub const __ANNOTATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
20474 type_url: "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation",
20475 to_json: ::buffa::type_registry::any_to_json::<Annotation>,
20476 from_json: ::buffa::type_registry::any_from_json::<Annotation>,
20477 is_wkt: false,
20478 };
20479 #[cfg(feature = "text")]
20480 #[doc(hidden)]
20481 pub const __ANNOTATION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
20482 type_url: "type.googleapis.com/google.protobuf.GeneratedCodeInfo.Annotation",
20483 text_encode: ::buffa::type_registry::any_encode_text::<Annotation>,
20484 text_merge: ::buffa::type_registry::any_merge_text::<Annotation>,
20485 };
20486 pub mod annotation {
20487 #[allow(unused_imports)]
20488 use super::*;
20489 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
20492 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
20493 #[repr(i32)]
20494 pub enum Semantic {
20495 NONE = 0i32,
20497 SET = 1i32,
20499 ALIAS = 2i32,
20501 }
20502 impl ::core::default::Default for Semantic {
20503 fn default() -> Self {
20504 Self::NONE
20505 }
20506 }
20507 #[cfg(feature = "json")]
20508 const _: () = {
20509 impl ::serde::Serialize for Semantic {
20510 fn serialize<S: ::serde::Serializer>(
20511 &self,
20512 s: S,
20513 ) -> ::core::result::Result<S::Ok, S::Error> {
20514 s.serialize_str(::buffa::Enumeration::proto_name(self))
20515 }
20516 }
20517 impl<'de> ::serde::Deserialize<'de> for Semantic {
20518 fn deserialize<D: ::serde::Deserializer<'de>>(
20519 d: D,
20520 ) -> ::core::result::Result<Self, D::Error> {
20521 struct _V;
20522 impl ::serde::de::Visitor<'_> for _V {
20523 type Value = Semantic;
20524 fn expecting(
20525 &self,
20526 f: &mut ::core::fmt::Formatter<'_>,
20527 ) -> ::core::fmt::Result {
20528 f.write_str(
20529 concat!(
20530 "a string, integer, or null for ", stringify!(Semantic)
20531 ),
20532 )
20533 }
20534 fn visit_str<E: ::serde::de::Error>(
20535 self,
20536 v: &str,
20537 ) -> ::core::result::Result<Semantic, E> {
20538 <Semantic as ::buffa::Enumeration>::from_proto_name(v)
20539 .ok_or_else(|| {
20540 ::serde::de::Error::unknown_variant(v, &[])
20541 })
20542 }
20543 fn visit_i64<E: ::serde::de::Error>(
20544 self,
20545 v: i64,
20546 ) -> ::core::result::Result<Semantic, E> {
20547 let v32 = i32::try_from(v)
20548 .map_err(|_| {
20549 ::serde::de::Error::custom(
20550 ::buffa::alloc::format!("enum value {v} out of i32 range"),
20551 )
20552 })?;
20553 <Semantic as ::buffa::Enumeration>::from_i32(v32)
20554 .ok_or_else(|| {
20555 ::serde::de::Error::custom(
20556 ::buffa::alloc::format!("unknown enum value {v32}"),
20557 )
20558 })
20559 }
20560 fn visit_u64<E: ::serde::de::Error>(
20561 self,
20562 v: u64,
20563 ) -> ::core::result::Result<Semantic, E> {
20564 let v32 = i32::try_from(v)
20565 .map_err(|_| {
20566 ::serde::de::Error::custom(
20567 ::buffa::alloc::format!("enum value {v} out of i32 range"),
20568 )
20569 })?;
20570 <Semantic as ::buffa::Enumeration>::from_i32(v32)
20571 .ok_or_else(|| {
20572 ::serde::de::Error::custom(
20573 ::buffa::alloc::format!("unknown enum value {v32}"),
20574 )
20575 })
20576 }
20577 fn visit_unit<E: ::serde::de::Error>(
20578 self,
20579 ) -> ::core::result::Result<Semantic, E> {
20580 ::core::result::Result::Ok(
20581 ::core::default::Default::default(),
20582 )
20583 }
20584 }
20585 d.deserialize_any(_V)
20586 }
20587 }
20588 impl ::buffa::json_helpers::ProtoElemJson for Semantic {
20589 fn serialize_proto_json<S: ::serde::Serializer>(
20590 v: &Self,
20591 s: S,
20592 ) -> ::core::result::Result<S::Ok, S::Error> {
20593 ::serde::Serialize::serialize(v, s)
20594 }
20595 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
20596 d: D,
20597 ) -> ::core::result::Result<Self, D::Error> {
20598 <Self as ::serde::Deserialize>::deserialize(d)
20599 }
20600 }
20601 };
20602 impl ::buffa::Enumeration for Semantic {
20603 fn from_i32(value: i32) -> ::core::option::Option<Self> {
20604 match value {
20605 0i32 => ::core::option::Option::Some(Self::NONE),
20606 1i32 => ::core::option::Option::Some(Self::SET),
20607 2i32 => ::core::option::Option::Some(Self::ALIAS),
20608 _ => ::core::option::Option::None,
20609 }
20610 }
20611 fn to_i32(&self) -> i32 {
20612 *self as i32
20613 }
20614 fn proto_name(&self) -> &'static str {
20615 match self {
20616 Self::NONE => "NONE",
20617 Self::SET => "SET",
20618 Self::ALIAS => "ALIAS",
20619 }
20620 }
20621 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
20622 match name {
20623 "NONE" => ::core::option::Option::Some(Self::NONE),
20624 "SET" => ::core::option::Option::Some(Self::SET),
20625 "ALIAS" => ::core::option::Option::Some(Self::ALIAS),
20626 _ => ::core::option::Option::None,
20627 }
20628 }
20629 fn values() -> &'static [Self] {
20630 &[Self::NONE, Self::SET, Self::ALIAS]
20631 }
20632 }
20633 }
20634 #[cfg(feature = "views")]
20635 #[doc(inline)]
20636 pub use super::__buffa::view::generated_code_info::AnnotationView;
20637}