#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
#[repr(i32)]
pub enum Syntax {
SYNTAX_PROTO2 = 0i32,
SYNTAX_PROTO3 = 1i32,
SYNTAX_EDITIONS = 2i32,
}
impl Syntax {
#[allow(non_upper_case_globals)]
pub const Proto2: Self = Self::SYNTAX_PROTO2;
#[allow(non_upper_case_globals)]
pub const Proto3: Self = Self::SYNTAX_PROTO3;
#[allow(non_upper_case_globals)]
pub const Editions: Self = Self::SYNTAX_EDITIONS;
}
impl ::core::default::Default for Syntax {
fn default() -> Self {
Self::SYNTAX_PROTO2
}
}
impl ::buffa::Enumeration for Syntax {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::SYNTAX_PROTO2),
1i32 => ::core::option::Option::Some(Self::SYNTAX_PROTO3),
2i32 => ::core::option::Option::Some(Self::SYNTAX_EDITIONS),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::SYNTAX_PROTO2 => "SYNTAX_PROTO2",
Self::SYNTAX_PROTO3 => "SYNTAX_PROTO3",
Self::SYNTAX_EDITIONS => "SYNTAX_EDITIONS",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"SYNTAX_PROTO2" => ::core::option::Option::Some(Self::SYNTAX_PROTO2),
"SYNTAX_PROTO3" => ::core::option::Option::Some(Self::SYNTAX_PROTO3),
"SYNTAX_EDITIONS" => ::core::option::Option::Some(Self::SYNTAX_EDITIONS),
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[Self::SYNTAX_PROTO2, Self::SYNTAX_PROTO3, Self::SYNTAX_EDITIONS]
}
}
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Type {
pub name: ::buffa::alloc::string::String,
pub fields: ::buffa::alloc::vec::Vec<Field>,
pub oneofs: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
pub options: ::buffa::alloc::vec::Vec<Option>,
pub source_context: ::buffa::MessageField<
SourceContext,
::buffa::Inline<SourceContext>,
>,
pub syntax: ::buffa::EnumValue<Syntax>,
pub edition: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Type {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Type")
.field("name", &self.name)
.field("fields", &self.fields)
.field("oneofs", &self.oneofs)
.field("options", &self.options)
.field("source_context", &self.source_context)
.field("syntax", &self.syntax)
.field("edition", &self.edition)
.finish()
}
}
impl Type {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Type";
}
::buffa::impl_default_instance!(Type);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Type {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
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.name),
2u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.fields),
3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.oneofs),
4u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
5u32 => {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::Reflectable::reflect(
&*self.source_context,
),
)
}
6u32 => {
::buffa_descriptor::reflect::ValueRef::EnumNumber(
self.syntax.to_i32(),
)
}
7u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.edition),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.name.is_empty(),
2u32 => !self.fields.is_empty(),
3u32 => !self.oneofs.is_empty(),
4u32 => !self.options.is_empty(),
5u32 => self.source_context.is_set(),
6u32 => self.syntax.to_i32() != 0,
7u32 => !self.edition.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 {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for Type {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Type {
#[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(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for Type {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Type {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Type";
const FULL_NAME: &'static str = "google.protobuf.Type";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Type";
}
impl ::buffa::Message for Type {
#[allow(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.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
for v in &self.fields {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.oneofs {
size += 1u64 + ::buffa::types::string_encoded_len(v) as u64;
}
for v in &self.options {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.source_context.is_set() {
let __slot = __cache.reserve();
let inner_size = self.source_context.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
{
let val = self.syntax.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
if !self.edition.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.edition) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
for v in &self.fields {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.oneofs {
::buffa::types::put_string_field(3u32, v, buf);
}
for v in &self.options {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if self.source_context.is_set() {
::buffa::types::put_len_delimited_header(
5u32,
u64::from(__cache.consume_next()),
buf,
);
self.source_context.write_to(__cache, buf);
}
{
let val = self.syntax.to_i32();
if val != 0 {
::buffa::types::put_int32_field(6u32, val, buf);
}
}
if !self.edition.is_empty() {
::buffa::types::put_string_field(7u32, &self.edition, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.name, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.fields.push(elem);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let __elem = ::buffa::types::decode_string(buf)?;
ctx.register_element_memory(
::buffa::__private::element_footprint(&__elem),
)?;
self.oneofs.push(__elem);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.options.push(elem);
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.source_context.get_or_insert_default(),
buf,
ctx,
)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.syntax = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.edition, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.name.clear();
self.fields.clear();
self.oneofs.clear();
self.options.clear();
self.source_context = ::buffa::MessageField::none();
self.syntax = ::buffa::EnumValue::from(0);
self.edition.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Type {
const PROTO_FQN: &'static str = "google.protobuf.Type";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::text::TextFormat for Type {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
enc.write_field_name("name")?;
enc.write_string(&self.name)?;
}
if self.source_context.is_set() {
enc.write_field_name("source_context")?;
enc.write_message(&*self.source_context)?;
}
if self.syntax.to_i32() != 0 {
enc.write_field_name("syntax")?;
match &self.syntax {
::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
}
}
if !self.edition.is_empty() {
enc.write_field_name("edition")?;
enc.write_string(&self.edition)?;
}
for __v in &self.fields {
enc.write_field_name("fields")?;
enc.write_message(__v)?;
}
for __v in &self.oneofs {
enc.write_field_name("oneofs")?;
enc.write_string(__v)?;
}
for __v in &self.options {
enc.write_field_name("options")?;
enc.write_message(__v)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"name" => self.name = dec.read_string()?.into_owned(),
"source_context" => {
dec.merge_message(self.source_context.get_or_insert_default())?
}
"syntax" => {
self.syntax = dec
.read_enum_by_name::<Syntax>()
.map(::buffa::EnumValue::from)?;
}
"edition" => self.edition = dec.read_string()?.into_owned(),
"fields" => {
dec.read_repeated_into(
&mut self.fields,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
"oneofs" => {
dec.read_repeated_into(
&mut self.oneofs,
|__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
)?
}
"options" => {
dec.read_repeated_into(
&mut self.options,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __TYPE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Type",
text_encode: ::buffa::type_registry::any_encode_text::<Type>,
text_merge: ::buffa::type_registry::any_merge_text::<Type>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Field {
pub kind: ::buffa::EnumValue<field::Kind>,
pub cardinality: ::buffa::EnumValue<field::Cardinality>,
pub number: i32,
pub name: ::buffa::alloc::string::String,
pub type_url: ::buffa::alloc::string::String,
pub oneof_index: i32,
pub packed: bool,
pub options: ::buffa::alloc::vec::Vec<Option>,
pub json_name: ::buffa::alloc::string::String,
pub default_value: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Field {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Field")
.field("kind", &self.kind)
.field("cardinality", &self.cardinality)
.field("number", &self.number)
.field("name", &self.name)
.field("type_url", &self.type_url)
.field("oneof_index", &self.oneof_index)
.field("packed", &self.packed)
.field("options", &self.options)
.field("json_name", &self.json_name)
.field("default_value", &self.default_value)
.finish()
}
}
impl Field {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Field";
}
::buffa::impl_default_instance!(Field);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Field {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
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::EnumNumber(self.kind.to_i32())
}
2u32 => {
::buffa_descriptor::reflect::ValueRef::EnumNumber(
self.cardinality.to_i32(),
)
}
3u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.number),
4u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.name),
6u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.type_url),
7u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.oneof_index),
8u32 => ::buffa_descriptor::reflect::ValueRef::Bool(self.packed),
9u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
10u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.json_name),
11u32 => {
::buffa_descriptor::reflect::ValueRef::String(&self.default_value)
}
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => self.kind.to_i32() != 0,
2u32 => self.cardinality.to_i32() != 0,
3u32 => self.number != 0,
4u32 => !self.name.is_empty(),
6u32 => !self.type_url.is_empty(),
7u32 => self.oneof_index != 0,
8u32 => self.packed,
9u32 => !self.options.is_empty(),
10u32 => !self.json_name.is_empty(),
11u32 => !self.default_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 {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for Field {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Field {
#[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(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for Field {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Field {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Field";
const FULL_NAME: &'static str = "google.protobuf.Field";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Field";
}
impl ::buffa::Message for Field {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
{
let val = self.kind.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
{
let val = self.cardinality.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
if self.number != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.number) as u64;
}
if !self.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if !self.type_url.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.type_url) as u64;
}
if self.oneof_index != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.oneof_index) as u64;
}
if self.packed {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
for v in &self.options {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if !self.json_name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.json_name) as u64;
}
if !self.default_value.is_empty() {
size
+= 1u64 + ::buffa::types::string_encoded_len(&self.default_value) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.kind.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
{
let val = self.cardinality.to_i32();
if val != 0 {
::buffa::types::put_int32_field(2u32, val, buf);
}
}
if self.number != 0i32 {
::buffa::types::put_int32_field(3u32, self.number, buf);
}
if !self.name.is_empty() {
::buffa::types::put_string_field(4u32, &self.name, buf);
}
if !self.type_url.is_empty() {
::buffa::types::put_string_field(6u32, &self.type_url, buf);
}
if self.oneof_index != 0i32 {
::buffa::types::put_int32_field(7u32, self.oneof_index, buf);
}
if self.packed {
::buffa::types::put_bool_field(8u32, self.packed, buf);
}
for v in &self.options {
::buffa::types::put_len_delimited_header(
9u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if !self.json_name.is_empty() {
::buffa::types::put_string_field(10u32, &self.json_name, buf);
}
if !self.default_value.is_empty() {
::buffa::types::put_string_field(11u32, &self.default_value, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.kind = ::buffa::EnumValue::from(::buffa::types::decode_int32(buf)?);
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.cardinality = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.number = ::buffa::types::decode_int32(buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.name, buf)?;
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.type_url, buf)?;
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.oneof_index = ::buffa::types::decode_int32(buf)?;
}
8u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.packed = ::buffa::types::decode_bool(buf)?;
}
9u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.options.push(elem);
}
10u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.json_name, buf)?;
}
11u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.default_value, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.kind = ::buffa::EnumValue::from(0);
self.cardinality = ::buffa::EnumValue::from(0);
self.number = 0i32;
self.name.clear();
self.type_url.clear();
self.oneof_index = 0i32;
self.packed = false;
self.options.clear();
self.json_name.clear();
self.default_value.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Field {
const PROTO_FQN: &'static str = "google.protobuf.Field";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::text::TextFormat for Field {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.kind.to_i32() != 0 {
enc.write_field_name("kind")?;
match &self.kind {
::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
}
}
if self.cardinality.to_i32() != 0 {
enc.write_field_name("cardinality")?;
match &self.cardinality {
::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
}
}
if self.number != 0i32 {
enc.write_field_name("number")?;
enc.write_i32(self.number)?;
}
if !self.name.is_empty() {
enc.write_field_name("name")?;
enc.write_string(&self.name)?;
}
if !self.type_url.is_empty() {
enc.write_field_name("type_url")?;
enc.write_string(&self.type_url)?;
}
if self.oneof_index != 0i32 {
enc.write_field_name("oneof_index")?;
enc.write_i32(self.oneof_index)?;
}
if self.packed {
enc.write_field_name("packed")?;
enc.write_bool(self.packed)?;
}
if !self.json_name.is_empty() {
enc.write_field_name("json_name")?;
enc.write_string(&self.json_name)?;
}
if !self.default_value.is_empty() {
enc.write_field_name("default_value")?;
enc.write_string(&self.default_value)?;
}
for __v in &self.options {
enc.write_field_name("options")?;
enc.write_message(__v)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"kind" => {
self.kind = dec
.read_enum_by_name::<field::Kind>()
.map(::buffa::EnumValue::from)?;
}
"cardinality" => {
self.cardinality = dec
.read_enum_by_name::<field::Cardinality>()
.map(::buffa::EnumValue::from)?;
}
"number" => self.number = dec.read_i32()?,
"name" => self.name = dec.read_string()?.into_owned(),
"type_url" => self.type_url = dec.read_string()?.into_owned(),
"oneof_index" => self.oneof_index = dec.read_i32()?,
"packed" => self.packed = dec.read_bool()?,
"json_name" => self.json_name = dec.read_string()?.into_owned(),
"default_value" => self.default_value = dec.read_string()?.into_owned(),
"options" => {
dec.read_repeated_into(
&mut self.options,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __FIELD_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Field",
text_encode: ::buffa::type_registry::any_encode_text::<Field>,
text_merge: ::buffa::type_registry::any_merge_text::<Field>,
};
pub mod field {
#[allow(unused_imports)]
use super::*;
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
#[repr(i32)]
pub enum Kind {
TYPE_UNKNOWN = 0i32,
TYPE_DOUBLE = 1i32,
TYPE_FLOAT = 2i32,
TYPE_INT64 = 3i32,
TYPE_UINT64 = 4i32,
TYPE_INT32 = 5i32,
TYPE_FIXED64 = 6i32,
TYPE_FIXED32 = 7i32,
TYPE_BOOL = 8i32,
TYPE_STRING = 9i32,
TYPE_GROUP = 10i32,
TYPE_MESSAGE = 11i32,
TYPE_BYTES = 12i32,
TYPE_UINT32 = 13i32,
TYPE_ENUM = 14i32,
TYPE_SFIXED32 = 15i32,
TYPE_SFIXED64 = 16i32,
TYPE_SINT32 = 17i32,
TYPE_SINT64 = 18i32,
}
impl Kind {
#[allow(non_upper_case_globals)]
pub const TypeUnknown: Self = Self::TYPE_UNKNOWN;
#[allow(non_upper_case_globals)]
pub const TypeDouble: Self = Self::TYPE_DOUBLE;
#[allow(non_upper_case_globals)]
pub const TypeFloat: Self = Self::TYPE_FLOAT;
#[allow(non_upper_case_globals)]
pub const TypeInt64: Self = Self::TYPE_INT64;
#[allow(non_upper_case_globals)]
pub const TypeUint64: Self = Self::TYPE_UINT64;
#[allow(non_upper_case_globals)]
pub const TypeInt32: Self = Self::TYPE_INT32;
#[allow(non_upper_case_globals)]
pub const TypeFixed64: Self = Self::TYPE_FIXED64;
#[allow(non_upper_case_globals)]
pub const TypeFixed32: Self = Self::TYPE_FIXED32;
#[allow(non_upper_case_globals)]
pub const TypeBool: Self = Self::TYPE_BOOL;
#[allow(non_upper_case_globals)]
pub const TypeString: Self = Self::TYPE_STRING;
#[allow(non_upper_case_globals)]
pub const TypeGroup: Self = Self::TYPE_GROUP;
#[allow(non_upper_case_globals)]
pub const TypeMessage: Self = Self::TYPE_MESSAGE;
#[allow(non_upper_case_globals)]
pub const TypeBytes: Self = Self::TYPE_BYTES;
#[allow(non_upper_case_globals)]
pub const TypeUint32: Self = Self::TYPE_UINT32;
#[allow(non_upper_case_globals)]
pub const TypeEnum: Self = Self::TYPE_ENUM;
#[allow(non_upper_case_globals)]
pub const TypeSfixed32: Self = Self::TYPE_SFIXED32;
#[allow(non_upper_case_globals)]
pub const TypeSfixed64: Self = Self::TYPE_SFIXED64;
#[allow(non_upper_case_globals)]
pub const TypeSint32: Self = Self::TYPE_SINT32;
#[allow(non_upper_case_globals)]
pub const TypeSint64: Self = Self::TYPE_SINT64;
}
impl ::core::default::Default for Kind {
fn default() -> Self {
Self::TYPE_UNKNOWN
}
}
impl ::buffa::Enumeration for Kind {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::TYPE_UNKNOWN),
1i32 => ::core::option::Option::Some(Self::TYPE_DOUBLE),
2i32 => ::core::option::Option::Some(Self::TYPE_FLOAT),
3i32 => ::core::option::Option::Some(Self::TYPE_INT64),
4i32 => ::core::option::Option::Some(Self::TYPE_UINT64),
5i32 => ::core::option::Option::Some(Self::TYPE_INT32),
6i32 => ::core::option::Option::Some(Self::TYPE_FIXED64),
7i32 => ::core::option::Option::Some(Self::TYPE_FIXED32),
8i32 => ::core::option::Option::Some(Self::TYPE_BOOL),
9i32 => ::core::option::Option::Some(Self::TYPE_STRING),
10i32 => ::core::option::Option::Some(Self::TYPE_GROUP),
11i32 => ::core::option::Option::Some(Self::TYPE_MESSAGE),
12i32 => ::core::option::Option::Some(Self::TYPE_BYTES),
13i32 => ::core::option::Option::Some(Self::TYPE_UINT32),
14i32 => ::core::option::Option::Some(Self::TYPE_ENUM),
15i32 => ::core::option::Option::Some(Self::TYPE_SFIXED32),
16i32 => ::core::option::Option::Some(Self::TYPE_SFIXED64),
17i32 => ::core::option::Option::Some(Self::TYPE_SINT32),
18i32 => ::core::option::Option::Some(Self::TYPE_SINT64),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::TYPE_UNKNOWN => "TYPE_UNKNOWN",
Self::TYPE_DOUBLE => "TYPE_DOUBLE",
Self::TYPE_FLOAT => "TYPE_FLOAT",
Self::TYPE_INT64 => "TYPE_INT64",
Self::TYPE_UINT64 => "TYPE_UINT64",
Self::TYPE_INT32 => "TYPE_INT32",
Self::TYPE_FIXED64 => "TYPE_FIXED64",
Self::TYPE_FIXED32 => "TYPE_FIXED32",
Self::TYPE_BOOL => "TYPE_BOOL",
Self::TYPE_STRING => "TYPE_STRING",
Self::TYPE_GROUP => "TYPE_GROUP",
Self::TYPE_MESSAGE => "TYPE_MESSAGE",
Self::TYPE_BYTES => "TYPE_BYTES",
Self::TYPE_UINT32 => "TYPE_UINT32",
Self::TYPE_ENUM => "TYPE_ENUM",
Self::TYPE_SFIXED32 => "TYPE_SFIXED32",
Self::TYPE_SFIXED64 => "TYPE_SFIXED64",
Self::TYPE_SINT32 => "TYPE_SINT32",
Self::TYPE_SINT64 => "TYPE_SINT64",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"TYPE_UNKNOWN" => ::core::option::Option::Some(Self::TYPE_UNKNOWN),
"TYPE_DOUBLE" => ::core::option::Option::Some(Self::TYPE_DOUBLE),
"TYPE_FLOAT" => ::core::option::Option::Some(Self::TYPE_FLOAT),
"TYPE_INT64" => ::core::option::Option::Some(Self::TYPE_INT64),
"TYPE_UINT64" => ::core::option::Option::Some(Self::TYPE_UINT64),
"TYPE_INT32" => ::core::option::Option::Some(Self::TYPE_INT32),
"TYPE_FIXED64" => ::core::option::Option::Some(Self::TYPE_FIXED64),
"TYPE_FIXED32" => ::core::option::Option::Some(Self::TYPE_FIXED32),
"TYPE_BOOL" => ::core::option::Option::Some(Self::TYPE_BOOL),
"TYPE_STRING" => ::core::option::Option::Some(Self::TYPE_STRING),
"TYPE_GROUP" => ::core::option::Option::Some(Self::TYPE_GROUP),
"TYPE_MESSAGE" => ::core::option::Option::Some(Self::TYPE_MESSAGE),
"TYPE_BYTES" => ::core::option::Option::Some(Self::TYPE_BYTES),
"TYPE_UINT32" => ::core::option::Option::Some(Self::TYPE_UINT32),
"TYPE_ENUM" => ::core::option::Option::Some(Self::TYPE_ENUM),
"TYPE_SFIXED32" => ::core::option::Option::Some(Self::TYPE_SFIXED32),
"TYPE_SFIXED64" => ::core::option::Option::Some(Self::TYPE_SFIXED64),
"TYPE_SINT32" => ::core::option::Option::Some(Self::TYPE_SINT32),
"TYPE_SINT64" => ::core::option::Option::Some(Self::TYPE_SINT64),
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[
Self::TYPE_UNKNOWN,
Self::TYPE_DOUBLE,
Self::TYPE_FLOAT,
Self::TYPE_INT64,
Self::TYPE_UINT64,
Self::TYPE_INT32,
Self::TYPE_FIXED64,
Self::TYPE_FIXED32,
Self::TYPE_BOOL,
Self::TYPE_STRING,
Self::TYPE_GROUP,
Self::TYPE_MESSAGE,
Self::TYPE_BYTES,
Self::TYPE_UINT32,
Self::TYPE_ENUM,
Self::TYPE_SFIXED32,
Self::TYPE_SFIXED64,
Self::TYPE_SINT32,
Self::TYPE_SINT64,
]
}
}
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
#[repr(i32)]
pub enum Cardinality {
CARDINALITY_UNKNOWN = 0i32,
CARDINALITY_OPTIONAL = 1i32,
CARDINALITY_REQUIRED = 2i32,
CARDINALITY_REPEATED = 3i32,
}
impl Cardinality {
#[allow(non_upper_case_globals)]
pub const Unknown: Self = Self::CARDINALITY_UNKNOWN;
#[allow(non_upper_case_globals)]
pub const Optional: Self = Self::CARDINALITY_OPTIONAL;
#[allow(non_upper_case_globals)]
pub const Required: Self = Self::CARDINALITY_REQUIRED;
#[allow(non_upper_case_globals)]
pub const Repeated: Self = Self::CARDINALITY_REPEATED;
}
impl ::core::default::Default for Cardinality {
fn default() -> Self {
Self::CARDINALITY_UNKNOWN
}
}
impl ::buffa::Enumeration for Cardinality {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::CARDINALITY_UNKNOWN),
1i32 => ::core::option::Option::Some(Self::CARDINALITY_OPTIONAL),
2i32 => ::core::option::Option::Some(Self::CARDINALITY_REQUIRED),
3i32 => ::core::option::Option::Some(Self::CARDINALITY_REPEATED),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::CARDINALITY_UNKNOWN => "CARDINALITY_UNKNOWN",
Self::CARDINALITY_OPTIONAL => "CARDINALITY_OPTIONAL",
Self::CARDINALITY_REQUIRED => "CARDINALITY_REQUIRED",
Self::CARDINALITY_REPEATED => "CARDINALITY_REPEATED",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"CARDINALITY_UNKNOWN" => {
::core::option::Option::Some(Self::CARDINALITY_UNKNOWN)
}
"CARDINALITY_OPTIONAL" => {
::core::option::Option::Some(Self::CARDINALITY_OPTIONAL)
}
"CARDINALITY_REQUIRED" => {
::core::option::Option::Some(Self::CARDINALITY_REQUIRED)
}
"CARDINALITY_REPEATED" => {
::core::option::Option::Some(Self::CARDINALITY_REPEATED)
}
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[
Self::CARDINALITY_UNKNOWN,
Self::CARDINALITY_OPTIONAL,
Self::CARDINALITY_REQUIRED,
Self::CARDINALITY_REPEATED,
]
}
}
}
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Enum {
pub name: ::buffa::alloc::string::String,
pub enumvalue: ::buffa::alloc::vec::Vec<EnumValue>,
pub options: ::buffa::alloc::vec::Vec<Option>,
pub source_context: ::buffa::MessageField<
SourceContext,
::buffa::Inline<SourceContext>,
>,
pub syntax: ::buffa::EnumValue<Syntax>,
pub edition: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Enum {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Enum")
.field("name", &self.name)
.field("enumvalue", &self.enumvalue)
.field("options", &self.options)
.field("source_context", &self.source_context)
.field("syntax", &self.syntax)
.field("edition", &self.edition)
.finish()
}
}
impl Enum {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Enum";
}
::buffa::impl_default_instance!(Enum);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Enum {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
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.name),
2u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.enumvalue),
3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
4u32 => {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::Reflectable::reflect(
&*self.source_context,
),
)
}
5u32 => {
::buffa_descriptor::reflect::ValueRef::EnumNumber(
self.syntax.to_i32(),
)
}
6u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.edition),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.name.is_empty(),
2u32 => !self.enumvalue.is_empty(),
3u32 => !self.options.is_empty(),
4u32 => self.source_context.is_set(),
5u32 => self.syntax.to_i32() != 0,
6u32 => !self.edition.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 {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for Enum {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Enum {
#[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(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for Enum {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Enum {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Enum";
const FULL_NAME: &'static str = "google.protobuf.Enum";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Enum";
}
impl ::buffa::Message for Enum {
#[allow(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.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
for v in &self.enumvalue {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
for v in &self.options {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
if self.source_context.is_set() {
let __slot = __cache.reserve();
let inner_size = self.source_context.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
{
let val = self.syntax.to_i32();
if val != 0 {
size += 1u64 + ::buffa::types::int32_encoded_len(val) as u64;
}
}
if !self.edition.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.edition) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
for v in &self.enumvalue {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
for v in &self.options {
::buffa::types::put_len_delimited_header(
3u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
if self.source_context.is_set() {
::buffa::types::put_len_delimited_header(
4u32,
u64::from(__cache.consume_next()),
buf,
);
self.source_context.write_to(__cache, buf);
}
{
let val = self.syntax.to_i32();
if val != 0 {
::buffa::types::put_int32_field(5u32, val, buf);
}
}
if !self.edition.is_empty() {
::buffa::types::put_string_field(6u32, &self.edition, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.name, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.enumvalue.push(elem);
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.options.push(elem);
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.source_context.get_or_insert_default(),
buf,
ctx,
)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.syntax = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
6u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.edition, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.name.clear();
self.enumvalue.clear();
self.options.clear();
self.source_context = ::buffa::MessageField::none();
self.syntax = ::buffa::EnumValue::from(0);
self.edition.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Enum {
const PROTO_FQN: &'static str = "google.protobuf.Enum";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::text::TextFormat for Enum {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
enc.write_field_name("name")?;
enc.write_string(&self.name)?;
}
if self.source_context.is_set() {
enc.write_field_name("source_context")?;
enc.write_message(&*self.source_context)?;
}
if self.syntax.to_i32() != 0 {
enc.write_field_name("syntax")?;
match &self.syntax {
::buffa::EnumValue::Known(__e) => enc.write_enum_name(__e.proto_name())?,
::buffa::EnumValue::Unknown(__n) => enc.write_enum_number(*__n)?,
}
}
if !self.edition.is_empty() {
enc.write_field_name("edition")?;
enc.write_string(&self.edition)?;
}
for __v in &self.enumvalue {
enc.write_field_name("enumvalue")?;
enc.write_message(__v)?;
}
for __v in &self.options {
enc.write_field_name("options")?;
enc.write_message(__v)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"name" => self.name = dec.read_string()?.into_owned(),
"source_context" => {
dec.merge_message(self.source_context.get_or_insert_default())?
}
"syntax" => {
self.syntax = dec
.read_enum_by_name::<Syntax>()
.map(::buffa::EnumValue::from)?;
}
"edition" => self.edition = dec.read_string()?.into_owned(),
"enumvalue" => {
dec.read_repeated_into(
&mut self.enumvalue,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
"options" => {
dec.read_repeated_into(
&mut self.options,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __ENUM_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Enum",
text_encode: ::buffa::type_registry::any_encode_text::<Enum>,
text_merge: ::buffa::type_registry::any_merge_text::<Enum>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct EnumValue {
pub name: ::buffa::alloc::string::String,
pub number: i32,
pub options: ::buffa::alloc::vec::Vec<Option>,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for EnumValue {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("EnumValue")
.field("name", &self.name)
.field("number", &self.number)
.field("options", &self.options)
.finish()
}
}
impl EnumValue {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValue";
}
::buffa::impl_default_instance!(EnumValue);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for EnumValue {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
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.name),
2u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.number),
3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.name.is_empty(),
2u32 => self.number != 0,
3u32 => !self.options.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 {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for EnumValue {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl EnumValue {
#[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(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for EnumValue {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for EnumValue {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "EnumValue";
const FULL_NAME: &'static str = "google.protobuf.EnumValue";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.EnumValue";
}
impl ::buffa::Message for EnumValue {
#[allow(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.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if self.number != 0i32 {
size += 1u64 + ::buffa::types::int32_encoded_len(self.number) as u64;
}
for v in &self.options {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
if self.number != 0i32 {
::buffa::types::put_int32_field(2u32, self.number, buf);
}
for v in &self.options {
::buffa::types::put_len_delimited_header(
3u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.name, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.number = ::buffa::types::decode_int32(buf)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
let mut elem = ::core::default::Default::default();
ctx.register_element_memory(
::buffa::__private::element_footprint(&elem),
)?;
::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
self.options.push(elem);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.name.clear();
self.number = 0i32;
self.options.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for EnumValue {
const PROTO_FQN: &'static str = "google.protobuf.EnumValue";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::text::TextFormat for EnumValue {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
enc.write_field_name("name")?;
enc.write_string(&self.name)?;
}
if self.number != 0i32 {
enc.write_field_name("number")?;
enc.write_i32(self.number)?;
}
for __v in &self.options {
enc.write_field_name("options")?;
enc.write_message(__v)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"name" => self.name = dec.read_string()?.into_owned(),
"number" => self.number = dec.read_i32()?,
"options" => {
dec.read_repeated_into(
&mut self.options,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __ENUM_VALUE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.EnumValue",
text_encode: ::buffa::type_registry::any_encode_text::<EnumValue>,
text_merge: ::buffa::type_registry::any_merge_text::<EnumValue>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Option {
pub name: ::buffa::alloc::string::String,
pub value: ::buffa::MessageField<Any, ::buffa::Inline<Any>>,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Option {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Option")
.field("name", &self.name)
.field("value", &self.value)
.finish()
}
}
impl Option {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Option";
}
::buffa::impl_default_instance!(Option);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Option {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
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.name),
2u32 => {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::Reflectable::reflect(&*self.value),
)
}
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.name.is_empty(),
2u32 => self.value.is_set(),
_ => 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 {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for Option {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Option {
#[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(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for Option {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Option {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Option";
const FULL_NAME: &'static str = "google.protobuf.Option";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Option";
}
impl ::buffa::Message for Option {
#[allow(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.name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.name) as u64;
}
if self.value.is_set() {
let __slot = __cache.reserve();
let inner_size = self.value.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u64 + ::buffa::encoding::varint_len(inner_size as u64) as u64
+ inner_size as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
::buffa::types::put_string_field(1u32, &self.name, buf);
}
if self.value.is_set() {
::buffa::types::put_len_delimited_header(
2u32,
u64::from(__cache.consume_next()),
buf,
);
self.value.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.name, buf)?;
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::Message::merge_length_delimited(
self.value.get_or_insert_default(),
buf,
ctx,
)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.name.clear();
self.value = ::buffa::MessageField::none();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Option {
const PROTO_FQN: &'static str = "google.protobuf.Option";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::text::TextFormat for Option {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.name.is_empty() {
enc.write_field_name("name")?;
enc.write_string(&self.name)?;
}
if self.value.is_set() {
enc.write_field_name("value")?;
enc.write_message(&*self.value)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"name" => self.name = dec.read_string()?.into_owned(),
"value" => dec.merge_message(self.value.get_or_insert_default())?,
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __OPTION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Option",
text_encode: ::buffa::type_registry::any_encode_text::<Option>,
text_merge: ::buffa::type_registry::any_merge_text::<Option>,
};