#[derive(Clone, Debug, Default)]
pub struct DoubleValueView<'a> {
pub value: f64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Fixed64,
)?;
view.value = ::buffa::types::decode_double(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::DoubleValue, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::DoubleValue, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::DoubleValue {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value.to_bits() != 0u64 {
size += 1u64 + ::buffa::types::FIXED64_ENCODED_LEN as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value.to_bits() != 0u64 {
::buffa::types::put_double_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for DoubleValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "DoubleValue";
const FULL_NAME: &'static str = "google.protobuf.DoubleValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.DoubleValue";
}
::buffa::impl_default_view_instance!(DoubleValueView);
::buffa::impl_view_reborrow!(DoubleValueView);
#[derive(Clone, Debug)]
pub struct DoubleValueOwnedView(::buffa::OwnedView<DoubleValueView<'static>>);
impl DoubleValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
DoubleValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
DoubleValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::DoubleValue,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
DoubleValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &DoubleValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::DoubleValue {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> f64 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<DoubleValueView<'static>>>
for DoubleValueOwnedView {
fn from(inner: ::buffa::OwnedView<DoubleValueView<'static>>) -> Self {
DoubleValueOwnedView(inner)
}
}
impl ::core::convert::From<DoubleValueOwnedView>
for ::buffa::OwnedView<DoubleValueView<'static>> {
fn from(wrapper: DoubleValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<DoubleValueView<'static>>>
for DoubleValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<DoubleValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::DoubleValue {
type View<'a> = DoubleValueView<'a>;
type ViewHandle = DoubleValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for DoubleValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::F64(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0.0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for DoubleValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> DoubleValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct FloatValueView<'a> {
pub value: f32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Fixed32,
)?;
view.value = ::buffa::types::decode_float(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::FloatValue, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::FloatValue, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::FloatValue {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value.to_bits() != 0u32 {
size += 1u64 + ::buffa::types::FIXED32_ENCODED_LEN as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value.to_bits() != 0u32 {
::buffa::types::put_float_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for FloatValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "FloatValue";
const FULL_NAME: &'static str = "google.protobuf.FloatValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.FloatValue";
}
::buffa::impl_default_view_instance!(FloatValueView);
::buffa::impl_view_reborrow!(FloatValueView);
#[derive(Clone, Debug)]
pub struct FloatValueOwnedView(::buffa::OwnedView<FloatValueView<'static>>);
impl FloatValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
FloatValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
FloatValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::FloatValue,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
FloatValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &FloatValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::FloatValue {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> f32 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<FloatValueView<'static>>>
for FloatValueOwnedView {
fn from(inner: ::buffa::OwnedView<FloatValueView<'static>>) -> Self {
FloatValueOwnedView(inner)
}
}
impl ::core::convert::From<FloatValueOwnedView>
for ::buffa::OwnedView<FloatValueView<'static>> {
fn from(wrapper: FloatValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<FloatValueView<'static>>>
for FloatValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<FloatValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::FloatValue {
type View<'a> = FloatValueView<'a>;
type ViewHandle = FloatValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for FloatValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::F32(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0.0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for FloatValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> FloatValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct Int64ValueView<'a> {
pub value: i64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.value = ::buffa::types::decode_int64(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Int64Value, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Int64Value, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Int64Value {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value != 0i64 {
size += 1u64 + ::buffa::types::int64_encoded_len(self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0i64 {
::buffa::types::put_int64_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for Int64ValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Int64Value";
const FULL_NAME: &'static str = "google.protobuf.Int64Value";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int64Value";
}
::buffa::impl_default_view_instance!(Int64ValueView);
::buffa::impl_view_reborrow!(Int64ValueView);
#[derive(Clone, Debug)]
pub struct Int64ValueOwnedView(::buffa::OwnedView<Int64ValueView<'static>>);
impl Int64ValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Int64Value,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &Int64ValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Int64Value {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> i64 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<Int64ValueView<'static>>>
for Int64ValueOwnedView {
fn from(inner: ::buffa::OwnedView<Int64ValueView<'static>>) -> Self {
Int64ValueOwnedView(inner)
}
}
impl ::core::convert::From<Int64ValueOwnedView>
for ::buffa::OwnedView<Int64ValueView<'static>> {
fn from(wrapper: Int64ValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<Int64ValueView<'static>>>
for Int64ValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<Int64ValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Int64Value {
type View<'a> = Int64ValueView<'a>;
type ViewHandle = Int64ValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int64ValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::I64(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int64ValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> Int64ValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct UInt64ValueView<'a> {
pub value: u64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.value = ::buffa::types::decode_uint64(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::UInt64Value, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::UInt64Value, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::UInt64Value {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value != 0u64 {
size += 1u64 + ::buffa::types::uint64_encoded_len(self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0u64 {
::buffa::types::put_uint64_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for UInt64ValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "UInt64Value";
const FULL_NAME: &'static str = "google.protobuf.UInt64Value";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt64Value";
}
::buffa::impl_default_view_instance!(UInt64ValueView);
::buffa::impl_view_reborrow!(UInt64ValueView);
#[derive(Clone, Debug)]
pub struct UInt64ValueOwnedView(::buffa::OwnedView<UInt64ValueView<'static>>);
impl UInt64ValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt64ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt64ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::UInt64Value,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt64ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &UInt64ValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::UInt64Value {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> u64 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<UInt64ValueView<'static>>>
for UInt64ValueOwnedView {
fn from(inner: ::buffa::OwnedView<UInt64ValueView<'static>>) -> Self {
UInt64ValueOwnedView(inner)
}
}
impl ::core::convert::From<UInt64ValueOwnedView>
for ::buffa::OwnedView<UInt64ValueView<'static>> {
fn from(wrapper: UInt64ValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<UInt64ValueView<'static>>>
for UInt64ValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<UInt64ValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::UInt64Value {
type View<'a> = UInt64ValueView<'a>;
type ViewHandle = UInt64ValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt64ValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::U64(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt64ValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> UInt64ValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct Int32ValueView<'a> {
pub value: i32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.value = ::buffa::types::decode_int32(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::Int32Value, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::Int32Value, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::Int32Value {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0i32 {
::buffa::types::put_int32_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for Int32ValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Int32Value";
const FULL_NAME: &'static str = "google.protobuf.Int32Value";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Int32Value";
}
::buffa::impl_default_view_instance!(Int32ValueView);
::buffa::impl_view_reborrow!(Int32ValueView);
#[derive(Clone, Debug)]
pub struct Int32ValueOwnedView(::buffa::OwnedView<Int32ValueView<'static>>);
impl Int32ValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::Int32Value,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
Int32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &Int32ValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::Int32Value {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> i32 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<Int32ValueView<'static>>>
for Int32ValueOwnedView {
fn from(inner: ::buffa::OwnedView<Int32ValueView<'static>>) -> Self {
Int32ValueOwnedView(inner)
}
}
impl ::core::convert::From<Int32ValueOwnedView>
for ::buffa::OwnedView<Int32ValueView<'static>> {
fn from(wrapper: Int32ValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<Int32ValueView<'static>>>
for Int32ValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<Int32ValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::Int32Value {
type View<'a> = Int32ValueView<'a>;
type ViewHandle = Int32ValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for Int32ValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for Int32ValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> Int32ValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct UInt32ValueView<'a> {
pub value: u32,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.value = ::buffa::types::decode_uint32(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::UInt32Value, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::UInt32Value, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::UInt32Value {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value != 0u32 {
size += 1u64 + ::buffa::types::uint32_encoded_len(self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value != 0u32 {
::buffa::types::put_uint32_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for UInt32ValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "UInt32Value";
const FULL_NAME: &'static str = "google.protobuf.UInt32Value";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.UInt32Value";
}
::buffa::impl_default_view_instance!(UInt32ValueView);
::buffa::impl_view_reborrow!(UInt32ValueView);
#[derive(Clone, Debug)]
pub struct UInt32ValueOwnedView(::buffa::OwnedView<UInt32ValueView<'static>>);
impl UInt32ValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt32ValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt32ValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::UInt32Value,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
UInt32ValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &UInt32ValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::UInt32Value {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> u32 {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<UInt32ValueView<'static>>>
for UInt32ValueOwnedView {
fn from(inner: ::buffa::OwnedView<UInt32ValueView<'static>>) -> Self {
UInt32ValueOwnedView(inner)
}
}
impl ::core::convert::From<UInt32ValueOwnedView>
for ::buffa::OwnedView<UInt32ValueView<'static>> {
fn from(wrapper: UInt32ValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<UInt32ValueView<'static>>>
for UInt32ValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<UInt32ValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::UInt32Value {
type View<'a> = UInt32ValueView<'a>;
type ViewHandle = UInt32ValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for UInt32ValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::U32(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value != 0,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for UInt32ValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> UInt32ValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct BoolValueView<'a> {
pub value: bool,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
view.value = ::buffa::types::decode_bool(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::BoolValue, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::BoolValue, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::BoolValue {
value: self.value,
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if self.value {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.value {
::buffa::types::put_bool_field(1u32, self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for BoolValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "BoolValue";
const FULL_NAME: &'static str = "google.protobuf.BoolValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BoolValue";
}
::buffa::impl_default_view_instance!(BoolValueView);
::buffa::impl_view_reborrow!(BoolValueView);
#[derive(Clone, Debug)]
pub struct BoolValueOwnedView(::buffa::OwnedView<BoolValueView<'static>>);
impl BoolValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BoolValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BoolValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::BoolValue,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BoolValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &BoolValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::BoolValue {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> bool {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<BoolValueView<'static>>>
for BoolValueOwnedView {
fn from(inner: ::buffa::OwnedView<BoolValueView<'static>>) -> Self {
BoolValueOwnedView(inner)
}
}
impl ::core::convert::From<BoolValueOwnedView>
for ::buffa::OwnedView<BoolValueView<'static>> {
fn from(wrapper: BoolValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<BoolValueView<'static>>>
for BoolValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<BoolValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::BoolValue {
type View<'a> = BoolValueView<'a>;
type ViewHandle = BoolValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BoolValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::Bool(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.value,
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for BoolValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> BoolValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct StringValueView<'a> {
pub value: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.value = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::StringValue, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::StringValue, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::StringValue {
value: self.value.to_string(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if !self.value.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.value.is_empty() {
::buffa::types::put_string_field(1u32, &self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for StringValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "StringValue";
const FULL_NAME: &'static str = "google.protobuf.StringValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.StringValue";
}
::buffa::impl_default_view_instance!(StringValueView);
::buffa::impl_view_reborrow!(StringValueView);
#[derive(Clone, Debug)]
pub struct StringValueOwnedView(::buffa::OwnedView<StringValueView<'static>>);
impl StringValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
StringValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
StringValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::StringValue,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
StringValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &StringValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::StringValue {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> &'_ str {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<StringValueView<'static>>>
for StringValueOwnedView {
fn from(inner: ::buffa::OwnedView<StringValueView<'static>>) -> Self {
StringValueOwnedView(inner)
}
}
impl ::core::convert::From<StringValueOwnedView>
for ::buffa::OwnedView<StringValueView<'static>> {
fn from(wrapper: StringValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<StringValueView<'static>>>
for StringValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<StringValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::StringValue {
type View<'a> = StringValueView<'a>;
type ViewHandle = StringValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for StringValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::String(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.value.is_empty(),
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for StringValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> StringValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};
#[derive(Clone, Debug, Default)]
pub struct BytesValueView<'a> {
pub value: &'a [u8],
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
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> {
let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
<Self as ::buffa::MessageView>::decode_view_ctx(
buf,
::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
.with_element_memory(&__elem),
)
}
fn decode_view_with_ctx(
buf: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
<Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
}
#[inline]
fn merge_view_field(
&mut self,
tag: ::buffa::encoding::Tag,
cur: &'a [u8],
before_tag: &'a [u8],
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
let _ = ctx;
#[allow(unused_variables)]
let view = self;
let mut cur = cur;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
view.value = ::buffa::types::borrow_bytes(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields.push_record(before_tag, span_len, ctx)?;
}
}
::core::result::Result::Ok(cur)
}
fn to_owned_message(
&self,
) -> ::core::result::Result<super::super::BytesValue, ::buffa::DecodeError> {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> ::core::result::Result<super::super::BytesValue, ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
::core::result::Result::Ok(super::super::BytesValue {
value: (self.value).to_vec(),
__buffa_unknown_fields: self.__buffa_unknown_fields.to_owned()?.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 = 0u64;
if !self.value.is_empty() {
size += 1u64 + ::buffa::types::bytes_encoded_len(&self.value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.value.is_empty() {
::buffa::types::put_shared_bytes_field(1u32, &self.value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'a> ::buffa::MessageName for BytesValueView<'a> {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "BytesValue";
const FULL_NAME: &'static str = "google.protobuf.BytesValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.BytesValue";
}
::buffa::impl_default_view_instance!(BytesValueView);
::buffa::impl_view_reborrow!(BytesValueView);
#[derive(Clone, Debug)]
pub struct BytesValueOwnedView(::buffa::OwnedView<BytesValueView<'static>>);
impl BytesValueOwnedView {
pub fn decode(
bytes: ::buffa::bytes::Bytes,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BytesValueOwnedView(::buffa::OwnedView::decode(bytes)?),
)
}
pub fn decode_with_options(
bytes: ::buffa::bytes::Bytes,
opts: &::buffa::DecodeOptions,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BytesValueOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
)
}
pub fn from_owned(
msg: &super::super::BytesValue,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
::core::result::Result::Ok(
BytesValueOwnedView(::buffa::OwnedView::from_owned(msg)?),
)
}
#[must_use]
pub fn view(&self) -> &BytesValueView<'_> {
self.0.reborrow()
}
#[must_use]
pub fn to_owned_message(&self) -> super::super::BytesValue {
self.0.to_owned_message()
}
#[must_use]
pub fn bytes(&self) -> &::buffa::bytes::Bytes {
self.0.bytes()
}
#[must_use]
pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
self.0.into_bytes()
}
#[must_use]
pub fn value(&self) -> &'_ [u8] {
self.0.reborrow().value
}
}
impl ::core::convert::From<::buffa::OwnedView<BytesValueView<'static>>>
for BytesValueOwnedView {
fn from(inner: ::buffa::OwnedView<BytesValueView<'static>>) -> Self {
BytesValueOwnedView(inner)
}
}
impl ::core::convert::From<BytesValueOwnedView>
for ::buffa::OwnedView<BytesValueView<'static>> {
fn from(wrapper: BytesValueOwnedView) -> Self {
wrapper.0
}
}
impl ::core::convert::AsRef<::buffa::OwnedView<BytesValueView<'static>>>
for BytesValueOwnedView {
fn as_ref(&self) -> &::buffa::OwnedView<BytesValueView<'static>> {
&self.0
}
}
impl ::buffa::HasMessageView for super::super::BytesValue {
type View<'a> = BytesValueView<'a>;
type ViewHandle = BytesValueOwnedView;
}
#[cfg(feature = "reflect")]
const _: () = {
impl<'a> ::buffa_descriptor::reflect::ReflectMessage for BytesValueView<'a> {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
super::super::__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
super::super::__buffa::reflect::descriptor_pool()
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::Bytes(self.value),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this view's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.value.is_empty(),
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
let bytes = ::buffa::ViewEncode::encode_to_vec(self);
let options = ::buffa::DecodeOptions::new()
.with_element_memory_limit(
bytes
.len()
.saturating_mul(128)
.max(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT),
)
.with_unknown_field_limit(
bytes.len().max(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT),
);
::buffa_descriptor::reflect::DynamicMessage::decode_with_options(
::buffa::alloc::sync::Arc::clone(
super::super::__buffa::reflect::descriptor_pool(),
),
Self::__buffa_reflect_message_index(),
&bytes,
&options,
)
.expect("view re-encodes to bytes decodable against its own descriptor")
}
}
impl<'a> ::buffa_descriptor::reflect::ReflectElement for BytesValueView<'a> {
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl<'a> BytesValueView<'a> {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
super::super::__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated view type is registered in the embedded descriptor pool",
)
})
}
}
};