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<'v> ::buffa::DefaultViewInstance for DoubleValueView<'v> {
135 fn default_view_instance<'a>() -> &'a Self
136 where
137 Self: 'a,
138 {
139 static VALUE: ::buffa::__private::OnceBox<DoubleValueView<'static>> = ::buffa::__private::OnceBox::new();
140 VALUE
141 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
142 <DoubleValueView<'static>>::default(),
143 ))
144 }
145}
146impl ::buffa::ViewReborrow for DoubleValueView<'static> {
147 type Reborrowed<'b> = DoubleValueView<'b>;
148 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
149 this
150 }
151}
152#[derive(Clone, Debug, Default)]
156pub struct FloatValueView<'a> {
157 pub value: f32,
161 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
162}
163impl<'a> FloatValueView<'a> {
164 #[doc(hidden)]
172 pub fn _decode_depth(
173 buf: &'a [u8],
174 depth: u32,
175 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
176 let mut view = Self::default();
177 view._merge_into_view(buf, depth)?;
178 ::core::result::Result::Ok(view)
179 }
180 #[doc(hidden)]
188 pub fn _merge_into_view(
189 &mut self,
190 buf: &'a [u8],
191 depth: u32,
192 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
193 let _ = depth;
194 #[allow(unused_variables)]
195 let view = self;
196 let mut cur: &'a [u8] = buf;
197 while !cur.is_empty() {
198 let before_tag = cur;
199 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
200 match tag.field_number() {
201 1u32 => {
202 if tag.wire_type() != ::buffa::encoding::WireType::Fixed32 {
203 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
204 field_number: 1u32,
205 expected: 5u8,
206 actual: tag.wire_type() as u8,
207 });
208 }
209 view.value = ::buffa::types::decode_float(&mut cur)?;
210 }
211 _ => {
212 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
213 let span_len = before_tag.len() - cur.len();
214 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
215 }
216 }
217 }
218 ::core::result::Result::Ok(())
219 }
220}
221impl<'a> ::buffa::MessageView<'a> for FloatValueView<'a> {
222 type Owned = super::super::FloatValue;
223 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
224 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
225 }
226 fn decode_view_with_limit(
227 buf: &'a [u8],
228 depth: u32,
229 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
230 Self::_decode_depth(buf, depth)
231 }
232 fn to_owned_message(&self) -> super::super::FloatValue {
233 self.to_owned_from_source(None)
234 }
235 #[allow(clippy::useless_conversion, clippy::needless_update)]
236 fn to_owned_from_source(
237 &self,
238 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
239 ) -> super::super::FloatValue {
240 #[allow(unused_imports)]
241 use ::buffa::alloc::string::ToString as _;
242 let _ = __buffa_src;
243 super::super::FloatValue {
244 value: self.value,
245 __buffa_unknown_fields: self
246 .__buffa_unknown_fields
247 .to_owned()
248 .unwrap_or_default()
249 .into(),
250 ..::core::default::Default::default()
251 }
252 }
253}
254impl<'a> ::buffa::ViewEncode<'a> for FloatValueView<'a> {
255 #[allow(clippy::needless_borrow, clippy::let_and_return)]
256 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
257 #[allow(unused_imports)]
258 use ::buffa::Enumeration as _;
259 let mut size = 0u32;
260 if self.value.to_bits() != 0u32 {
261 size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
262 }
263 size += self.__buffa_unknown_fields.encoded_len() as u32;
264 size
265 }
266 #[allow(clippy::needless_borrow)]
267 fn write_to(
268 &self,
269 _cache: &mut ::buffa::SizeCache,
270 buf: &mut impl ::buffa::bytes::BufMut,
271 ) {
272 #[allow(unused_imports)]
273 use ::buffa::Enumeration as _;
274 if self.value.to_bits() != 0u32 {
275 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed32)
276 .encode(buf);
277 ::buffa::types::encode_float(self.value, buf);
278 }
279 self.__buffa_unknown_fields.write_to(buf);
280 }
281}
282impl<'v> ::buffa::DefaultViewInstance for FloatValueView<'v> {
283 fn default_view_instance<'a>() -> &'a Self
284 where
285 Self: 'a,
286 {
287 static VALUE: ::buffa::__private::OnceBox<FloatValueView<'static>> = ::buffa::__private::OnceBox::new();
288 VALUE
289 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
290 <FloatValueView<'static>>::default(),
291 ))
292 }
293}
294impl ::buffa::ViewReborrow for FloatValueView<'static> {
295 type Reborrowed<'b> = FloatValueView<'b>;
296 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
297 this
298 }
299}
300#[derive(Clone, Debug, Default)]
304pub struct Int64ValueView<'a> {
305 pub value: i64,
309 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
310}
311impl<'a> Int64ValueView<'a> {
312 #[doc(hidden)]
320 pub fn _decode_depth(
321 buf: &'a [u8],
322 depth: u32,
323 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
324 let mut view = Self::default();
325 view._merge_into_view(buf, depth)?;
326 ::core::result::Result::Ok(view)
327 }
328 #[doc(hidden)]
336 pub fn _merge_into_view(
337 &mut self,
338 buf: &'a [u8],
339 depth: u32,
340 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
341 let _ = depth;
342 #[allow(unused_variables)]
343 let view = self;
344 let mut cur: &'a [u8] = buf;
345 while !cur.is_empty() {
346 let before_tag = cur;
347 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
348 match tag.field_number() {
349 1u32 => {
350 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
351 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
352 field_number: 1u32,
353 expected: 0u8,
354 actual: tag.wire_type() as u8,
355 });
356 }
357 view.value = ::buffa::types::decode_int64(&mut cur)?;
358 }
359 _ => {
360 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
361 let span_len = before_tag.len() - cur.len();
362 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
363 }
364 }
365 }
366 ::core::result::Result::Ok(())
367 }
368}
369impl<'a> ::buffa::MessageView<'a> for Int64ValueView<'a> {
370 type Owned = super::super::Int64Value;
371 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
372 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
373 }
374 fn decode_view_with_limit(
375 buf: &'a [u8],
376 depth: u32,
377 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
378 Self::_decode_depth(buf, depth)
379 }
380 fn to_owned_message(&self) -> super::super::Int64Value {
381 self.to_owned_from_source(None)
382 }
383 #[allow(clippy::useless_conversion, clippy::needless_update)]
384 fn to_owned_from_source(
385 &self,
386 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
387 ) -> super::super::Int64Value {
388 #[allow(unused_imports)]
389 use ::buffa::alloc::string::ToString as _;
390 let _ = __buffa_src;
391 super::super::Int64Value {
392 value: self.value,
393 __buffa_unknown_fields: self
394 .__buffa_unknown_fields
395 .to_owned()
396 .unwrap_or_default()
397 .into(),
398 ..::core::default::Default::default()
399 }
400 }
401}
402impl<'a> ::buffa::ViewEncode<'a> for Int64ValueView<'a> {
403 #[allow(clippy::needless_borrow, clippy::let_and_return)]
404 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
405 #[allow(unused_imports)]
406 use ::buffa::Enumeration as _;
407 let mut size = 0u32;
408 if self.value != 0i64 {
409 size += 1u32 + ::buffa::types::int64_encoded_len(self.value) as u32;
410 }
411 size += self.__buffa_unknown_fields.encoded_len() as u32;
412 size
413 }
414 #[allow(clippy::needless_borrow)]
415 fn write_to(
416 &self,
417 _cache: &mut ::buffa::SizeCache,
418 buf: &mut impl ::buffa::bytes::BufMut,
419 ) {
420 #[allow(unused_imports)]
421 use ::buffa::Enumeration as _;
422 if self.value != 0i64 {
423 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
424 .encode(buf);
425 ::buffa::types::encode_int64(self.value, buf);
426 }
427 self.__buffa_unknown_fields.write_to(buf);
428 }
429}
430impl<'v> ::buffa::DefaultViewInstance for Int64ValueView<'v> {
431 fn default_view_instance<'a>() -> &'a Self
432 where
433 Self: 'a,
434 {
435 static VALUE: ::buffa::__private::OnceBox<Int64ValueView<'static>> = ::buffa::__private::OnceBox::new();
436 VALUE
437 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
438 <Int64ValueView<'static>>::default(),
439 ))
440 }
441}
442impl ::buffa::ViewReborrow for Int64ValueView<'static> {
443 type Reborrowed<'b> = Int64ValueView<'b>;
444 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
445 this
446 }
447}
448#[derive(Clone, Debug, Default)]
452pub struct UInt64ValueView<'a> {
453 pub value: u64,
457 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
458}
459impl<'a> UInt64ValueView<'a> {
460 #[doc(hidden)]
468 pub fn _decode_depth(
469 buf: &'a [u8],
470 depth: u32,
471 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
472 let mut view = Self::default();
473 view._merge_into_view(buf, depth)?;
474 ::core::result::Result::Ok(view)
475 }
476 #[doc(hidden)]
484 pub fn _merge_into_view(
485 &mut self,
486 buf: &'a [u8],
487 depth: u32,
488 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
489 let _ = depth;
490 #[allow(unused_variables)]
491 let view = self;
492 let mut cur: &'a [u8] = buf;
493 while !cur.is_empty() {
494 let before_tag = cur;
495 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
496 match tag.field_number() {
497 1u32 => {
498 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
499 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
500 field_number: 1u32,
501 expected: 0u8,
502 actual: tag.wire_type() as u8,
503 });
504 }
505 view.value = ::buffa::types::decode_uint64(&mut cur)?;
506 }
507 _ => {
508 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
509 let span_len = before_tag.len() - cur.len();
510 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
511 }
512 }
513 }
514 ::core::result::Result::Ok(())
515 }
516}
517impl<'a> ::buffa::MessageView<'a> for UInt64ValueView<'a> {
518 type Owned = super::super::UInt64Value;
519 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
520 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
521 }
522 fn decode_view_with_limit(
523 buf: &'a [u8],
524 depth: u32,
525 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
526 Self::_decode_depth(buf, depth)
527 }
528 fn to_owned_message(&self) -> super::super::UInt64Value {
529 self.to_owned_from_source(None)
530 }
531 #[allow(clippy::useless_conversion, clippy::needless_update)]
532 fn to_owned_from_source(
533 &self,
534 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
535 ) -> super::super::UInt64Value {
536 #[allow(unused_imports)]
537 use ::buffa::alloc::string::ToString as _;
538 let _ = __buffa_src;
539 super::super::UInt64Value {
540 value: self.value,
541 __buffa_unknown_fields: self
542 .__buffa_unknown_fields
543 .to_owned()
544 .unwrap_or_default()
545 .into(),
546 ..::core::default::Default::default()
547 }
548 }
549}
550impl<'a> ::buffa::ViewEncode<'a> for UInt64ValueView<'a> {
551 #[allow(clippy::needless_borrow, clippy::let_and_return)]
552 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
553 #[allow(unused_imports)]
554 use ::buffa::Enumeration as _;
555 let mut size = 0u32;
556 if self.value != 0u64 {
557 size += 1u32 + ::buffa::types::uint64_encoded_len(self.value) as u32;
558 }
559 size += self.__buffa_unknown_fields.encoded_len() as u32;
560 size
561 }
562 #[allow(clippy::needless_borrow)]
563 fn write_to(
564 &self,
565 _cache: &mut ::buffa::SizeCache,
566 buf: &mut impl ::buffa::bytes::BufMut,
567 ) {
568 #[allow(unused_imports)]
569 use ::buffa::Enumeration as _;
570 if self.value != 0u64 {
571 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
572 .encode(buf);
573 ::buffa::types::encode_uint64(self.value, buf);
574 }
575 self.__buffa_unknown_fields.write_to(buf);
576 }
577}
578impl<'v> ::buffa::DefaultViewInstance for UInt64ValueView<'v> {
579 fn default_view_instance<'a>() -> &'a Self
580 where
581 Self: 'a,
582 {
583 static VALUE: ::buffa::__private::OnceBox<UInt64ValueView<'static>> = ::buffa::__private::OnceBox::new();
584 VALUE
585 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
586 <UInt64ValueView<'static>>::default(),
587 ))
588 }
589}
590impl ::buffa::ViewReborrow for UInt64ValueView<'static> {
591 type Reborrowed<'b> = UInt64ValueView<'b>;
592 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
593 this
594 }
595}
596#[derive(Clone, Debug, Default)]
600pub struct Int32ValueView<'a> {
601 pub value: i32,
605 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
606}
607impl<'a> Int32ValueView<'a> {
608 #[doc(hidden)]
616 pub fn _decode_depth(
617 buf: &'a [u8],
618 depth: u32,
619 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
620 let mut view = Self::default();
621 view._merge_into_view(buf, depth)?;
622 ::core::result::Result::Ok(view)
623 }
624 #[doc(hidden)]
632 pub fn _merge_into_view(
633 &mut self,
634 buf: &'a [u8],
635 depth: u32,
636 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
637 let _ = depth;
638 #[allow(unused_variables)]
639 let view = self;
640 let mut cur: &'a [u8] = buf;
641 while !cur.is_empty() {
642 let before_tag = cur;
643 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
644 match tag.field_number() {
645 1u32 => {
646 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
647 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
648 field_number: 1u32,
649 expected: 0u8,
650 actual: tag.wire_type() as u8,
651 });
652 }
653 view.value = ::buffa::types::decode_int32(&mut cur)?;
654 }
655 _ => {
656 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
657 let span_len = before_tag.len() - cur.len();
658 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
659 }
660 }
661 }
662 ::core::result::Result::Ok(())
663 }
664}
665impl<'a> ::buffa::MessageView<'a> for Int32ValueView<'a> {
666 type Owned = super::super::Int32Value;
667 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
668 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
669 }
670 fn decode_view_with_limit(
671 buf: &'a [u8],
672 depth: u32,
673 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
674 Self::_decode_depth(buf, depth)
675 }
676 fn to_owned_message(&self) -> super::super::Int32Value {
677 self.to_owned_from_source(None)
678 }
679 #[allow(clippy::useless_conversion, clippy::needless_update)]
680 fn to_owned_from_source(
681 &self,
682 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
683 ) -> super::super::Int32Value {
684 #[allow(unused_imports)]
685 use ::buffa::alloc::string::ToString as _;
686 let _ = __buffa_src;
687 super::super::Int32Value {
688 value: self.value,
689 __buffa_unknown_fields: self
690 .__buffa_unknown_fields
691 .to_owned()
692 .unwrap_or_default()
693 .into(),
694 ..::core::default::Default::default()
695 }
696 }
697}
698impl<'a> ::buffa::ViewEncode<'a> for Int32ValueView<'a> {
699 #[allow(clippy::needless_borrow, clippy::let_and_return)]
700 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
701 #[allow(unused_imports)]
702 use ::buffa::Enumeration as _;
703 let mut size = 0u32;
704 if self.value != 0i32 {
705 size += 1u32 + ::buffa::types::int32_encoded_len(self.value) as u32;
706 }
707 size += self.__buffa_unknown_fields.encoded_len() as u32;
708 size
709 }
710 #[allow(clippy::needless_borrow)]
711 fn write_to(
712 &self,
713 _cache: &mut ::buffa::SizeCache,
714 buf: &mut impl ::buffa::bytes::BufMut,
715 ) {
716 #[allow(unused_imports)]
717 use ::buffa::Enumeration as _;
718 if self.value != 0i32 {
719 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
720 .encode(buf);
721 ::buffa::types::encode_int32(self.value, buf);
722 }
723 self.__buffa_unknown_fields.write_to(buf);
724 }
725}
726impl<'v> ::buffa::DefaultViewInstance for Int32ValueView<'v> {
727 fn default_view_instance<'a>() -> &'a Self
728 where
729 Self: 'a,
730 {
731 static VALUE: ::buffa::__private::OnceBox<Int32ValueView<'static>> = ::buffa::__private::OnceBox::new();
732 VALUE
733 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
734 <Int32ValueView<'static>>::default(),
735 ))
736 }
737}
738impl ::buffa::ViewReborrow for Int32ValueView<'static> {
739 type Reborrowed<'b> = Int32ValueView<'b>;
740 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
741 this
742 }
743}
744#[derive(Clone, Debug, Default)]
748pub struct UInt32ValueView<'a> {
749 pub value: u32,
753 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
754}
755impl<'a> UInt32ValueView<'a> {
756 #[doc(hidden)]
764 pub fn _decode_depth(
765 buf: &'a [u8],
766 depth: u32,
767 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
768 let mut view = Self::default();
769 view._merge_into_view(buf, depth)?;
770 ::core::result::Result::Ok(view)
771 }
772 #[doc(hidden)]
780 pub fn _merge_into_view(
781 &mut self,
782 buf: &'a [u8],
783 depth: u32,
784 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
785 let _ = depth;
786 #[allow(unused_variables)]
787 let view = self;
788 let mut cur: &'a [u8] = buf;
789 while !cur.is_empty() {
790 let before_tag = cur;
791 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
792 match tag.field_number() {
793 1u32 => {
794 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
795 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
796 field_number: 1u32,
797 expected: 0u8,
798 actual: tag.wire_type() as u8,
799 });
800 }
801 view.value = ::buffa::types::decode_uint32(&mut cur)?;
802 }
803 _ => {
804 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
805 let span_len = before_tag.len() - cur.len();
806 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
807 }
808 }
809 }
810 ::core::result::Result::Ok(())
811 }
812}
813impl<'a> ::buffa::MessageView<'a> for UInt32ValueView<'a> {
814 type Owned = super::super::UInt32Value;
815 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
816 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
817 }
818 fn decode_view_with_limit(
819 buf: &'a [u8],
820 depth: u32,
821 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
822 Self::_decode_depth(buf, depth)
823 }
824 fn to_owned_message(&self) -> super::super::UInt32Value {
825 self.to_owned_from_source(None)
826 }
827 #[allow(clippy::useless_conversion, clippy::needless_update)]
828 fn to_owned_from_source(
829 &self,
830 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
831 ) -> super::super::UInt32Value {
832 #[allow(unused_imports)]
833 use ::buffa::alloc::string::ToString as _;
834 let _ = __buffa_src;
835 super::super::UInt32Value {
836 value: self.value,
837 __buffa_unknown_fields: self
838 .__buffa_unknown_fields
839 .to_owned()
840 .unwrap_or_default()
841 .into(),
842 ..::core::default::Default::default()
843 }
844 }
845}
846impl<'a> ::buffa::ViewEncode<'a> for UInt32ValueView<'a> {
847 #[allow(clippy::needless_borrow, clippy::let_and_return)]
848 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
849 #[allow(unused_imports)]
850 use ::buffa::Enumeration as _;
851 let mut size = 0u32;
852 if self.value != 0u32 {
853 size += 1u32 + ::buffa::types::uint32_encoded_len(self.value) as u32;
854 }
855 size += self.__buffa_unknown_fields.encoded_len() as u32;
856 size
857 }
858 #[allow(clippy::needless_borrow)]
859 fn write_to(
860 &self,
861 _cache: &mut ::buffa::SizeCache,
862 buf: &mut impl ::buffa::bytes::BufMut,
863 ) {
864 #[allow(unused_imports)]
865 use ::buffa::Enumeration as _;
866 if self.value != 0u32 {
867 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
868 .encode(buf);
869 ::buffa::types::encode_uint32(self.value, buf);
870 }
871 self.__buffa_unknown_fields.write_to(buf);
872 }
873}
874impl<'v> ::buffa::DefaultViewInstance for UInt32ValueView<'v> {
875 fn default_view_instance<'a>() -> &'a Self
876 where
877 Self: 'a,
878 {
879 static VALUE: ::buffa::__private::OnceBox<UInt32ValueView<'static>> = ::buffa::__private::OnceBox::new();
880 VALUE
881 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
882 <UInt32ValueView<'static>>::default(),
883 ))
884 }
885}
886impl ::buffa::ViewReborrow for UInt32ValueView<'static> {
887 type Reborrowed<'b> = UInt32ValueView<'b>;
888 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
889 this
890 }
891}
892#[derive(Clone, Debug, Default)]
896pub struct BoolValueView<'a> {
897 pub value: bool,
901 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
902}
903impl<'a> BoolValueView<'a> {
904 #[doc(hidden)]
912 pub fn _decode_depth(
913 buf: &'a [u8],
914 depth: u32,
915 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
916 let mut view = Self::default();
917 view._merge_into_view(buf, depth)?;
918 ::core::result::Result::Ok(view)
919 }
920 #[doc(hidden)]
928 pub fn _merge_into_view(
929 &mut self,
930 buf: &'a [u8],
931 depth: u32,
932 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
933 let _ = depth;
934 #[allow(unused_variables)]
935 let view = self;
936 let mut cur: &'a [u8] = buf;
937 while !cur.is_empty() {
938 let before_tag = cur;
939 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
940 match tag.field_number() {
941 1u32 => {
942 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
943 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
944 field_number: 1u32,
945 expected: 0u8,
946 actual: tag.wire_type() as u8,
947 });
948 }
949 view.value = ::buffa::types::decode_bool(&mut cur)?;
950 }
951 _ => {
952 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
953 let span_len = before_tag.len() - cur.len();
954 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
955 }
956 }
957 }
958 ::core::result::Result::Ok(())
959 }
960}
961impl<'a> ::buffa::MessageView<'a> for BoolValueView<'a> {
962 type Owned = super::super::BoolValue;
963 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
964 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
965 }
966 fn decode_view_with_limit(
967 buf: &'a [u8],
968 depth: u32,
969 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
970 Self::_decode_depth(buf, depth)
971 }
972 fn to_owned_message(&self) -> super::super::BoolValue {
973 self.to_owned_from_source(None)
974 }
975 #[allow(clippy::useless_conversion, clippy::needless_update)]
976 fn to_owned_from_source(
977 &self,
978 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
979 ) -> super::super::BoolValue {
980 #[allow(unused_imports)]
981 use ::buffa::alloc::string::ToString as _;
982 let _ = __buffa_src;
983 super::super::BoolValue {
984 value: self.value,
985 __buffa_unknown_fields: self
986 .__buffa_unknown_fields
987 .to_owned()
988 .unwrap_or_default()
989 .into(),
990 ..::core::default::Default::default()
991 }
992 }
993}
994impl<'a> ::buffa::ViewEncode<'a> for BoolValueView<'a> {
995 #[allow(clippy::needless_borrow, clippy::let_and_return)]
996 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
997 #[allow(unused_imports)]
998 use ::buffa::Enumeration as _;
999 let mut size = 0u32;
1000 if self.value {
1001 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
1002 }
1003 size += self.__buffa_unknown_fields.encoded_len() as u32;
1004 size
1005 }
1006 #[allow(clippy::needless_borrow)]
1007 fn write_to(
1008 &self,
1009 _cache: &mut ::buffa::SizeCache,
1010 buf: &mut impl ::buffa::bytes::BufMut,
1011 ) {
1012 #[allow(unused_imports)]
1013 use ::buffa::Enumeration as _;
1014 if self.value {
1015 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
1016 .encode(buf);
1017 ::buffa::types::encode_bool(self.value, buf);
1018 }
1019 self.__buffa_unknown_fields.write_to(buf);
1020 }
1021}
1022impl<'v> ::buffa::DefaultViewInstance for BoolValueView<'v> {
1023 fn default_view_instance<'a>() -> &'a Self
1024 where
1025 Self: 'a,
1026 {
1027 static VALUE: ::buffa::__private::OnceBox<BoolValueView<'static>> = ::buffa::__private::OnceBox::new();
1028 VALUE
1029 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1030 <BoolValueView<'static>>::default(),
1031 ))
1032 }
1033}
1034impl ::buffa::ViewReborrow for BoolValueView<'static> {
1035 type Reborrowed<'b> = BoolValueView<'b>;
1036 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1037 this
1038 }
1039}
1040#[derive(Clone, Debug, Default)]
1044pub struct StringValueView<'a> {
1045 pub value: &'a str,
1049 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1050}
1051impl<'a> StringValueView<'a> {
1052 #[doc(hidden)]
1060 pub fn _decode_depth(
1061 buf: &'a [u8],
1062 depth: u32,
1063 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1064 let mut view = Self::default();
1065 view._merge_into_view(buf, depth)?;
1066 ::core::result::Result::Ok(view)
1067 }
1068 #[doc(hidden)]
1076 pub fn _merge_into_view(
1077 &mut self,
1078 buf: &'a [u8],
1079 depth: u32,
1080 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1081 let _ = depth;
1082 #[allow(unused_variables)]
1083 let view = self;
1084 let mut cur: &'a [u8] = buf;
1085 while !cur.is_empty() {
1086 let before_tag = cur;
1087 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1088 match tag.field_number() {
1089 1u32 => {
1090 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1091 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1092 field_number: 1u32,
1093 expected: 2u8,
1094 actual: tag.wire_type() as u8,
1095 });
1096 }
1097 view.value = ::buffa::types::borrow_str(&mut cur)?;
1098 }
1099 _ => {
1100 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1101 let span_len = before_tag.len() - cur.len();
1102 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1103 }
1104 }
1105 }
1106 ::core::result::Result::Ok(())
1107 }
1108}
1109impl<'a> ::buffa::MessageView<'a> for StringValueView<'a> {
1110 type Owned = super::super::StringValue;
1111 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1112 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1113 }
1114 fn decode_view_with_limit(
1115 buf: &'a [u8],
1116 depth: u32,
1117 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1118 Self::_decode_depth(buf, depth)
1119 }
1120 fn to_owned_message(&self) -> super::super::StringValue {
1121 self.to_owned_from_source(None)
1122 }
1123 #[allow(clippy::useless_conversion, clippy::needless_update)]
1124 fn to_owned_from_source(
1125 &self,
1126 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1127 ) -> super::super::StringValue {
1128 #[allow(unused_imports)]
1129 use ::buffa::alloc::string::ToString as _;
1130 let _ = __buffa_src;
1131 super::super::StringValue {
1132 value: self.value.to_string(),
1133 __buffa_unknown_fields: self
1134 .__buffa_unknown_fields
1135 .to_owned()
1136 .unwrap_or_default()
1137 .into(),
1138 ..::core::default::Default::default()
1139 }
1140 }
1141}
1142impl<'a> ::buffa::ViewEncode<'a> for StringValueView<'a> {
1143 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1144 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1145 #[allow(unused_imports)]
1146 use ::buffa::Enumeration as _;
1147 let mut size = 0u32;
1148 if !self.value.is_empty() {
1149 size += 1u32 + ::buffa::types::string_encoded_len(&self.value) as u32;
1150 }
1151 size += self.__buffa_unknown_fields.encoded_len() as u32;
1152 size
1153 }
1154 #[allow(clippy::needless_borrow)]
1155 fn write_to(
1156 &self,
1157 _cache: &mut ::buffa::SizeCache,
1158 buf: &mut impl ::buffa::bytes::BufMut,
1159 ) {
1160 #[allow(unused_imports)]
1161 use ::buffa::Enumeration as _;
1162 if !self.value.is_empty() {
1163 ::buffa::encoding::Tag::new(
1164 1u32,
1165 ::buffa::encoding::WireType::LengthDelimited,
1166 )
1167 .encode(buf);
1168 ::buffa::types::encode_string(&self.value, buf);
1169 }
1170 self.__buffa_unknown_fields.write_to(buf);
1171 }
1172}
1173impl<'v> ::buffa::DefaultViewInstance for StringValueView<'v> {
1174 fn default_view_instance<'a>() -> &'a Self
1175 where
1176 Self: 'a,
1177 {
1178 static VALUE: ::buffa::__private::OnceBox<StringValueView<'static>> = ::buffa::__private::OnceBox::new();
1179 VALUE
1180 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1181 <StringValueView<'static>>::default(),
1182 ))
1183 }
1184}
1185impl ::buffa::ViewReborrow for StringValueView<'static> {
1186 type Reborrowed<'b> = StringValueView<'b>;
1187 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1188 this
1189 }
1190}
1191#[derive(Clone, Debug, Default)]
1195pub struct BytesValueView<'a> {
1196 pub value: &'a [u8],
1200 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1201}
1202impl<'a> BytesValueView<'a> {
1203 #[doc(hidden)]
1211 pub fn _decode_depth(
1212 buf: &'a [u8],
1213 depth: u32,
1214 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1215 let mut view = Self::default();
1216 view._merge_into_view(buf, depth)?;
1217 ::core::result::Result::Ok(view)
1218 }
1219 #[doc(hidden)]
1227 pub fn _merge_into_view(
1228 &mut self,
1229 buf: &'a [u8],
1230 depth: u32,
1231 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1232 let _ = depth;
1233 #[allow(unused_variables)]
1234 let view = self;
1235 let mut cur: &'a [u8] = buf;
1236 while !cur.is_empty() {
1237 let before_tag = cur;
1238 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
1239 match tag.field_number() {
1240 1u32 => {
1241 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1242 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1243 field_number: 1u32,
1244 expected: 2u8,
1245 actual: tag.wire_type() as u8,
1246 });
1247 }
1248 view.value = ::buffa::types::borrow_bytes(&mut cur)?;
1249 }
1250 _ => {
1251 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
1252 let span_len = before_tag.len() - cur.len();
1253 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
1254 }
1255 }
1256 }
1257 ::core::result::Result::Ok(())
1258 }
1259}
1260impl<'a> ::buffa::MessageView<'a> for BytesValueView<'a> {
1261 type Owned = super::super::BytesValue;
1262 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1263 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
1264 }
1265 fn decode_view_with_limit(
1266 buf: &'a [u8],
1267 depth: u32,
1268 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1269 Self::_decode_depth(buf, depth)
1270 }
1271 fn to_owned_message(&self) -> super::super::BytesValue {
1272 self.to_owned_from_source(None)
1273 }
1274 #[allow(clippy::useless_conversion, clippy::needless_update)]
1275 fn to_owned_from_source(
1276 &self,
1277 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1278 ) -> super::super::BytesValue {
1279 #[allow(unused_imports)]
1280 use ::buffa::alloc::string::ToString as _;
1281 let _ = __buffa_src;
1282 super::super::BytesValue {
1283 value: (self.value).to_vec(),
1284 __buffa_unknown_fields: self
1285 .__buffa_unknown_fields
1286 .to_owned()
1287 .unwrap_or_default()
1288 .into(),
1289 ..::core::default::Default::default()
1290 }
1291 }
1292}
1293impl<'a> ::buffa::ViewEncode<'a> for BytesValueView<'a> {
1294 #[allow(clippy::needless_borrow, clippy::let_and_return)]
1295 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1296 #[allow(unused_imports)]
1297 use ::buffa::Enumeration as _;
1298 let mut size = 0u32;
1299 if !self.value.is_empty() {
1300 size += 1u32 + ::buffa::types::bytes_encoded_len(&self.value) as u32;
1301 }
1302 size += self.__buffa_unknown_fields.encoded_len() as u32;
1303 size
1304 }
1305 #[allow(clippy::needless_borrow)]
1306 fn write_to(
1307 &self,
1308 _cache: &mut ::buffa::SizeCache,
1309 buf: &mut impl ::buffa::bytes::BufMut,
1310 ) {
1311 #[allow(unused_imports)]
1312 use ::buffa::Enumeration as _;
1313 if !self.value.is_empty() {
1314 ::buffa::encoding::Tag::new(
1315 1u32,
1316 ::buffa::encoding::WireType::LengthDelimited,
1317 )
1318 .encode(buf);
1319 ::buffa::types::encode_bytes(&self.value, buf);
1320 }
1321 self.__buffa_unknown_fields.write_to(buf);
1322 }
1323}
1324impl<'v> ::buffa::DefaultViewInstance for BytesValueView<'v> {
1325 fn default_view_instance<'a>() -> &'a Self
1326 where
1327 Self: 'a,
1328 {
1329 static VALUE: ::buffa::__private::OnceBox<BytesValueView<'static>> = ::buffa::__private::OnceBox::new();
1330 VALUE
1331 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
1332 <BytesValueView<'static>>::default(),
1333 ))
1334 }
1335}
1336impl ::buffa::ViewReborrow for BytesValueView<'static> {
1337 type Reborrowed<'b> = BytesValueView<'b>;
1338 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
1339 this
1340 }
1341}