#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Api {
pub name: ::buffa::alloc::string::String,
pub methods: ::buffa::alloc::vec::Vec<Method>,
pub options: ::buffa::alloc::vec::Vec<Option>,
pub version: ::buffa::alloc::string::String,
pub source_context: ::buffa::MessageField<
SourceContext,
::buffa::Inline<SourceContext>,
>,
pub mixins: ::buffa::alloc::vec::Vec<Mixin>,
pub syntax: ::buffa::EnumValue<Syntax>,
pub edition: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Api {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Api")
.field("name", &self.name)
.field("methods", &self.methods)
.field("options", &self.options)
.field("version", &self.version)
.field("source_context", &self.source_context)
.field("mixins", &self.mixins)
.field("syntax", &self.syntax)
.field("edition", &self.edition)
.finish()
}
}
impl Api {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Api";
}
::buffa::impl_default_instance!(Api);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Api {
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.methods),
3u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
4u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.version),
5u32 => {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::Reflectable::reflect(
&*self.source_context,
),
)
}
6u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.mixins),
7u32 => {
::buffa_descriptor::reflect::ValueRef::EnumNumber(
self.syntax.to_i32(),
)
}
8u32 => ::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.methods.is_empty(),
3u32 => !self.options.is_empty(),
4u32 => !self.version.is_empty(),
5u32 => self.source_context.is_set(),
6u32 => !self.mixins.is_empty(),
7u32 => self.syntax.to_i32() != 0,
8u32 => !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 Api {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Api {
#[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 Api {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Api {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Api";
const FULL_NAME: &'static str = "google.protobuf.Api";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Api";
}
impl ::buffa::Message for Api {
#[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.methods {
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.version.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.version) 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;
}
for v in &self.mixins {
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;
}
{
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.methods {
::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.version.is_empty() {
::buffa::types::put_string_field(4u32, &self.version, 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);
}
for v in &self.mixins {
::buffa::types::put_len_delimited_header(
6u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
{
let val = self.syntax.to_i32();
if val != 0 {
::buffa::types::put_int32_field(7u32, val, buf);
}
}
if !self.edition.is_empty() {
::buffa::types::put_string_field(8u32, &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.methods.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::types::merge_string(&mut self.version, buf)?;
}
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::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.mixins.push(elem);
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.syntax = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
8u32 => {
::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.methods.clear();
self.options.clear();
self.version.clear();
self.source_context = ::buffa::MessageField::none();
self.mixins.clear();
self.syntax = ::buffa::EnumValue::from(0);
self.edition.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Api {
const PROTO_FQN: &'static str = "google.protobuf.Api";
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 Api {
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.version.is_empty() {
enc.write_field_name("version")?;
enc.write_string(&self.version)?;
}
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.methods {
enc.write_field_name("methods")?;
enc.write_message(__v)?;
}
for __v in &self.options {
enc.write_field_name("options")?;
enc.write_message(__v)?;
}
for __v in &self.mixins {
enc.write_field_name("mixins")?;
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(),
"version" => self.version = 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(),
"methods" => {
dec.read_repeated_into(
&mut self.methods,
|__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)
},
)?
}
"mixins" => {
dec.read_repeated_into(
&mut self.mixins,
|__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 __API_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Api",
text_encode: ::buffa::type_registry::any_encode_text::<Api>,
text_merge: ::buffa::type_registry::any_merge_text::<Api>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Method {
pub name: ::buffa::alloc::string::String,
pub request_type_url: ::buffa::alloc::string::String,
pub request_streaming: bool,
pub response_type_url: ::buffa::alloc::string::String,
pub response_streaming: bool,
pub options: ::buffa::alloc::vec::Vec<Option>,
pub syntax: ::buffa::EnumValue<Syntax>,
pub edition: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Method {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Method")
.field("name", &self.name)
.field("request_type_url", &self.request_type_url)
.field("request_streaming", &self.request_streaming)
.field("response_type_url", &self.response_type_url)
.field("response_streaming", &self.response_streaming)
.field("options", &self.options)
.field("syntax", &self.syntax)
.field("edition", &self.edition)
.finish()
}
}
impl Method {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Method";
}
::buffa::impl_default_instance!(Method);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Method {
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::String(&self.request_type_url)
}
3u32 => {
::buffa_descriptor::reflect::ValueRef::Bool(self.request_streaming)
}
4u32 => {
::buffa_descriptor::reflect::ValueRef::String(
&self.response_type_url,
)
}
5u32 => {
::buffa_descriptor::reflect::ValueRef::Bool(self.response_streaming)
}
6u32 => ::buffa_descriptor::reflect::ValueRef::List(&self.options),
7u32 => {
::buffa_descriptor::reflect::ValueRef::EnumNumber(
self.syntax.to_i32(),
)
}
8u32 => ::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.request_type_url.is_empty(),
3u32 => self.request_streaming,
4u32 => !self.response_type_url.is_empty(),
5u32 => self.response_streaming,
6u32 => !self.options.is_empty(),
7u32 => self.syntax.to_i32() != 0,
8u32 => !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 Method {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Method {
#[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 Method {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Method {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Method";
const FULL_NAME: &'static str = "google.protobuf.Method";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Method";
}
impl ::buffa::Message for Method {
#[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.request_type_url.is_empty() {
size
+= 1u64
+ ::buffa::types::string_encoded_len(&self.request_type_url) as u64;
}
if self.request_streaming {
size += 1u64 + ::buffa::types::BOOL_ENCODED_LEN as u64;
}
if !self.response_type_url.is_empty() {
size
+= 1u64
+ ::buffa::types::string_encoded_len(&self.response_type_url) as u64;
}
if self.response_streaming {
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;
}
{
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);
}
if !self.request_type_url.is_empty() {
::buffa::types::put_string_field(2u32, &self.request_type_url, buf);
}
if self.request_streaming {
::buffa::types::put_bool_field(3u32, self.request_streaming, buf);
}
if !self.response_type_url.is_empty() {
::buffa::types::put_string_field(4u32, &self.response_type_url, buf);
}
if self.response_streaming {
::buffa::types::put_bool_field(5u32, self.response_streaming, buf);
}
for v in &self.options {
::buffa::types::put_len_delimited_header(
6u32,
u64::from(__cache.consume_next()),
buf,
);
v.write_to(__cache, buf);
}
{
let val = self.syntax.to_i32();
if val != 0 {
::buffa::types::put_int32_field(7u32, val, buf);
}
}
if !self.edition.is_empty() {
::buffa::types::put_string_field(8u32, &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,
)?;
::buffa::types::merge_string(&mut self.request_type_url, buf)?;
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.request_streaming = ::buffa::types::decode_bool(buf)?;
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
::buffa::types::merge_string(&mut self.response_type_url, buf)?;
}
5u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.response_streaming = ::buffa::types::decode_bool(buf)?;
}
6u32 => {
::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);
}
7u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.syntax = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
8u32 => {
::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.request_type_url.clear();
self.request_streaming = false;
self.response_type_url.clear();
self.response_streaming = false;
self.options.clear();
self.syntax = ::buffa::EnumValue::from(0);
self.edition.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Method {
const PROTO_FQN: &'static str = "google.protobuf.Method";
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 Method {
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.request_type_url.is_empty() {
enc.write_field_name("request_type_url")?;
enc.write_string(&self.request_type_url)?;
}
if self.request_streaming {
enc.write_field_name("request_streaming")?;
enc.write_bool(self.request_streaming)?;
}
if !self.response_type_url.is_empty() {
enc.write_field_name("response_type_url")?;
enc.write_string(&self.response_type_url)?;
}
if self.response_streaming {
enc.write_field_name("response_streaming")?;
enc.write_bool(self.response_streaming)?;
}
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.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(),
"request_type_url" => {
self.request_type_url = dec.read_string()?.into_owned();
}
"request_streaming" => self.request_streaming = dec.read_bool()?,
"response_type_url" => {
self.response_type_url = dec.read_string()?.into_owned();
}
"response_streaming" => self.response_streaming = dec.read_bool()?,
"syntax" => {
self.syntax = dec
.read_enum_by_name::<Syntax>()
.map(::buffa::EnumValue::from)?;
}
"edition" => self.edition = 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 __METHOD_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Method",
text_encode: ::buffa::type_registry::any_encode_text::<Method>,
text_merge: ::buffa::type_registry::any_merge_text::<Method>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Mixin {
pub name: ::buffa::alloc::string::String,
pub root: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Mixin {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Mixin")
.field("name", &self.name)
.field("root", &self.root)
.finish()
}
}
impl Mixin {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Mixin";
}
::buffa::impl_default_instance!(Mixin);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for Mixin {
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::String(&self.root),
_ => {
::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.root.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 Mixin {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl Mixin {
#[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 Mixin {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for Mixin {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "Mixin";
const FULL_NAME: &'static str = "google.protobuf.Mixin";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Mixin";
}
impl ::buffa::Message for Mixin {
#[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.root.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.root) 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.root.is_empty() {
::buffa::types::put_string_field(2u32, &self.root, 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::types::merge_string(&mut self.root, 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.root.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Mixin {
const PROTO_FQN: &'static str = "google.protobuf.Mixin";
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 Mixin {
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.root.is_empty() {
enc.write_field_name("root")?;
enc.write_string(&self.root)?;
}
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(),
"root" => self.root = dec.read_string()?.into_owned(),
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __MIXIN_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.Mixin",
text_encode: ::buffa::type_registry::any_encode_text::<Mixin>,
text_merge: ::buffa::type_registry::any_merge_text::<Mixin>,
};