1#[derive(Clone, Debug, Default)]
8pub struct DoubleValueView<'a> {
9 pub value: f64,
13 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
14}
15impl<'a> ::buffa::MessageView<'a> for DoubleValueView<'a> {
16 type Owned = super::super::DoubleValue;
17 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
18 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
19 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
20 <Self as ::buffa::MessageView>::decode_view_ctx(
21 buf,
22 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
23 .with_element_memory(&__elem),
24 )
25 }
26 fn decode_view_with_ctx(
27 buf: &'a [u8],
28 ctx: ::buffa::DecodeContext<'_>,
29 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
30 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
31 }
32 #[inline]
33 fn merge_view_field(
34 &mut self,
35 tag: ::buffa::encoding::Tag,
36 cur: &'a [u8],
37 before_tag: &'a [u8],
38 ctx: ::buffa::DecodeContext<'_>,
39 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
40 let _ = ctx;
41 #[allow(unused_variables)]
42 let view = self;
43 let mut cur = cur;
44 match tag.field_number() {
45 1u32 => {
46 ::buffa::encoding::check_wire_type(
47 tag,
48 ::buffa::encoding::WireType::Fixed64,
49 )?;
50 view.value = ::buffa::types::decode_double(&mut cur)?;
51 }
52 _ => {
53 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
54 let span_len = before_tag.len() - cur.len();
55 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
56 }
57 }
58 ::core::result::Result::Ok(cur)
59 }
60 fn to_owned_message(
61 &self,
62 ) -> ::core::result::Result<super::super::DoubleValue, ::buffa::DecodeError> {
63 self.to_owned_from_source(None)
64 }
65 #[allow(clippy::useless_conversion, clippy::needless_update)]
66 fn to_owned_from_source(
67 &self,
68 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
69 ) -> ::core::result::Result<super::super::DoubleValue, ::buffa::DecodeError> {
70 #[allow(unused_imports)]
71 use ::buffa::alloc::string::ToString as _;
72 let _ = __buffa_src;
73 ::core::result::Result::Ok(super::super::DoubleValue {
74 value: self.value,
75 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
76 ..::core::default::Default::default()
77 })
78 }
79}
80impl<'a> ::buffa::ViewEncode<'a> for DoubleValueView<'a> {
81 #[allow(clippy::needless_borrow, clippy::let_and_return)]
82 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
83 #[allow(unused_imports)]
84 use ::buffa::Enumeration as _;
85 let mut size = 0u64;
86 if self.value.to_bits() != 0u64 {
87 size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64;
88 }
89 size += self.__buffa_unknown_fields.encoded_len() as u64;
90 ::buffa::saturate_size(size)
91 }
92 #[allow(clippy::needless_borrow)]
93 fn write_to(
94 &self,
95 _cache: &mut ::buffa::SizeCache,
96 buf: &mut impl ::buffa::EncodeSink,
97 ) {
98 #[allow(unused_imports)]
99 use ::buffa::Enumeration as _;
100 if self.value.to_bits() != 0u64 {
101 ::buffa::types::put_double_field(1u32, self.value, buf);
102 }
103 self.__buffa_unknown_fields.write_to(buf);
104 }
105}
106impl<'a> ::buffa::MessageName for DoubleValueView<'a> {
107 const PACKAGE: &'static str = "google.protobuf";
108 const NAME: &'static str = "DoubleValue";
109 const FULL_NAME: &'static str = "google.protobuf.DoubleValue";
110 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DoubleValue";
111}
112::buffa::impl_default_view_instance!(DoubleValueView);
113::buffa::impl_view_reborrow!(DoubleValueView);
114#[derive(Clone, Debug)]
120pub struct DoubleValueOwnedView(::buffa::OwnedView<DoubleValueView<'static>>);
121impl DoubleValueOwnedView {
122 pub fn decode(
132 bytes: ::buffa::bytes::Bytes,
133 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
134 ::core::result::Result::Ok(
135 DoubleValueOwnedView(::buffa::OwnedView::decode(bytes)?),
136 )
137 }
138 pub fn decode_with_options(
146 bytes: ::buffa::bytes::Bytes,
147 opts: &::buffa::DecodeOptions,
148 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
149 ::core::result::Result::Ok(
150 DoubleValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
151 )
152 }
153 pub fn from_owned(
162 msg: &super::super::DoubleValue,
163 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
164 ::core::result::Result::Ok(
165 DoubleValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
166 )
167 }
168 #[must_use]
170 pub fn view(&self) -> &DoubleValueView<'_> {
171 self.0.reborrow()
172 }
173 #[must_use]
181 pub fn to_owned_message(&self) -> super::super::DoubleValue {
182 self.0.to_owned_message()
183 }
184 #[must_use]
186 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
187 self.0.bytes()
188 }
189 #[must_use]
191 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
192 self.0.into_bytes()
193 }
194 #[must_use]
198 pub fn value(&self) -> f64 {
199 self.0.reborrow().value
200 }
201}
202impl ::core::convert::From<::buffa::OwnedView<DoubleValueView<'static>>>
203for DoubleValueOwnedView {
204 fn from(inner: ::buffa::OwnedView<DoubleValueView<'static>>) -> Self {
205 DoubleValueOwnedView(inner)
206 }
207}
208impl ::core::convert::From<DoubleValueOwnedView>
209for ::buffa::OwnedView<DoubleValueView<'static>> {
210 fn from(wrapper: DoubleValueOwnedView) -> Self {
211 wrapper.0
212 }
213}
214impl ::core::convert::AsRef<::buffa::OwnedView<DoubleValueView<'static>>>
215for DoubleValueOwnedView {
216 fn as_ref(&self) -> &::buffa::OwnedView<DoubleValueView<'static>> {
217 &self.0
218 }
219}
220impl ::buffa::HasMessageView for super::super::DoubleValue {
221 type View<'a> = DoubleValueView<'a>;
222 type ViewHandle = DoubleValueOwnedView;
223}
224#[cfg(feature = "reflect")]
225const _: () = {
226 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for DoubleValueView<'a> {
227 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
228 super::super::__buffa::reflect::descriptor_pool()
229 .message(Self::__buffa_reflect_message_index())
230 }
231 fn pool(
232 &self,
233 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
234 super::super::__buffa::reflect::descriptor_pool()
235 }
236 fn get(
237 &self,
238 field: &::buffa_descriptor::FieldDescriptor,
239 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
240 #[allow(unused_imports)]
241 use ::buffa::Enumeration as _;
242 match field.number() {
243 1u32 => ::buffa_descriptor::reflect::ValueRef::F64(self.value),
244 _ => {
245 ::core::debug_assert!(
246 false,
247 "field number {} is not a member of this view's reflect get()",
248 field.number(),
249 );
250 ::buffa_descriptor::reflect::ValueRef::Bool(false)
251 }
252 }
253 }
254 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
255 match field.number() {
256 1u32 => self.value != 0.0,
257 _ => false,
258 }
259 }
260 fn for_each_set(
261 &self,
262 f: &mut dyn ::core::ops::FnMut(
263 &::buffa_descriptor::FieldDescriptor,
264 ::buffa_descriptor::reflect::ValueRef<'_>,
265 ),
266 ) {
267 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
268 self,
269 );
270 for fd in md.fields() {
271 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
272 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
273 }
274 }
275 }
276 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
277 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
278 let options = ::buffa::DecodeOptions::new()
279 .with_element_memory_limit(
280 bytes
281 .len()
282 .saturating_mul(128)
283 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
284 )
285 .with_unknown_field_limit(
286 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
287 );
288 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
289 ::buffa::alloc::sync::Arc::clone(
290 super::super::__buffa::reflect::descriptor_pool(),
291 ),
292 Self::__buffa_reflect_message_index(),
293 &bytes,
294 &options,
295 )
296 .expect("view re-encodes to bytes decodable against its own descriptor")
297 }
298 }
299 impl<'a> ::buffa_descriptor::reflect::ReflectElement for DoubleValueView<'a> {
300 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
301 ::buffa_descriptor::reflect::ValueRef::Message(
302 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
303 )
304 }
305 }
306 impl<'a> DoubleValueView<'a> {
307 #[doc(hidden)]
312 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
313 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
314 *IDX
315 .get_or_init(|| {
316 super::super::__buffa::reflect::descriptor_pool()
317 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
318 .expect(
319 "generated view type is registered in the embedded descriptor pool",
320 )
321 })
322 }
323 }
324};
325#[derive(Clone, Debug, Default)]
329pub struct FloatValueView<'a> {
330 pub value: f32,
334 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
335}
336impl<'a> ::buffa::MessageView<'a> for FloatValueView<'a> {
337 type Owned = super::super::FloatValue;
338 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
339 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
340 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
341 <Self as ::buffa::MessageView>::decode_view_ctx(
342 buf,
343 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
344 .with_element_memory(&__elem),
345 )
346 }
347 fn decode_view_with_ctx(
348 buf: &'a [u8],
349 ctx: ::buffa::DecodeContext<'_>,
350 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
351 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
352 }
353 #[inline]
354 fn merge_view_field(
355 &mut self,
356 tag: ::buffa::encoding::Tag,
357 cur: &'a [u8],
358 before_tag: &'a [u8],
359 ctx: ::buffa::DecodeContext<'_>,
360 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
361 let _ = ctx;
362 #[allow(unused_variables)]
363 let view = self;
364 let mut cur = cur;
365 match tag.field_number() {
366 1u32 => {
367 ::buffa::encoding::check_wire_type(
368 tag,
369 ::buffa::encoding::WireType::Fixed32,
370 )?;
371 view.value = ::buffa::types::decode_float(&mut cur)?;
372 }
373 _ => {
374 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
375 let span_len = before_tag.len() - cur.len();
376 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
377 }
378 }
379 ::core::result::Result::Ok(cur)
380 }
381 fn to_owned_message(
382 &self,
383 ) -> ::core::result::Result<super::super::FloatValue, ::buffa::DecodeError> {
384 self.to_owned_from_source(None)
385 }
386 #[allow(clippy::useless_conversion, clippy::needless_update)]
387 fn to_owned_from_source(
388 &self,
389 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
390 ) -> ::core::result::Result<super::super::FloatValue, ::buffa::DecodeError> {
391 #[allow(unused_imports)]
392 use ::buffa::alloc::string::ToString as _;
393 let _ = __buffa_src;
394 ::core::result::Result::Ok(super::super::FloatValue {
395 value: self.value,
396 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
397 ..::core::default::Default::default()
398 })
399 }
400}
401impl<'a> ::buffa::ViewEncode<'a> for FloatValueView<'a> {
402 #[allow(clippy::needless_borrow, clippy::let_and_return)]
403 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
404 #[allow(unused_imports)]
405 use ::buffa::Enumeration as _;
406 let mut size = 0u64;
407 if self.value.to_bits() != 0u32 {
408 size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64;
409 }
410 size += self.__buffa_unknown_fields.encoded_len() as u64;
411 ::buffa::saturate_size(size)
412 }
413 #[allow(clippy::needless_borrow)]
414 fn write_to(
415 &self,
416 _cache: &mut ::buffa::SizeCache,
417 buf: &mut impl ::buffa::EncodeSink,
418 ) {
419 #[allow(unused_imports)]
420 use ::buffa::Enumeration as _;
421 if self.value.to_bits() != 0u32 {
422 ::buffa::types::put_float_field(1u32, self.value, buf);
423 }
424 self.__buffa_unknown_fields.write_to(buf);
425 }
426}
427impl<'a> ::buffa::MessageName for FloatValueView<'a> {
428 const PACKAGE: &'static str = "google.protobuf";
429 const NAME: &'static str = "FloatValue";
430 const FULL_NAME: &'static str = "google.protobuf.FloatValue";
431 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FloatValue";
432}
433::buffa::impl_default_view_instance!(FloatValueView);
434::buffa::impl_view_reborrow!(FloatValueView);
435#[derive(Clone, Debug)]
441pub struct FloatValueOwnedView(::buffa::OwnedView<FloatValueView<'static>>);
442impl FloatValueOwnedView {
443 pub fn decode(
453 bytes: ::buffa::bytes::Bytes,
454 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
455 ::core::result::Result::Ok(
456 FloatValueOwnedView(::buffa::OwnedView::decode(bytes)?),
457 )
458 }
459 pub fn decode_with_options(
467 bytes: ::buffa::bytes::Bytes,
468 opts: &::buffa::DecodeOptions,
469 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
470 ::core::result::Result::Ok(
471 FloatValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
472 )
473 }
474 pub fn from_owned(
483 msg: &super::super::FloatValue,
484 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
485 ::core::result::Result::Ok(
486 FloatValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
487 )
488 }
489 #[must_use]
491 pub fn view(&self) -> &FloatValueView<'_> {
492 self.0.reborrow()
493 }
494 #[must_use]
502 pub fn to_owned_message(&self) -> super::super::FloatValue {
503 self.0.to_owned_message()
504 }
505 #[must_use]
507 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
508 self.0.bytes()
509 }
510 #[must_use]
512 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
513 self.0.into_bytes()
514 }
515 #[must_use]
519 pub fn value(&self) -> f32 {
520 self.0.reborrow().value
521 }
522}
523impl ::core::convert::From<::buffa::OwnedView<FloatValueView<'static>>>
524for FloatValueOwnedView {
525 fn from(inner: ::buffa::OwnedView<FloatValueView<'static>>) -> Self {
526 FloatValueOwnedView(inner)
527 }
528}
529impl ::core::convert::From<FloatValueOwnedView>
530for ::buffa::OwnedView<FloatValueView<'static>> {
531 fn from(wrapper: FloatValueOwnedView) -> Self {
532 wrapper.0
533 }
534}
535impl ::core::convert::AsRef<::buffa::OwnedView<FloatValueView<'static>>>
536for FloatValueOwnedView {
537 fn as_ref(&self) -> &::buffa::OwnedView<FloatValueView<'static>> {
538 &self.0
539 }
540}
541impl ::buffa::HasMessageView for super::super::FloatValue {
542 type View<'a> = FloatValueView<'a>;
543 type ViewHandle = FloatValueOwnedView;
544}
545#[cfg(feature = "reflect")]
546const _: () = {
547 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for FloatValueView<'a> {
548 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
549 super::super::__buffa::reflect::descriptor_pool()
550 .message(Self::__buffa_reflect_message_index())
551 }
552 fn pool(
553 &self,
554 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
555 super::super::__buffa::reflect::descriptor_pool()
556 }
557 fn get(
558 &self,
559 field: &::buffa_descriptor::FieldDescriptor,
560 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
561 #[allow(unused_imports)]
562 use ::buffa::Enumeration as _;
563 match field.number() {
564 1u32 => ::buffa_descriptor::reflect::ValueRef::F32(self.value),
565 _ => {
566 ::core::debug_assert!(
567 false,
568 "field number {} is not a member of this view's reflect get()",
569 field.number(),
570 );
571 ::buffa_descriptor::reflect::ValueRef::Bool(false)
572 }
573 }
574 }
575 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
576 match field.number() {
577 1u32 => self.value != 0.0,
578 _ => false,
579 }
580 }
581 fn for_each_set(
582 &self,
583 f: &mut dyn ::core::ops::FnMut(
584 &::buffa_descriptor::FieldDescriptor,
585 ::buffa_descriptor::reflect::ValueRef<'_>,
586 ),
587 ) {
588 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
589 self,
590 );
591 for fd in md.fields() {
592 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
593 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
594 }
595 }
596 }
597 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
598 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
599 let options = ::buffa::DecodeOptions::new()
600 .with_element_memory_limit(
601 bytes
602 .len()
603 .saturating_mul(128)
604 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
605 )
606 .with_unknown_field_limit(
607 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
608 );
609 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
610 ::buffa::alloc::sync::Arc::clone(
611 super::super::__buffa::reflect::descriptor_pool(),
612 ),
613 Self::__buffa_reflect_message_index(),
614 &bytes,
615 &options,
616 )
617 .expect("view re-encodes to bytes decodable against its own descriptor")
618 }
619 }
620 impl<'a> ::buffa_descriptor::reflect::ReflectElement for FloatValueView<'a> {
621 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
622 ::buffa_descriptor::reflect::ValueRef::Message(
623 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
624 )
625 }
626 }
627 impl<'a> FloatValueView<'a> {
628 #[doc(hidden)]
633 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
634 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
635 *IDX
636 .get_or_init(|| {
637 super::super::__buffa::reflect::descriptor_pool()
638 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
639 .expect(
640 "generated view type is registered in the embedded descriptor pool",
641 )
642 })
643 }
644 }
645};
646#[derive(Clone, Debug, Default)]
650pub struct Int64ValueView<'a> {
651 pub value: i64,
655 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
656}
657impl<'a> ::buffa::MessageView<'a> for Int64ValueView<'a> {
658 type Owned = super::super::Int64Value;
659 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
660 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
661 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
662 <Self as ::buffa::MessageView>::decode_view_ctx(
663 buf,
664 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
665 .with_element_memory(&__elem),
666 )
667 }
668 fn decode_view_with_ctx(
669 buf: &'a [u8],
670 ctx: ::buffa::DecodeContext<'_>,
671 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
672 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
673 }
674 #[inline]
675 fn merge_view_field(
676 &mut self,
677 tag: ::buffa::encoding::Tag,
678 cur: &'a [u8],
679 before_tag: &'a [u8],
680 ctx: ::buffa::DecodeContext<'_>,
681 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
682 let _ = ctx;
683 #[allow(unused_variables)]
684 let view = self;
685 let mut cur = cur;
686 match tag.field_number() {
687 1u32 => {
688 ::buffa::encoding::check_wire_type(
689 tag,
690 ::buffa::encoding::WireType::Varint,
691 )?;
692 view.value = ::buffa::types::decode_int64(&mut cur)?;
693 }
694 _ => {
695 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
696 let span_len = before_tag.len() - cur.len();
697 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
698 }
699 }
700 ::core::result::Result::Ok(cur)
701 }
702 fn to_owned_message(
703 &self,
704 ) -> ::core::result::Result<super::super::Int64Value, ::buffa::DecodeError> {
705 self.to_owned_from_source(None)
706 }
707 #[allow(clippy::useless_conversion, clippy::needless_update)]
708 fn to_owned_from_source(
709 &self,
710 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
711 ) -> ::core::result::Result<super::super::Int64Value, ::buffa::DecodeError> {
712 #[allow(unused_imports)]
713 use ::buffa::alloc::string::ToString as _;
714 let _ = __buffa_src;
715 ::core::result::Result::Ok(super::super::Int64Value {
716 value: self.value,
717 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
718 ..::core::default::Default::default()
719 })
720 }
721}
722impl<'a> ::buffa::ViewEncode<'a> for Int64ValueView<'a> {
723 #[allow(clippy::needless_borrow, clippy::let_and_return)]
724 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
725 #[allow(unused_imports)]
726 use ::buffa::Enumeration as _;
727 let mut size = 0u64;
728 if self.value != 0i64 {
729 size += 1u64 + ::buffa::types::int64_encoded_len(self.value) as u64;
730 }
731 size += self.__buffa_unknown_fields.encoded_len() as u64;
732 ::buffa::saturate_size(size)
733 }
734 #[allow(clippy::needless_borrow)]
735 fn write_to(
736 &self,
737 _cache: &mut ::buffa::SizeCache,
738 buf: &mut impl ::buffa::EncodeSink,
739 ) {
740 #[allow(unused_imports)]
741 use ::buffa::Enumeration as _;
742 if self.value != 0i64 {
743 ::buffa::types::put_int64_field(1u32, self.value, buf);
744 }
745 self.__buffa_unknown_fields.write_to(buf);
746 }
747}
748impl<'a> ::buffa::MessageName for Int64ValueView<'a> {
749 const PACKAGE: &'static str = "google.protobuf";
750 const NAME: &'static str = "Int64Value";
751 const FULL_NAME: &'static str = "google.protobuf.Int64Value";
752 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int64Value";
753}
754::buffa::impl_default_view_instance!(Int64ValueView);
755::buffa::impl_view_reborrow!(Int64ValueView);
756#[derive(Clone, Debug)]
762pub struct Int64ValueOwnedView(::buffa::OwnedView<Int64ValueView<'static>>);
763impl Int64ValueOwnedView {
764 pub fn decode(
774 bytes: ::buffa::bytes::Bytes,
775 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
776 ::core::result::Result::Ok(
777 Int64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
778 )
779 }
780 pub fn decode_with_options(
788 bytes: ::buffa::bytes::Bytes,
789 opts: &::buffa::DecodeOptions,
790 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
791 ::core::result::Result::Ok(
792 Int64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
793 )
794 }
795 pub fn from_owned(
804 msg: &super::super::Int64Value,
805 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
806 ::core::result::Result::Ok(
807 Int64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
808 )
809 }
810 #[must_use]
812 pub fn view(&self) -> &Int64ValueView<'_> {
813 self.0.reborrow()
814 }
815 #[must_use]
823 pub fn to_owned_message(&self) -> super::super::Int64Value {
824 self.0.to_owned_message()
825 }
826 #[must_use]
828 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
829 self.0.bytes()
830 }
831 #[must_use]
833 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
834 self.0.into_bytes()
835 }
836 #[must_use]
840 pub fn value(&self) -> i64 {
841 self.0.reborrow().value
842 }
843}
844impl ::core::convert::From<::buffa::OwnedView<Int64ValueView<'static>>>
845for Int64ValueOwnedView {
846 fn from(inner: ::buffa::OwnedView<Int64ValueView<'static>>) -> Self {
847 Int64ValueOwnedView(inner)
848 }
849}
850impl ::core::convert::From<Int64ValueOwnedView>
851for ::buffa::OwnedView<Int64ValueView<'static>> {
852 fn from(wrapper: Int64ValueOwnedView) -> Self {
853 wrapper.0
854 }
855}
856impl ::core::convert::AsRef<::buffa::OwnedView<Int64ValueView<'static>>>
857for Int64ValueOwnedView {
858 fn as_ref(&self) -> &::buffa::OwnedView<Int64ValueView<'static>> {
859 &self.0
860 }
861}
862impl ::buffa::HasMessageView for super::super::Int64Value {
863 type View<'a> = Int64ValueView<'a>;
864 type ViewHandle = Int64ValueOwnedView;
865}
866#[cfg(feature = "reflect")]
867const _: () = {
868 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int64ValueView<'a> {
869 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
870 super::super::__buffa::reflect::descriptor_pool()
871 .message(Self::__buffa_reflect_message_index())
872 }
873 fn pool(
874 &self,
875 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
876 super::super::__buffa::reflect::descriptor_pool()
877 }
878 fn get(
879 &self,
880 field: &::buffa_descriptor::FieldDescriptor,
881 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
882 #[allow(unused_imports)]
883 use ::buffa::Enumeration as _;
884 match field.number() {
885 1u32 => ::buffa_descriptor::reflect::ValueRef::I64(self.value),
886 _ => {
887 ::core::debug_assert!(
888 false,
889 "field number {} is not a member of this view's reflect get()",
890 field.number(),
891 );
892 ::buffa_descriptor::reflect::ValueRef::Bool(false)
893 }
894 }
895 }
896 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
897 match field.number() {
898 1u32 => self.value != 0,
899 _ => false,
900 }
901 }
902 fn for_each_set(
903 &self,
904 f: &mut dyn ::core::ops::FnMut(
905 &::buffa_descriptor::FieldDescriptor,
906 ::buffa_descriptor::reflect::ValueRef<'_>,
907 ),
908 ) {
909 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
910 self,
911 );
912 for fd in md.fields() {
913 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
914 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
915 }
916 }
917 }
918 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
919 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
920 let options = ::buffa::DecodeOptions::new()
921 .with_element_memory_limit(
922 bytes
923 .len()
924 .saturating_mul(128)
925 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
926 )
927 .with_unknown_field_limit(
928 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
929 );
930 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
931 ::buffa::alloc::sync::Arc::clone(
932 super::super::__buffa::reflect::descriptor_pool(),
933 ),
934 Self::__buffa_reflect_message_index(),
935 &bytes,
936 &options,
937 )
938 .expect("view re-encodes to bytes decodable against its own descriptor")
939 }
940 }
941 impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int64ValueView<'a> {
942 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
943 ::buffa_descriptor::reflect::ValueRef::Message(
944 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
945 )
946 }
947 }
948 impl<'a> Int64ValueView<'a> {
949 #[doc(hidden)]
954 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
955 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
956 *IDX
957 .get_or_init(|| {
958 super::super::__buffa::reflect::descriptor_pool()
959 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
960 .expect(
961 "generated view type is registered in the embedded descriptor pool",
962 )
963 })
964 }
965 }
966};
967#[derive(Clone, Debug, Default)]
971pub struct UInt64ValueView<'a> {
972 pub value: u64,
976 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
977}
978impl<'a> ::buffa::MessageView<'a> for UInt64ValueView<'a> {
979 type Owned = super::super::UInt64Value;
980 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
981 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
982 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
983 <Self as ::buffa::MessageView>::decode_view_ctx(
984 buf,
985 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
986 .with_element_memory(&__elem),
987 )
988 }
989 fn decode_view_with_ctx(
990 buf: &'a [u8],
991 ctx: ::buffa::DecodeContext<'_>,
992 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
993 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
994 }
995 #[inline]
996 fn merge_view_field(
997 &mut self,
998 tag: ::buffa::encoding::Tag,
999 cur: &'a [u8],
1000 before_tag: &'a [u8],
1001 ctx: ::buffa::DecodeContext<'_>,
1002 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1003 let _ = ctx;
1004 #[allow(unused_variables)]
1005 let view = self;
1006 let mut cur = cur;
1007 match tag.field_number() {
1008 1u32 => {
1009 ::buffa::encoding::check_wire_type(
1010 tag,
1011 ::buffa::encoding::WireType::Varint,
1012 )?;
1013 view.value = ::buffa::types::decode_uint64(&mut cur)?;
1014 }
1015 _ => {
1016 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1017 let span_len = before_tag.len() - cur.len();
1018 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
1019 }
1020 }
1021 ::core::result::Result::Ok(cur)
1022 }
1023 fn to_owned_message(
1024 &self,
1025 ) -> ::core::result::Result<super::super::UInt64Value, ::buffa::DecodeError> {
1026 self.to_owned_from_source(None)
1027 }
1028 #[allow(clippy::useless_conversion, clippy::needless_update)]
1029 fn to_owned_from_source(
1030 &self,
1031 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1032 ) -> ::core::result::Result<super::super::UInt64Value, ::buffa::DecodeError> {
1033 #[allow(unused_imports)]
1034 use ::buffa::alloc::string::ToString as _;
1035 let _ = __buffa_src;
1036 ::core::result::Result::Ok(super::super::UInt64Value {
1037 value: self.value,
1038 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
1039 ..::core::default::Default::default()
1040 })
1041 }
1042}
1043impl<'a> ::buffa::ViewEncode<'a> for UInt64ValueView<'a> {
1044 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1045 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1046 #[allow(unused_imports)]
1047 use ::buffa::Enumeration as _;
1048 let mut size = 0u64;
1049 if self.value != 0u64 {
1050 size += 1u64 + ::buffa::types::uint64_encoded_len(self.value) as u64;
1051 }
1052 size += self.__buffa_unknown_fields.encoded_len() as u64;
1053 ::buffa::saturate_size(size)
1054 }
1055 #[allow(clippy::needless_borrow)]
1056 fn write_to(
1057 &self,
1058 _cache: &mut ::buffa::SizeCache,
1059 buf: &mut impl ::buffa::EncodeSink,
1060 ) {
1061 #[allow(unused_imports)]
1062 use ::buffa::Enumeration as _;
1063 if self.value != 0u64 {
1064 ::buffa::types::put_uint64_field(1u32, self.value, buf);
1065 }
1066 self.__buffa_unknown_fields.write_to(buf);
1067 }
1068}
1069impl<'a> ::buffa::MessageName for UInt64ValueView<'a> {
1070 const PACKAGE: &'static str = "google.protobuf";
1071 const NAME: &'static str = "UInt64Value";
1072 const FULL_NAME: &'static str = "google.protobuf.UInt64Value";
1073 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt64Value";
1074}
1075::buffa::impl_default_view_instance!(UInt64ValueView);
1076::buffa::impl_view_reborrow!(UInt64ValueView);
1077#[derive(Clone, Debug)]
1083pub struct UInt64ValueOwnedView(::buffa::OwnedView<UInt64ValueView<'static>>);
1084impl UInt64ValueOwnedView {
1085 pub fn decode(
1095 bytes: ::buffa::bytes::Bytes,
1096 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1097 ::core::result::Result::Ok(
1098 UInt64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1099 )
1100 }
1101 pub fn decode_with_options(
1109 bytes: ::buffa::bytes::Bytes,
1110 opts: &::buffa::DecodeOptions,
1111 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1112 ::core::result::Result::Ok(
1113 UInt64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1114 )
1115 }
1116 pub fn from_owned(
1125 msg: &super::super::UInt64Value,
1126 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1127 ::core::result::Result::Ok(
1128 UInt64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1129 )
1130 }
1131 #[must_use]
1133 pub fn view(&self) -> &UInt64ValueView<'_> {
1134 self.0.reborrow()
1135 }
1136 #[must_use]
1144 pub fn to_owned_message(&self) -> super::super::UInt64Value {
1145 self.0.to_owned_message()
1146 }
1147 #[must_use]
1149 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1150 self.0.bytes()
1151 }
1152 #[must_use]
1154 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1155 self.0.into_bytes()
1156 }
1157 #[must_use]
1161 pub fn value(&self) -> u64 {
1162 self.0.reborrow().value
1163 }
1164}
1165impl ::core::convert::From<::buffa::OwnedView<UInt64ValueView<'static>>>
1166for UInt64ValueOwnedView {
1167 fn from(inner: ::buffa::OwnedView<UInt64ValueView<'static>>) -> Self {
1168 UInt64ValueOwnedView(inner)
1169 }
1170}
1171impl ::core::convert::From<UInt64ValueOwnedView>
1172for ::buffa::OwnedView<UInt64ValueView<'static>> {
1173 fn from(wrapper: UInt64ValueOwnedView) -> Self {
1174 wrapper.0
1175 }
1176}
1177impl ::core::convert::AsRef<::buffa::OwnedView<UInt64ValueView<'static>>>
1178for UInt64ValueOwnedView {
1179 fn as_ref(&self) -> &::buffa::OwnedView<UInt64ValueView<'static>> {
1180 &self.0
1181 }
1182}
1183impl ::buffa::HasMessageView for super::super::UInt64Value {
1184 type View<'a> = UInt64ValueView<'a>;
1185 type ViewHandle = UInt64ValueOwnedView;
1186}
1187#[cfg(feature = "reflect")]
1188const _: () = {
1189 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt64ValueView<'a> {
1190 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1191 super::super::__buffa::reflect::descriptor_pool()
1192 .message(Self::__buffa_reflect_message_index())
1193 }
1194 fn pool(
1195 &self,
1196 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1197 super::super::__buffa::reflect::descriptor_pool()
1198 }
1199 fn get(
1200 &self,
1201 field: &::buffa_descriptor::FieldDescriptor,
1202 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1203 #[allow(unused_imports)]
1204 use ::buffa::Enumeration as _;
1205 match field.number() {
1206 1u32 => ::buffa_descriptor::reflect::ValueRef::U64(self.value),
1207 _ => {
1208 ::core::debug_assert!(
1209 false,
1210 "field number {} is not a member of this view's reflect get()",
1211 field.number(),
1212 );
1213 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1214 }
1215 }
1216 }
1217 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1218 match field.number() {
1219 1u32 => self.value != 0,
1220 _ => false,
1221 }
1222 }
1223 fn for_each_set(
1224 &self,
1225 f: &mut dyn ::core::ops::FnMut(
1226 &::buffa_descriptor::FieldDescriptor,
1227 ::buffa_descriptor::reflect::ValueRef<'_>,
1228 ),
1229 ) {
1230 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1231 self,
1232 );
1233 for fd in md.fields() {
1234 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1235 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1236 }
1237 }
1238 }
1239 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1240 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1241 let options = ::buffa::DecodeOptions::new()
1242 .with_element_memory_limit(
1243 bytes
1244 .len()
1245 .saturating_mul(128)
1246 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
1247 )
1248 .with_unknown_field_limit(
1249 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
1250 );
1251 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
1252 ::buffa::alloc::sync::Arc::clone(
1253 super::super::__buffa::reflect::descriptor_pool(),
1254 ),
1255 Self::__buffa_reflect_message_index(),
1256 &bytes,
1257 &options,
1258 )
1259 .expect("view re-encodes to bytes decodable against its own descriptor")
1260 }
1261 }
1262 impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt64ValueView<'a> {
1263 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1264 ::buffa_descriptor::reflect::ValueRef::Message(
1265 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1266 )
1267 }
1268 }
1269 impl<'a> UInt64ValueView<'a> {
1270 #[doc(hidden)]
1275 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1276 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1277 *IDX
1278 .get_or_init(|| {
1279 super::super::__buffa::reflect::descriptor_pool()
1280 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1281 .expect(
1282 "generated view type is registered in the embedded descriptor pool",
1283 )
1284 })
1285 }
1286 }
1287};
1288#[derive(Clone, Debug, Default)]
1292pub struct Int32ValueView<'a> {
1293 pub value: i32,
1297 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1298}
1299impl<'a> ::buffa::MessageView<'a> for Int32ValueView<'a> {
1300 type Owned = super::super::Int32Value;
1301 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1302 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
1303 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
1304 <Self as ::buffa::MessageView>::decode_view_ctx(
1305 buf,
1306 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
1307 .with_element_memory(&__elem),
1308 )
1309 }
1310 fn decode_view_with_ctx(
1311 buf: &'a [u8],
1312 ctx: ::buffa::DecodeContext<'_>,
1313 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1314 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1315 }
1316 #[inline]
1317 fn merge_view_field(
1318 &mut self,
1319 tag: ::buffa::encoding::Tag,
1320 cur: &'a [u8],
1321 before_tag: &'a [u8],
1322 ctx: ::buffa::DecodeContext<'_>,
1323 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1324 let _ = ctx;
1325 #[allow(unused_variables)]
1326 let view = self;
1327 let mut cur = cur;
1328 match tag.field_number() {
1329 1u32 => {
1330 ::buffa::encoding::check_wire_type(
1331 tag,
1332 ::buffa::encoding::WireType::Varint,
1333 )?;
1334 view.value = ::buffa::types::decode_int32(&mut cur)?;
1335 }
1336 _ => {
1337 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1338 let span_len = before_tag.len() - cur.len();
1339 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
1340 }
1341 }
1342 ::core::result::Result::Ok(cur)
1343 }
1344 fn to_owned_message(
1345 &self,
1346 ) -> ::core::result::Result<super::super::Int32Value, ::buffa::DecodeError> {
1347 self.to_owned_from_source(None)
1348 }
1349 #[allow(clippy::useless_conversion, clippy::needless_update)]
1350 fn to_owned_from_source(
1351 &self,
1352 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1353 ) -> ::core::result::Result<super::super::Int32Value, ::buffa::DecodeError> {
1354 #[allow(unused_imports)]
1355 use ::buffa::alloc::string::ToString as _;
1356 let _ = __buffa_src;
1357 ::core::result::Result::Ok(super::super::Int32Value {
1358 value: self.value,
1359 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
1360 ..::core::default::Default::default()
1361 })
1362 }
1363}
1364impl<'a> ::buffa::ViewEncode<'a> for Int32ValueView<'a> {
1365 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1366 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1367 #[allow(unused_imports)]
1368 use ::buffa::Enumeration as _;
1369 let mut size = 0u64;
1370 if self.value != 0i32 {
1371 size += 1u64 + ::buffa::types::int32_encoded_len(self.value) as u64;
1372 }
1373 size += self.__buffa_unknown_fields.encoded_len() as u64;
1374 ::buffa::saturate_size(size)
1375 }
1376 #[allow(clippy::needless_borrow)]
1377 fn write_to(
1378 &self,
1379 _cache: &mut ::buffa::SizeCache,
1380 buf: &mut impl ::buffa::EncodeSink,
1381 ) {
1382 #[allow(unused_imports)]
1383 use ::buffa::Enumeration as _;
1384 if self.value != 0i32 {
1385 ::buffa::types::put_int32_field(1u32, self.value, buf);
1386 }
1387 self.__buffa_unknown_fields.write_to(buf);
1388 }
1389}
1390impl<'a> ::buffa::MessageName for Int32ValueView<'a> {
1391 const PACKAGE: &'static str = "google.protobuf";
1392 const NAME: &'static str = "Int32Value";
1393 const FULL_NAME: &'static str = "google.protobuf.Int32Value";
1394 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int32Value";
1395}
1396::buffa::impl_default_view_instance!(Int32ValueView);
1397::buffa::impl_view_reborrow!(Int32ValueView);
1398#[derive(Clone, Debug)]
1404pub struct Int32ValueOwnedView(::buffa::OwnedView<Int32ValueView<'static>>);
1405impl Int32ValueOwnedView {
1406 pub fn decode(
1416 bytes: ::buffa::bytes::Bytes,
1417 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1418 ::core::result::Result::Ok(
1419 Int32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1420 )
1421 }
1422 pub fn decode_with_options(
1430 bytes: ::buffa::bytes::Bytes,
1431 opts: &::buffa::DecodeOptions,
1432 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1433 ::core::result::Result::Ok(
1434 Int32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1435 )
1436 }
1437 pub fn from_owned(
1446 msg: &super::super::Int32Value,
1447 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1448 ::core::result::Result::Ok(
1449 Int32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1450 )
1451 }
1452 #[must_use]
1454 pub fn view(&self) -> &Int32ValueView<'_> {
1455 self.0.reborrow()
1456 }
1457 #[must_use]
1465 pub fn to_owned_message(&self) -> super::super::Int32Value {
1466 self.0.to_owned_message()
1467 }
1468 #[must_use]
1470 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1471 self.0.bytes()
1472 }
1473 #[must_use]
1475 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1476 self.0.into_bytes()
1477 }
1478 #[must_use]
1482 pub fn value(&self) -> i32 {
1483 self.0.reborrow().value
1484 }
1485}
1486impl ::core::convert::From<::buffa::OwnedView<Int32ValueView<'static>>>
1487for Int32ValueOwnedView {
1488 fn from(inner: ::buffa::OwnedView<Int32ValueView<'static>>) -> Self {
1489 Int32ValueOwnedView(inner)
1490 }
1491}
1492impl ::core::convert::From<Int32ValueOwnedView>
1493for ::buffa::OwnedView<Int32ValueView<'static>> {
1494 fn from(wrapper: Int32ValueOwnedView) -> Self {
1495 wrapper.0
1496 }
1497}
1498impl ::core::convert::AsRef<::buffa::OwnedView<Int32ValueView<'static>>>
1499for Int32ValueOwnedView {
1500 fn as_ref(&self) -> &::buffa::OwnedView<Int32ValueView<'static>> {
1501 &self.0
1502 }
1503}
1504impl ::buffa::HasMessageView for super::super::Int32Value {
1505 type View<'a> = Int32ValueView<'a>;
1506 type ViewHandle = Int32ValueOwnedView;
1507}
1508#[cfg(feature = "reflect")]
1509const _: () = {
1510 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int32ValueView<'a> {
1511 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1512 super::super::__buffa::reflect::descriptor_pool()
1513 .message(Self::__buffa_reflect_message_index())
1514 }
1515 fn pool(
1516 &self,
1517 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1518 super::super::__buffa::reflect::descriptor_pool()
1519 }
1520 fn get(
1521 &self,
1522 field: &::buffa_descriptor::FieldDescriptor,
1523 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1524 #[allow(unused_imports)]
1525 use ::buffa::Enumeration as _;
1526 match field.number() {
1527 1u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.value),
1528 _ => {
1529 ::core::debug_assert!(
1530 false,
1531 "field number {} is not a member of this view's reflect get()",
1532 field.number(),
1533 );
1534 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1535 }
1536 }
1537 }
1538 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1539 match field.number() {
1540 1u32 => self.value != 0,
1541 _ => false,
1542 }
1543 }
1544 fn for_each_set(
1545 &self,
1546 f: &mut dyn ::core::ops::FnMut(
1547 &::buffa_descriptor::FieldDescriptor,
1548 ::buffa_descriptor::reflect::ValueRef<'_>,
1549 ),
1550 ) {
1551 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1552 self,
1553 );
1554 for fd in md.fields() {
1555 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1556 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1557 }
1558 }
1559 }
1560 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1561 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1562 let options = ::buffa::DecodeOptions::new()
1563 .with_element_memory_limit(
1564 bytes
1565 .len()
1566 .saturating_mul(128)
1567 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
1568 )
1569 .with_unknown_field_limit(
1570 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
1571 );
1572 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
1573 ::buffa::alloc::sync::Arc::clone(
1574 super::super::__buffa::reflect::descriptor_pool(),
1575 ),
1576 Self::__buffa_reflect_message_index(),
1577 &bytes,
1578 &options,
1579 )
1580 .expect("view re-encodes to bytes decodable against its own descriptor")
1581 }
1582 }
1583 impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int32ValueView<'a> {
1584 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1585 ::buffa_descriptor::reflect::ValueRef::Message(
1586 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1587 )
1588 }
1589 }
1590 impl<'a> Int32ValueView<'a> {
1591 #[doc(hidden)]
1596 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1597 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1598 *IDX
1599 .get_or_init(|| {
1600 super::super::__buffa::reflect::descriptor_pool()
1601 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1602 .expect(
1603 "generated view type is registered in the embedded descriptor pool",
1604 )
1605 })
1606 }
1607 }
1608};
1609#[derive(Clone, Debug, Default)]
1613pub struct UInt32ValueView<'a> {
1614 pub value: u32,
1618 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1619}
1620impl<'a> ::buffa::MessageView<'a> for UInt32ValueView<'a> {
1621 type Owned = super::super::UInt32Value;
1622 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1623 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
1624 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
1625 <Self as ::buffa::MessageView>::decode_view_ctx(
1626 buf,
1627 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
1628 .with_element_memory(&__elem),
1629 )
1630 }
1631 fn decode_view_with_ctx(
1632 buf: &'a [u8],
1633 ctx: ::buffa::DecodeContext<'_>,
1634 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1635 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1636 }
1637 #[inline]
1638 fn merge_view_field(
1639 &mut self,
1640 tag: ::buffa::encoding::Tag,
1641 cur: &'a [u8],
1642 before_tag: &'a [u8],
1643 ctx: ::buffa::DecodeContext<'_>,
1644 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1645 let _ = ctx;
1646 #[allow(unused_variables)]
1647 let view = self;
1648 let mut cur = cur;
1649 match tag.field_number() {
1650 1u32 => {
1651 ::buffa::encoding::check_wire_type(
1652 tag,
1653 ::buffa::encoding::WireType::Varint,
1654 )?;
1655 view.value = ::buffa::types::decode_uint32(&mut cur)?;
1656 }
1657 _ => {
1658 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1659 let span_len = before_tag.len() - cur.len();
1660 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
1661 }
1662 }
1663 ::core::result::Result::Ok(cur)
1664 }
1665 fn to_owned_message(
1666 &self,
1667 ) -> ::core::result::Result<super::super::UInt32Value, ::buffa::DecodeError> {
1668 self.to_owned_from_source(None)
1669 }
1670 #[allow(clippy::useless_conversion, clippy::needless_update)]
1671 fn to_owned_from_source(
1672 &self,
1673 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1674 ) -> ::core::result::Result<super::super::UInt32Value, ::buffa::DecodeError> {
1675 #[allow(unused_imports)]
1676 use ::buffa::alloc::string::ToString as _;
1677 let _ = __buffa_src;
1678 ::core::result::Result::Ok(super::super::UInt32Value {
1679 value: self.value,
1680 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
1681 ..::core::default::Default::default()
1682 })
1683 }
1684}
1685impl<'a> ::buffa::ViewEncode<'a> for UInt32ValueView<'a> {
1686 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1687 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1688 #[allow(unused_imports)]
1689 use ::buffa::Enumeration as _;
1690 let mut size = 0u64;
1691 if self.value != 0u32 {
1692 size += 1u64 + ::buffa::types::uint32_encoded_len(self.value) as u64;
1693 }
1694 size += self.__buffa_unknown_fields.encoded_len() as u64;
1695 ::buffa::saturate_size(size)
1696 }
1697 #[allow(clippy::needless_borrow)]
1698 fn write_to(
1699 &self,
1700 _cache: &mut ::buffa::SizeCache,
1701 buf: &mut impl ::buffa::EncodeSink,
1702 ) {
1703 #[allow(unused_imports)]
1704 use ::buffa::Enumeration as _;
1705 if self.value != 0u32 {
1706 ::buffa::types::put_uint32_field(1u32, self.value, buf);
1707 }
1708 self.__buffa_unknown_fields.write_to(buf);
1709 }
1710}
1711impl<'a> ::buffa::MessageName for UInt32ValueView<'a> {
1712 const PACKAGE: &'static str = "google.protobuf";
1713 const NAME: &'static str = "UInt32Value";
1714 const FULL_NAME: &'static str = "google.protobuf.UInt32Value";
1715 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt32Value";
1716}
1717::buffa::impl_default_view_instance!(UInt32ValueView);
1718::buffa::impl_view_reborrow!(UInt32ValueView);
1719#[derive(Clone, Debug)]
1725pub struct UInt32ValueOwnedView(::buffa::OwnedView<UInt32ValueView<'static>>);
1726impl UInt32ValueOwnedView {
1727 pub fn decode(
1737 bytes: ::buffa::bytes::Bytes,
1738 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1739 ::core::result::Result::Ok(
1740 UInt32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
1741 )
1742 }
1743 pub fn decode_with_options(
1751 bytes: ::buffa::bytes::Bytes,
1752 opts: &::buffa::DecodeOptions,
1753 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1754 ::core::result::Result::Ok(
1755 UInt32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
1756 )
1757 }
1758 pub fn from_owned(
1767 msg: &super::super::UInt32Value,
1768 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1769 ::core::result::Result::Ok(
1770 UInt32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
1771 )
1772 }
1773 #[must_use]
1775 pub fn view(&self) -> &UInt32ValueView<'_> {
1776 self.0.reborrow()
1777 }
1778 #[must_use]
1786 pub fn to_owned_message(&self) -> super::super::UInt32Value {
1787 self.0.to_owned_message()
1788 }
1789 #[must_use]
1791 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1792 self.0.bytes()
1793 }
1794 #[must_use]
1796 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1797 self.0.into_bytes()
1798 }
1799 #[must_use]
1803 pub fn value(&self) -> u32 {
1804 self.0.reborrow().value
1805 }
1806}
1807impl ::core::convert::From<::buffa::OwnedView<UInt32ValueView<'static>>>
1808for UInt32ValueOwnedView {
1809 fn from(inner: ::buffa::OwnedView<UInt32ValueView<'static>>) -> Self {
1810 UInt32ValueOwnedView(inner)
1811 }
1812}
1813impl ::core::convert::From<UInt32ValueOwnedView>
1814for ::buffa::OwnedView<UInt32ValueView<'static>> {
1815 fn from(wrapper: UInt32ValueOwnedView) -> Self {
1816 wrapper.0
1817 }
1818}
1819impl ::core::convert::AsRef<::buffa::OwnedView<UInt32ValueView<'static>>>
1820for UInt32ValueOwnedView {
1821 fn as_ref(&self) -> &::buffa::OwnedView<UInt32ValueView<'static>> {
1822 &self.0
1823 }
1824}
1825impl ::buffa::HasMessageView for super::super::UInt32Value {
1826 type View<'a> = UInt32ValueView<'a>;
1827 type ViewHandle = UInt32ValueOwnedView;
1828}
1829#[cfg(feature = "reflect")]
1830const _: () = {
1831 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt32ValueView<'a> {
1832 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
1833 super::super::__buffa::reflect::descriptor_pool()
1834 .message(Self::__buffa_reflect_message_index())
1835 }
1836 fn pool(
1837 &self,
1838 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
1839 super::super::__buffa::reflect::descriptor_pool()
1840 }
1841 fn get(
1842 &self,
1843 field: &::buffa_descriptor::FieldDescriptor,
1844 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1845 #[allow(unused_imports)]
1846 use ::buffa::Enumeration as _;
1847 match field.number() {
1848 1u32 => ::buffa_descriptor::reflect::ValueRef::U32(self.value),
1849 _ => {
1850 ::core::debug_assert!(
1851 false,
1852 "field number {} is not a member of this view's reflect get()",
1853 field.number(),
1854 );
1855 ::buffa_descriptor::reflect::ValueRef::Bool(false)
1856 }
1857 }
1858 }
1859 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
1860 match field.number() {
1861 1u32 => self.value != 0,
1862 _ => false,
1863 }
1864 }
1865 fn for_each_set(
1866 &self,
1867 f: &mut dyn ::core::ops::FnMut(
1868 &::buffa_descriptor::FieldDescriptor,
1869 ::buffa_descriptor::reflect::ValueRef<'_>,
1870 ),
1871 ) {
1872 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
1873 self,
1874 );
1875 for fd in md.fields() {
1876 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
1877 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
1878 }
1879 }
1880 }
1881 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
1882 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
1883 let options = ::buffa::DecodeOptions::new()
1884 .with_element_memory_limit(
1885 bytes
1886 .len()
1887 .saturating_mul(128)
1888 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
1889 )
1890 .with_unknown_field_limit(
1891 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
1892 );
1893 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
1894 ::buffa::alloc::sync::Arc::clone(
1895 super::super::__buffa::reflect::descriptor_pool(),
1896 ),
1897 Self::__buffa_reflect_message_index(),
1898 &bytes,
1899 &options,
1900 )
1901 .expect("view re-encodes to bytes decodable against its own descriptor")
1902 }
1903 }
1904 impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt32ValueView<'a> {
1905 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
1906 ::buffa_descriptor::reflect::ValueRef::Message(
1907 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
1908 )
1909 }
1910 }
1911 impl<'a> UInt32ValueView<'a> {
1912 #[doc(hidden)]
1917 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
1918 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
1919 *IDX
1920 .get_or_init(|| {
1921 super::super::__buffa::reflect::descriptor_pool()
1922 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
1923 .expect(
1924 "generated view type is registered in the embedded descriptor pool",
1925 )
1926 })
1927 }
1928 }
1929};
1930#[derive(Clone, Debug, Default)]
1934pub struct BoolValueView<'a> {
1935 pub value: bool,
1939 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1940}
1941impl<'a> ::buffa::MessageView<'a> for BoolValueView<'a> {
1942 type Owned = super::super::BoolValue;
1943 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1944 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
1945 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
1946 <Self as ::buffa::MessageView>::decode_view_ctx(
1947 buf,
1948 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
1949 .with_element_memory(&__elem),
1950 )
1951 }
1952 fn decode_view_with_ctx(
1953 buf: &'a [u8],
1954 ctx: ::buffa::DecodeContext<'_>,
1955 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1956 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1957 }
1958 #[inline]
1959 fn merge_view_field(
1960 &mut self,
1961 tag: ::buffa::encoding::Tag,
1962 cur: &'a [u8],
1963 before_tag: &'a [u8],
1964 ctx: ::buffa::DecodeContext<'_>,
1965 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1966 let _ = ctx;
1967 #[allow(unused_variables)]
1968 let view = self;
1969 let mut cur = cur;
1970 match tag.field_number() {
1971 1u32 => {
1972 ::buffa::encoding::check_wire_type(
1973 tag,
1974 ::buffa::encoding::WireType::Varint,
1975 )?;
1976 view.value = ::buffa::types::decode_bool(&mut cur)?;
1977 }
1978 _ => {
1979 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1980 let span_len = before_tag.len() - cur.len();
1981 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
1982 }
1983 }
1984 ::core::result::Result::Ok(cur)
1985 }
1986 fn to_owned_message(
1987 &self,
1988 ) -> ::core::result::Result<super::super::BoolValue, ::buffa::DecodeError> {
1989 self.to_owned_from_source(None)
1990 }
1991 #[allow(clippy::useless_conversion, clippy::needless_update)]
1992 fn to_owned_from_source(
1993 &self,
1994 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1995 ) -> ::core::result::Result<super::super::BoolValue, ::buffa::DecodeError> {
1996 #[allow(unused_imports)]
1997 use ::buffa::alloc::string::ToString as _;
1998 let _ = __buffa_src;
1999 ::core::result::Result::Ok(super::super::BoolValue {
2000 value: self.value,
2001 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
2002 ..::core::default::Default::default()
2003 })
2004 }
2005}
2006impl<'a> ::buffa::ViewEncode<'a> for BoolValueView<'a> {
2007 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2008 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2009 #[allow(unused_imports)]
2010 use ::buffa::Enumeration as _;
2011 let mut size = 0u64;
2012 if self.value {
2013 size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
2014 }
2015 size += self.__buffa_unknown_fields.encoded_len() as u64;
2016 ::buffa::saturate_size(size)
2017 }
2018 #[allow(clippy::needless_borrow)]
2019 fn write_to(
2020 &self,
2021 _cache: &mut ::buffa::SizeCache,
2022 buf: &mut impl ::buffa::EncodeSink,
2023 ) {
2024 #[allow(unused_imports)]
2025 use ::buffa::Enumeration as _;
2026 if self.value {
2027 ::buffa::types::put_bool_field(1u32, self.value, buf);
2028 }
2029 self.__buffa_unknown_fields.write_to(buf);
2030 }
2031}
2032impl<'a> ::buffa::MessageName for BoolValueView<'a> {
2033 const PACKAGE: &'static str = "google.protobuf";
2034 const NAME: &'static str = "BoolValue";
2035 const FULL_NAME: &'static str = "google.protobuf.BoolValue";
2036 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BoolValue";
2037}
2038::buffa::impl_default_view_instance!(BoolValueView);
2039::buffa::impl_view_reborrow!(BoolValueView);
2040#[derive(Clone, Debug)]
2046pub struct BoolValueOwnedView(::buffa::OwnedView<BoolValueView<'static>>);
2047impl BoolValueOwnedView {
2048 pub fn decode(
2058 bytes: ::buffa::bytes::Bytes,
2059 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2060 ::core::result::Result::Ok(
2061 BoolValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2062 )
2063 }
2064 pub fn decode_with_options(
2072 bytes: ::buffa::bytes::Bytes,
2073 opts: &::buffa::DecodeOptions,
2074 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2075 ::core::result::Result::Ok(
2076 BoolValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2077 )
2078 }
2079 pub fn from_owned(
2088 msg: &super::super::BoolValue,
2089 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2090 ::core::result::Result::Ok(
2091 BoolValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2092 )
2093 }
2094 #[must_use]
2096 pub fn view(&self) -> &BoolValueView<'_> {
2097 self.0.reborrow()
2098 }
2099 #[must_use]
2107 pub fn to_owned_message(&self) -> super::super::BoolValue {
2108 self.0.to_owned_message()
2109 }
2110 #[must_use]
2112 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2113 self.0.bytes()
2114 }
2115 #[must_use]
2117 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2118 self.0.into_bytes()
2119 }
2120 #[must_use]
2124 pub fn value(&self) -> bool {
2125 self.0.reborrow().value
2126 }
2127}
2128impl ::core::convert::From<::buffa::OwnedView<BoolValueView<'static>>>
2129for BoolValueOwnedView {
2130 fn from(inner: ::buffa::OwnedView<BoolValueView<'static>>) -> Self {
2131 BoolValueOwnedView(inner)
2132 }
2133}
2134impl ::core::convert::From<BoolValueOwnedView>
2135for ::buffa::OwnedView<BoolValueView<'static>> {
2136 fn from(wrapper: BoolValueOwnedView) -> Self {
2137 wrapper.0
2138 }
2139}
2140impl ::core::convert::AsRef<::buffa::OwnedView<BoolValueView<'static>>>
2141for BoolValueOwnedView {
2142 fn as_ref(&self) -> &::buffa::OwnedView<BoolValueView<'static>> {
2143 &self.0
2144 }
2145}
2146impl ::buffa::HasMessageView for super::super::BoolValue {
2147 type View<'a> = BoolValueView<'a>;
2148 type ViewHandle = BoolValueOwnedView;
2149}
2150#[cfg(feature = "reflect")]
2151const _: () = {
2152 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BoolValueView<'a> {
2153 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2154 super::super::__buffa::reflect::descriptor_pool()
2155 .message(Self::__buffa_reflect_message_index())
2156 }
2157 fn pool(
2158 &self,
2159 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2160 super::super::__buffa::reflect::descriptor_pool()
2161 }
2162 fn get(
2163 &self,
2164 field: &::buffa_descriptor::FieldDescriptor,
2165 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2166 #[allow(unused_imports)]
2167 use ::buffa::Enumeration as _;
2168 match field.number() {
2169 1u32 => ::buffa_descriptor::reflect::ValueRef::Bool(self.value),
2170 _ => {
2171 ::core::debug_assert!(
2172 false,
2173 "field number {} is not a member of this view's reflect get()",
2174 field.number(),
2175 );
2176 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2177 }
2178 }
2179 }
2180 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2181 match field.number() {
2182 1u32 => self.value,
2183 _ => false,
2184 }
2185 }
2186 fn for_each_set(
2187 &self,
2188 f: &mut dyn ::core::ops::FnMut(
2189 &::buffa_descriptor::FieldDescriptor,
2190 ::buffa_descriptor::reflect::ValueRef<'_>,
2191 ),
2192 ) {
2193 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2194 self,
2195 );
2196 for fd in md.fields() {
2197 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2198 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2199 }
2200 }
2201 }
2202 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2203 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2204 let options = ::buffa::DecodeOptions::new()
2205 .with_element_memory_limit(
2206 bytes
2207 .len()
2208 .saturating_mul(128)
2209 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
2210 )
2211 .with_unknown_field_limit(
2212 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
2213 );
2214 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
2215 ::buffa::alloc::sync::Arc::clone(
2216 super::super::__buffa::reflect::descriptor_pool(),
2217 ),
2218 Self::__buffa_reflect_message_index(),
2219 &bytes,
2220 &options,
2221 )
2222 .expect("view re-encodes to bytes decodable against its own descriptor")
2223 }
2224 }
2225 impl<'a> ::buffa_descriptor::reflect::ReflectElement for BoolValueView<'a> {
2226 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2227 ::buffa_descriptor::reflect::ValueRef::Message(
2228 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2229 )
2230 }
2231 }
2232 impl<'a> BoolValueView<'a> {
2233 #[doc(hidden)]
2238 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2239 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2240 *IDX
2241 .get_or_init(|| {
2242 super::super::__buffa::reflect::descriptor_pool()
2243 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2244 .expect(
2245 "generated view type is registered in the embedded descriptor pool",
2246 )
2247 })
2248 }
2249 }
2250};
2251#[derive(Clone, Debug, Default)]
2255pub struct StringValueView<'a> {
2256 pub value: &'a str,
2260 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2261}
2262impl<'a> ::buffa::MessageView<'a> for StringValueView<'a> {
2263 type Owned = super::super::StringValue;
2264 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2265 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
2266 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
2267 <Self as ::buffa::MessageView>::decode_view_ctx(
2268 buf,
2269 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
2270 .with_element_memory(&__elem),
2271 )
2272 }
2273 fn decode_view_with_ctx(
2274 buf: &'a [u8],
2275 ctx: ::buffa::DecodeContext<'_>,
2276 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2277 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2278 }
2279 #[inline]
2280 fn merge_view_field(
2281 &mut self,
2282 tag: ::buffa::encoding::Tag,
2283 cur: &'a [u8],
2284 before_tag: &'a [u8],
2285 ctx: ::buffa::DecodeContext<'_>,
2286 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2287 let _ = ctx;
2288 #[allow(unused_variables)]
2289 let view = self;
2290 let mut cur = cur;
2291 match tag.field_number() {
2292 1u32 => {
2293 ::buffa::encoding::check_wire_type(
2294 tag,
2295 ::buffa::encoding::WireType::LengthDelimited,
2296 )?;
2297 view.value = ::buffa::types::borrow_str(&mut cur)?;
2298 }
2299 _ => {
2300 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2301 let span_len = before_tag.len() - cur.len();
2302 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
2303 }
2304 }
2305 ::core::result::Result::Ok(cur)
2306 }
2307 fn to_owned_message(
2308 &self,
2309 ) -> ::core::result::Result<super::super::StringValue, ::buffa::DecodeError> {
2310 self.to_owned_from_source(None)
2311 }
2312 #[allow(clippy::useless_conversion, clippy::needless_update)]
2313 fn to_owned_from_source(
2314 &self,
2315 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2316 ) -> ::core::result::Result<super::super::StringValue, ::buffa::DecodeError> {
2317 #[allow(unused_imports)]
2318 use ::buffa::alloc::string::ToString as _;
2319 let _ = __buffa_src;
2320 ::core::result::Result::Ok(super::super::StringValue {
2321 value: self.value.to_string(),
2322 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
2323 ..::core::default::Default::default()
2324 })
2325 }
2326}
2327impl<'a> ::buffa::ViewEncode<'a> for StringValueView<'a> {
2328 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2329 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2330 #[allow(unused_imports)]
2331 use ::buffa::Enumeration as _;
2332 let mut size = 0u64;
2333 if !self.value.is_empty() {
2334 size += 1u64 + ::buffa::types::string_encoded_len(&self.value) as u64;
2335 }
2336 size += self.__buffa_unknown_fields.encoded_len() as u64;
2337 ::buffa::saturate_size(size)
2338 }
2339 #[allow(clippy::needless_borrow)]
2340 fn write_to(
2341 &self,
2342 _cache: &mut ::buffa::SizeCache,
2343 buf: &mut impl ::buffa::EncodeSink,
2344 ) {
2345 #[allow(unused_imports)]
2346 use ::buffa::Enumeration as _;
2347 if !self.value.is_empty() {
2348 ::buffa::types::put_string_field(1u32, &self.value, buf);
2349 }
2350 self.__buffa_unknown_fields.write_to(buf);
2351 }
2352}
2353impl<'a> ::buffa::MessageName for StringValueView<'a> {
2354 const PACKAGE: &'static str = "google.protobuf";
2355 const NAME: &'static str = "StringValue";
2356 const FULL_NAME: &'static str = "google.protobuf.StringValue";
2357 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.StringValue";
2358}
2359::buffa::impl_default_view_instance!(StringValueView);
2360::buffa::impl_view_reborrow!(StringValueView);
2361#[derive(Clone, Debug)]
2367pub struct StringValueOwnedView(::buffa::OwnedView<StringValueView<'static>>);
2368impl StringValueOwnedView {
2369 pub fn decode(
2379 bytes: ::buffa::bytes::Bytes,
2380 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2381 ::core::result::Result::Ok(
2382 StringValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2383 )
2384 }
2385 pub fn decode_with_options(
2393 bytes: ::buffa::bytes::Bytes,
2394 opts: &::buffa::DecodeOptions,
2395 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2396 ::core::result::Result::Ok(
2397 StringValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2398 )
2399 }
2400 pub fn from_owned(
2409 msg: &super::super::StringValue,
2410 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2411 ::core::result::Result::Ok(
2412 StringValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2413 )
2414 }
2415 #[must_use]
2417 pub fn view(&self) -> &StringValueView<'_> {
2418 self.0.reborrow()
2419 }
2420 #[must_use]
2428 pub fn to_owned_message(&self) -> super::super::StringValue {
2429 self.0.to_owned_message()
2430 }
2431 #[must_use]
2433 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2434 self.0.bytes()
2435 }
2436 #[must_use]
2438 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2439 self.0.into_bytes()
2440 }
2441 #[must_use]
2445 pub fn value(&self) -> &'_ str {
2446 self.0.reborrow().value
2447 }
2448}
2449impl ::core::convert::From<::buffa::OwnedView<StringValueView<'static>>>
2450for StringValueOwnedView {
2451 fn from(inner: ::buffa::OwnedView<StringValueView<'static>>) -> Self {
2452 StringValueOwnedView(inner)
2453 }
2454}
2455impl ::core::convert::From<StringValueOwnedView>
2456for ::buffa::OwnedView<StringValueView<'static>> {
2457 fn from(wrapper: StringValueOwnedView) -> Self {
2458 wrapper.0
2459 }
2460}
2461impl ::core::convert::AsRef<::buffa::OwnedView<StringValueView<'static>>>
2462for StringValueOwnedView {
2463 fn as_ref(&self) -> &::buffa::OwnedView<StringValueView<'static>> {
2464 &self.0
2465 }
2466}
2467impl ::buffa::HasMessageView for super::super::StringValue {
2468 type View<'a> = StringValueView<'a>;
2469 type ViewHandle = StringValueOwnedView;
2470}
2471#[cfg(feature = "reflect")]
2472const _: () = {
2473 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for StringValueView<'a> {
2474 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2475 super::super::__buffa::reflect::descriptor_pool()
2476 .message(Self::__buffa_reflect_message_index())
2477 }
2478 fn pool(
2479 &self,
2480 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2481 super::super::__buffa::reflect::descriptor_pool()
2482 }
2483 fn get(
2484 &self,
2485 field: &::buffa_descriptor::FieldDescriptor,
2486 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2487 #[allow(unused_imports)]
2488 use ::buffa::Enumeration as _;
2489 match field.number() {
2490 1u32 => ::buffa_descriptor::reflect::ValueRef::String(self.value),
2491 _ => {
2492 ::core::debug_assert!(
2493 false,
2494 "field number {} is not a member of this view's reflect get()",
2495 field.number(),
2496 );
2497 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2498 }
2499 }
2500 }
2501 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2502 match field.number() {
2503 1u32 => !self.value.is_empty(),
2504 _ => false,
2505 }
2506 }
2507 fn for_each_set(
2508 &self,
2509 f: &mut dyn ::core::ops::FnMut(
2510 &::buffa_descriptor::FieldDescriptor,
2511 ::buffa_descriptor::reflect::ValueRef<'_>,
2512 ),
2513 ) {
2514 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2515 self,
2516 );
2517 for fd in md.fields() {
2518 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2519 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2520 }
2521 }
2522 }
2523 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2524 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2525 let options = ::buffa::DecodeOptions::new()
2526 .with_element_memory_limit(
2527 bytes
2528 .len()
2529 .saturating_mul(128)
2530 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
2531 )
2532 .with_unknown_field_limit(
2533 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
2534 );
2535 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
2536 ::buffa::alloc::sync::Arc::clone(
2537 super::super::__buffa::reflect::descriptor_pool(),
2538 ),
2539 Self::__buffa_reflect_message_index(),
2540 &bytes,
2541 &options,
2542 )
2543 .expect("view re-encodes to bytes decodable against its own descriptor")
2544 }
2545 }
2546 impl<'a> ::buffa_descriptor::reflect::ReflectElement for StringValueView<'a> {
2547 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2548 ::buffa_descriptor::reflect::ValueRef::Message(
2549 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2550 )
2551 }
2552 }
2553 impl<'a> StringValueView<'a> {
2554 #[doc(hidden)]
2559 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2560 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2561 *IDX
2562 .get_or_init(|| {
2563 super::super::__buffa::reflect::descriptor_pool()
2564 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2565 .expect(
2566 "generated view type is registered in the embedded descriptor pool",
2567 )
2568 })
2569 }
2570 }
2571};
2572#[derive(Clone, Debug, Default)]
2576pub struct BytesValueView<'a> {
2577 pub value: &'a [u8],
2581 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2582}
2583impl<'a> ::buffa::MessageView<'a> for BytesValueView<'a> {
2584 type Owned = super::super::BytesValue;
2585 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2586 let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
2587 let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
2588 <Self as ::buffa::MessageView>::decode_view_ctx(
2589 buf,
2590 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
2591 .with_element_memory(&__elem),
2592 )
2593 }
2594 fn decode_view_with_ctx(
2595 buf: &'a [u8],
2596 ctx: ::buffa::DecodeContext<'_>,
2597 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2598 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2599 }
2600 #[inline]
2601 fn merge_view_field(
2602 &mut self,
2603 tag: ::buffa::encoding::Tag,
2604 cur: &'a [u8],
2605 before_tag: &'a [u8],
2606 ctx: ::buffa::DecodeContext<'_>,
2607 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2608 let _ = ctx;
2609 #[allow(unused_variables)]
2610 let view = self;
2611 let mut cur = cur;
2612 match tag.field_number() {
2613 1u32 => {
2614 ::buffa::encoding::check_wire_type(
2615 tag,
2616 ::buffa::encoding::WireType::LengthDelimited,
2617 )?;
2618 view.value = ::buffa::types::borrow_bytes(&mut cur)?;
2619 }
2620 _ => {
2621 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2622 let span_len = before_tag.len() - cur.len();
2623 view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
2624 }
2625 }
2626 ::core::result::Result::Ok(cur)
2627 }
2628 fn to_owned_message(
2629 &self,
2630 ) -> ::core::result::Result<super::super::BytesValue, ::buffa::DecodeError> {
2631 self.to_owned_from_source(None)
2632 }
2633 #[allow(clippy::useless_conversion, clippy::needless_update)]
2634 fn to_owned_from_source(
2635 &self,
2636 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2637 ) -> ::core::result::Result<super::super::BytesValue, ::buffa::DecodeError> {
2638 #[allow(unused_imports)]
2639 use ::buffa::alloc::string::ToString as _;
2640 let _ = __buffa_src;
2641 ::core::result::Result::Ok(super::super::BytesValue {
2642 value: (self.value).to_vec(),
2643 __buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.into(),
2644 ..::core::default::Default::default()
2645 })
2646 }
2647}
2648impl<'a> ::buffa::ViewEncode<'a> for BytesValueView<'a> {
2649 #[allow(clippy::needless_borrow, clippy::let_and_return)]
2650 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2651 #[allow(unused_imports)]
2652 use ::buffa::Enumeration as _;
2653 let mut size = 0u64;
2654 if !self.value.is_empty() {
2655 size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64;
2656 }
2657 size += self.__buffa_unknown_fields.encoded_len() as u64;
2658 ::buffa::saturate_size(size)
2659 }
2660 #[allow(clippy::needless_borrow)]
2661 fn write_to(
2662 &self,
2663 _cache: &mut ::buffa::SizeCache,
2664 buf: &mut impl ::buffa::EncodeSink,
2665 ) {
2666 #[allow(unused_imports)]
2667 use ::buffa::Enumeration as _;
2668 if !self.value.is_empty() {
2669 ::buffa::types::put_shared_bytes_field(1u32, &self.value, buf);
2670 }
2671 self.__buffa_unknown_fields.write_to(buf);
2672 }
2673}
2674impl<'a> ::buffa::MessageName for BytesValueView<'a> {
2675 const PACKAGE: &'static str = "google.protobuf";
2676 const NAME: &'static str = "BytesValue";
2677 const FULL_NAME: &'static str = "google.protobuf.BytesValue";
2678 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BytesValue";
2679}
2680::buffa::impl_default_view_instance!(BytesValueView);
2681::buffa::impl_view_reborrow!(BytesValueView);
2682#[derive(Clone, Debug)]
2688pub struct BytesValueOwnedView(::buffa::OwnedView<BytesValueView<'static>>);
2689impl BytesValueOwnedView {
2690 pub fn decode(
2700 bytes: ::buffa::bytes::Bytes,
2701 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2702 ::core::result::Result::Ok(
2703 BytesValueOwnedView(::buffa::OwnedView::decode(bytes)?),
2704 )
2705 }
2706 pub fn decode_with_options(
2714 bytes: ::buffa::bytes::Bytes,
2715 opts: &::buffa::DecodeOptions,
2716 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2717 ::core::result::Result::Ok(
2718 BytesValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
2719 )
2720 }
2721 pub fn from_owned(
2730 msg: &super::super::BytesValue,
2731 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2732 ::core::result::Result::Ok(
2733 BytesValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
2734 )
2735 }
2736 #[must_use]
2738 pub fn view(&self) -> &BytesValueView<'_> {
2739 self.0.reborrow()
2740 }
2741 #[must_use]
2749 pub fn to_owned_message(&self) -> super::super::BytesValue {
2750 self.0.to_owned_message()
2751 }
2752 #[must_use]
2754 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2755 self.0.bytes()
2756 }
2757 #[must_use]
2759 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2760 self.0.into_bytes()
2761 }
2762 #[must_use]
2766 pub fn value(&self) -> &'_ [u8] {
2767 self.0.reborrow().value
2768 }
2769}
2770impl ::core::convert::From<::buffa::OwnedView<BytesValueView<'static>>>
2771for BytesValueOwnedView {
2772 fn from(inner: ::buffa::OwnedView<BytesValueView<'static>>) -> Self {
2773 BytesValueOwnedView(inner)
2774 }
2775}
2776impl ::core::convert::From<BytesValueOwnedView>
2777for ::buffa::OwnedView<BytesValueView<'static>> {
2778 fn from(wrapper: BytesValueOwnedView) -> Self {
2779 wrapper.0
2780 }
2781}
2782impl ::core::convert::AsRef<::buffa::OwnedView<BytesValueView<'static>>>
2783for BytesValueOwnedView {
2784 fn as_ref(&self) -> &::buffa::OwnedView<BytesValueView<'static>> {
2785 &self.0
2786 }
2787}
2788impl ::buffa::HasMessageView for super::super::BytesValue {
2789 type View<'a> = BytesValueView<'a>;
2790 type ViewHandle = BytesValueOwnedView;
2791}
2792#[cfg(feature = "reflect")]
2793const _: () = {
2794 impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BytesValueView<'a> {
2795 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
2796 super::super::__buffa::reflect::descriptor_pool()
2797 .message(Self::__buffa_reflect_message_index())
2798 }
2799 fn pool(
2800 &self,
2801 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
2802 super::super::__buffa::reflect::descriptor_pool()
2803 }
2804 fn get(
2805 &self,
2806 field: &::buffa_descriptor::FieldDescriptor,
2807 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2808 #[allow(unused_imports)]
2809 use ::buffa::Enumeration as _;
2810 match field.number() {
2811 1u32 => ::buffa_descriptor::reflect::ValueRef::Bytes(self.value),
2812 _ => {
2813 ::core::debug_assert!(
2814 false,
2815 "field number {} is not a member of this view's reflect get()",
2816 field.number(),
2817 );
2818 ::buffa_descriptor::reflect::ValueRef::Bool(false)
2819 }
2820 }
2821 }
2822 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
2823 match field.number() {
2824 1u32 => !self.value.is_empty(),
2825 _ => false,
2826 }
2827 }
2828 fn for_each_set(
2829 &self,
2830 f: &mut dyn ::core::ops::FnMut(
2831 &::buffa_descriptor::FieldDescriptor,
2832 ::buffa_descriptor::reflect::ValueRef<'_>,
2833 ),
2834 ) {
2835 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
2836 self,
2837 );
2838 for fd in md.fields() {
2839 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
2840 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
2841 }
2842 }
2843 }
2844 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
2845 let bytes = ::buffa::ViewEncode::encode_to_vec(self);
2846 let options = ::buffa::DecodeOptions::new()
2847 .with_element_memory_limit(
2848 bytes
2849 .len()
2850 .saturating_mul(128)
2851 .max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
2852 )
2853 .with_unknown_field_limit(
2854 bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
2855 );
2856 ::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
2857 ::buffa::alloc::sync::Arc::clone(
2858 super::super::__buffa::reflect::descriptor_pool(),
2859 ),
2860 Self::__buffa_reflect_message_index(),
2861 &bytes,
2862 &options,
2863 )
2864 .expect("view re-encodes to bytes decodable against its own descriptor")
2865 }
2866 }
2867 impl<'a> ::buffa_descriptor::reflect::ReflectElement for BytesValueView<'a> {
2868 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
2869 ::buffa_descriptor::reflect::ValueRef::Message(
2870 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
2871 )
2872 }
2873 }
2874 impl<'a> BytesValueView<'a> {
2875 #[doc(hidden)]
2880 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
2881 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
2882 *IDX
2883 .get_or_init(|| {
2884 super::super::__buffa::reflect::descriptor_pool()
2885 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
2886 .expect(
2887 "generated view type is registered in the embedded descriptor pool",
2888 )
2889 })
2890 }
2891 }
2892};