#[derive(Clone, Debug, Default)]
pub struct DoubleValueView<'a> {
pub value: f64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> DoubleValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Fixed64 {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 1u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_double(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for DoubleValueView<'a> {
type Owned = super::super::DoubleValue;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::DoubleValue {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::DoubleValue {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for DoubleValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value.to_bits() != 0u64 {
size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value.to_bits() != 0u64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed64)
.encode(buf);
::buffa::types::encode_double(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for DoubleValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<DoubleValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<DoubleValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct FloatValueView<'a> {
pub value: f32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> FloatValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Fixed32 {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 5u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_float(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for FloatValueView<'a> {
type Owned = super::super::FloatValue;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::FloatValue {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::FloatValue {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for FloatValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value.to_bits() != 0u32 {
size += 1u32 + ::buffa::types::FIXED32_ENCODED_LEN as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value.to_bits() != 0u32 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Fixed32)
.encode(buf);
::buffa::types::encode_float(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for FloatValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<FloatValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<FloatValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct Int64ValueView<'a> {
pub value: i64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> Int64ValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_int64(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for Int64ValueView<'a> {
type Owned = super::super::Int64Value;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::Int64Value {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::Int64Value {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for Int64ValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value != 0i64 {
size += 1u32 + ::buffa::types::int64_encoded_len(self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0i64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int64(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for Int64ValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<Int64ValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<Int64ValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct UInt64ValueView<'a> {
pub value: u64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> UInt64ValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_uint64(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for UInt64ValueView<'a> {
type Owned = super::super::UInt64Value;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::UInt64Value {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::UInt64Value {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for UInt64ValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value != 0u64 {
size += 1u32 + ::buffa::types::uint64_encoded_len(self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0u64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint64(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for UInt64ValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<UInt64ValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<UInt64ValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct Int32ValueView<'a> {
pub value: i32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> Int32ValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_int32(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for Int32ValueView<'a> {
type Owned = super::super::Int32Value;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::Int32Value {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::Int32Value {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for Int32ValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value != 0i32 {
size += 1u32 + ::buffa::types::int32_encoded_len(self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0i32 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for Int32ValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<Int32ValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<Int32ValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct UInt32ValueView<'a> {
pub value: u32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> UInt32ValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_uint32(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for UInt32ValueView<'a> {
type Owned = super::super::UInt32Value;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::UInt32Value {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::UInt32Value {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for UInt32ValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value != 0u32 {
size += 1u32 + ::buffa::types::uint32_encoded_len(self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0u32 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint32(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for UInt32ValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<UInt32ValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<UInt32ValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct BoolValueView<'a> {
pub value: bool,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> BoolValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::decode_bool(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for BoolValueView<'a> {
type Owned = super::super::BoolValue;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::BoolValue {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::BoolValue {
value: self.value,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for BoolValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.value {
size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_bool(self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for BoolValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<BoolValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<BoolValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct StringValueView<'a> {
pub value: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> StringValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for StringValueView<'a> {
type Owned = super::super::StringValue;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::StringValue {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::StringValue {
value: self.value.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for StringValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.value.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.value.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for StringValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<StringValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<StringValueView<'static>>::default(),
))
}
}
#[derive(Clone, Debug, Default)]
pub struct BytesValueView<'a> {
pub value: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> BytesValueView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
view.value = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for BytesValueView<'a> {
type Owned = super::super::BytesValue;
fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
#[allow(clippy::needless_update)]
fn to_owned_message(&self) -> super::super::BytesValue {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
super::super::BytesValue {
value: (self.value).to_vec(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for BytesValueView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.value.is_empty() {
size += 1u32 + ::buffa::types::bytes_encoded_len(&self.value) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.value.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_bytes(&self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'v> ::buffa::DefaultViewInstance for BytesValueView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<BytesValueView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<BytesValueView<'static>>::default(),
))
}
}