1#[allow(non_camel_case_types)]
6#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
7#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
8#[repr(i32)]
9pub enum Syntax {
10 SYNTAX_PROTO2 = 0i32,
12 SYNTAX_PROTO3 = 1i32,
14 SYNTAX_EDITIONS = 2i32,
16}
17impl Syntax {
18 #[allow(non_upper_case_globals)]
20 pub const Proto2: Self = Self::SYNTAX_PROTO2;
21 #[allow(non_upper_case_globals)]
23 pub const Proto3: Self = Self::SYNTAX_PROTO3;
24 #[allow(non_upper_case_globals)]
26 pub const Editions: Self = Self::SYNTAX_EDITIONS;
27}
28impl ::core::default::Default for Syntax {
29 fn default() -> Self {
30 Self::SYNTAX_PROTO2
31 }
32}
33impl ::buffa::Enumeration for Syntax {
34 fn from_i32(value: i32) -> ::core::option::Option<Self> {
35 match value {
36 0i32 => ::core::option::Option::Some(Self::SYNTAX_PROTO2),
37 1i32 => ::core::option::Option::Some(Self::SYNTAX_PROTO3),
38 2i32 => ::core::option::Option::Some(Self::SYNTAX_EDITIONS),
39 _ => ::core::option::Option::None,
40 }
41 }
42 fn to_i32(&self) -> i32 {
43 *self as i32
44 }
45 fn proto_name(&self) -> &'static str {
46 match self {
47 Self::SYNTAX_PROTO2 => "SYNTAX_PROTO2",
48 Self::SYNTAX_PROTO3 => "SYNTAX_PROTO3",
49 Self::SYNTAX_EDITIONS => "SYNTAX_EDITIONS",
50 }
51 }
52 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
53 match name {
54 "SYNTAX_PROTO2" => ::core::option::Option::Some(Self::SYNTAX_PROTO2),
55 "SYNTAX_PROTO3" => ::core::option::Option::Some(Self::SYNTAX_PROTO3),
56 "SYNTAX_EDITIONS" => ::core::option::Option::Some(Self::SYNTAX_EDITIONS),
57 _ => ::core::option::Option::None,
58 }
59 }
60 fn values() -> &'static [Self] {
61 &[Self::SYNTAX_PROTO2, Self::SYNTAX_PROTO3, Self::SYNTAX_EDITIONS]
62 }
63}
64#[derive(Clone, PartialEq, Default)]
71#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
72pub struct Type {
73 pub name: ::buffa::alloc::string::String,
77 pub fields: ::buffa::alloc::vec::Vec<Field>,
81 pub oneofs: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
85 pub options: ::buffa::alloc::vec::Vec<Option>,
89 pub source_context: ::buffa::MessageField<
93 SourceContext,
94 ::buffa::Inline<SourceContext>,
95 >,
96 pub syntax: ::buffa::EnumValue<Syntax>,
100 pub edition: ::buffa::alloc::string::String,
104 #[doc(hidden)]
105 pub __buffa_unknown_fields: ::buffa::UnknownFields,
106}
107impl ::core::fmt::Debug for Type {
108 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
109 f.debug_struct("Type")
110 .field("name", &self.name)
111 .field("fields", &self.fields)
112 .field("oneofs", &self.oneofs)
113 .field("options", &self.options)
114 .field("source_context", &self.source_context)
115 .field("syntax", &self.syntax)
116 .field("edition", &self.edition)
117 .finish()
118 }
119}
120impl Type {
121 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Type";
126}
127::buffa::impl_default_instance!(Type);
128#[cfg(feature = "reflect")]
129const _: () = {
130 impl ::buffa_descriptor::reflect::ReflectMessage for Type {
131 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
132 __buffa::reflect::descriptor_pool()
133 .message(Self::__buffa_reflect_message_index())
134 }
135 fn pool(
136 &self,
137 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
138 __buffa::reflect::descriptor_pool()
139 }
140 fn unknown_fields(&self) -> &::buffa::UnknownFields {
141 &self.__buffa_unknown_fields
142 }
143 fn get(
144 &self,
145 field: &::buffa_descriptor::FieldDescriptor,
146 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
147 #[allow(unused_imports)]
148 use ::buffa::Enumeration as _;
149 match field.number() {
150 1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
151 2u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.fields),
152 3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.oneofs),
153 4u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
154 5u32 => {
155 ::buffa_descriptor::reflect::ValueRef::Message(
156 ::buffa_descriptor::reflect::Reflectable::reflect(
157 &*self.source_context,
158 ),
159 )
160 }
161 6u32 => {
162 ::buffa_descriptor::reflect::ValueRef::EnumNumber(
163 self.syntax.to_i32(),
164 )
165 }
166 7u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.edition),
167 _ => {
168 ::core::debug_assert!(
169 false,
170 "field number {} is not a member of this message's reflect get()",
171 field.number(),
172 );
173 ::buffa_descriptor::reflect::ValueRef::Bool(false)
174 }
175 }
176 }
177 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
178 match field.number() {
179 1u32 => !self.name.is_empty(),
180 2u32 => !self.fields.is_empty(),
181 3u32 => !self.oneofs.is_empty(),
182 4u32 => !self.options.is_empty(),
183 5u32 => self.source_context.is_set(),
184 6u32 => self.syntax.to_i32() != 0,
185 7u32 => !self.edition.is_empty(),
186 _ => false,
187 }
188 }
189 fn for_each_set(
190 &self,
191 f: &mut dyn ::core::ops::FnMut(
192 &::buffa_descriptor::FieldDescriptor,
193 ::buffa_descriptor::reflect::ValueRef<'_>,
194 ),
195 ) {
196 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
197 self,
198 );
199 for fd in md.fields() {
200 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
201 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
202 }
203 }
204 }
205 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
206 ::buffa_descriptor::reflect::DynamicMessage::from_message(
207 self,
208 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
209 Self::__buffa_reflect_message_index(),
210 )
211 }
212 }
213 impl ::buffa_descriptor::reflect::ReflectElement for Type {
214 #[inline]
215 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
216 ::buffa_descriptor::reflect::ValueRef::Message(
217 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
218 )
219 }
220 }
221 impl Type {
222 #[doc(hidden)]
225 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
226 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
227 *IDX
228 .get_or_init(|| {
229 __buffa::reflect::descriptor_pool()
230 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
231 .expect(
232 "generated message is registered in the embedded descriptor pool",
233 )
234 })
235 }
236 }
237 impl ::buffa_descriptor::reflect::Reflectable for Type {
238 #[inline]
242 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
243 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
244 }
245 }
246};
247impl ::buffa::MessageName for Type {
248 const PACKAGE: &'static str = "google.protobuf";
249 const NAME: &'static str = "Type";
250 const FULL_NAME: &'static str = "google.protobuf.Type";
251 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Type";
252}
253impl ::buffa::Message for Type {
254 #[allow(clippy::let_and_return)]
262 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
263 #[allow(unused_imports)]
264 use ::buffa::Enumeration as _;
265 let mut size = 0u64;
266 if !self.name.is_empty() {
267 size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
268 }
269 for v in &self.fields {
270 let __slot = __cache.reserve();
271 let inner_size = v.compute_size(__cache);
272 __cache.set(__slot, inner_size);
273 size
274 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
275 + inner_size as u64;
276 }
277 for v in &self.oneofs {
278 size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
279 }
280 for v in &self.options {
281 let __slot = __cache.reserve();
282 let inner_size = v.compute_size(__cache);
283 __cache.set(__slot, inner_size);
284 size
285 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
286 + inner_size as u64;
287 }
288 if self.source_context.is_set() {
289 let __slot = __cache.reserve();
290 let inner_size = self.source_context.compute_size(__cache);
291 __cache.set(__slot, inner_size);
292 size
293 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
294 + inner_size as u64;
295 }
296 {
297 let val = self.syntax.to_i32();
298 if val != 0 {
299 size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
300 }
301 }
302 if !self.edition.is_empty() {
303 size += 1u64 + ::buffa::types::string_encoded_len(&self.edition) as u64;
304 }
305 size += self.__buffa_unknown_fields.encoded_len() as u64;
306 ::buffa::saturate_size(size)
307 }
308 fn write_to(
309 &self,
310 __cache: &mut ::buffa::SizeCache,
311 buf: &mut impl ::buffa::EncodeSink,
312 ) {
313 #[allow(unused_imports)]
314 use ::buffa::Enumeration as _;
315 if !self.name.is_empty() {
316 ::buffa::types::put_string_field(1u32, &self.name, buf);
317 }
318 for v in &self.fields {
319 ::buffa::types::put_len_delimited_header(
320 2u32,
321 u64::from(__cache.consume_next()),
322 buf,
323 );
324 v.write_to(__cache, buf);
325 }
326 for v in &self.oneofs {
327 ::buffa::types::put_string_field(3u32, v, buf);
328 }
329 for v in &self.options {
330 ::buffa::types::put_len_delimited_header(
331 4u32,
332 u64::from(__cache.consume_next()),
333 buf,
334 );
335 v.write_to(__cache, buf);
336 }
337 if self.source_context.is_set() {
338 ::buffa::types::put_len_delimited_header(
339 5u32,
340 u64::from(__cache.consume_next()),
341 buf,
342 );
343 self.source_context.write_to(__cache, buf);
344 }
345 {
346 let val = self.syntax.to_i32();
347 if val != 0 {
348 ::buffa::types::put_int32_field(6u32, val, buf);
349 }
350 }
351 if !self.edition.is_empty() {
352 ::buffa::types::put_string_field(7u32, &self.edition, buf);
353 }
354 self.__buffa_unknown_fields.write_to(buf);
355 }
356 fn merge_field(
357 &mut self,
358 tag: ::buffa::encoding::Tag,
359 buf: &mut impl ::buffa::bytes::Buf,
360 ctx: ::buffa::DecodeContext<'_>,
361 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
362 #[allow(unused_imports)]
363 use ::buffa::bytes::Buf as _;
364 #[allow(unused_imports)]
365 use ::buffa::Enumeration as _;
366 match tag.field_number() {
367 1u32 => {
368 ::buffa::encoding::check_wire_type(
369 tag,
370 ::buffa::encoding::WireType::LengthDelimited,
371 )?;
372 ::buffa::types::merge_string(&mut self.name, buf)?;
373 }
374 2u32 => {
375 ::buffa::encoding::check_wire_type(
376 tag,
377 ::buffa::encoding::WireType::LengthDelimited,
378 )?;
379 let mut elem = ::core::default::Default::default();
380 ctx.register_element_memory(
381 ::buffa::__private::element_footprint(&elem),
382 )?;
383 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
384 self.fields.push(elem);
385 }
386 3u32 => {
387 ::buffa::encoding::check_wire_type(
388 tag,
389 ::buffa::encoding::WireType::LengthDelimited,
390 )?;
391 let __elem = ::buffa::types::decode_string(buf)?;
392 ctx.register_element_memory(
393 ::buffa::__private::element_footprint(&__elem),
394 )?;
395 self.oneofs.push(__elem);
396 }
397 4u32 => {
398 ::buffa::encoding::check_wire_type(
399 tag,
400 ::buffa::encoding::WireType::LengthDelimited,
401 )?;
402 let mut elem = ::core::default::Default::default();
403 ctx.register_element_memory(
404 ::buffa::__private::element_footprint(&elem),
405 )?;
406 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
407 self.options.push(elem);
408 }
409 5u32 => {
410 ::buffa::encoding::check_wire_type(
411 tag,
412 ::buffa::encoding::WireType::LengthDelimited,
413 )?;
414 ::buffa::Message::merge_length_delimited(
415 self.source_context.get_or_insert_default(),
416 buf,
417 ctx,
418 )?;
419 }
420 6u32 => {
421 ::buffa::encoding::check_wire_type(
422 tag,
423 ::buffa::encoding::WireType::Varint,
424 )?;
425 self.syntax = ::buffa::EnumValue::from(
426 ::buffa::types::decode_int32(buf)?,
427 );
428 }
429 7u32 => {
430 ::buffa::encoding::check_wire_type(
431 tag,
432 ::buffa::encoding::WireType::LengthDelimited,
433 )?;
434 ::buffa::types::merge_string(&mut self.edition, buf)?;
435 }
436 _ => {
437 self.__buffa_unknown_fields
438 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
439 }
440 }
441 ::core::result::Result::Ok(())
442 }
443 fn clear(&mut self) {
444 self.name.clear();
445 self.fields.clear();
446 self.oneofs.clear();
447 self.options.clear();
448 self.source_context = ::buffa::MessageField::none();
449 self.syntax = ::buffa::EnumValue::from(0);
450 self.edition.clear();
451 self.__buffa_unknown_fields.clear();
452 }
453}
454impl ::buffa::ExtensionSet for Type {
455 const PROTO_FQN: &'static str = "google.protobuf.Type";
456 fn unknown_fields(&self) -> &::buffa::UnknownFields {
457 &self.__buffa_unknown_fields
458 }
459 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
460 &mut self.__buffa_unknown_fields
461 }
462}
463impl ::buffa::text::TextFormat for Type {
464 fn encode_text(
465 &self,
466 enc: &mut ::buffa::text::TextEncoder<'_>,
467 ) -> ::core::fmt::Result {
468 #[allow(unused_imports)]
469 use ::buffa::Enumeration as _;
470 if !self.name.is_empty() {
471 enc.write_field_name("name")?;
472 enc.write_string(&self.name)?;
473 }
474 if self.source_context.is_set() {
475 enc.write_field_name("source_context")?;
476 enc.write_message(&*self.source_context)?;
477 }
478 if self.syntax.to_i32() != 0 {
479 enc.write_field_name("syntax")?;
480 match &self.syntax {
481 ::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
482 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
483 }
484 }
485 if !self.edition.is_empty() {
486 enc.write_field_name("edition")?;
487 enc.write_string(&self.edition)?;
488 }
489 for __v in &self.fields {
490 enc.write_field_name("fields")?;
491 enc.write_message(__v)?;
492 }
493 for __v in &self.oneofs {
494 enc.write_field_name("oneofs")?;
495 enc.write_string(__v)?;
496 }
497 for __v in &self.options {
498 enc.write_field_name("options")?;
499 enc.write_message(__v)?;
500 }
501 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
502 ::core::result::Result::Ok(())
503 }
504 fn merge_text(
505 &mut self,
506 dec: &mut ::buffa::text::TextDecoder<'_>,
507 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
508 #[allow(unused_imports)]
509 use ::buffa::Enumeration as _;
510 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
511 match __name {
512 "name" => self.name = dec.read_string()?.into_owned(),
513 "source_context" => {
514 dec.merge_message(self.source_context.get_or_insert_default())?
515 }
516 "syntax" => {
517 self.syntax = dec
518 .read_enum_by_name::<Syntax>()
519 .map(::buffa::EnumValue::from)?;
520 }
521 "edition" => self.edition = dec.read_string()?.into_owned(),
522 "fields" => {
523 dec.read_repeated_into(
524 &mut self.fields,
525 |__d| {
526 let mut __m = ::core::default::Default::default();
527 __d.merge_message(&mut __m)?;
528 ::core::result::Result::Ok(__m)
529 },
530 )?
531 }
532 "oneofs" => {
533 dec.read_repeated_into(
534 &mut self.oneofs,
535 |__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
536 )?
537 }
538 "options" => {
539 dec.read_repeated_into(
540 &mut self.options,
541 |__d| {
542 let mut __m = ::core::default::Default::default();
543 __d.merge_message(&mut __m)?;
544 ::core::result::Result::Ok(__m)
545 },
546 )?
547 }
548 _ => dec.skip_value()?,
549 }
550 }
551 ::core::result::Result::Ok(())
552 }
553}
554#[doc(hidden)]
555pub const __TYPE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
556 type_url: "type.googleapis.com/google.protobuf.Type",
557 text_encode: ::buffa::type_registry::any_encode_text::<Type>,
558 text_merge: ::buffa::type_registry::any_merge_text::<Type>,
559};
560#[derive(Clone, PartialEq, Default)]
567#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
568pub struct Field {
569 pub kind: ::buffa::EnumValue<field::Kind>,
573 pub cardinality: ::buffa::EnumValue<field::Cardinality>,
577 pub number: i32,
581 pub name: ::buffa::alloc::string::String,
585 pub type_url: ::buffa::alloc::string::String,
590 pub oneof_index: i32,
595 pub packed: bool,
599 pub options: ::buffa::alloc::vec::Vec<Option>,
603 pub json_name: ::buffa::alloc::string::String,
607 pub default_value: ::buffa::alloc::string::String,
611 #[doc(hidden)]
612 pub __buffa_unknown_fields: ::buffa::UnknownFields,
613}
614impl ::core::fmt::Debug for Field {
615 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
616 f.debug_struct("Field")
617 .field("kind", &self.kind)
618 .field("cardinality", &self.cardinality)
619 .field("number", &self.number)
620 .field("name", &self.name)
621 .field("type_url", &self.type_url)
622 .field("oneof_index", &self.oneof_index)
623 .field("packed", &self.packed)
624 .field("options", &self.options)
625 .field("json_name", &self.json_name)
626 .field("default_value", &self.default_value)
627 .finish()
628 }
629}
630impl Field {
631 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Field";
636}
637::buffa::impl_default_instance!(Field);
638#[cfg(feature = "reflect")]
639const _: () = {
640 impl ::buffa_descriptor::reflect::ReflectMessage for Field {
641 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
642 __buffa::reflect::descriptor_pool()
643 .message(Self::__buffa_reflect_message_index())
644 }
645 fn pool(
646 &self,
647 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
648 __buffa::reflect::descriptor_pool()
649 }
650 fn unknown_fields(&self) -> &::buffa::UnknownFields {
651 &self.__buffa_unknown_fields
652 }
653 fn get(
654 &self,
655 field: &::buffa_descriptor::FieldDescriptor,
656 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
657 #[allow(unused_imports)]
658 use ::buffa::Enumeration as _;
659 match field.number() {
660 1u32 => {
661 ::buffa_descriptor::reflect::ValueRef::EnumNumber(self.kind.to_i32())
662 }
663 2u32 => {
664 ::buffa_descriptor::reflect::ValueRef::EnumNumber(
665 self.cardinality.to_i32(),
666 )
667 }
668 3u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.number),
669 4u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
670 6u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.type_url),
671 7u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.oneof_index),
672 8u32 => ::buffa_descriptor::reflect::ValueRef::Bool(self.packed),
673 9u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
674 10u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.json_name),
675 11u32 => {
676 ::buffa_descriptor::reflect::ValueRef::String(&self.default_value)
677 }
678 _ => {
679 ::core::debug_assert!(
680 false,
681 "field number {} is not a member of this message's reflect get()",
682 field.number(),
683 );
684 ::buffa_descriptor::reflect::ValueRef::Bool(false)
685 }
686 }
687 }
688 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
689 match field.number() {
690 1u32 => self.kind.to_i32() != 0,
691 2u32 => self.cardinality.to_i32() != 0,
692 3u32 => self.number != 0,
693 4u32 => !self.name.is_empty(),
694 6u32 => !self.type_url.is_empty(),
695 7u32 => self.oneof_index != 0,
696 8u32 => self.packed,
697 9u32 => !self.options.is_empty(),
698 10u32 => !self.json_name.is_empty(),
699 11u32 => !self.default_value.is_empty(),
700 _ => false,
701 }
702 }
703 fn for_each_set(
704 &self,
705 f: &mut dyn ::core::ops::FnMut(
706 &::buffa_descriptor::FieldDescriptor,
707 ::buffa_descriptor::reflect::ValueRef<'_>,
708 ),
709 ) {
710 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
711 self,
712 );
713 for fd in md.fields() {
714 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
715 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
716 }
717 }
718 }
719 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
720 ::buffa_descriptor::reflect::DynamicMessage::from_message(
721 self,
722 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
723 Self::__buffa_reflect_message_index(),
724 )
725 }
726 }
727 impl ::buffa_descriptor::reflect::ReflectElement for Field {
728 #[inline]
729 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
730 ::buffa_descriptor::reflect::ValueRef::Message(
731 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
732 )
733 }
734 }
735 impl Field {
736 #[doc(hidden)]
739 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
740 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
741 *IDX
742 .get_or_init(|| {
743 __buffa::reflect::descriptor_pool()
744 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
745 .expect(
746 "generated message is registered in the embedded descriptor pool",
747 )
748 })
749 }
750 }
751 impl ::buffa_descriptor::reflect::Reflectable for Field {
752 #[inline]
756 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
757 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
758 }
759 }
760};
761impl ::buffa::MessageName for Field {
762 const PACKAGE: &'static str = "google.protobuf";
763 const NAME: &'static str = "Field";
764 const FULL_NAME: &'static str = "google.protobuf.Field";
765 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Field";
766}
767impl ::buffa::Message for Field {
768 #[allow(clippy::let_and_return)]
776 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
777 #[allow(unused_imports)]
778 use ::buffa::Enumeration as _;
779 let mut size = 0u64;
780 {
781 let val = self.kind.to_i32();
782 if val != 0 {
783 size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
784 }
785 }
786 {
787 let val = self.cardinality.to_i32();
788 if val != 0 {
789 size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
790 }
791 }
792 if self.number != 0i32 {
793 size += 1u64 + ::buffa::types::int32_encoded_len(self.number) as u64;
794 }
795 if !self.name.is_empty() {
796 size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
797 }
798 if !self.type_url.is_empty() {
799 size += 1u64 + ::buffa::types::string_encoded_len(&self.type_url) as u64;
800 }
801 if self.oneof_index != 0i32 {
802 size += 1u64 + ::buffa::types::int32_encoded_len(self.oneof_index) as u64;
803 }
804 if self.packed {
805 size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
806 }
807 for v in &self.options {
808 let __slot = __cache.reserve();
809 let inner_size = v.compute_size(__cache);
810 __cache.set(__slot, inner_size);
811 size
812 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
813 + inner_size as u64;
814 }
815 if !self.json_name.is_empty() {
816 size += 1u64 + ::buffa::types::string_encoded_len(&self.json_name) as u64;
817 }
818 if !self.default_value.is_empty() {
819 size
820 += 1u64 + ::buffa::types::string_encoded_len(&self.default_value) as u64;
821 }
822 size += self.__buffa_unknown_fields.encoded_len() as u64;
823 ::buffa::saturate_size(size)
824 }
825 fn write_to(
826 &self,
827 __cache: &mut ::buffa::SizeCache,
828 buf: &mut impl ::buffa::EncodeSink,
829 ) {
830 #[allow(unused_imports)]
831 use ::buffa::Enumeration as _;
832 {
833 let val = self.kind.to_i32();
834 if val != 0 {
835 ::buffa::types::put_int32_field(1u32, val, buf);
836 }
837 }
838 {
839 let val = self.cardinality.to_i32();
840 if val != 0 {
841 ::buffa::types::put_int32_field(2u32, val, buf);
842 }
843 }
844 if self.number != 0i32 {
845 ::buffa::types::put_int32_field(3u32, self.number, buf);
846 }
847 if !self.name.is_empty() {
848 ::buffa::types::put_string_field(4u32, &self.name, buf);
849 }
850 if !self.type_url.is_empty() {
851 ::buffa::types::put_string_field(6u32, &self.type_url, buf);
852 }
853 if self.oneof_index != 0i32 {
854 ::buffa::types::put_int32_field(7u32, self.oneof_index, buf);
855 }
856 if self.packed {
857 ::buffa::types::put_bool_field(8u32, self.packed, buf);
858 }
859 for v in &self.options {
860 ::buffa::types::put_len_delimited_header(
861 9u32,
862 u64::from(__cache.consume_next()),
863 buf,
864 );
865 v.write_to(__cache, buf);
866 }
867 if !self.json_name.is_empty() {
868 ::buffa::types::put_string_field(10u32, &self.json_name, buf);
869 }
870 if !self.default_value.is_empty() {
871 ::buffa::types::put_string_field(11u32, &self.default_value, buf);
872 }
873 self.__buffa_unknown_fields.write_to(buf);
874 }
875 fn merge_field(
876 &mut self,
877 tag: ::buffa::encoding::Tag,
878 buf: &mut impl ::buffa::bytes::Buf,
879 ctx: ::buffa::DecodeContext<'_>,
880 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
881 #[allow(unused_imports)]
882 use ::buffa::bytes::Buf as _;
883 #[allow(unused_imports)]
884 use ::buffa::Enumeration as _;
885 match tag.field_number() {
886 1u32 => {
887 ::buffa::encoding::check_wire_type(
888 tag,
889 ::buffa::encoding::WireType::Varint,
890 )?;
891 self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
892 }
893 2u32 => {
894 ::buffa::encoding::check_wire_type(
895 tag,
896 ::buffa::encoding::WireType::Varint,
897 )?;
898 self.cardinality = ::buffa::EnumValue::from(
899 ::buffa::types::decode_int32(buf)?,
900 );
901 }
902 3u32 => {
903 ::buffa::encoding::check_wire_type(
904 tag,
905 ::buffa::encoding::WireType::Varint,
906 )?;
907 self.number = ::buffa::types::decode_int32(buf)?;
908 }
909 4u32 => {
910 ::buffa::encoding::check_wire_type(
911 tag,
912 ::buffa::encoding::WireType::LengthDelimited,
913 )?;
914 ::buffa::types::merge_string(&mut self.name, buf)?;
915 }
916 6u32 => {
917 ::buffa::encoding::check_wire_type(
918 tag,
919 ::buffa::encoding::WireType::LengthDelimited,
920 )?;
921 ::buffa::types::merge_string(&mut self.type_url, buf)?;
922 }
923 7u32 => {
924 ::buffa::encoding::check_wire_type(
925 tag,
926 ::buffa::encoding::WireType::Varint,
927 )?;
928 self.oneof_index = ::buffa::types::decode_int32(buf)?;
929 }
930 8u32 => {
931 ::buffa::encoding::check_wire_type(
932 tag,
933 ::buffa::encoding::WireType::Varint,
934 )?;
935 self.packed = ::buffa::types::decode_bool(buf)?;
936 }
937 9u32 => {
938 ::buffa::encoding::check_wire_type(
939 tag,
940 ::buffa::encoding::WireType::LengthDelimited,
941 )?;
942 let mut elem = ::core::default::Default::default();
943 ctx.register_element_memory(
944 ::buffa::__private::element_footprint(&elem),
945 )?;
946 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
947 self.options.push(elem);
948 }
949 10u32 => {
950 ::buffa::encoding::check_wire_type(
951 tag,
952 ::buffa::encoding::WireType::LengthDelimited,
953 )?;
954 ::buffa::types::merge_string(&mut self.json_name, buf)?;
955 }
956 11u32 => {
957 ::buffa::encoding::check_wire_type(
958 tag,
959 ::buffa::encoding::WireType::LengthDelimited,
960 )?;
961 ::buffa::types::merge_string(&mut self.default_value, buf)?;
962 }
963 _ => {
964 self.__buffa_unknown_fields
965 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
966 }
967 }
968 ::core::result::Result::Ok(())
969 }
970 fn clear(&mut self) {
971 self.kind = ::buffa::EnumValue::from(0);
972 self.cardinality = ::buffa::EnumValue::from(0);
973 self.number = 0i32;
974 self.name.clear();
975 self.type_url.clear();
976 self.oneof_index = 0i32;
977 self.packed = false;
978 self.options.clear();
979 self.json_name.clear();
980 self.default_value.clear();
981 self.__buffa_unknown_fields.clear();
982 }
983}
984impl ::buffa::ExtensionSet for Field {
985 const PROTO_FQN: &'static str = "google.protobuf.Field";
986 fn unknown_fields(&self) -> &::buffa::UnknownFields {
987 &self.__buffa_unknown_fields
988 }
989 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
990 &mut self.__buffa_unknown_fields
991 }
992}
993impl ::buffa::text::TextFormat for Field {
994 fn encode_text(
995 &self,
996 enc: &mut ::buffa::text::TextEncoder<'_>,
997 ) -> ::core::fmt::Result {
998 #[allow(unused_imports)]
999 use ::buffa::Enumeration as _;
1000 if self.kind.to_i32() != 0 {
1001 enc.write_field_name("kind")?;
1002 match &self.kind {
1003 ::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
1004 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
1005 }
1006 }
1007 if self.cardinality.to_i32() != 0 {
1008 enc.write_field_name("cardinality")?;
1009 match &self.cardinality {
1010 ::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
1011 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
1012 }
1013 }
1014 if self.number != 0i32 {
1015 enc.write_field_name("number")?;
1016 enc.write_i32(self.number)?;
1017 }
1018 if !self.name.is_empty() {
1019 enc.write_field_name("name")?;
1020 enc.write_string(&self.name)?;
1021 }
1022 if !self.type_url.is_empty() {
1023 enc.write_field_name("type_url")?;
1024 enc.write_string(&self.type_url)?;
1025 }
1026 if self.oneof_index != 0i32 {
1027 enc.write_field_name("oneof_index")?;
1028 enc.write_i32(self.oneof_index)?;
1029 }
1030 if self.packed {
1031 enc.write_field_name("packed")?;
1032 enc.write_bool(self.packed)?;
1033 }
1034 if !self.json_name.is_empty() {
1035 enc.write_field_name("json_name")?;
1036 enc.write_string(&self.json_name)?;
1037 }
1038 if !self.default_value.is_empty() {
1039 enc.write_field_name("default_value")?;
1040 enc.write_string(&self.default_value)?;
1041 }
1042 for __v in &self.options {
1043 enc.write_field_name("options")?;
1044 enc.write_message(__v)?;
1045 }
1046 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1047 ::core::result::Result::Ok(())
1048 }
1049 fn merge_text(
1050 &mut self,
1051 dec: &mut ::buffa::text::TextDecoder<'_>,
1052 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1053 #[allow(unused_imports)]
1054 use ::buffa::Enumeration as _;
1055 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1056 match __name {
1057 "kind" => {
1058 self.kind = dec
1059 .read_enum_by_name::<field::Kind>()
1060 .map(::buffa::EnumValue::from)?;
1061 }
1062 "cardinality" => {
1063 self.cardinality = dec
1064 .read_enum_by_name::<field::Cardinality>()
1065 .map(::buffa::EnumValue::from)?;
1066 }
1067 "number" => self.number = dec.read_i32()?,
1068 "name" => self.name = dec.read_string()?.into_owned(),
1069 "type_url" => self.type_url = dec.read_string()?.into_owned(),
1070 "oneof_index" => self.oneof_index = dec.read_i32()?,
1071 "packed" => self.packed = dec.read_bool()?,
1072 "json_name" => self.json_name = dec.read_string()?.into_owned(),
1073 "default_value" => self.default_value = dec.read_string()?.into_owned(),
1074 "options" => {
1075 dec.read_repeated_into(
1076 &mut self.options,
1077 |__d| {
1078 let mut __m = ::core::default::Default::default();
1079 __d.merge_message(&mut __m)?;
1080 ::core::result::Result::Ok(__m)
1081 },
1082 )?
1083 }
1084 _ => dec.skip_value()?,
1085 }
1086 }
1087 ::core::result::Result::Ok(())
1088 }
1089}
1090#[doc(hidden)]
1091pub const __FIELD_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1092 type_url: "type.googleapis.com/google.protobuf.Field",
1093 text_encode: ::buffa::type_registry::any_encode_text::<Field>,
1094 text_merge: ::buffa::type_registry::any_merge_text::<Field>,
1095};
1096pub mod field {
1097 #[allow(unused_imports)]
1098 use super::*;
1099 #[allow(non_camel_case_types)]
1101 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
1102 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1103 #[repr(i32)]
1104 pub enum Kind {
1105 TYPE_UNKNOWN = 0i32,
1107 TYPE_DOUBLE = 1i32,
1109 TYPE_FLOAT = 2i32,
1111 TYPE_INT64 = 3i32,
1113 TYPE_UINT64 = 4i32,
1115 TYPE_INT32 = 5i32,
1117 TYPE_FIXED64 = 6i32,
1119 TYPE_FIXED32 = 7i32,
1121 TYPE_BOOL = 8i32,
1123 TYPE_STRING = 9i32,
1125 TYPE_GROUP = 10i32,
1127 TYPE_MESSAGE = 11i32,
1129 TYPE_BYTES = 12i32,
1131 TYPE_UINT32 = 13i32,
1133 TYPE_ENUM = 14i32,
1135 TYPE_SFIXED32 = 15i32,
1137 TYPE_SFIXED64 = 16i32,
1139 TYPE_SINT32 = 17i32,
1141 TYPE_SINT64 = 18i32,
1143 }
1144 impl Kind {
1145 #[allow(non_upper_case_globals)]
1147 pub const TypeUnknown: Self = Self::TYPE_UNKNOWN;
1148 #[allow(non_upper_case_globals)]
1150 pub const TypeDouble: Self = Self::TYPE_DOUBLE;
1151 #[allow(non_upper_case_globals)]
1153 pub const TypeFloat: Self = Self::TYPE_FLOAT;
1154 #[allow(non_upper_case_globals)]
1156 pub const TypeInt64: Self = Self::TYPE_INT64;
1157 #[allow(non_upper_case_globals)]
1159 pub const TypeUint64: Self = Self::TYPE_UINT64;
1160 #[allow(non_upper_case_globals)]
1162 pub const TypeInt32: Self = Self::TYPE_INT32;
1163 #[allow(non_upper_case_globals)]
1165 pub const TypeFixed64: Self = Self::TYPE_FIXED64;
1166 #[allow(non_upper_case_globals)]
1168 pub const TypeFixed32: Self = Self::TYPE_FIXED32;
1169 #[allow(non_upper_case_globals)]
1171 pub const TypeBool: Self = Self::TYPE_BOOL;
1172 #[allow(non_upper_case_globals)]
1174 pub const TypeString: Self = Self::TYPE_STRING;
1175 #[allow(non_upper_case_globals)]
1177 pub const TypeGroup: Self = Self::TYPE_GROUP;
1178 #[allow(non_upper_case_globals)]
1180 pub const TypeMessage: Self = Self::TYPE_MESSAGE;
1181 #[allow(non_upper_case_globals)]
1183 pub const TypeBytes: Self = Self::TYPE_BYTES;
1184 #[allow(non_upper_case_globals)]
1186 pub const TypeUint32: Self = Self::TYPE_UINT32;
1187 #[allow(non_upper_case_globals)]
1189 pub const TypeEnum: Self = Self::TYPE_ENUM;
1190 #[allow(non_upper_case_globals)]
1192 pub const TypeSfixed32: Self = Self::TYPE_SFIXED32;
1193 #[allow(non_upper_case_globals)]
1195 pub const TypeSfixed64: Self = Self::TYPE_SFIXED64;
1196 #[allow(non_upper_case_globals)]
1198 pub const TypeSint32: Self = Self::TYPE_SINT32;
1199 #[allow(non_upper_case_globals)]
1201 pub const TypeSint64: Self = Self::TYPE_SINT64;
1202 }
1203 impl ::core::default::Default for Kind {
1204 fn default() -> Self {
1205 Self::TYPE_UNKNOWN
1206 }
1207 }
1208 impl ::buffa::Enumeration for Kind {
1209 fn from_i32(value: i32) -> ::core::option::Option<Self> {
1210 match value {
1211 0i32 => ::core::option::Option::Some(Self::TYPE_UNKNOWN),
1212 1i32 => ::core::option::Option::Some(Self::TYPE_DOUBLE),
1213 2i32 => ::core::option::Option::Some(Self::TYPE_FLOAT),
1214 3i32 => ::core::option::Option::Some(Self::TYPE_INT64),
1215 4i32 => ::core::option::Option::Some(Self::TYPE_UINT64),
1216 5i32 => ::core::option::Option::Some(Self::TYPE_INT32),
1217 6i32 => ::core::option::Option::Some(Self::TYPE_FIXED64),
1218 7i32 => ::core::option::Option::Some(Self::TYPE_FIXED32),
1219 8i32 => ::core::option::Option::Some(Self::TYPE_BOOL),
1220 9i32 => ::core::option::Option::Some(Self::TYPE_STRING),
1221 10i32 => ::core::option::Option::Some(Self::TYPE_GROUP),
1222 11i32 => ::core::option::Option::Some(Self::TYPE_MESSAGE),
1223 12i32 => ::core::option::Option::Some(Self::TYPE_BYTES),
1224 13i32 => ::core::option::Option::Some(Self::TYPE_UINT32),
1225 14i32 => ::core::option::Option::Some(Self::TYPE_ENUM),
1226 15i32 => ::core::option::Option::Some(Self::TYPE_SFIXED32),
1227 16i32 => ::core::option::Option::Some(Self::TYPE_SFIXED64),
1228 17i32 => ::core::option::Option::Some(Self::TYPE_SINT32),
1229 18i32 => ::core::option::Option::Some(Self::TYPE_SINT64),
1230 _ => ::core::option::Option::None,
1231 }
1232 }
1233 fn to_i32(&self) -> i32 {
1234 *self as i32
1235 }
1236 fn proto_name(&self) -> &'static str {
1237 match self {
1238 Self::TYPE_UNKNOWN => "TYPE_UNKNOWN",
1239 Self::TYPE_DOUBLE => "TYPE_DOUBLE",
1240 Self::TYPE_FLOAT => "TYPE_FLOAT",
1241 Self::TYPE_INT64 => "TYPE_INT64",
1242 Self::TYPE_UINT64 => "TYPE_UINT64",
1243 Self::TYPE_INT32 => "TYPE_INT32",
1244 Self::TYPE_FIXED64 => "TYPE_FIXED64",
1245 Self::TYPE_FIXED32 => "TYPE_FIXED32",
1246 Self::TYPE_BOOL => "TYPE_BOOL",
1247 Self::TYPE_STRING => "TYPE_STRING",
1248 Self::TYPE_GROUP => "TYPE_GROUP",
1249 Self::TYPE_MESSAGE => "TYPE_MESSAGE",
1250 Self::TYPE_BYTES => "TYPE_BYTES",
1251 Self::TYPE_UINT32 => "TYPE_UINT32",
1252 Self::TYPE_ENUM => "TYPE_ENUM",
1253 Self::TYPE_SFIXED32 => "TYPE_SFIXED32",
1254 Self::TYPE_SFIXED64 => "TYPE_SFIXED64",
1255 Self::TYPE_SINT32 => "TYPE_SINT32",
1256 Self::TYPE_SINT64 => "TYPE_SINT64",
1257 }
1258 }
1259 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
1260 match name {
1261 "TYPE_UNKNOWN" => ::core::option::Option::Some(Self::TYPE_UNKNOWN),
1262 "TYPE_DOUBLE" => ::core::option::Option::Some(Self::TYPE_DOUBLE),
1263 "TYPE_FLOAT" => ::core::option::Option::Some(Self::TYPE_FLOAT),
1264 "TYPE_INT64" => ::core::option::Option::Some(Self::TYPE_INT64),
1265 "TYPE_UINT64" => ::core::option::Option::Some(Self::TYPE_UINT64),
1266 "TYPE_INT32" => ::core::option::Option::Some(Self::TYPE_INT32),
1267 "TYPE_FIXED64" => ::core::option::Option::Some(Self::TYPE_FIXED64),
1268 "TYPE_FIXED32" => ::core::option::Option::Some(Self::TYPE_FIXED32),
1269 "TYPE_BOOL" => ::core::option::Option::Some(Self::TYPE_BOOL),
1270 "TYPE_STRING" => ::core::option::Option::Some(Self::TYPE_STRING),
1271 "TYPE_GROUP" => ::core::option::Option::Some(Self::TYPE_GROUP),
1272 "TYPE_MESSAGE" => ::core::option::Option::Some(Self::TYPE_MESSAGE),
1273 "TYPE_BYTES" => ::core::option::Option::Some(Self::TYPE_BYTES),
1274 "TYPE_UINT32" => ::core::option::Option::Some(Self::TYPE_UINT32),
1275 "TYPE_ENUM" => ::core::option::Option::Some(Self::TYPE_ENUM),
1276 "TYPE_SFIXED32" => ::core::option::Option::Some(Self::TYPE_SFIXED32),
1277 "TYPE_SFIXED64" => ::core::option::Option::Some(Self::TYPE_SFIXED64),
1278 "TYPE_SINT32" => ::core::option::Option::Some(Self::TYPE_SINT32),
1279 "TYPE_SINT64" => ::core::option::Option::Some(Self::TYPE_SINT64),
1280 _ => ::core::option::Option::None,
1281 }
1282 }
1283 fn values() -> &'static [Self] {
1284 &[
1285 Self::TYPE_UNKNOWN,
1286 Self::TYPE_DOUBLE,
1287 Self::TYPE_FLOAT,
1288 Self::TYPE_INT64,
1289 Self::TYPE_UINT64,
1290 Self::TYPE_INT32,
1291 Self::TYPE_FIXED64,
1292 Self::TYPE_FIXED32,
1293 Self::TYPE_BOOL,
1294 Self::TYPE_STRING,
1295 Self::TYPE_GROUP,
1296 Self::TYPE_MESSAGE,
1297 Self::TYPE_BYTES,
1298 Self::TYPE_UINT32,
1299 Self::TYPE_ENUM,
1300 Self::TYPE_SFIXED32,
1301 Self::TYPE_SFIXED64,
1302 Self::TYPE_SINT32,
1303 Self::TYPE_SINT64,
1304 ]
1305 }
1306 }
1307 #[allow(non_camel_case_types)]
1309 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
1310 #[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1311 #[repr(i32)]
1312 pub enum Cardinality {
1313 CARDINALITY_UNKNOWN = 0i32,
1315 CARDINALITY_OPTIONAL = 1i32,
1317 CARDINALITY_REQUIRED = 2i32,
1319 CARDINALITY_REPEATED = 3i32,
1321 }
1322 impl Cardinality {
1323 #[allow(non_upper_case_globals)]
1325 pub const Unknown: Self = Self::CARDINALITY_UNKNOWN;
1326 #[allow(non_upper_case_globals)]
1328 pub const Optional: Self = Self::CARDINALITY_OPTIONAL;
1329 #[allow(non_upper_case_globals)]
1331 pub const Required: Self = Self::CARDINALITY_REQUIRED;
1332 #[allow(non_upper_case_globals)]
1334 pub const Repeated: Self = Self::CARDINALITY_REPEATED;
1335 }
1336 impl ::core::default::Default for Cardinality {
1337 fn default() -> Self {
1338 Self::CARDINALITY_UNKNOWN
1339 }
1340 }
1341 impl ::buffa::Enumeration for Cardinality {
1342 fn from_i32(value: i32) -> ::core::option::Option<Self> {
1343 match value {
1344 0i32 => ::core::option::Option::Some(Self::CARDINALITY_UNKNOWN),
1345 1i32 => ::core::option::Option::Some(Self::CARDINALITY_OPTIONAL),
1346 2i32 => ::core::option::Option::Some(Self::CARDINALITY_REQUIRED),
1347 3i32 => ::core::option::Option::Some(Self::CARDINALITY_REPEATED),
1348 _ => ::core::option::Option::None,
1349 }
1350 }
1351 fn to_i32(&self) -> i32 {
1352 *self as i32
1353 }
1354 fn proto_name(&self) -> &'static str {
1355 match self {
1356 Self::CARDINALITY_UNKNOWN => "CARDINALITY_UNKNOWN",
1357 Self::CARDINALITY_OPTIONAL => "CARDINALITY_OPTIONAL",
1358 Self::CARDINALITY_REQUIRED => "CARDINALITY_REQUIRED",
1359 Self::CARDINALITY_REPEATED => "CARDINALITY_REPEATED",
1360 }
1361 }
1362 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
1363 match name {
1364 "CARDINALITY_UNKNOWN" => {
1365 ::core::option::Option::Some(Self::CARDINALITY_UNKNOWN)
1366 }
1367 "CARDINALITY_OPTIONAL" => {
1368 ::core::option::Option::Some(Self::CARDINALITY_OPTIONAL)
1369 }
1370 "CARDINALITY_REQUIRED" => {
1371 ::core::option::Option::Some(Self::CARDINALITY_REQUIRED)
1372 }
1373 "CARDINALITY_REPEATED" => {
1374 ::core::option::Option::Some(Self::CARDINALITY_REPEATED)
1375 }
1376 _ => ::core::option::Option::None,
1377 }
1378 }
1379 fn values() -> &'static [Self] {
1380 &[
1381 Self::CARDINALITY_UNKNOWN,
1382 Self::CARDINALITY_OPTIONAL,
1383 Self::CARDINALITY_REQUIRED,
1384 Self::CARDINALITY_REPEATED,
1385 ]
1386 }
1387 }
1388}
1389#[derive(Clone, PartialEq, Default)]
1396#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1397pub struct Enum {
1398 pub name: ::buffa::alloc::string::String,
1402 pub enumvalue: ::buffa::alloc::vec::Vec<EnumValue>,
1406 pub options: ::buffa::alloc::vec::Vec<Option>,
1410 pub source_context: ::buffa::MessageField<
1414 SourceContext,
1415 ::buffa::Inline<SourceContext>,
1416 >,
1417 pub syntax: ::buffa::EnumValue<Syntax>,
1421 pub edition: ::buffa::alloc::string::String,
1425 #[doc(hidden)]
1426 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1427}
1428impl ::core::fmt::Debug for Enum {
1429 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1430 f.debug_struct("Enum")
1431 .field("name", &self.name)
1432 .field("enumvalue", &self.enumvalue)
1433 .field("options", &self.options)
1434 .field("source_context", &self.source_context)
1435 .field("syntax", &self.syntax)
1436 .field("edition", &self.edition)
1437 .finish()
1438 }
1439}
1440impl Enum {
1441 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Enum";
1446}
1447::buffa::impl_default_instance!(Enum);
1448#[cfg(feature = "reflect")]
1449const _: () = {
1450 impl ::buffa_descriptor::reflect::ReflectMessage for Enum {
1451 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1452 __buffa::reflect::descriptor_pool()
1453 .message(Self::__buffa_reflect_message_index())
1454 }
1455 fn pool(
1456 &self,
1457 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1458 __buffa::reflect::descriptor_pool()
1459 }
1460 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1461 &self.__buffa_unknown_fields
1462 }
1463 fn get(
1464 &self,
1465 field: &::buffa_descriptor::FieldDescriptor,
1466 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1467 #[allow(unused_imports)]
1468 use ::buffa::Enumeration as _;
1469 match field.number() {
1470 1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
1471 2u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.enumvalue),
1472 3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
1473 4u32 => {
1474 ::buffa_descriptor::reflect::ValueRef::Message(
1475 ::buffa_descriptor::reflect::Reflectable::reflect(
1476 &*self.source_context,
1477 ),
1478 )
1479 }
1480 5u32 => {
1481 ::buffa_descriptor::reflect::ValueRef::EnumNumber(
1482 self.syntax.to_i32(),
1483 )
1484 }
1485 6u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.edition),
1486 _ => {
1487 ::core::debug_assert!(
1488 false,
1489 "field number {} is not a member of this message's reflect get()",
1490 field.number(),
1491 );
1492 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1493 }
1494 }
1495 }
1496 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1497 match field.number() {
1498 1u32 => !self.name.is_empty(),
1499 2u32 => !self.enumvalue.is_empty(),
1500 3u32 => !self.options.is_empty(),
1501 4u32 => self.source_context.is_set(),
1502 5u32 => self.syntax.to_i32() != 0,
1503 6u32 => !self.edition.is_empty(),
1504 _ => false,
1505 }
1506 }
1507 fn for_each_set(
1508 &self,
1509 f: &mut dyn ::core::ops::FnMut(
1510 &::buffa_descriptor::FieldDescriptor,
1511 ::buffa_descriptor::reflect::ValueRef<'_>,
1512 ),
1513 ) {
1514 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1515 self,
1516 );
1517 for fd in md.fields() {
1518 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1519 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1520 }
1521 }
1522 }
1523 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1524 ::buffa_descriptor::reflect::DynamicMessage::from_message(
1525 self,
1526 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
1527 Self::__buffa_reflect_message_index(),
1528 )
1529 }
1530 }
1531 impl ::buffa_descriptor::reflect::ReflectElement for Enum {
1532 #[inline]
1533 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1534 ::buffa_descriptor::reflect::ValueRef::Message(
1535 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1536 )
1537 }
1538 }
1539 impl Enum {
1540 #[doc(hidden)]
1543 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1544 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1545 *IDX
1546 .get_or_init(|| {
1547 __buffa::reflect::descriptor_pool()
1548 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1549 .expect(
1550 "generated message is registered in the embedded descriptor pool",
1551 )
1552 })
1553 }
1554 }
1555 impl ::buffa_descriptor::reflect::Reflectable for Enum {
1556 #[inline]
1560 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
1561 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
1562 }
1563 }
1564};
1565impl ::buffa::MessageName for Enum {
1566 const PACKAGE: &'static str = "google.protobuf";
1567 const NAME: &'static str = "Enum";
1568 const FULL_NAME: &'static str = "google.protobuf.Enum";
1569 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Enum";
1570}
1571impl ::buffa::Message for Enum {
1572 #[allow(clippy::let_and_return)]
1580 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1581 #[allow(unused_imports)]
1582 use ::buffa::Enumeration as _;
1583 let mut size = 0u64;
1584 if !self.name.is_empty() {
1585 size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
1586 }
1587 for v in &self.enumvalue {
1588 let __slot = __cache.reserve();
1589 let inner_size = v.compute_size(__cache);
1590 __cache.set(__slot, inner_size);
1591 size
1592 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1593 + inner_size as u64;
1594 }
1595 for v in &self.options {
1596 let __slot = __cache.reserve();
1597 let inner_size = v.compute_size(__cache);
1598 __cache.set(__slot, inner_size);
1599 size
1600 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1601 + inner_size as u64;
1602 }
1603 if self.source_context.is_set() {
1604 let __slot = __cache.reserve();
1605 let inner_size = self.source_context.compute_size(__cache);
1606 __cache.set(__slot, inner_size);
1607 size
1608 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
1609 + inner_size as u64;
1610 }
1611 {
1612 let val = self.syntax.to_i32();
1613 if val != 0 {
1614 size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
1615 }
1616 }
1617 if !self.edition.is_empty() {
1618 size += 1u64 + ::buffa::types::string_encoded_len(&self.edition) as u64;
1619 }
1620 size += self.__buffa_unknown_fields.encoded_len() as u64;
1621 ::buffa::saturate_size(size)
1622 }
1623 fn write_to(
1624 &self,
1625 __cache: &mut ::buffa::SizeCache,
1626 buf: &mut impl ::buffa::EncodeSink,
1627 ) {
1628 #[allow(unused_imports)]
1629 use ::buffa::Enumeration as _;
1630 if !self.name.is_empty() {
1631 ::buffa::types::put_string_field(1u32, &self.name, buf);
1632 }
1633 for v in &self.enumvalue {
1634 ::buffa::types::put_len_delimited_header(
1635 2u32,
1636 u64::from(__cache.consume_next()),
1637 buf,
1638 );
1639 v.write_to(__cache, buf);
1640 }
1641 for v in &self.options {
1642 ::buffa::types::put_len_delimited_header(
1643 3u32,
1644 u64::from(__cache.consume_next()),
1645 buf,
1646 );
1647 v.write_to(__cache, buf);
1648 }
1649 if self.source_context.is_set() {
1650 ::buffa::types::put_len_delimited_header(
1651 4u32,
1652 u64::from(__cache.consume_next()),
1653 buf,
1654 );
1655 self.source_context.write_to(__cache, buf);
1656 }
1657 {
1658 let val = self.syntax.to_i32();
1659 if val != 0 {
1660 ::buffa::types::put_int32_field(5u32, val, buf);
1661 }
1662 }
1663 if !self.edition.is_empty() {
1664 ::buffa::types::put_string_field(6u32, &self.edition, buf);
1665 }
1666 self.__buffa_unknown_fields.write_to(buf);
1667 }
1668 fn merge_field(
1669 &mut self,
1670 tag: ::buffa::encoding::Tag,
1671 buf: &mut impl ::buffa::bytes::Buf,
1672 ctx: ::buffa::DecodeContext<'_>,
1673 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1674 #[allow(unused_imports)]
1675 use ::buffa::bytes::Buf as _;
1676 #[allow(unused_imports)]
1677 use ::buffa::Enumeration as _;
1678 match tag.field_number() {
1679 1u32 => {
1680 ::buffa::encoding::check_wire_type(
1681 tag,
1682 ::buffa::encoding::WireType::LengthDelimited,
1683 )?;
1684 ::buffa::types::merge_string(&mut self.name, buf)?;
1685 }
1686 2u32 => {
1687 ::buffa::encoding::check_wire_type(
1688 tag,
1689 ::buffa::encoding::WireType::LengthDelimited,
1690 )?;
1691 let mut elem = ::core::default::Default::default();
1692 ctx.register_element_memory(
1693 ::buffa::__private::element_footprint(&elem),
1694 )?;
1695 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1696 self.enumvalue.push(elem);
1697 }
1698 3u32 => {
1699 ::buffa::encoding::check_wire_type(
1700 tag,
1701 ::buffa::encoding::WireType::LengthDelimited,
1702 )?;
1703 let mut elem = ::core::default::Default::default();
1704 ctx.register_element_memory(
1705 ::buffa::__private::element_footprint(&elem),
1706 )?;
1707 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1708 self.options.push(elem);
1709 }
1710 4u32 => {
1711 ::buffa::encoding::check_wire_type(
1712 tag,
1713 ::buffa::encoding::WireType::LengthDelimited,
1714 )?;
1715 ::buffa::Message::merge_length_delimited(
1716 self.source_context.get_or_insert_default(),
1717 buf,
1718 ctx,
1719 )?;
1720 }
1721 5u32 => {
1722 ::buffa::encoding::check_wire_type(
1723 tag,
1724 ::buffa::encoding::WireType::Varint,
1725 )?;
1726 self.syntax = ::buffa::EnumValue::from(
1727 ::buffa::types::decode_int32(buf)?,
1728 );
1729 }
1730 6u32 => {
1731 ::buffa::encoding::check_wire_type(
1732 tag,
1733 ::buffa::encoding::WireType::LengthDelimited,
1734 )?;
1735 ::buffa::types::merge_string(&mut self.edition, buf)?;
1736 }
1737 _ => {
1738 self.__buffa_unknown_fields
1739 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1740 }
1741 }
1742 ::core::result::Result::Ok(())
1743 }
1744 fn clear(&mut self) {
1745 self.name.clear();
1746 self.enumvalue.clear();
1747 self.options.clear();
1748 self.source_context = ::buffa::MessageField::none();
1749 self.syntax = ::buffa::EnumValue::from(0);
1750 self.edition.clear();
1751 self.__buffa_unknown_fields.clear();
1752 }
1753}
1754impl ::buffa::ExtensionSet for Enum {
1755 const PROTO_FQN: &'static str = "google.protobuf.Enum";
1756 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1757 &self.__buffa_unknown_fields
1758 }
1759 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1760 &mut self.__buffa_unknown_fields
1761 }
1762}
1763impl ::buffa::text::TextFormat for Enum {
1764 fn encode_text(
1765 &self,
1766 enc: &mut ::buffa::text::TextEncoder<'_>,
1767 ) -> ::core::fmt::Result {
1768 #[allow(unused_imports)]
1769 use ::buffa::Enumeration as _;
1770 if !self.name.is_empty() {
1771 enc.write_field_name("name")?;
1772 enc.write_string(&self.name)?;
1773 }
1774 if self.source_context.is_set() {
1775 enc.write_field_name("source_context")?;
1776 enc.write_message(&*self.source_context)?;
1777 }
1778 if self.syntax.to_i32() != 0 {
1779 enc.write_field_name("syntax")?;
1780 match &self.syntax {
1781 ::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
1782 ::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
1783 }
1784 }
1785 if !self.edition.is_empty() {
1786 enc.write_field_name("edition")?;
1787 enc.write_string(&self.edition)?;
1788 }
1789 for __v in &self.enumvalue {
1790 enc.write_field_name("enumvalue")?;
1791 enc.write_message(__v)?;
1792 }
1793 for __v in &self.options {
1794 enc.write_field_name("options")?;
1795 enc.write_message(__v)?;
1796 }
1797 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
1798 ::core::result::Result::Ok(())
1799 }
1800 fn merge_text(
1801 &mut self,
1802 dec: &mut ::buffa::text::TextDecoder<'_>,
1803 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
1804 #[allow(unused_imports)]
1805 use ::buffa::Enumeration as _;
1806 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
1807 match __name {
1808 "name" => self.name = dec.read_string()?.into_owned(),
1809 "source_context" => {
1810 dec.merge_message(self.source_context.get_or_insert_default())?
1811 }
1812 "syntax" => {
1813 self.syntax = dec
1814 .read_enum_by_name::<Syntax>()
1815 .map(::buffa::EnumValue::from)?;
1816 }
1817 "edition" => self.edition = dec.read_string()?.into_owned(),
1818 "enumvalue" => {
1819 dec.read_repeated_into(
1820 &mut self.enumvalue,
1821 |__d| {
1822 let mut __m = ::core::default::Default::default();
1823 __d.merge_message(&mut __m)?;
1824 ::core::result::Result::Ok(__m)
1825 },
1826 )?
1827 }
1828 "options" => {
1829 dec.read_repeated_into(
1830 &mut self.options,
1831 |__d| {
1832 let mut __m = ::core::default::Default::default();
1833 __d.merge_message(&mut __m)?;
1834 ::core::result::Result::Ok(__m)
1835 },
1836 )?
1837 }
1838 _ => dec.skip_value()?,
1839 }
1840 }
1841 ::core::result::Result::Ok(())
1842 }
1843}
1844#[doc(hidden)]
1845pub const __ENUM_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
1846 type_url: "type.googleapis.com/google.protobuf.Enum",
1847 text_encode: ::buffa::type_registry::any_encode_text::<Enum>,
1848 text_merge: ::buffa::type_registry::any_merge_text::<Enum>,
1849};
1850#[derive(Clone, PartialEq, Default)]
1857#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
1858pub struct EnumValue {
1859 pub name: ::buffa::alloc::string::String,
1863 pub number: i32,
1867 pub options: ::buffa::alloc::vec::Vec<Option>,
1871 #[doc(hidden)]
1872 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1873}
1874impl ::core::fmt::Debug for EnumValue {
1875 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1876 f.debug_struct("EnumValue")
1877 .field("name", &self.name)
1878 .field("number", &self.number)
1879 .field("options", &self.options)
1880 .finish()
1881 }
1882}
1883impl EnumValue {
1884 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValue";
1889}
1890::buffa::impl_default_instance!(EnumValue);
1891#[cfg(feature = "reflect")]
1892const _: () = {
1893 impl ::buffa_descriptor::reflect::ReflectMessage for EnumValue {
1894 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1895 __buffa::reflect::descriptor_pool()
1896 .message(Self::__buffa_reflect_message_index())
1897 }
1898 fn pool(
1899 &self,
1900 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1901 __buffa::reflect::descriptor_pool()
1902 }
1903 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1904 &self.__buffa_unknown_fields
1905 }
1906 fn get(
1907 &self,
1908 field: &::buffa_descriptor::FieldDescriptor,
1909 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1910 #[allow(unused_imports)]
1911 use ::buffa::Enumeration as _;
1912 match field.number() {
1913 1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
1914 2u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.number),
1915 3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
1916 _ => {
1917 ::core::debug_assert!(
1918 false,
1919 "field number {} is not a member of this message's reflect get()",
1920 field.number(),
1921 );
1922 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1923 }
1924 }
1925 }
1926 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1927 match field.number() {
1928 1u32 => !self.name.is_empty(),
1929 2u32 => self.number != 0,
1930 3u32 => !self.options.is_empty(),
1931 _ => false,
1932 }
1933 }
1934 fn for_each_set(
1935 &self,
1936 f: &mut dyn ::core::ops::FnMut(
1937 &::buffa_descriptor::FieldDescriptor,
1938 ::buffa_descriptor::reflect::ValueRef<'_>,
1939 ),
1940 ) {
1941 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1942 self,
1943 );
1944 for fd in md.fields() {
1945 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1946 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1947 }
1948 }
1949 }
1950 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1951 ::buffa_descriptor::reflect::DynamicMessage::from_message(
1952 self,
1953 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
1954 Self::__buffa_reflect_message_index(),
1955 )
1956 }
1957 }
1958 impl ::buffa_descriptor::reflect::ReflectElement for EnumValue {
1959 #[inline]
1960 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1961 ::buffa_descriptor::reflect::ValueRef::Message(
1962 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1963 )
1964 }
1965 }
1966 impl EnumValue {
1967 #[doc(hidden)]
1970 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1971 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1972 *IDX
1973 .get_or_init(|| {
1974 __buffa::reflect::descriptor_pool()
1975 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1976 .expect(
1977 "generated message is registered in the embedded descriptor pool",
1978 )
1979 })
1980 }
1981 }
1982 impl ::buffa_descriptor::reflect::Reflectable for EnumValue {
1983 #[inline]
1987 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
1988 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
1989 }
1990 }
1991};
1992impl ::buffa::MessageName for EnumValue {
1993 const PACKAGE: &'static str = "google.protobuf";
1994 const NAME: &'static str = "EnumValue";
1995 const FULL_NAME: &'static str = "google.protobuf.EnumValue";
1996 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValue";
1997}
1998impl ::buffa::Message for EnumValue {
1999 #[allow(clippy::let_and_return)]
2007 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2008 #[allow(unused_imports)]
2009 use ::buffa::Enumeration as _;
2010 let mut size = 0u64;
2011 if !self.name.is_empty() {
2012 size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
2013 }
2014 if self.number != 0i32 {
2015 size += 1u64 + ::buffa::types::int32_encoded_len(self.number) as u64;
2016 }
2017 for v in &self.options {
2018 let __slot = __cache.reserve();
2019 let inner_size = v.compute_size(__cache);
2020 __cache.set(__slot, inner_size);
2021 size
2022 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
2023 + inner_size as u64;
2024 }
2025 size += self.__buffa_unknown_fields.encoded_len() as u64;
2026 ::buffa::saturate_size(size)
2027 }
2028 fn write_to(
2029 &self,
2030 __cache: &mut ::buffa::SizeCache,
2031 buf: &mut impl ::buffa::EncodeSink,
2032 ) {
2033 #[allow(unused_imports)]
2034 use ::buffa::Enumeration as _;
2035 if !self.name.is_empty() {
2036 ::buffa::types::put_string_field(1u32, &self.name, buf);
2037 }
2038 if self.number != 0i32 {
2039 ::buffa::types::put_int32_field(2u32, self.number, buf);
2040 }
2041 for v in &self.options {
2042 ::buffa::types::put_len_delimited_header(
2043 3u32,
2044 u64::from(__cache.consume_next()),
2045 buf,
2046 );
2047 v.write_to(__cache, buf);
2048 }
2049 self.__buffa_unknown_fields.write_to(buf);
2050 }
2051 fn merge_field(
2052 &mut self,
2053 tag: ::buffa::encoding::Tag,
2054 buf: &mut impl ::buffa::bytes::Buf,
2055 ctx: ::buffa::DecodeContext<'_>,
2056 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2057 #[allow(unused_imports)]
2058 use ::buffa::bytes::Buf as _;
2059 #[allow(unused_imports)]
2060 use ::buffa::Enumeration as _;
2061 match tag.field_number() {
2062 1u32 => {
2063 ::buffa::encoding::check_wire_type(
2064 tag,
2065 ::buffa::encoding::WireType::LengthDelimited,
2066 )?;
2067 ::buffa::types::merge_string(&mut self.name, buf)?;
2068 }
2069 2u32 => {
2070 ::buffa::encoding::check_wire_type(
2071 tag,
2072 ::buffa::encoding::WireType::Varint,
2073 )?;
2074 self.number = ::buffa::types::decode_int32(buf)?;
2075 }
2076 3u32 => {
2077 ::buffa::encoding::check_wire_type(
2078 tag,
2079 ::buffa::encoding::WireType::LengthDelimited,
2080 )?;
2081 let mut elem = ::core::default::Default::default();
2082 ctx.register_element_memory(
2083 ::buffa::__private::element_footprint(&elem),
2084 )?;
2085 ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
2086 self.options.push(elem);
2087 }
2088 _ => {
2089 self.__buffa_unknown_fields
2090 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2091 }
2092 }
2093 ::core::result::Result::Ok(())
2094 }
2095 fn clear(&mut self) {
2096 self.name.clear();
2097 self.number = 0i32;
2098 self.options.clear();
2099 self.__buffa_unknown_fields.clear();
2100 }
2101}
2102impl ::buffa::ExtensionSet for EnumValue {
2103 const PROTO_FQN: &'static str = "google.protobuf.EnumValue";
2104 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2105 &self.__buffa_unknown_fields
2106 }
2107 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2108 &mut self.__buffa_unknown_fields
2109 }
2110}
2111impl ::buffa::text::TextFormat for EnumValue {
2112 fn encode_text(
2113 &self,
2114 enc: &mut ::buffa::text::TextEncoder<'_>,
2115 ) -> ::core::fmt::Result {
2116 #[allow(unused_imports)]
2117 use ::buffa::Enumeration as _;
2118 if !self.name.is_empty() {
2119 enc.write_field_name("name")?;
2120 enc.write_string(&self.name)?;
2121 }
2122 if self.number != 0i32 {
2123 enc.write_field_name("number")?;
2124 enc.write_i32(self.number)?;
2125 }
2126 for __v in &self.options {
2127 enc.write_field_name("options")?;
2128 enc.write_message(__v)?;
2129 }
2130 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
2131 ::core::result::Result::Ok(())
2132 }
2133 fn merge_text(
2134 &mut self,
2135 dec: &mut ::buffa::text::TextDecoder<'_>,
2136 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
2137 #[allow(unused_imports)]
2138 use ::buffa::Enumeration as _;
2139 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
2140 match __name {
2141 "name" => self.name = dec.read_string()?.into_owned(),
2142 "number" => self.number = dec.read_i32()?,
2143 "options" => {
2144 dec.read_repeated_into(
2145 &mut self.options,
2146 |__d| {
2147 let mut __m = ::core::default::Default::default();
2148 __d.merge_message(&mut __m)?;
2149 ::core::result::Result::Ok(__m)
2150 },
2151 )?
2152 }
2153 _ => dec.skip_value()?,
2154 }
2155 }
2156 ::core::result::Result::Ok(())
2157 }
2158}
2159#[doc(hidden)]
2160pub const __ENUM_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
2161 type_url: "type.googleapis.com/google.protobuf.EnumValue",
2162 text_encode: ::buffa::type_registry::any_encode_text::<EnumValue>,
2163 text_merge: ::buffa::type_registry::any_merge_text::<EnumValue>,
2164};
2165#[derive(Clone, PartialEq, Default)]
2172#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
2173pub struct Option {
2174 pub name: ::buffa::alloc::string::String,
2181 pub value: ::buffa::MessageField<Any, ::buffa::Inline<Any>>,
2188 #[doc(hidden)]
2189 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2190}
2191impl ::core::fmt::Debug for Option {
2192 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2193 f.debug_struct("Option")
2194 .field("name", &self.name)
2195 .field("value", &self.value)
2196 .finish()
2197 }
2198}
2199impl Option {
2200 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Option";
2205}
2206::buffa::impl_default_instance!(Option);
2207#[cfg(feature = "reflect")]
2208const _: () = {
2209 impl ::buffa_descriptor::reflect::ReflectMessage for Option {
2210 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2211 __buffa::reflect::descriptor_pool()
2212 .message(Self::__buffa_reflect_message_index())
2213 }
2214 fn pool(
2215 &self,
2216 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2217 __buffa::reflect::descriptor_pool()
2218 }
2219 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2220 &self.__buffa_unknown_fields
2221 }
2222 fn get(
2223 &self,
2224 field: &::buffa_descriptor::FieldDescriptor,
2225 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2226 #[allow(unused_imports)]
2227 use ::buffa::Enumeration as _;
2228 match field.number() {
2229 1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
2230 2u32 => {
2231 ::buffa_descriptor::reflect::ValueRef::Message(
2232 ::buffa_descriptor::reflect::Reflectable::reflect(&*self.value),
2233 )
2234 }
2235 _ => {
2236 ::core::debug_assert!(
2237 false,
2238 "field number {} is not a member of this message's reflect get()",
2239 field.number(),
2240 );
2241 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2242 }
2243 }
2244 }
2245 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2246 match field.number() {
2247 1u32 => !self.name.is_empty(),
2248 2u32 => self.value.is_set(),
2249 _ => false,
2250 }
2251 }
2252 fn for_each_set(
2253 &self,
2254 f: &mut dyn ::core::ops::FnMut(
2255 &::buffa_descriptor::FieldDescriptor,
2256 ::buffa_descriptor::reflect::ValueRef<'_>,
2257 ),
2258 ) {
2259 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2260 self,
2261 );
2262 for fd in md.fields() {
2263 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2264 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2265 }
2266 }
2267 }
2268 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2269 ::buffa_descriptor::reflect::DynamicMessage::from_message(
2270 self,
2271 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
2272 Self::__buffa_reflect_message_index(),
2273 )
2274 }
2275 }
2276 impl ::buffa_descriptor::reflect::ReflectElement for Option {
2277 #[inline]
2278 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2279 ::buffa_descriptor::reflect::ValueRef::Message(
2280 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2281 )
2282 }
2283 }
2284 impl Option {
2285 #[doc(hidden)]
2288 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2289 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2290 *IDX
2291 .get_or_init(|| {
2292 __buffa::reflect::descriptor_pool()
2293 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2294 .expect(
2295 "generated message is registered in the embedded descriptor pool",
2296 )
2297 })
2298 }
2299 }
2300 impl ::buffa_descriptor::reflect::Reflectable for Option {
2301 #[inline]
2305 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
2306 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
2307 }
2308 }
2309};
2310impl ::buffa::MessageName for Option {
2311 const PACKAGE: &'static str = "google.protobuf";
2312 const NAME: &'static str = "Option";
2313 const FULL_NAME: &'static str = "google.protobuf.Option";
2314 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Option";
2315}
2316impl ::buffa::Message for Option {
2317 #[allow(clippy::let_and_return)]
2325 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2326 #[allow(unused_imports)]
2327 use ::buffa::Enumeration as _;
2328 let mut size = 0u64;
2329 if !self.name.is_empty() {
2330 size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
2331 }
2332 if self.value.is_set() {
2333 let __slot = __cache.reserve();
2334 let inner_size = self.value.compute_size(__cache);
2335 __cache.set(__slot, inner_size);
2336 size
2337 += 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
2338 + inner_size as u64;
2339 }
2340 size += self.__buffa_unknown_fields.encoded_len() as u64;
2341 ::buffa::saturate_size(size)
2342 }
2343 fn write_to(
2344 &self,
2345 __cache: &mut ::buffa::SizeCache,
2346 buf: &mut impl ::buffa::EncodeSink,
2347 ) {
2348 #[allow(unused_imports)]
2349 use ::buffa::Enumeration as _;
2350 if !self.name.is_empty() {
2351 ::buffa::types::put_string_field(1u32, &self.name, buf);
2352 }
2353 if self.value.is_set() {
2354 ::buffa::types::put_len_delimited_header(
2355 2u32,
2356 u64::from(__cache.consume_next()),
2357 buf,
2358 );
2359 self.value.write_to(__cache, buf);
2360 }
2361 self.__buffa_unknown_fields.write_to(buf);
2362 }
2363 fn merge_field(
2364 &mut self,
2365 tag: ::buffa::encoding::Tag,
2366 buf: &mut impl ::buffa::bytes::Buf,
2367 ctx: ::buffa::DecodeContext<'_>,
2368 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2369 #[allow(unused_imports)]
2370 use ::buffa::bytes::Buf as _;
2371 #[allow(unused_imports)]
2372 use ::buffa::Enumeration as _;
2373 match tag.field_number() {
2374 1u32 => {
2375 ::buffa::encoding::check_wire_type(
2376 tag,
2377 ::buffa::encoding::WireType::LengthDelimited,
2378 )?;
2379 ::buffa::types::merge_string(&mut self.name, buf)?;
2380 }
2381 2u32 => {
2382 ::buffa::encoding::check_wire_type(
2383 tag,
2384 ::buffa::encoding::WireType::LengthDelimited,
2385 )?;
2386 ::buffa::Message::merge_length_delimited(
2387 self.value.get_or_insert_default(),
2388 buf,
2389 ctx,
2390 )?;
2391 }
2392 _ => {
2393 self.__buffa_unknown_fields
2394 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
2395 }
2396 }
2397 ::core::result::Result::Ok(())
2398 }
2399 fn clear(&mut self) {
2400 self.name.clear();
2401 self.value = ::buffa::MessageField::none();
2402 self.__buffa_unknown_fields.clear();
2403 }
2404}
2405impl ::buffa::ExtensionSet for Option {
2406 const PROTO_FQN: &'static str = "google.protobuf.Option";
2407 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2408 &self.__buffa_unknown_fields
2409 }
2410 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2411 &mut self.__buffa_unknown_fields
2412 }
2413}
2414impl ::buffa::text::TextFormat for Option {
2415 fn encode_text(
2416 &self,
2417 enc: &mut ::buffa::text::TextEncoder<'_>,
2418 ) -> ::core::fmt::Result {
2419 #[allow(unused_imports)]
2420 use ::buffa::Enumeration as _;
2421 if !self.name.is_empty() {
2422 enc.write_field_name("name")?;
2423 enc.write_string(&self.name)?;
2424 }
2425 if self.value.is_set() {
2426 enc.write_field_name("value")?;
2427 enc.write_message(&*self.value)?;
2428 }
2429 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
2430 ::core::result::Result::Ok(())
2431 }
2432 fn merge_text(
2433 &mut self,
2434 dec: &mut ::buffa::text::TextDecoder<'_>,
2435 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
2436 #[allow(unused_imports)]
2437 use ::buffa::Enumeration as _;
2438 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
2439 match __name {
2440 "name" => self.name = dec.read_string()?.into_owned(),
2441 "value" => dec.merge_message(self.value.get_or_insert_default())?,
2442 _ => dec.skip_value()?,
2443 }
2444 }
2445 ::core::result::Result::Ok(())
2446 }
2447}
2448#[doc(hidden)]
2449pub const __OPTION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
2450 type_url: "type.googleapis.com/google.protobuf.Option",
2451 text_encode: ::buffa::type_registry::any_encode_text::<Option>,
2452 text_merge: ::buffa::type_registry::any_merge_text::<Option>,
2453};