1#[derive(Clone, Debug, Default)]
8pub struct DoubleValueView<'a> {
9 pub value: f64,
13 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14}
15impl<'a> DoubleValueView<'a> {
16 #[doc(hidden)]
24 pub fn _decode_depth(
25 buf: &'a [u8],
26 depth: u32,
27 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
28 let mut view = Self::default();
29 view._merge_into_view(buf, depth)?;
30 ::core::result::Result::Ok(view)
31 }
32 #[doc(hidden)]
40 pub fn _merge_into_view(
41 &mut self,
42 buf: &'a [u8],
43 depth: u32,
44 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
45 let _ = depth;
46 #[allow(unused_variables)]
47 let view = self;
48 let mut cur: &'a [u8] = buf;
49 while !cur.is_empty() {
50 let before_tag = cur;
51 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
52 match tag.field_number() {
53 1u32 => {
54 if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
55 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
56 field_number: 1u32,
57 expected: 1u8,
58 actual: tag.wire_type() as u8,
59 });
60 }
61 view.value = ::buffa::types::decode_double(&mut cur)?;
62 }
63 _ => {
64 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
65 let span_len = before_tag.len() - cur.len();
66 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
67 }
68 }
69 }
70 ::core::result::Result::Ok(())
71 }
72}
73impl<'a> ::buffa::MessageView<'a> for DoubleValueView<'a> {
74 type Owned = super::super::DoubleValue;
75 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
76 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
77 }
78 fn decode_view_with_limit(
79 buf: &'a [u8],
80 depth: u32,
81 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
82 Self::_decode_depth(buf, depth)
83 }
84 fn to_owned_message(&self) -> super::super::DoubleValue {
85 self.to_owned_from_source(None)
86 }
87 #[allow(clippy::useless_conversion, clippy::needless_update)]
88 fn to_owned_from_source(
89 &self,
90 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
91 ) -> super::super::DoubleValue {
92 #[allow(unused_imports)]
93 use ::buffa::alloc::string::ToString as _;
94 let _ = __buffa_src;
95 super::super::DoubleValue {
96 value: self.value,
97 __buffa_unknown_fields: self
98 .__buffa_unknown_fields
99 .to_owned()
100 .unwrap_or_default()
101 .into(),
102 ..::core::default::Default::default()
103 }
104 }
105}
106impl<'a> ::buffa::ViewEncode<'a> for DoubleValueView<'a> {
107 #[allow(clippy::needless_borrow, clippy::let_and_return)]
108 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
109 #[allow(unused_imports)]
110 use ::buffa::Enumeration as _;
111 let mut size = 0u32;
112 if self.value.to_bits() != 0u64 {
113 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
114 }
115 size += self.__buffa_unknown_fields.encoded_len() as u32;
116 size
117 }
118 #[allow(clippy::needless_borrow)]
119 fn write_to(
120 &self,
121 _cache: &mut ::buffa::SizeCache,
122 buf: &mut impl ::buffa::bytes::BufMut,
123 ) {
124 #[allow(unused_imports)]
125 use ::buffa::Enumeration as _;
126 if self.value.to_bits() != 0u64 {
127 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed64)
128 .encode(buf);
129 ::buffa::types::encode_double(self.value, buf);
130 }
131 self.__buffa_unknown_fields.write_to(buf);
132 }
133}
134impl<'a> ::buffa::MessageName for DoubleValueView<'a> {
135 const PACKAGE: &'static str = "google.protobuf";
136 const NAME: &'static str = "DoubleValue";
137 const FULL_NAME: &'static str = "google.protobuf.DoubleValue";
138 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DoubleValue";
139}
140impl<'v> ::buffa::DefaultViewInstance for DoubleValueView<'v> {
141 fn default_view_instance<'a>() -> &'a Self
142 where
143 Self: 'a,
144 {
145 static VALUE: ::buffa::__private::OnceBox<DoubleValueView<'static>> = ::buffa::__private::OnceBox::new();
146 VALUE
147 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
148 <DoubleValueView<'static>>::default(),
149 ))
150 }
151}
152impl ::buffa::ViewReborrow for DoubleValueView<'static> {
153 type Reborrowed<'b> = DoubleValueView<'b>;
154 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
155 this
156 }
157}
158#[derive(Clone, Debug)]
164pub struct DoubleValueOwnedView(::buffa::OwnedView<DoubleValueView<'static>>);
165impl DoubleValueOwnedView {
166 pub fn decode(
176 bytes: ::buffa::bytes::Bytes,
177 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
178 ::core::result::Result::Ok(
179 DoubleValueOwnedView(::buffa::OwnedView::decode(bytes)?),
180 )
181 }
182 pub fn decode_with_options(
190 bytes: ::buffa::bytes::Bytes,
191 opts: &::buffa::DecodeOptions,
192 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
193 ::core::result::Result::Ok(
194 DoubleValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
195 )
196 }
197 pub fn from_owned(
204 msg: &super::super::DoubleValue,
205 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
206 ::core::result::Result::Ok(
207 DoubleValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
208 )
209 }
210 #[must_use]
212 pub fn view(&self) -> &DoubleValueView<'_> {
213 self.0.reborrow()
214 }
215 #[must_use]
217 pub fn to_owned_message(&self) -> super::super::DoubleValue {
218 self.0.to_owned_message()
219 }
220 #[must_use]
222 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
223 self.0.bytes()
224 }
225 #[must_use]
227 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
228 self.0.into_bytes()
229 }
230 #[must_use]
234 pub fn value(&self) -> f64 {
235 self.0.reborrow().value
236 }
237}
238impl ::core::convert::From<::buffa::OwnedView<DoubleValueView<'static>>>
239for DoubleValueOwnedView {
240 fn from(inner: ::buffa::OwnedView<DoubleValueView<'static>>) -> Self {
241 DoubleValueOwnedView(inner)
242 }
243}
244impl ::core::convert::From<DoubleValueOwnedView>
245for ::buffa::OwnedView<DoubleValueView<'static>> {
246 fn from(wrapper: DoubleValueOwnedView) -> Self {
247 wrapper.0
248 }
249}
250impl ::core::convert::AsRef<::buffa::OwnedView<DoubleValueView<'static>>>
251for DoubleValueOwnedView {
252 fn as_ref(&self) -> &::buffa::OwnedView<DoubleValueView<'static>> {
253 &self.0
254 }
255}
256impl ::buffa::HasMessageView for super::super::DoubleValue {
257 type View<'a> = DoubleValueView<'a>;
258 type ViewHandle = DoubleValueOwnedView;
259}
260#[cfg(feature = "reflect")]
261const _: () = {
262 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for DoubleValueView<'a> {
263 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
264 super::super::__buffa::reflect::descriptor_pool()
265 .message(Self::__buffa_reflect_message_index())
266 }
267 fn pool(
268 &self,
269 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
270 super::super::__buffa::reflect::descriptor_pool()
271 }
272 fn get(
273 &self,
274 field: &::buffa_descriptor::FieldDescriptor,
275 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
276 #[allow(unused_imports)]
277 use ::buffa::Enumeration as _;
278 match field.number() {
279 1u32 => ::buffa_descriptor::reflect::ValueRef::F64(self.value),
280 _ => {
281 ::core::debug_assert!(
282 false,
283 "field number {} is not a member of this view's reflect get()",
284 field.number(),
285 );
286 ::buffa_descriptor::reflect::ValueRef::Bool(false)
287 }
288 }
289 }
290 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
291 match field.number() {
292 1u32 => self.value != 0.0,
293 _ => false,
294 }
295 }
296 fn for_each_set(
297 &self,
298 f: &mut dyn ::core::ops::FnMut(
299 &::buffa_descriptor::FieldDescriptor,
300 ::buffa_descriptor::reflect::ValueRef<'_>,
301 ),
302 ) {
303 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
304 self,
305 );
306 for fd in md.fields() {
307 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
308 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
309 }
310 }
311 }
312 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
313 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
314 ::buffa_descriptor::reflect::DynamicMessage::decode(
315 ::buffa::alloc::sync::Arc::clone(
316 super::super::__buffa::reflect::descriptor_pool(),
317 ),
318 Self::__buffa_reflect_message_index(),
319 &bytes,
320 )
321 .expect("view re-encodes to bytes decodable against its own descriptor")
322 }
323 }
324 impl<'a> ::buffa_descriptor::reflect::ReflectElement for DoubleValueView<'a> {
325 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
326 ::buffa_descriptor::reflect::ValueRef::Message(
327 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
328 )
329 }
330 }
331 impl<'a> DoubleValueView<'a> {
332 #[doc(hidden)]
337 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
338 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
339 *IDX
340 .get_or_init(|| {
341 super::super::__buffa::reflect::descriptor_pool()
342 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
343 .expect(
344 "generated view type is registered in the embedded descriptor pool",
345 )
346 })
347 }
348 }
349};
350#[derive(Clone, Debug, Default)]
354pub struct FloatValueView<'a> {
355 pub value: f32,
359 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
360}
361impl<'a> FloatValueView<'a> {
362 #[doc(hidden)]
370 pub fn _decode_depth(
371 buf: &'a [u8],
372 depth: u32,
373 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
374 let mut view = Self::default();
375 view._merge_into_view(buf, depth)?;
376 ::core::result::Result::Ok(view)
377 }
378 #[doc(hidden)]
386 pub fn _merge_into_view(
387 &mut self,
388 buf: &'a [u8],
389 depth: u32,
390 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
391 let _ = depth;
392 #[allow(unused_variables)]
393 let view = self;
394 let mut cur: &'a [u8] = buf;
395 while !cur.is_empty() {
396 let before_tag = cur;
397 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
398 match tag.field_number() {
399 1u32 => {
400 if tag.wire_type() != ::buffa::encoding::WireType::Fixed32 {
401 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
402 field_number: 1u32,
403 expected: 5u8,
404 actual: tag.wire_type() as u8,
405 });
406 }
407 view.value = ::buffa::types::decode_float(&mut cur)?;
408 }
409 _ => {
410 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
411 let span_len = before_tag.len() - cur.len();
412 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
413 }
414 }
415 }
416 ::core::result::Result::Ok(())
417 }
418}
419impl<'a> ::buffa::MessageView<'a> for FloatValueView<'a> {
420 type Owned = super::super::FloatValue;
421 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
422 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
423 }
424 fn decode_view_with_limit(
425 buf: &'a [u8],
426 depth: u32,
427 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
428 Self::_decode_depth(buf, depth)
429 }
430 fn to_owned_message(&self) -> super::super::FloatValue {
431 self.to_owned_from_source(None)
432 }
433 #[allow(clippy::useless_conversion, clippy::needless_update)]
434 fn to_owned_from_source(
435 &self,
436 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
437 ) -> super::super::FloatValue {
438 #[allow(unused_imports)]
439 use ::buffa::alloc::string::ToString as _;
440 let _ = __buffa_src;
441 super::super::FloatValue {
442 value: self.value,
443 __buffa_unknown_fields: self
444 .__buffa_unknown_fields
445 .to_owned()
446 .unwrap_or_default()
447 .into(),
448 ..::core::default::Default::default()
449 }
450 }
451}
452impl<'a> ::buffa::ViewEncode<'a> for FloatValueView<'a> {
453 #[allow(clippy::needless_borrow, clippy::let_and_return)]
454 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
455 #[allow(unused_imports)]
456 use ::buffa::Enumeration as _;
457 let mut size = 0u32;
458 if self.value.to_bits() != 0u32 {
459 size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
460 }
461 size += self.__buffa_unknown_fields.encoded_len() as u32;
462 size
463 }
464 #[allow(clippy::needless_borrow)]
465 fn write_to(
466 &self,
467 _cache: &mut ::buffa::SizeCache,
468 buf: &mut impl ::buffa::bytes::BufMut,
469 ) {
470 #[allow(unused_imports)]
471 use ::buffa::Enumeration as _;
472 if self.value.to_bits() != 0u32 {
473 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed32)
474 .encode(buf);
475 ::buffa::types::encode_float(self.value, buf);
476 }
477 self.__buffa_unknown_fields.write_to(buf);
478 }
479}
480impl<'a> ::buffa::MessageName for FloatValueView<'a> {
481 const PACKAGE: &'static str = "google.protobuf";
482 const NAME: &'static str = "FloatValue";
483 const FULL_NAME: &'static str = "google.protobuf.FloatValue";
484 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FloatValue";
485}
486impl<'v> ::buffa::DefaultViewInstance for FloatValueView<'v> {
487 fn default_view_instance<'a>() -> &'a Self
488 where
489 Self: 'a,
490 {
491 static VALUE: ::buffa::__private::OnceBox<FloatValueView<'static>> = ::buffa::__private::OnceBox::new();
492 VALUE
493 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
494 <FloatValueView<'static>>::default(),
495 ))
496 }
497}
498impl ::buffa::ViewReborrow for FloatValueView<'static> {
499 type Reborrowed<'b> = FloatValueView<'b>;
500 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
501 this
502 }
503}
504#[derive(Clone, Debug)]
510pub struct FloatValueOwnedView(::buffa::OwnedView<FloatValueView<'static>>);
511impl FloatValueOwnedView {
512 pub fn decode(
522 bytes: ::buffa::bytes::Bytes,
523 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
524 ::core::result::Result::Ok(
525 FloatValueOwnedView(::buffa::OwnedView::decode(bytes)?),
526 )
527 }
528 pub fn decode_with_options(
536 bytes: ::buffa::bytes::Bytes,
537 opts: &::buffa::DecodeOptions,
538 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
539 ::core::result::Result::Ok(
540 FloatValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
541 )
542 }
543 pub fn from_owned(
550 msg: &super::super::FloatValue,
551 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
552 ::core::result::Result::Ok(
553 FloatValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
554 )
555 }
556 #[must_use]
558 pub fn view(&self) -> &FloatValueView<'_> {
559 self.0.reborrow()
560 }
561 #[must_use]
563 pub fn to_owned_message(&self) -> super::super::FloatValue {
564 self.0.to_owned_message()
565 }
566 #[must_use]
568 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
569 self.0.bytes()
570 }
571 #[must_use]
573 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
574 self.0.into_bytes()
575 }
576 #[must_use]
580 pub fn value(&self) -> f32 {
581 self.0.reborrow().value
582 }
583}
584impl ::core::convert::From<::buffa::OwnedView<FloatValueView<'static>>>
585for FloatValueOwnedView {
586 fn from(inner: ::buffa::OwnedView<FloatValueView<'static>>) -> Self {
587 FloatValueOwnedView(inner)
588 }
589}
590impl ::core::convert::From<FloatValueOwnedView>
591for ::buffa::OwnedView<FloatValueView<'static>> {
592 fn from(wrapper: FloatValueOwnedView) -> Self {
593 wrapper.0
594 }
595}
596impl ::core::convert::AsRef<::buffa::OwnedView<FloatValueView<'static>>>
597for FloatValueOwnedView {
598 fn as_ref(&self) -> &::buffa::OwnedView<FloatValueView<'static>> {
599 &self.0
600 }
601}
602impl ::buffa::HasMessageView for super::super::FloatValue {
603 type View<'a> = FloatValueView<'a>;
604 type ViewHandle = FloatValueOwnedView;
605}
606#[cfg(feature = "reflect")]
607const _: () = {
608 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for FloatValueView<'a> {
609 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
610 super::super::__buffa::reflect::descriptor_pool()
611 .message(Self::__buffa_reflect_message_index())
612 }
613 fn pool(
614 &self,
615 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
616 super::super::__buffa::reflect::descriptor_pool()
617 }
618 fn get(
619 &self,
620 field: &::buffa_descriptor::FieldDescriptor,
621 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
622 #[allow(unused_imports)]
623 use ::buffa::Enumeration as _;
624 match field.number() {
625 1u32 => ::buffa_descriptor::reflect::ValueRef::F32(self.value),
626 _ => {
627 ::core::debug_assert!(
628 false,
629 "field number {} is not a member of this view's reflect get()",
630 field.number(),
631 );
632 ::buffa_descriptor::reflect::ValueRef::Bool(false)
633 }
634 }
635 }
636 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
637 match field.number() {
638 1u32 => self.value != 0.0,
639 _ => false,
640 }
641 }
642 fn for_each_set(
643 &self,
644 f: &mut dyn ::core::ops::FnMut(
645 &::buffa_descriptor::FieldDescriptor,
646 ::buffa_descriptor::reflect::ValueRef<'_>,
647 ),
648 ) {
649 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
650 self,
651 );
652 for fd in md.fields() {
653 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
654 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
655 }
656 }
657 }
658 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
659 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
660 ::buffa_descriptor::reflect::DynamicMessage::decode(
661 ::buffa::alloc::sync::Arc::clone(
662 super::super::__buffa::reflect::descriptor_pool(),
663 ),
664 Self::__buffa_reflect_message_index(),
665 &bytes,
666 )
667 .expect("view re-encodes to bytes decodable against its own descriptor")
668 }
669 }
670 impl<'a> ::buffa_descriptor::reflect::ReflectElement for FloatValueView<'a> {
671 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
672 ::buffa_descriptor::reflect::ValueRef::Message(
673 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
674 )
675 }
676 }
677 impl<'a> FloatValueView<'a> {
678 #[doc(hidden)]
683 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
684 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
685 *IDX
686 .get_or_init(|| {
687 super::super::__buffa::reflect::descriptor_pool()
688 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
689 .expect(
690 "generated view type is registered in the embedded descriptor pool",
691 )
692 })
693 }
694 }
695};
696#[derive(Clone, Debug, Default)]
700pub struct Int64ValueView<'a> {
701 pub value: i64,
705 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
706}
707impl<'a> Int64ValueView<'a> {
708 #[doc(hidden)]
716 pub fn _decode_depth(
717 buf: &'a [u8],
718 depth: u32,
719 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
720 let mut view = Self::default();
721 view._merge_into_view(buf, depth)?;
722 ::core::result::Result::Ok(view)
723 }
724 #[doc(hidden)]
732 pub fn _merge_into_view(
733 &mut self,
734 buf: &'a [u8],
735 depth: u32,
736 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
737 let _ = depth;
738 #[allow(unused_variables)]
739 let view = self;
740 let mut cur: &'a [u8] = buf;
741 while !cur.is_empty() {
742 let before_tag = cur;
743 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
744 match tag.field_number() {
745 1u32 => {
746 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
747 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
748 field_number: 1u32,
749 expected: 0u8,
750 actual: tag.wire_type() as u8,
751 });
752 }
753 view.value = ::buffa::types::decode_int64(&mut cur)?;
754 }
755 _ => {
756 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
757 let span_len = before_tag.len() - cur.len();
758 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
759 }
760 }
761 }
762 ::core::result::Result::Ok(())
763 }
764}
765impl<'a> ::buffa::MessageView<'a> for Int64ValueView<'a> {
766 type Owned = super::super::Int64Value;
767 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
768 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
769 }
770 fn decode_view_with_limit(
771 buf: &'a [u8],
772 depth: u32,
773 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
774 Self::_decode_depth(buf, depth)
775 }
776 fn to_owned_message(&self) -> super::super::Int64Value {
777 self.to_owned_from_source(None)
778 }
779 #[allow(clippy::useless_conversion, clippy::needless_update)]
780 fn to_owned_from_source(
781 &self,
782 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
783 ) -> super::super::Int64Value {
784 #[allow(unused_imports)]
785 use ::buffa::alloc::string::ToString as _;
786 let _ = __buffa_src;
787 super::super::Int64Value {
788 value: self.value,
789 __buffa_unknown_fields: self
790 .__buffa_unknown_fields
791 .to_owned()
792 .unwrap_or_default()
793 .into(),
794 ..::core::default::Default::default()
795 }
796 }
797}
798impl<'a> ::buffa::ViewEncode<'a> for Int64ValueView<'a> {
799 #[allow(clippy::needless_borrow, clippy::let_and_return)]
800 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
801 #[allow(unused_imports)]
802 use ::buffa::Enumeration as _;
803 let mut size = 0u32;
804 if self.value != 0i64 {
805 size += 1u32 + ::buffa::types::int64_encoded_len(self.value) as u32;
806 }
807 size += self.__buffa_unknown_fields.encoded_len() as u32;
808 size
809 }
810 #[allow(clippy::needless_borrow)]
811 fn write_to(
812 &self,
813 _cache: &mut ::buffa::SizeCache,
814 buf: &mut impl ::buffa::bytes::BufMut,
815 ) {
816 #[allow(unused_imports)]
817 use ::buffa::Enumeration as _;
818 if self.value != 0i64 {
819 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
820 .encode(buf);
821 ::buffa::types::encode_int64(self.value, buf);
822 }
823 self.__buffa_unknown_fields.write_to(buf);
824 }
825}
826impl<'a> ::buffa::MessageName for Int64ValueView<'a> {
827 const PACKAGE: &'static str = "google.protobuf";
828 const NAME: &'static str = "Int64Value";
829 const FULL_NAME: &'static str = "google.protobuf.Int64Value";
830 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int64Value";
831}
832impl<'v> ::buffa::DefaultViewInstance for Int64ValueView<'v> {
833 fn default_view_instance<'a>() -> &'a Self
834 where
835 Self: 'a,
836 {
837 static VALUE: ::buffa::__private::OnceBox<Int64ValueView<'static>> = ::buffa::__private::OnceBox::new();
838 VALUE
839 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
840 <Int64ValueView<'static>>::default(),
841 ))
842 }
843}
844impl ::buffa::ViewReborrow for Int64ValueView<'static> {
845 type Reborrowed<'b> = Int64ValueView<'b>;
846 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
847 this
848 }
849}
850#[derive(Clone, Debug)]
856pub struct Int64ValueOwnedView(::buffa::OwnedView<Int64ValueView<'static>>);
857impl Int64ValueOwnedView {
858 pub fn decode(
868 bytes: ::buffa::bytes::Bytes,
869 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
870 ::core::result::Result::Ok(
871 Int64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
872 )
873 }
874 pub fn decode_with_options(
882 bytes: ::buffa::bytes::Bytes,
883 opts: &::buffa::DecodeOptions,
884 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
885 ::core::result::Result::Ok(
886 Int64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
887 )
888 }
889 pub fn from_owned(
896 msg: &super::super::Int64Value,
897 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
898 ::core::result::Result::Ok(
899 Int64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
900 )
901 }
902 #[must_use]
904 pub fn view(&self) -> &Int64ValueView<'_> {
905 self.0.reborrow()
906 }
907 #[must_use]
909 pub fn to_owned_message(&self) -> super::super::Int64Value {
910 self.0.to_owned_message()
911 }
912 #[must_use]
914 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
915 self.0.bytes()
916 }
917 #[must_use]
919 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
920 self.0.into_bytes()
921 }
922 #[must_use]
926 pub fn value(&self) -> i64 {
927 self.0.reborrow().value
928 }
929}
930impl ::core::convert::From<::buffa::OwnedView<Int64ValueView<'static>>>
931for Int64ValueOwnedView {
932 fn from(inner: ::buffa::OwnedView<Int64ValueView<'static>>) -> Self {
933 Int64ValueOwnedView(inner)
934 }
935}
936impl ::core::convert::From<Int64ValueOwnedView>
937for ::buffa::OwnedView<Int64ValueView<'static>> {
938 fn from(wrapper: Int64ValueOwnedView) -> Self {
939 wrapper.0
940 }
941}
942impl ::core::convert::AsRef<::buffa::OwnedView<Int64ValueView<'static>>>
943for Int64ValueOwnedView {
944 fn as_ref(&self) -> &::buffa::OwnedView<Int64ValueView<'static>> {
945 &self.0
946 }
947}
948impl ::buffa::HasMessageView for super::super::Int64Value {
949 type View<'a> = Int64ValueView<'a>;
950 type ViewHandle = Int64ValueOwnedView;
951}
952#[cfg(feature = "reflect")]
953const _: () = {
954 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int64ValueView<'a> {
955 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
956 super::super::__buffa::reflect::descriptor_pool()
957 .message(Self::__buffa_reflect_message_index())
958 }
959 fn pool(
960 &self,
961 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
962 super::super::__buffa::reflect::descriptor_pool()
963 }
964 fn get(
965 &self,
966 field: &::buffa_descriptor::FieldDescriptor,
967 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
968 #[allow(unused_imports)]
969 use ::buffa::Enumeration as _;
970 match field.number() {
971 1u32 => ::buffa_descriptor::reflect::ValueRef::I64(self.value),
972 _ => {
973 ::core::debug_assert!(
974 false,
975 "field number {} is not a member of this view's reflect get()",
976 field.number(),
977 );
978 ::buffa_descriptor::reflect::ValueRef::Bool(false)
979 }
980 }
981 }
982 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
983 match field.number() {
984 1u32 => self.value != 0,
985 _ => false,
986 }
987 }
988 fn for_each_set(
989 &self,
990 f: &mut dyn ::core::ops::FnMut(
991 &::buffa_descriptor::FieldDescriptor,
992 ::buffa_descriptor::reflect::ValueRef<'_>,
993 ),
994 ) {
995 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
996 self,
997 );
998 for fd in md.fields() {
999 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1000 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1001 }
1002 }
1003 }
1004 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1005 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1006 ::buffa_descriptor::reflect::DynamicMessage::decode(
1007 ::buffa::alloc::sync::Arc::clone(
1008 super::super::__buffa::reflect::descriptor_pool(),
1009 ),
1010 Self::__buffa_reflect_message_index(),
1011 &bytes,
1012 )
1013 .expect("view re-encodes to bytes decodable against its own descriptor")
1014 }
1015 }
1016 impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int64ValueView<'a> {
1017 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1018 ::buffa_descriptor::reflect::ValueRef::Message(
1019 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1020 )
1021 }
1022 }
1023 impl<'a> Int64ValueView<'a> {
1024 #[doc(hidden)]
1029 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1030 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1031 *IDX
1032 .get_or_init(|| {
1033 super::super::__buffa::reflect::descriptor_pool()
1034 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1035 .expect(
1036 "generated view type is registered in the embedded descriptor pool",
1037 )
1038 })
1039 }
1040 }
1041};
1042#[derive(Clone, Debug, Default)]
1046pub struct UInt64ValueView<'a> {
1047 pub value: u64,
1051 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1052}
1053impl<'a> UInt64ValueView<'a> {
1054 #[doc(hidden)]
1062 pub fn _decode_depth(
1063 buf: &'a [u8],
1064 depth: u32,
1065 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1066 let mut view = Self::default();
1067 view._merge_into_view(buf, depth)?;
1068 ::core::result::Result::Ok(view)
1069 }
1070 #[doc(hidden)]
1078 pub fn _merge_into_view(
1079 &mut self,
1080 buf: &'a [u8],
1081 depth: u32,
1082 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1083 let _ = depth;
1084 #[allow(unused_variables)]
1085 let view = self;
1086 let mut cur: &'a [u8] = buf;
1087 while !cur.is_empty() {
1088 let before_tag = cur;
1089 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1090 match tag.field_number() {
1091 1u32 => {
1092 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1093 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1094 field_number: 1u32,
1095 expected: 0u8,
1096 actual: tag.wire_type() as u8,
1097 });
1098 }
1099 view.value = ::buffa::types::decode_uint64(&mut cur)?;
1100 }
1101 _ => {
1102 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1103 let span_len = before_tag.len() - cur.len();
1104 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1105 }
1106 }
1107 }
1108 ::core::result::Result::Ok(())
1109 }
1110}
1111impl<'a> ::buffa::MessageView<'a> for UInt64ValueView<'a> {
1112 type Owned = super::super::UInt64Value;
1113 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1114 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1115 }
1116 fn decode_view_with_limit(
1117 buf: &'a [u8],
1118 depth: u32,
1119 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1120 Self::_decode_depth(buf, depth)
1121 }
1122 fn to_owned_message(&self) -> super::super::UInt64Value {
1123 self.to_owned_from_source(None)
1124 }
1125 #[allow(clippy::useless_conversion, clippy::needless_update)]
1126 fn to_owned_from_source(
1127 &self,
1128 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1129 ) -> super::super::UInt64Value {
1130 #[allow(unused_imports)]
1131 use ::buffa::alloc::string::ToString as _;
1132 let _ = __buffa_src;
1133 super::super::UInt64Value {
1134 value: self.value,
1135 __buffa_unknown_fields: self
1136 .__buffa_unknown_fields
1137 .to_owned()
1138 .unwrap_or_default()
1139 .into(),
1140 ..::core::default::Default::default()
1141 }
1142 }
1143}
1144impl<'a> ::buffa::ViewEncode<'a> for UInt64ValueView<'a> {
1145 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1146 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1147 #[allow(unused_imports)]
1148 use ::buffa::Enumeration as _;
1149 let mut size = 0u32;
1150 if self.value != 0u64 {
1151 size += 1u32 + ::buffa::types::uint64_encoded_len(self.value) as u32;
1152 }
1153 size += self.__buffa_unknown_fields.encoded_len() as u32;
1154 size
1155 }
1156 #[allow(clippy::needless_borrow)]
1157 fn write_to(
1158 &self,
1159 _cache: &mut ::buffa::SizeCache,
1160 buf: &mut impl ::buffa::bytes::BufMut,
1161 ) {
1162 #[allow(unused_imports)]
1163 use ::buffa::Enumeration as _;
1164 if self.value != 0u64 {
1165 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
1166 .encode(buf);
1167 ::buffa::types::encode_uint64(self.value, buf);
1168 }
1169 self.__buffa_unknown_fields.write_to(buf);
1170 }
1171}
1172impl<'a> ::buffa::MessageName for UInt64ValueView<'a> {
1173 const PACKAGE: &'static str = "google.protobuf";
1174 const NAME: &'static str = "UInt64Value";
1175 const FULL_NAME: &'static str = "google.protobuf.UInt64Value";
1176 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt64Value";
1177}
1178impl<'v> ::buffa::DefaultViewInstance for UInt64ValueView<'v> {
1179 fn default_view_instance<'a>() -> &'a Self
1180 where
1181 Self: 'a,
1182 {
1183 static VALUE: ::buffa::__private::OnceBox<UInt64ValueView<'static>> = ::buffa::__private::OnceBox::new();
1184 VALUE
1185 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1186 <UInt64ValueView<'static>>::default(),
1187 ))
1188 }
1189}
1190impl ::buffa::ViewReborrow for UInt64ValueView<'static> {
1191 type Reborrowed<'b> = UInt64ValueView<'b>;
1192 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1193 this
1194 }
1195}
1196#[derive(Clone, Debug)]
1202pub struct UInt64ValueOwnedView(::buffa::OwnedView<UInt64ValueView<'static>>);
1203impl UInt64ValueOwnedView {
1204 pub fn decode(
1214 bytes: ::buffa::bytes::Bytes,
1215 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1216 ::core::result::Result::Ok(
1217 UInt64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1218 )
1219 }
1220 pub fn decode_with_options(
1228 bytes: ::buffa::bytes::Bytes,
1229 opts: &::buffa::DecodeOptions,
1230 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1231 ::core::result::Result::Ok(
1232 UInt64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1233 )
1234 }
1235 pub fn from_owned(
1242 msg: &super::super::UInt64Value,
1243 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1244 ::core::result::Result::Ok(
1245 UInt64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1246 )
1247 }
1248 #[must_use]
1250 pub fn view(&self) -> &UInt64ValueView<'_> {
1251 self.0.reborrow()
1252 }
1253 #[must_use]
1255 pub fn to_owned_message(&self) -> super::super::UInt64Value {
1256 self.0.to_owned_message()
1257 }
1258 #[must_use]
1260 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1261 self.0.bytes()
1262 }
1263 #[must_use]
1265 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1266 self.0.into_bytes()
1267 }
1268 #[must_use]
1272 pub fn value(&self) -> u64 {
1273 self.0.reborrow().value
1274 }
1275}
1276impl ::core::convert::From<::buffa::OwnedView<UInt64ValueView<'static>>>
1277for UInt64ValueOwnedView {
1278 fn from(inner: ::buffa::OwnedView<UInt64ValueView<'static>>) -> Self {
1279 UInt64ValueOwnedView(inner)
1280 }
1281}
1282impl ::core::convert::From<UInt64ValueOwnedView>
1283for ::buffa::OwnedView<UInt64ValueView<'static>> {
1284 fn from(wrapper: UInt64ValueOwnedView) -> Self {
1285 wrapper.0
1286 }
1287}
1288impl ::core::convert::AsRef<::buffa::OwnedView<UInt64ValueView<'static>>>
1289for UInt64ValueOwnedView {
1290 fn as_ref(&self) -> &::buffa::OwnedView<UInt64ValueView<'static>> {
1291 &self.0
1292 }
1293}
1294impl ::buffa::HasMessageView for super::super::UInt64Value {
1295 type View<'a> = UInt64ValueView<'a>;
1296 type ViewHandle = UInt64ValueOwnedView;
1297}
1298#[cfg(feature = "reflect")]
1299const _: () = {
1300 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt64ValueView<'a> {
1301 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1302 super::super::__buffa::reflect::descriptor_pool()
1303 .message(Self::__buffa_reflect_message_index())
1304 }
1305 fn pool(
1306 &self,
1307 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1308 super::super::__buffa::reflect::descriptor_pool()
1309 }
1310 fn get(
1311 &self,
1312 field: &::buffa_descriptor::FieldDescriptor,
1313 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1314 #[allow(unused_imports)]
1315 use ::buffa::Enumeration as _;
1316 match field.number() {
1317 1u32 => ::buffa_descriptor::reflect::ValueRef::U64(self.value),
1318 _ => {
1319 ::core::debug_assert!(
1320 false,
1321 "field number {} is not a member of this view's reflect get()",
1322 field.number(),
1323 );
1324 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1325 }
1326 }
1327 }
1328 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1329 match field.number() {
1330 1u32 => self.value != 0,
1331 _ => false,
1332 }
1333 }
1334 fn for_each_set(
1335 &self,
1336 f: &mut dyn ::core::ops::FnMut(
1337 &::buffa_descriptor::FieldDescriptor,
1338 ::buffa_descriptor::reflect::ValueRef<'_>,
1339 ),
1340 ) {
1341 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1342 self,
1343 );
1344 for fd in md.fields() {
1345 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1346 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1347 }
1348 }
1349 }
1350 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1351 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1352 ::buffa_descriptor::reflect::DynamicMessage::decode(
1353 ::buffa::alloc::sync::Arc::clone(
1354 super::super::__buffa::reflect::descriptor_pool(),
1355 ),
1356 Self::__buffa_reflect_message_index(),
1357 &bytes,
1358 )
1359 .expect("view re-encodes to bytes decodable against its own descriptor")
1360 }
1361 }
1362 impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt64ValueView<'a> {
1363 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1364 ::buffa_descriptor::reflect::ValueRef::Message(
1365 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1366 )
1367 }
1368 }
1369 impl<'a> UInt64ValueView<'a> {
1370 #[doc(hidden)]
1375 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1376 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1377 *IDX
1378 .get_or_init(|| {
1379 super::super::__buffa::reflect::descriptor_pool()
1380 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1381 .expect(
1382 "generated view type is registered in the embedded descriptor pool",
1383 )
1384 })
1385 }
1386 }
1387};
1388#[derive(Clone, Debug, Default)]
1392pub struct Int32ValueView<'a> {
1393 pub value: i32,
1397 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1398}
1399impl<'a> Int32ValueView<'a> {
1400 #[doc(hidden)]
1408 pub fn _decode_depth(
1409 buf: &'a [u8],
1410 depth: u32,
1411 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1412 let mut view = Self::default();
1413 view._merge_into_view(buf, depth)?;
1414 ::core::result::Result::Ok(view)
1415 }
1416 #[doc(hidden)]
1424 pub fn _merge_into_view(
1425 &mut self,
1426 buf: &'a [u8],
1427 depth: u32,
1428 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1429 let _ = depth;
1430 #[allow(unused_variables)]
1431 let view = self;
1432 let mut cur: &'a [u8] = buf;
1433 while !cur.is_empty() {
1434 let before_tag = cur;
1435 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1436 match tag.field_number() {
1437 1u32 => {
1438 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1439 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1440 field_number: 1u32,
1441 expected: 0u8,
1442 actual: tag.wire_type() as u8,
1443 });
1444 }
1445 view.value = ::buffa::types::decode_int32(&mut cur)?;
1446 }
1447 _ => {
1448 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1449 let span_len = before_tag.len() - cur.len();
1450 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1451 }
1452 }
1453 }
1454 ::core::result::Result::Ok(())
1455 }
1456}
1457impl<'a> ::buffa::MessageView<'a> for Int32ValueView<'a> {
1458 type Owned = super::super::Int32Value;
1459 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1460 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1461 }
1462 fn decode_view_with_limit(
1463 buf: &'a [u8],
1464 depth: u32,
1465 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1466 Self::_decode_depth(buf, depth)
1467 }
1468 fn to_owned_message(&self) -> super::super::Int32Value {
1469 self.to_owned_from_source(None)
1470 }
1471 #[allow(clippy::useless_conversion, clippy::needless_update)]
1472 fn to_owned_from_source(
1473 &self,
1474 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1475 ) -> super::super::Int32Value {
1476 #[allow(unused_imports)]
1477 use ::buffa::alloc::string::ToString as _;
1478 let _ = __buffa_src;
1479 super::super::Int32Value {
1480 value: self.value,
1481 __buffa_unknown_fields: self
1482 .__buffa_unknown_fields
1483 .to_owned()
1484 .unwrap_or_default()
1485 .into(),
1486 ..::core::default::Default::default()
1487 }
1488 }
1489}
1490impl<'a> ::buffa::ViewEncode<'a> for Int32ValueView<'a> {
1491 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1492 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1493 #[allow(unused_imports)]
1494 use ::buffa::Enumeration as _;
1495 let mut size = 0u32;
1496 if self.value != 0i32 {
1497 size += 1u32 + ::buffa::types::int32_encoded_len(self.value) as u32;
1498 }
1499 size += self.__buffa_unknown_fields.encoded_len() as u32;
1500 size
1501 }
1502 #[allow(clippy::needless_borrow)]
1503 fn write_to(
1504 &self,
1505 _cache: &mut ::buffa::SizeCache,
1506 buf: &mut impl ::buffa::bytes::BufMut,
1507 ) {
1508 #[allow(unused_imports)]
1509 use ::buffa::Enumeration as _;
1510 if self.value != 0i32 {
1511 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
1512 .encode(buf);
1513 ::buffa::types::encode_int32(self.value, buf);
1514 }
1515 self.__buffa_unknown_fields.write_to(buf);
1516 }
1517}
1518impl<'a> ::buffa::MessageName for Int32ValueView<'a> {
1519 const PACKAGE: &'static str = "google.protobuf";
1520 const NAME: &'static str = "Int32Value";
1521 const FULL_NAME: &'static str = "google.protobuf.Int32Value";
1522 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int32Value";
1523}
1524impl<'v> ::buffa::DefaultViewInstance for Int32ValueView<'v> {
1525 fn default_view_instance<'a>() -> &'a Self
1526 where
1527 Self: 'a,
1528 {
1529 static VALUE: ::buffa::__private::OnceBox<Int32ValueView<'static>> = ::buffa::__private::OnceBox::new();
1530 VALUE
1531 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1532 <Int32ValueView<'static>>::default(),
1533 ))
1534 }
1535}
1536impl ::buffa::ViewReborrow for Int32ValueView<'static> {
1537 type Reborrowed<'b> = Int32ValueView<'b>;
1538 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1539 this
1540 }
1541}
1542#[derive(Clone, Debug)]
1548pub struct Int32ValueOwnedView(::buffa::OwnedView<Int32ValueView<'static>>);
1549impl Int32ValueOwnedView {
1550 pub fn decode(
1560 bytes: ::buffa::bytes::Bytes,
1561 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1562 ::core::result::Result::Ok(
1563 Int32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1564 )
1565 }
1566 pub fn decode_with_options(
1574 bytes: ::buffa::bytes::Bytes,
1575 opts: &::buffa::DecodeOptions,
1576 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1577 ::core::result::Result::Ok(
1578 Int32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1579 )
1580 }
1581 pub fn from_owned(
1588 msg: &super::super::Int32Value,
1589 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1590 ::core::result::Result::Ok(
1591 Int32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1592 )
1593 }
1594 #[must_use]
1596 pub fn view(&self) -> &Int32ValueView<'_> {
1597 self.0.reborrow()
1598 }
1599 #[must_use]
1601 pub fn to_owned_message(&self) -> super::super::Int32Value {
1602 self.0.to_owned_message()
1603 }
1604 #[must_use]
1606 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1607 self.0.bytes()
1608 }
1609 #[must_use]
1611 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1612 self.0.into_bytes()
1613 }
1614 #[must_use]
1618 pub fn value(&self) -> i32 {
1619 self.0.reborrow().value
1620 }
1621}
1622impl ::core::convert::From<::buffa::OwnedView<Int32ValueView<'static>>>
1623for Int32ValueOwnedView {
1624 fn from(inner: ::buffa::OwnedView<Int32ValueView<'static>>) -> Self {
1625 Int32ValueOwnedView(inner)
1626 }
1627}
1628impl ::core::convert::From<Int32ValueOwnedView>
1629for ::buffa::OwnedView<Int32ValueView<'static>> {
1630 fn from(wrapper: Int32ValueOwnedView) -> Self {
1631 wrapper.0
1632 }
1633}
1634impl ::core::convert::AsRef<::buffa::OwnedView<Int32ValueView<'static>>>
1635for Int32ValueOwnedView {
1636 fn as_ref(&self) -> &::buffa::OwnedView<Int32ValueView<'static>> {
1637 &self.0
1638 }
1639}
1640impl ::buffa::HasMessageView for super::super::Int32Value {
1641 type View<'a> = Int32ValueView<'a>;
1642 type ViewHandle = Int32ValueOwnedView;
1643}
1644#[cfg(feature = "reflect")]
1645const _: () = {
1646 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int32ValueView<'a> {
1647 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1648 super::super::__buffa::reflect::descriptor_pool()
1649 .message(Self::__buffa_reflect_message_index())
1650 }
1651 fn pool(
1652 &self,
1653 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1654 super::super::__buffa::reflect::descriptor_pool()
1655 }
1656 fn get(
1657 &self,
1658 field: &::buffa_descriptor::FieldDescriptor,
1659 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1660 #[allow(unused_imports)]
1661 use ::buffa::Enumeration as _;
1662 match field.number() {
1663 1u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.value),
1664 _ => {
1665 ::core::debug_assert!(
1666 false,
1667 "field number {} is not a member of this view's reflect get()",
1668 field.number(),
1669 );
1670 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1671 }
1672 }
1673 }
1674 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1675 match field.number() {
1676 1u32 => self.value != 0,
1677 _ => false,
1678 }
1679 }
1680 fn for_each_set(
1681 &self,
1682 f: &mut dyn ::core::ops::FnMut(
1683 &::buffa_descriptor::FieldDescriptor,
1684 ::buffa_descriptor::reflect::ValueRef<'_>,
1685 ),
1686 ) {
1687 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1688 self,
1689 );
1690 for fd in md.fields() {
1691 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1692 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1693 }
1694 }
1695 }
1696 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1697 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1698 ::buffa_descriptor::reflect::DynamicMessage::decode(
1699 ::buffa::alloc::sync::Arc::clone(
1700 super::super::__buffa::reflect::descriptor_pool(),
1701 ),
1702 Self::__buffa_reflect_message_index(),
1703 &bytes,
1704 )
1705 .expect("view re-encodes to bytes decodable against its own descriptor")
1706 }
1707 }
1708 impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int32ValueView<'a> {
1709 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1710 ::buffa_descriptor::reflect::ValueRef::Message(
1711 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1712 )
1713 }
1714 }
1715 impl<'a> Int32ValueView<'a> {
1716 #[doc(hidden)]
1721 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1722 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1723 *IDX
1724 .get_or_init(|| {
1725 super::super::__buffa::reflect::descriptor_pool()
1726 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1727 .expect(
1728 "generated view type is registered in the embedded descriptor pool",
1729 )
1730 })
1731 }
1732 }
1733};
1734#[derive(Clone, Debug, Default)]
1738pub struct UInt32ValueView<'a> {
1739 pub value: u32,
1743 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1744}
1745impl<'a> UInt32ValueView<'a> {
1746 #[doc(hidden)]
1754 pub fn _decode_depth(
1755 buf: &'a [u8],
1756 depth: u32,
1757 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1758 let mut view = Self::default();
1759 view._merge_into_view(buf, depth)?;
1760 ::core::result::Result::Ok(view)
1761 }
1762 #[doc(hidden)]
1770 pub fn _merge_into_view(
1771 &mut self,
1772 buf: &'a [u8],
1773 depth: u32,
1774 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1775 let _ = depth;
1776 #[allow(unused_variables)]
1777 let view = self;
1778 let mut cur: &'a [u8] = buf;
1779 while !cur.is_empty() {
1780 let before_tag = cur;
1781 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1782 match tag.field_number() {
1783 1u32 => {
1784 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1785 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1786 field_number: 1u32,
1787 expected: 0u8,
1788 actual: tag.wire_type() as u8,
1789 });
1790 }
1791 view.value = ::buffa::types::decode_uint32(&mut cur)?;
1792 }
1793 _ => {
1794 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1795 let span_len = before_tag.len() - cur.len();
1796 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1797 }
1798 }
1799 }
1800 ::core::result::Result::Ok(())
1801 }
1802}
1803impl<'a> ::buffa::MessageView<'a> for UInt32ValueView<'a> {
1804 type Owned = super::super::UInt32Value;
1805 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1806 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1807 }
1808 fn decode_view_with_limit(
1809 buf: &'a [u8],
1810 depth: u32,
1811 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1812 Self::_decode_depth(buf, depth)
1813 }
1814 fn to_owned_message(&self) -> super::super::UInt32Value {
1815 self.to_owned_from_source(None)
1816 }
1817 #[allow(clippy::useless_conversion, clippy::needless_update)]
1818 fn to_owned_from_source(
1819 &self,
1820 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1821 ) -> super::super::UInt32Value {
1822 #[allow(unused_imports)]
1823 use ::buffa::alloc::string::ToString as _;
1824 let _ = __buffa_src;
1825 super::super::UInt32Value {
1826 value: self.value,
1827 __buffa_unknown_fields: self
1828 .__buffa_unknown_fields
1829 .to_owned()
1830 .unwrap_or_default()
1831 .into(),
1832 ..::core::default::Default::default()
1833 }
1834 }
1835}
1836impl<'a> ::buffa::ViewEncode<'a> for UInt32ValueView<'a> {
1837 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1838 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1839 #[allow(unused_imports)]
1840 use ::buffa::Enumeration as _;
1841 let mut size = 0u32;
1842 if self.value != 0u32 {
1843 size += 1u32 + ::buffa::types::uint32_encoded_len(self.value) as u32;
1844 }
1845 size += self.__buffa_unknown_fields.encoded_len() as u32;
1846 size
1847 }
1848 #[allow(clippy::needless_borrow)]
1849 fn write_to(
1850 &self,
1851 _cache: &mut ::buffa::SizeCache,
1852 buf: &mut impl ::buffa::bytes::BufMut,
1853 ) {
1854 #[allow(unused_imports)]
1855 use ::buffa::Enumeration as _;
1856 if self.value != 0u32 {
1857 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
1858 .encode(buf);
1859 ::buffa::types::encode_uint32(self.value, buf);
1860 }
1861 self.__buffa_unknown_fields.write_to(buf);
1862 }
1863}
1864impl<'a> ::buffa::MessageName for UInt32ValueView<'a> {
1865 const PACKAGE: &'static str = "google.protobuf";
1866 const NAME: &'static str = "UInt32Value";
1867 const FULL_NAME: &'static str = "google.protobuf.UInt32Value";
1868 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt32Value";
1869}
1870impl<'v> ::buffa::DefaultViewInstance for UInt32ValueView<'v> {
1871 fn default_view_instance<'a>() -> &'a Self
1872 where
1873 Self: 'a,
1874 {
1875 static VALUE: ::buffa::__private::OnceBox<UInt32ValueView<'static>> = ::buffa::__private::OnceBox::new();
1876 VALUE
1877 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1878 <UInt32ValueView<'static>>::default(),
1879 ))
1880 }
1881}
1882impl ::buffa::ViewReborrow for UInt32ValueView<'static> {
1883 type Reborrowed<'b> = UInt32ValueView<'b>;
1884 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1885 this
1886 }
1887}
1888#[derive(Clone, Debug)]
1894pub struct UInt32ValueOwnedView(::buffa::OwnedView<UInt32ValueView<'static>>);
1895impl UInt32ValueOwnedView {
1896 pub fn decode(
1906 bytes: ::buffa::bytes::Bytes,
1907 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1908 ::core::result::Result::Ok(
1909 UInt32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1910 )
1911 }
1912 pub fn decode_with_options(
1920 bytes: ::buffa::bytes::Bytes,
1921 opts: &::buffa::DecodeOptions,
1922 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1923 ::core::result::Result::Ok(
1924 UInt32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1925 )
1926 }
1927 pub fn from_owned(
1934 msg: &super::super::UInt32Value,
1935 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1936 ::core::result::Result::Ok(
1937 UInt32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1938 )
1939 }
1940 #[must_use]
1942 pub fn view(&self) -> &UInt32ValueView<'_> {
1943 self.0.reborrow()
1944 }
1945 #[must_use]
1947 pub fn to_owned_message(&self) -> super::super::UInt32Value {
1948 self.0.to_owned_message()
1949 }
1950 #[must_use]
1952 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1953 self.0.bytes()
1954 }
1955 #[must_use]
1957 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1958 self.0.into_bytes()
1959 }
1960 #[must_use]
1964 pub fn value(&self) -> u32 {
1965 self.0.reborrow().value
1966 }
1967}
1968impl ::core::convert::From<::buffa::OwnedView<UInt32ValueView<'static>>>
1969for UInt32ValueOwnedView {
1970 fn from(inner: ::buffa::OwnedView<UInt32ValueView<'static>>) -> Self {
1971 UInt32ValueOwnedView(inner)
1972 }
1973}
1974impl ::core::convert::From<UInt32ValueOwnedView>
1975for ::buffa::OwnedView<UInt32ValueView<'static>> {
1976 fn from(wrapper: UInt32ValueOwnedView) -> Self {
1977 wrapper.0
1978 }
1979}
1980impl ::core::convert::AsRef<::buffa::OwnedView<UInt32ValueView<'static>>>
1981for UInt32ValueOwnedView {
1982 fn as_ref(&self) -> &::buffa::OwnedView<UInt32ValueView<'static>> {
1983 &self.0
1984 }
1985}
1986impl ::buffa::HasMessageView for super::super::UInt32Value {
1987 type View<'a> = UInt32ValueView<'a>;
1988 type ViewHandle = UInt32ValueOwnedView;
1989}
1990#[cfg(feature = "reflect")]
1991const _: () = {
1992 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt32ValueView<'a> {
1993 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1994 super::super::__buffa::reflect::descriptor_pool()
1995 .message(Self::__buffa_reflect_message_index())
1996 }
1997 fn pool(
1998 &self,
1999 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2000 super::super::__buffa::reflect::descriptor_pool()
2001 }
2002 fn get(
2003 &self,
2004 field: &::buffa_descriptor::FieldDescriptor,
2005 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2006 #[allow(unused_imports)]
2007 use ::buffa::Enumeration as _;
2008 match field.number() {
2009 1u32 => ::buffa_descriptor::reflect::ValueRef::U32(self.value),
2010 _ => {
2011 ::core::debug_assert!(
2012 false,
2013 "field number {} is not a member of this view's reflect get()",
2014 field.number(),
2015 );
2016 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2017 }
2018 }
2019 }
2020 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2021 match field.number() {
2022 1u32 => self.value != 0,
2023 _ => false,
2024 }
2025 }
2026 fn for_each_set(
2027 &self,
2028 f: &mut dyn ::core::ops::FnMut(
2029 &::buffa_descriptor::FieldDescriptor,
2030 ::buffa_descriptor::reflect::ValueRef<'_>,
2031 ),
2032 ) {
2033 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2034 self,
2035 );
2036 for fd in md.fields() {
2037 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2038 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2039 }
2040 }
2041 }
2042 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2043 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2044 ::buffa_descriptor::reflect::DynamicMessage::decode(
2045 ::buffa::alloc::sync::Arc::clone(
2046 super::super::__buffa::reflect::descriptor_pool(),
2047 ),
2048 Self::__buffa_reflect_message_index(),
2049 &bytes,
2050 )
2051 .expect("view re-encodes to bytes decodable against its own descriptor")
2052 }
2053 }
2054 impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt32ValueView<'a> {
2055 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2056 ::buffa_descriptor::reflect::ValueRef::Message(
2057 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2058 )
2059 }
2060 }
2061 impl<'a> UInt32ValueView<'a> {
2062 #[doc(hidden)]
2067 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2068 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2069 *IDX
2070 .get_or_init(|| {
2071 super::super::__buffa::reflect::descriptor_pool()
2072 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2073 .expect(
2074 "generated view type is registered in the embedded descriptor pool",
2075 )
2076 })
2077 }
2078 }
2079};
2080#[derive(Clone, Debug, Default)]
2084pub struct BoolValueView<'a> {
2085 pub value: bool,
2089 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2090}
2091impl<'a> BoolValueView<'a> {
2092 #[doc(hidden)]
2100 pub fn _decode_depth(
2101 buf: &'a [u8],
2102 depth: u32,
2103 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2104 let mut view = Self::default();
2105 view._merge_into_view(buf, depth)?;
2106 ::core::result::Result::Ok(view)
2107 }
2108 #[doc(hidden)]
2116 pub fn _merge_into_view(
2117 &mut self,
2118 buf: &'a [u8],
2119 depth: u32,
2120 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2121 let _ = depth;
2122 #[allow(unused_variables)]
2123 let view = self;
2124 let mut cur: &'a [u8] = buf;
2125 while !cur.is_empty() {
2126 let before_tag = cur;
2127 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2128 match tag.field_number() {
2129 1u32 => {
2130 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2131 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2132 field_number: 1u32,
2133 expected: 0u8,
2134 actual: tag.wire_type() as u8,
2135 });
2136 }
2137 view.value = ::buffa::types::decode_bool(&mut cur)?;
2138 }
2139 _ => {
2140 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2141 let span_len = before_tag.len() - cur.len();
2142 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2143 }
2144 }
2145 }
2146 ::core::result::Result::Ok(())
2147 }
2148}
2149impl<'a> ::buffa::MessageView<'a> for BoolValueView<'a> {
2150 type Owned = super::super::BoolValue;
2151 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2152 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2153 }
2154 fn decode_view_with_limit(
2155 buf: &'a [u8],
2156 depth: u32,
2157 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2158 Self::_decode_depth(buf, depth)
2159 }
2160 fn to_owned_message(&self) -> super::super::BoolValue {
2161 self.to_owned_from_source(None)
2162 }
2163 #[allow(clippy::useless_conversion, clippy::needless_update)]
2164 fn to_owned_from_source(
2165 &self,
2166 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2167 ) -> super::super::BoolValue {
2168 #[allow(unused_imports)]
2169 use ::buffa::alloc::string::ToString as _;
2170 let _ = __buffa_src;
2171 super::super::BoolValue {
2172 value: self.value,
2173 __buffa_unknown_fields: self
2174 .__buffa_unknown_fields
2175 .to_owned()
2176 .unwrap_or_default()
2177 .into(),
2178 ..::core::default::Default::default()
2179 }
2180 }
2181}
2182impl<'a> ::buffa::ViewEncode<'a> for BoolValueView<'a> {
2183 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2184 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2185 #[allow(unused_imports)]
2186 use ::buffa::Enumeration as _;
2187 let mut size = 0u32;
2188 if self.value {
2189 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
2190 }
2191 size += self.__buffa_unknown_fields.encoded_len() as u32;
2192 size
2193 }
2194 #[allow(clippy::needless_borrow)]
2195 fn write_to(
2196 &self,
2197 _cache: &mut ::buffa::SizeCache,
2198 buf: &mut impl ::buffa::bytes::BufMut,
2199 ) {
2200 #[allow(unused_imports)]
2201 use ::buffa::Enumeration as _;
2202 if self.value {
2203 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
2204 .encode(buf);
2205 ::buffa::types::encode_bool(self.value, buf);
2206 }
2207 self.__buffa_unknown_fields.write_to(buf);
2208 }
2209}
2210impl<'a> ::buffa::MessageName for BoolValueView<'a> {
2211 const PACKAGE: &'static str = "google.protobuf";
2212 const NAME: &'static str = "BoolValue";
2213 const FULL_NAME: &'static str = "google.protobuf.BoolValue";
2214 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BoolValue";
2215}
2216impl<'v> ::buffa::DefaultViewInstance for BoolValueView<'v> {
2217 fn default_view_instance<'a>() -> &'a Self
2218 where
2219 Self: 'a,
2220 {
2221 static VALUE: ::buffa::__private::OnceBox<BoolValueView<'static>> = ::buffa::__private::OnceBox::new();
2222 VALUE
2223 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
2224 <BoolValueView<'static>>::default(),
2225 ))
2226 }
2227}
2228impl ::buffa::ViewReborrow for BoolValueView<'static> {
2229 type Reborrowed<'b> = BoolValueView<'b>;
2230 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
2231 this
2232 }
2233}
2234#[derive(Clone, Debug)]
2240pub struct BoolValueOwnedView(::buffa::OwnedView<BoolValueView<'static>>);
2241impl BoolValueOwnedView {
2242 pub fn decode(
2252 bytes: ::buffa::bytes::Bytes,
2253 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2254 ::core::result::Result::Ok(
2255 BoolValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2256 )
2257 }
2258 pub fn decode_with_options(
2266 bytes: ::buffa::bytes::Bytes,
2267 opts: &::buffa::DecodeOptions,
2268 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2269 ::core::result::Result::Ok(
2270 BoolValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2271 )
2272 }
2273 pub fn from_owned(
2280 msg: &super::super::BoolValue,
2281 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2282 ::core::result::Result::Ok(
2283 BoolValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2284 )
2285 }
2286 #[must_use]
2288 pub fn view(&self) -> &BoolValueView<'_> {
2289 self.0.reborrow()
2290 }
2291 #[must_use]
2293 pub fn to_owned_message(&self) -> super::super::BoolValue {
2294 self.0.to_owned_message()
2295 }
2296 #[must_use]
2298 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2299 self.0.bytes()
2300 }
2301 #[must_use]
2303 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2304 self.0.into_bytes()
2305 }
2306 #[must_use]
2310 pub fn value(&self) -> bool {
2311 self.0.reborrow().value
2312 }
2313}
2314impl ::core::convert::From<::buffa::OwnedView<BoolValueView<'static>>>
2315for BoolValueOwnedView {
2316 fn from(inner: ::buffa::OwnedView<BoolValueView<'static>>) -> Self {
2317 BoolValueOwnedView(inner)
2318 }
2319}
2320impl ::core::convert::From<BoolValueOwnedView>
2321for ::buffa::OwnedView<BoolValueView<'static>> {
2322 fn from(wrapper: BoolValueOwnedView) -> Self {
2323 wrapper.0
2324 }
2325}
2326impl ::core::convert::AsRef<::buffa::OwnedView<BoolValueView<'static>>>
2327for BoolValueOwnedView {
2328 fn as_ref(&self) -> &::buffa::OwnedView<BoolValueView<'static>> {
2329 &self.0
2330 }
2331}
2332impl ::buffa::HasMessageView for super::super::BoolValue {
2333 type View<'a> = BoolValueView<'a>;
2334 type ViewHandle = BoolValueOwnedView;
2335}
2336#[cfg(feature = "reflect")]
2337const _: () = {
2338 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BoolValueView<'a> {
2339 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2340 super::super::__buffa::reflect::descriptor_pool()
2341 .message(Self::__buffa_reflect_message_index())
2342 }
2343 fn pool(
2344 &self,
2345 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2346 super::super::__buffa::reflect::descriptor_pool()
2347 }
2348 fn get(
2349 &self,
2350 field: &::buffa_descriptor::FieldDescriptor,
2351 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2352 #[allow(unused_imports)]
2353 use ::buffa::Enumeration as _;
2354 match field.number() {
2355 1u32 => ::buffa_descriptor::reflect::ValueRef::Bool(self.value),
2356 _ => {
2357 ::core::debug_assert!(
2358 false,
2359 "field number {} is not a member of this view's reflect get()",
2360 field.number(),
2361 );
2362 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2363 }
2364 }
2365 }
2366 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2367 match field.number() {
2368 1u32 => self.value,
2369 _ => false,
2370 }
2371 }
2372 fn for_each_set(
2373 &self,
2374 f: &mut dyn ::core::ops::FnMut(
2375 &::buffa_descriptor::FieldDescriptor,
2376 ::buffa_descriptor::reflect::ValueRef<'_>,
2377 ),
2378 ) {
2379 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2380 self,
2381 );
2382 for fd in md.fields() {
2383 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2384 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2385 }
2386 }
2387 }
2388 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2389 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2390 ::buffa_descriptor::reflect::DynamicMessage::decode(
2391 ::buffa::alloc::sync::Arc::clone(
2392 super::super::__buffa::reflect::descriptor_pool(),
2393 ),
2394 Self::__buffa_reflect_message_index(),
2395 &bytes,
2396 )
2397 .expect("view re-encodes to bytes decodable against its own descriptor")
2398 }
2399 }
2400 impl<'a> ::buffa_descriptor::reflect::ReflectElement for BoolValueView<'a> {
2401 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2402 ::buffa_descriptor::reflect::ValueRef::Message(
2403 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2404 )
2405 }
2406 }
2407 impl<'a> BoolValueView<'a> {
2408 #[doc(hidden)]
2413 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2414 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2415 *IDX
2416 .get_or_init(|| {
2417 super::super::__buffa::reflect::descriptor_pool()
2418 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2419 .expect(
2420 "generated view type is registered in the embedded descriptor pool",
2421 )
2422 })
2423 }
2424 }
2425};
2426#[derive(Clone, Debug, Default)]
2430pub struct StringValueView<'a> {
2431 pub value: &'a str,
2435 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2436}
2437impl<'a> StringValueView<'a> {
2438 #[doc(hidden)]
2446 pub fn _decode_depth(
2447 buf: &'a [u8],
2448 depth: u32,
2449 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2450 let mut view = Self::default();
2451 view._merge_into_view(buf, depth)?;
2452 ::core::result::Result::Ok(view)
2453 }
2454 #[doc(hidden)]
2462 pub fn _merge_into_view(
2463 &mut self,
2464 buf: &'a [u8],
2465 depth: u32,
2466 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2467 let _ = depth;
2468 #[allow(unused_variables)]
2469 let view = self;
2470 let mut cur: &'a [u8] = buf;
2471 while !cur.is_empty() {
2472 let before_tag = cur;
2473 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2474 match tag.field_number() {
2475 1u32 => {
2476 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2477 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2478 field_number: 1u32,
2479 expected: 2u8,
2480 actual: tag.wire_type() as u8,
2481 });
2482 }
2483 view.value = ::buffa::types::borrow_str(&mut cur)?;
2484 }
2485 _ => {
2486 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2487 let span_len = before_tag.len() - cur.len();
2488 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2489 }
2490 }
2491 }
2492 ::core::result::Result::Ok(())
2493 }
2494}
2495impl<'a> ::buffa::MessageView<'a> for StringValueView<'a> {
2496 type Owned = super::super::StringValue;
2497 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2498 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2499 }
2500 fn decode_view_with_limit(
2501 buf: &'a [u8],
2502 depth: u32,
2503 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2504 Self::_decode_depth(buf, depth)
2505 }
2506 fn to_owned_message(&self) -> super::super::StringValue {
2507 self.to_owned_from_source(None)
2508 }
2509 #[allow(clippy::useless_conversion, clippy::needless_update)]
2510 fn to_owned_from_source(
2511 &self,
2512 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2513 ) -> super::super::StringValue {
2514 #[allow(unused_imports)]
2515 use ::buffa::alloc::string::ToString as _;
2516 let _ = __buffa_src;
2517 super::super::StringValue {
2518 value: self.value.to_string(),
2519 __buffa_unknown_fields: self
2520 .__buffa_unknown_fields
2521 .to_owned()
2522 .unwrap_or_default()
2523 .into(),
2524 ..::core::default::Default::default()
2525 }
2526 }
2527}
2528impl<'a> ::buffa::ViewEncode<'a> for StringValueView<'a> {
2529 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2530 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2531 #[allow(unused_imports)]
2532 use ::buffa::Enumeration as _;
2533 let mut size = 0u32;
2534 if !self.value.is_empty() {
2535 size += 1u32 + ::buffa::types::string_encoded_len(&self.value) as u32;
2536 }
2537 size += self.__buffa_unknown_fields.encoded_len() as u32;
2538 size
2539 }
2540 #[allow(clippy::needless_borrow)]
2541 fn write_to(
2542 &self,
2543 _cache: &mut ::buffa::SizeCache,
2544 buf: &mut impl ::buffa::bytes::BufMut,
2545 ) {
2546 #[allow(unused_imports)]
2547 use ::buffa::Enumeration as _;
2548 if !self.value.is_empty() {
2549 ::buffa::encoding::Tag::new(
2550 1u32,
2551 ::buffa::encoding::WireType::LengthDelimited,
2552 )
2553 .encode(buf);
2554 ::buffa::types::encode_string(&self.value, buf);
2555 }
2556 self.__buffa_unknown_fields.write_to(buf);
2557 }
2558}
2559impl<'a> ::buffa::MessageName for StringValueView<'a> {
2560 const PACKAGE: &'static str = "google.protobuf";
2561 const NAME: &'static str = "StringValue";
2562 const FULL_NAME: &'static str = "google.protobuf.StringValue";
2563 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.StringValue";
2564}
2565impl<'v> ::buffa::DefaultViewInstance for StringValueView<'v> {
2566 fn default_view_instance<'a>() -> &'a Self
2567 where
2568 Self: 'a,
2569 {
2570 static VALUE: ::buffa::__private::OnceBox<StringValueView<'static>> = ::buffa::__private::OnceBox::new();
2571 VALUE
2572 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
2573 <StringValueView<'static>>::default(),
2574 ))
2575 }
2576}
2577impl ::buffa::ViewReborrow for StringValueView<'static> {
2578 type Reborrowed<'b> = StringValueView<'b>;
2579 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
2580 this
2581 }
2582}
2583#[derive(Clone, Debug)]
2589pub struct StringValueOwnedView(::buffa::OwnedView<StringValueView<'static>>);
2590impl StringValueOwnedView {
2591 pub fn decode(
2601 bytes: ::buffa::bytes::Bytes,
2602 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2603 ::core::result::Result::Ok(
2604 StringValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2605 )
2606 }
2607 pub fn decode_with_options(
2615 bytes: ::buffa::bytes::Bytes,
2616 opts: &::buffa::DecodeOptions,
2617 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2618 ::core::result::Result::Ok(
2619 StringValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2620 )
2621 }
2622 pub fn from_owned(
2629 msg: &super::super::StringValue,
2630 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2631 ::core::result::Result::Ok(
2632 StringValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2633 )
2634 }
2635 #[must_use]
2637 pub fn view(&self) -> &StringValueView<'_> {
2638 self.0.reborrow()
2639 }
2640 #[must_use]
2642 pub fn to_owned_message(&self) -> super::super::StringValue {
2643 self.0.to_owned_message()
2644 }
2645 #[must_use]
2647 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2648 self.0.bytes()
2649 }
2650 #[must_use]
2652 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2653 self.0.into_bytes()
2654 }
2655 #[must_use]
2659 pub fn value(&self) -> &'_ str {
2660 self.0.reborrow().value
2661 }
2662}
2663impl ::core::convert::From<::buffa::OwnedView<StringValueView<'static>>>
2664for StringValueOwnedView {
2665 fn from(inner: ::buffa::OwnedView<StringValueView<'static>>) -> Self {
2666 StringValueOwnedView(inner)
2667 }
2668}
2669impl ::core::convert::From<StringValueOwnedView>
2670for ::buffa::OwnedView<StringValueView<'static>> {
2671 fn from(wrapper: StringValueOwnedView) -> Self {
2672 wrapper.0
2673 }
2674}
2675impl ::core::convert::AsRef<::buffa::OwnedView<StringValueView<'static>>>
2676for StringValueOwnedView {
2677 fn as_ref(&self) -> &::buffa::OwnedView<StringValueView<'static>> {
2678 &self.0
2679 }
2680}
2681impl ::buffa::HasMessageView for super::super::StringValue {
2682 type View<'a> = StringValueView<'a>;
2683 type ViewHandle = StringValueOwnedView;
2684}
2685#[cfg(feature = "reflect")]
2686const _: () = {
2687 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for StringValueView<'a> {
2688 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2689 super::super::__buffa::reflect::descriptor_pool()
2690 .message(Self::__buffa_reflect_message_index())
2691 }
2692 fn pool(
2693 &self,
2694 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2695 super::super::__buffa::reflect::descriptor_pool()
2696 }
2697 fn get(
2698 &self,
2699 field: &::buffa_descriptor::FieldDescriptor,
2700 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2701 #[allow(unused_imports)]
2702 use ::buffa::Enumeration as _;
2703 match field.number() {
2704 1u32 => ::buffa_descriptor::reflect::ValueRef::String(self.value),
2705 _ => {
2706 ::core::debug_assert!(
2707 false,
2708 "field number {} is not a member of this view's reflect get()",
2709 field.number(),
2710 );
2711 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2712 }
2713 }
2714 }
2715 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2716 match field.number() {
2717 1u32 => !self.value.is_empty(),
2718 _ => false,
2719 }
2720 }
2721 fn for_each_set(
2722 &self,
2723 f: &mut dyn ::core::ops::FnMut(
2724 &::buffa_descriptor::FieldDescriptor,
2725 ::buffa_descriptor::reflect::ValueRef<'_>,
2726 ),
2727 ) {
2728 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2729 self,
2730 );
2731 for fd in md.fields() {
2732 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2733 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2734 }
2735 }
2736 }
2737 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2738 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2739 ::buffa_descriptor::reflect::DynamicMessage::decode(
2740 ::buffa::alloc::sync::Arc::clone(
2741 super::super::__buffa::reflect::descriptor_pool(),
2742 ),
2743 Self::__buffa_reflect_message_index(),
2744 &bytes,
2745 )
2746 .expect("view re-encodes to bytes decodable against its own descriptor")
2747 }
2748 }
2749 impl<'a> ::buffa_descriptor::reflect::ReflectElement for StringValueView<'a> {
2750 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2751 ::buffa_descriptor::reflect::ValueRef::Message(
2752 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2753 )
2754 }
2755 }
2756 impl<'a> StringValueView<'a> {
2757 #[doc(hidden)]
2762 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2763 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2764 *IDX
2765 .get_or_init(|| {
2766 super::super::__buffa::reflect::descriptor_pool()
2767 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2768 .expect(
2769 "generated view type is registered in the embedded descriptor pool",
2770 )
2771 })
2772 }
2773 }
2774};
2775#[derive(Clone, Debug, Default)]
2779pub struct BytesValueView<'a> {
2780 pub value: &'a [u8],
2784 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2785}
2786impl<'a> BytesValueView<'a> {
2787 #[doc(hidden)]
2795 pub fn _decode_depth(
2796 buf: &'a [u8],
2797 depth: u32,
2798 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2799 let mut view = Self::default();
2800 view._merge_into_view(buf, depth)?;
2801 ::core::result::Result::Ok(view)
2802 }
2803 #[doc(hidden)]
2811 pub fn _merge_into_view(
2812 &mut self,
2813 buf: &'a [u8],
2814 depth: u32,
2815 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2816 let _ = depth;
2817 #[allow(unused_variables)]
2818 let view = self;
2819 let mut cur: &'a [u8] = buf;
2820 while !cur.is_empty() {
2821 let before_tag = cur;
2822 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
2823 match tag.field_number() {
2824 1u32 => {
2825 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2826 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2827 field_number: 1u32,
2828 expected: 2u8,
2829 actual: tag.wire_type() as u8,
2830 });
2831 }
2832 view.value = ::buffa::types::borrow_bytes(&mut cur)?;
2833 }
2834 _ => {
2835 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
2836 let span_len = before_tag.len() - cur.len();
2837 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
2838 }
2839 }
2840 }
2841 ::core::result::Result::Ok(())
2842 }
2843}
2844impl<'a> ::buffa::MessageView<'a> for BytesValueView<'a> {
2845 type Owned = super::super::BytesValue;
2846 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2847 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
2848 }
2849 fn decode_view_with_limit(
2850 buf: &'a [u8],
2851 depth: u32,
2852 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2853 Self::_decode_depth(buf, depth)
2854 }
2855 fn to_owned_message(&self) -> super::super::BytesValue {
2856 self.to_owned_from_source(None)
2857 }
2858 #[allow(clippy::useless_conversion, clippy::needless_update)]
2859 fn to_owned_from_source(
2860 &self,
2861 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2862 ) -> super::super::BytesValue {
2863 #[allow(unused_imports)]
2864 use ::buffa::alloc::string::ToString as _;
2865 let _ = __buffa_src;
2866 super::super::BytesValue {
2867 value: (self.value).to_vec(),
2868 __buffa_unknown_fields: self
2869 .__buffa_unknown_fields
2870 .to_owned()
2871 .unwrap_or_default()
2872 .into(),
2873 ..::core::default::Default::default()
2874 }
2875 }
2876}
2877impl<'a> ::buffa::ViewEncode<'a> for BytesValueView<'a> {
2878 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2879 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2880 #[allow(unused_imports)]
2881 use ::buffa::Enumeration as _;
2882 let mut size = 0u32;
2883 if !self.value.is_empty() {
2884 size += 1u32 + ::buffa::types::bytes_encoded_len(&self.value) as u32;
2885 }
2886 size += self.__buffa_unknown_fields.encoded_len() as u32;
2887 size
2888 }
2889 #[allow(clippy::needless_borrow)]
2890 fn write_to(
2891 &self,
2892 _cache: &mut ::buffa::SizeCache,
2893 buf: &mut impl ::buffa::bytes::BufMut,
2894 ) {
2895 #[allow(unused_imports)]
2896 use ::buffa::Enumeration as _;
2897 if !self.value.is_empty() {
2898 ::buffa::encoding::Tag::new(
2899 1u32,
2900 ::buffa::encoding::WireType::LengthDelimited,
2901 )
2902 .encode(buf);
2903 ::buffa::types::encode_bytes(&self.value, buf);
2904 }
2905 self.__buffa_unknown_fields.write_to(buf);
2906 }
2907}
2908impl<'a> ::buffa::MessageName for BytesValueView<'a> {
2909 const PACKAGE: &'static str = "google.protobuf";
2910 const NAME: &'static str = "BytesValue";
2911 const FULL_NAME: &'static str = "google.protobuf.BytesValue";
2912 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BytesValue";
2913}
2914impl<'v> ::buffa::DefaultViewInstance for BytesValueView<'v> {
2915 fn default_view_instance<'a>() -> &'a Self
2916 where
2917 Self: 'a,
2918 {
2919 static VALUE: ::buffa::__private::OnceBox<BytesValueView<'static>> = ::buffa::__private::OnceBox::new();
2920 VALUE
2921 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
2922 <BytesValueView<'static>>::default(),
2923 ))
2924 }
2925}
2926impl ::buffa::ViewReborrow for BytesValueView<'static> {
2927 type Reborrowed<'b> = BytesValueView<'b>;
2928 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
2929 this
2930 }
2931}
2932#[derive(Clone, Debug)]
2938pub struct BytesValueOwnedView(::buffa::OwnedView<BytesValueView<'static>>);
2939impl BytesValueOwnedView {
2940 pub fn decode(
2950 bytes: ::buffa::bytes::Bytes,
2951 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2952 ::core::result::Result::Ok(
2953 BytesValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2954 )
2955 }
2956 pub fn decode_with_options(
2964 bytes: ::buffa::bytes::Bytes,
2965 opts: &::buffa::DecodeOptions,
2966 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2967 ::core::result::Result::Ok(
2968 BytesValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2969 )
2970 }
2971 pub fn from_owned(
2978 msg: &super::super::BytesValue,
2979 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2980 ::core::result::Result::Ok(
2981 BytesValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2982 )
2983 }
2984 #[must_use]
2986 pub fn view(&self) -> &BytesValueView<'_> {
2987 self.0.reborrow()
2988 }
2989 #[must_use]
2991 pub fn to_owned_message(&self) -> super::super::BytesValue {
2992 self.0.to_owned_message()
2993 }
2994 #[must_use]
2996 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2997 self.0.bytes()
2998 }
2999 #[must_use]
3001 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3002 self.0.into_bytes()
3003 }
3004 #[must_use]
3008 pub fn value(&self) -> &'_ [u8] {
3009 self.0.reborrow().value
3010 }
3011}
3012impl ::core::convert::From<::buffa::OwnedView<BytesValueView<'static>>>
3013for BytesValueOwnedView {
3014 fn from(inner: ::buffa::OwnedView<BytesValueView<'static>>) -> Self {
3015 BytesValueOwnedView(inner)
3016 }
3017}
3018impl ::core::convert::From<BytesValueOwnedView>
3019for ::buffa::OwnedView<BytesValueView<'static>> {
3020 fn from(wrapper: BytesValueOwnedView) -> Self {
3021 wrapper.0
3022 }
3023}
3024impl ::core::convert::AsRef<::buffa::OwnedView<BytesValueView<'static>>>
3025for BytesValueOwnedView {
3026 fn as_ref(&self) -> &::buffa::OwnedView<BytesValueView<'static>> {
3027 &self.0
3028 }
3029}
3030impl ::buffa::HasMessageView for super::super::BytesValue {
3031 type View<'a> = BytesValueView<'a>;
3032 type ViewHandle = BytesValueOwnedView;
3033}
3034#[cfg(feature = "reflect")]
3035const _: () = {
3036 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BytesValueView<'a> {
3037 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
3038 super::super::__buffa::reflect::descriptor_pool()
3039 .message(Self::__buffa_reflect_message_index())
3040 }
3041 fn pool(
3042 &self,
3043 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
3044 super::super::__buffa::reflect::descriptor_pool()
3045 }
3046 fn get(
3047 &self,
3048 field: &::buffa_descriptor::FieldDescriptor,
3049 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
3050 #[allow(unused_imports)]
3051 use ::buffa::Enumeration as _;
3052 match field.number() {
3053 1u32 => ::buffa_descriptor::reflect::ValueRef::Bytes(self.value),
3054 _ => {
3055 ::core::debug_assert!(
3056 false,
3057 "field number {} is not a member of this view's reflect get()",
3058 field.number(),
3059 );
3060 ::buffa_descriptor::reflect::ValueRef::Bool(false)
3061 }
3062 }
3063 }
3064 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
3065 match field.number() {
3066 1u32 => !self.value.is_empty(),
3067 _ => false,
3068 }
3069 }
3070 fn for_each_set(
3071 &self,
3072 f: &mut dyn ::core::ops::FnMut(
3073 &::buffa_descriptor::FieldDescriptor,
3074 ::buffa_descriptor::reflect::ValueRef<'_>,
3075 ),
3076 ) {
3077 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
3078 self,
3079 );
3080 for fd in md.fields() {
3081 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
3082 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
3083 }
3084 }
3085 }
3086 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
3087 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
3088 ::buffa_descriptor::reflect::DynamicMessage::decode(
3089 ::buffa::alloc::sync::Arc::clone(
3090 super::super::__buffa::reflect::descriptor_pool(),
3091 ),
3092 Self::__buffa_reflect_message_index(),
3093 &bytes,
3094 )
3095 .expect("view re-encodes to bytes decodable against its own descriptor")
3096 }
3097 }
3098 impl<'a> ::buffa_descriptor::reflect::ReflectElement for BytesValueView<'a> {
3099 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
3100 ::buffa_descriptor::reflect::ValueRef::Message(
3101 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
3102 )
3103 }
3104 }
3105 impl<'a> BytesValueView<'a> {
3106 #[doc(hidden)]
3111 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
3112 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
3113 *IDX
3114 .get_or_init(|| {
3115 super::super::__buffa::reflect::descriptor_pool()
3116 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
3117 .expect(
3118 "generated view type is registered in the embedded descriptor pool",
3119 )
3120 })
3121 }
3122 }
3123};