#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "json", serde(default))]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Version {
#[cfg_attr(
feature = "json",
serde(
rename = "major",
with = "::buffa::json_helpers::opt_int32",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub major: ::core::option::Option<i32>,
#[cfg_attr(
feature = "json",
serde(
rename = "minor",
with = "::buffa::json_helpers::opt_int32",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub minor: ::core::option::Option<i32>,
#[cfg_attr(
feature = "json",
serde(
rename = "patch",
with = "::buffa::json_helpers::opt_int32",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub patch: ::core::option::Option<i32>,
#[cfg_attr(
feature = "json",
serde(rename = "suffix", skip_serializing_if = "::core::option::Option::is_none")
)]
pub suffix: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(feature = "json", serde(skip))]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Version {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Version")
.field("major", &self.major)
.field("minor", &self.minor)
.field("patch", &self.patch)
.field("suffix", &self.suffix)
.finish()
}
}
impl Version {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
}
impl Version {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_major(mut self, value: i32) -> Self {
self.major = Some(value);
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_minor(mut self, value: i32) -> Self {
self.minor = Some(value);
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_patch(mut self, value: i32) -> Self {
self.patch = Some(value);
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_suffix(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.suffix = Some(value.into());
self
}
}
impl ::buffa::DefaultInstance for Version {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<Version> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for Version {
const PACKAGE: &'static str = "google.protobuf.compiler";
const NAME: &'static str = "Version";
const FULL_NAME: &'static str = "google.protobuf.compiler.Version";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.Version";
}
impl ::buffa::Message for Version {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if let Some(v) = self.major {
size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
}
if let Some(v) = self.minor {
size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
}
if let Some(v) = self.patch {
size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
}
if let Some(ref v) = self.suffix {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let Some(v) = self.major {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(v, buf);
}
if let Some(v) = self.minor {
::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(v, buf);
}
if let Some(v) = self.patch {
::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(v, buf);
}
if let Some(ref v) = self.suffix {
::buffa::encoding::Tag::new(
4u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
depth: u32,
) -> ::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 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.major = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
2u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 2u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.minor = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
3u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 3u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.patch = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
4u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 4u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self.suffix.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.major = ::core::option::Option::None;
self.minor = ::core::option::Option::None;
self.patch = ::core::option::Option::None;
self.suffix = ::core::option::Option::None;
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for Version {
const PROTO_FQN: &'static str = "google.protobuf.compiler.Version";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
#[cfg(feature = "text")]
impl ::buffa::text::TextFormat for Version {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let ::core::option::Option::Some(ref __v) = self.major {
enc.write_field_name("major")?;
enc.write_i32(*__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.minor {
enc.write_field_name("minor")?;
enc.write_i32(*__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.patch {
enc.write_field_name("patch")?;
enc.write_i32(*__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.suffix {
enc.write_field_name("suffix")?;
enc.write_string(__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 {
"major" => self.major = ::core::option::Option::Some(dec.read_i32()?),
"minor" => self.minor = ::core::option::Option::Some(dec.read_i32()?),
"patch" => self.patch = ::core::option::Option::Some(dec.read_i32()?),
"suffix" => {
self.suffix = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[cfg(feature = "json")]
impl ::buffa::json_helpers::ProtoElemJson for Version {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[cfg(feature = "json")]
#[doc(hidden)]
pub const __VERSION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.Version",
to_json: ::buffa::type_registry::any_to_json::<Version>,
from_json: ::buffa::type_registry::any_from_json::<Version>,
is_wkt: false,
};
#[cfg(feature = "text")]
#[doc(hidden)]
pub const __VERSION_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.Version",
text_encode: ::buffa::type_registry::any_encode_text::<Version>,
text_merge: ::buffa::type_registry::any_merge_text::<Version>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "json", serde(default))]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct CodeGeneratorRequest {
#[cfg_attr(
feature = "json",
serde(
rename = "fileToGenerate",
alias = "file_to_generate",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)
)]
pub file_to_generate: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "parameter",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub parameter: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "protoFile",
alias = "proto_file",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)
)]
pub proto_file: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
#[cfg_attr(
feature = "json",
serde(
rename = "sourceFileDescriptors",
alias = "source_file_descriptors",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)
)]
pub source_file_descriptors: ::buffa::alloc::vec::Vec<super::FileDescriptorProto>,
#[cfg_attr(
feature = "json",
serde(
rename = "compilerVersion",
alias = "compiler_version",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)
)]
pub compiler_version: ::buffa::MessageField<Version>,
#[cfg_attr(feature = "json", serde(skip))]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodeGeneratorRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodeGeneratorRequest")
.field("file_to_generate", &self.file_to_generate)
.field("parameter", &self.parameter)
.field("proto_file", &self.proto_file)
.field("source_file_descriptors", &self.source_file_descriptors)
.field("compiler_version", &self.compiler_version)
.finish()
}
}
impl CodeGeneratorRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
}
impl CodeGeneratorRequest {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_parameter(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.parameter = Some(value.into());
self
}
}
impl ::buffa::DefaultInstance for CodeGeneratorRequest {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<CodeGeneratorRequest> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for CodeGeneratorRequest {
const PACKAGE: &'static str = "google.protobuf.compiler";
const NAME: &'static str = "CodeGeneratorRequest";
const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest";
}
impl ::buffa::Message for CodeGeneratorRequest {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
for v in &self.file_to_generate {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if let Some(ref v) = self.parameter {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if self.compiler_version.is_set() {
let __slot = __cache.reserve();
let inner_size = self.compiler_version.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
for v in &self.proto_file {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
for v in &self.source_file_descriptors {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.file_to_generate {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if let Some(ref v) = self.parameter {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if self.compiler_version.is_set() {
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
self.compiler_version.write_to(__cache, buf);
}
for v in &self.proto_file {
::buffa::encoding::Tag::new(
15u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
v.write_to(__cache, buf);
}
for v in &self.source_file_descriptors {
::buffa::encoding::Tag::new(
17u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, 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,
depth: u32,
) -> ::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 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
self.file_to_generate.push(::buffa::types::decode_string(buf)?);
}
2u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 2u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self
.parameter
.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
3u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 3u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::Message::merge_length_delimited(
self.compiler_version.get_or_insert_default(),
buf,
depth,
)?;
}
15u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 15u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
let mut elem = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
self.proto_file.push(elem);
}
17u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 17u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
let mut elem = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
self.source_file_descriptors.push(elem);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.file_to_generate.clear();
self.parameter = ::core::option::Option::None;
self.compiler_version = ::buffa::MessageField::none();
self.proto_file.clear();
self.source_file_descriptors.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodeGeneratorRequest {
const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorRequest";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
#[cfg(feature = "text")]
impl ::buffa::text::TextFormat for CodeGeneratorRequest {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let ::core::option::Option::Some(ref __v) = self.parameter {
enc.write_field_name("parameter")?;
enc.write_string(__v)?;
}
if self.compiler_version.is_set() {
enc.write_field_name("compiler_version")?;
enc.write_message(&*self.compiler_version)?;
}
for __v in &self.file_to_generate {
enc.write_field_name("file_to_generate")?;
enc.write_string(__v)?;
}
for __v in &self.proto_file {
enc.write_field_name("proto_file")?;
enc.write_message(__v)?;
}
for __v in &self.source_file_descriptors {
enc.write_field_name("source_file_descriptors")?;
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 {
"parameter" => {
self.parameter = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
"compiler_version" => {
dec.merge_message(self.compiler_version.get_or_insert_default())?
}
"file_to_generate" => {
dec.read_repeated_into(
&mut self.file_to_generate,
|__d| ::core::result::Result::Ok(__d.read_string()?.into_owned()),
)?
}
"proto_file" => {
dec.read_repeated_into(
&mut self.proto_file,
|__d| {
let mut __m = ::core::default::Default::default();
__d.merge_message(&mut __m)?;
::core::result::Result::Ok(__m)
},
)?
}
"source_file_descriptors" => {
dec.read_repeated_into(
&mut self.source_file_descriptors,
|__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(())
}
}
#[cfg(feature = "json")]
impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorRequest {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[cfg(feature = "json")]
#[doc(hidden)]
pub const __CODE_GENERATOR_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorRequest>,
from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorRequest>,
is_wkt: false,
};
#[cfg(feature = "text")]
#[doc(hidden)]
pub const __CODE_GENERATOR_REQUEST_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorRequest",
text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorRequest>,
text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorRequest>,
};
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "json", serde(default))]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct CodeGeneratorResponse {
#[cfg_attr(
feature = "json",
serde(rename = "error", skip_serializing_if = "::core::option::Option::is_none")
)]
pub error: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "supportedFeatures",
alias = "supported_features",
with = "::buffa::json_helpers::opt_uint64",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub supported_features: ::core::option::Option<u64>,
#[cfg_attr(
feature = "json",
serde(
rename = "minimumEdition",
alias = "minimum_edition",
with = "::buffa::json_helpers::opt_int32",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub minimum_edition: ::core::option::Option<i32>,
#[cfg_attr(
feature = "json",
serde(
rename = "maximumEdition",
alias = "maximum_edition",
with = "::buffa::json_helpers::opt_int32",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub maximum_edition: ::core::option::Option<i32>,
#[cfg_attr(
feature = "json",
serde(
rename = "file",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)
)]
pub file: ::buffa::alloc::vec::Vec<code_generator_response::File>,
#[cfg_attr(feature = "json", serde(skip))]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodeGeneratorResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodeGeneratorResponse")
.field("error", &self.error)
.field("supported_features", &self.supported_features)
.field("minimum_edition", &self.minimum_edition)
.field("maximum_edition", &self.maximum_edition)
.field("file", &self.file)
.finish()
}
}
impl CodeGeneratorResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
}
impl CodeGeneratorResponse {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_error(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.error = Some(value.into());
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_supported_features(mut self, value: u64) -> Self {
self.supported_features = Some(value);
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_minimum_edition(mut self, value: i32) -> Self {
self.minimum_edition = Some(value);
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_maximum_edition(mut self, value: i32) -> Self {
self.maximum_edition = Some(value);
self
}
}
impl ::buffa::DefaultInstance for CodeGeneratorResponse {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<CodeGeneratorResponse> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for CodeGeneratorResponse {
const PACKAGE: &'static str = "google.protobuf.compiler";
const NAME: &'static str = "CodeGeneratorResponse";
const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse";
}
impl ::buffa::Message for CodeGeneratorResponse {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if let Some(ref v) = self.error {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if let Some(v) = self.supported_features {
size += 1u32 + ::buffa::types::uint64_encoded_len(v) as u32;
}
if let Some(v) = self.minimum_edition {
size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
}
if let Some(v) = self.maximum_edition {
size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
}
for v in &self.file {
let __slot = __cache.reserve();
let inner_size = v.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let Some(ref v) = self.error {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if let Some(v) = self.supported_features {
::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint64(v, buf);
}
if let Some(v) = self.minimum_edition {
::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(v, buf);
}
if let Some(v) = self.maximum_edition {
::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(v, buf);
}
for v in &self.file {
::buffa::encoding::Tag::new(
15u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, 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,
depth: u32,
) -> ::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 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self.error.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
2u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 2u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.supported_features = ::core::option::Option::Some(
::buffa::types::decode_uint64(buf)?,
);
}
3u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 3u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.minimum_edition = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
4u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 4u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
self.maximum_edition = ::core::option::Option::Some(
::buffa::types::decode_int32(buf)?,
);
}
15u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 15u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
let mut elem = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
self.file.push(elem);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.error = ::core::option::Option::None;
self.supported_features = ::core::option::Option::None;
self.minimum_edition = ::core::option::Option::None;
self.maximum_edition = ::core::option::Option::None;
self.file.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodeGeneratorResponse {
const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
#[cfg(feature = "text")]
impl ::buffa::text::TextFormat for CodeGeneratorResponse {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let ::core::option::Option::Some(ref __v) = self.error {
enc.write_field_name("error")?;
enc.write_string(__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.supported_features {
enc.write_field_name("supported_features")?;
enc.write_u64(*__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.minimum_edition {
enc.write_field_name("minimum_edition")?;
enc.write_i32(*__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.maximum_edition {
enc.write_field_name("maximum_edition")?;
enc.write_i32(*__v)?;
}
for __v in &self.file {
enc.write_field_name("file")?;
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 {
"error" => {
self.error = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
"supported_features" => {
self.supported_features = ::core::option::Option::Some(
dec.read_u64()?,
);
}
"minimum_edition" => {
self.minimum_edition = ::core::option::Option::Some(dec.read_i32()?);
}
"maximum_edition" => {
self.maximum_edition = ::core::option::Option::Some(dec.read_i32()?);
}
"file" => {
dec.read_repeated_into(
&mut self.file,
|__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(())
}
}
#[cfg(feature = "json")]
impl ::buffa::json_helpers::ProtoElemJson for CodeGeneratorResponse {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[cfg(feature = "json")]
#[doc(hidden)]
pub const __CODE_GENERATOR_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
to_json: ::buffa::type_registry::any_to_json::<CodeGeneratorResponse>,
from_json: ::buffa::type_registry::any_from_json::<CodeGeneratorResponse>,
is_wkt: false,
};
#[cfg(feature = "text")]
#[doc(hidden)]
pub const __CODE_GENERATOR_RESPONSE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse",
text_encode: ::buffa::type_registry::any_encode_text::<CodeGeneratorResponse>,
text_merge: ::buffa::type_registry::any_merge_text::<CodeGeneratorResponse>,
};
pub mod code_generator_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
#[repr(i32)]
pub enum Feature {
FEATURE_NONE = 0i32,
FEATURE_PROTO3_OPTIONAL = 1i32,
FEATURE_SUPPORTS_EDITIONS = 2i32,
}
impl ::core::default::Default for Feature {
fn default() -> Self {
Self::FEATURE_NONE
}
}
#[cfg(feature = "json")]
const _: () = {
impl ::serde::Serialize for Feature {
fn serialize<S: ::serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
s.serialize_str(::buffa::Enumeration::proto_name(self))
}
}
impl<'de> ::serde::Deserialize<'de> for Feature {
fn deserialize<D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl ::serde::de::Visitor<'_> for _V {
type Value = Feature;
fn expecting(
&self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::fmt::Result {
f.write_str(
concat!(
"a string, integer, or null for ", stringify!(Feature)
),
)
}
fn visit_str<E: ::serde::de::Error>(
self,
v: &str,
) -> ::core::result::Result<Feature, E> {
<Feature as ::buffa::Enumeration>::from_proto_name(v)
.ok_or_else(|| {
::serde::de::Error::unknown_variant(v, &[])
})
}
fn visit_i64<E: ::serde::de::Error>(
self,
v: i64,
) -> ::core::result::Result<Feature, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<Feature as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_u64<E: ::serde::de::Error>(
self,
v: u64,
) -> ::core::result::Result<Feature, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<Feature as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_unit<E: ::serde::de::Error>(
self,
) -> ::core::result::Result<Feature, E> {
::core::result::Result::Ok(::core::default::Default::default())
}
}
d.deserialize_any(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for Feature {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
};
impl ::buffa::Enumeration for Feature {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::FEATURE_NONE),
1i32 => ::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL),
2i32 => ::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::FEATURE_NONE => "FEATURE_NONE",
Self::FEATURE_PROTO3_OPTIONAL => "FEATURE_PROTO3_OPTIONAL",
Self::FEATURE_SUPPORTS_EDITIONS => "FEATURE_SUPPORTS_EDITIONS",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"FEATURE_NONE" => ::core::option::Option::Some(Self::FEATURE_NONE),
"FEATURE_PROTO3_OPTIONAL" => {
::core::option::Option::Some(Self::FEATURE_PROTO3_OPTIONAL)
}
"FEATURE_SUPPORTS_EDITIONS" => {
::core::option::Option::Some(Self::FEATURE_SUPPORTS_EDITIONS)
}
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[
Self::FEATURE_NONE,
Self::FEATURE_PROTO3_OPTIONAL,
Self::FEATURE_SUPPORTS_EDITIONS,
]
}
}
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "json", derive(::serde::Serialize, ::serde::Deserialize))]
#[cfg_attr(feature = "json", serde(default))]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct File {
#[cfg_attr(
feature = "json",
serde(
rename = "name",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub name: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "insertionPoint",
alias = "insertion_point",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub insertion_point: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "content",
skip_serializing_if = "::core::option::Option::is_none"
)
)]
pub content: ::core::option::Option<::buffa::alloc::string::String>,
#[cfg_attr(
feature = "json",
serde(
rename = "generatedCodeInfo",
alias = "generated_code_info",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)
)]
pub generated_code_info: ::buffa::MessageField<super::super::GeneratedCodeInfo>,
#[cfg_attr(feature = "json", serde(skip))]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for File {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("File")
.field("name", &self.name)
.field("insertion_point", &self.insertion_point)
.field("content", &self.content)
.field("generated_code_info", &self.generated_code_info)
.finish()
}
}
impl File {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
}
impl File {
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_name(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.name = Some(value.into());
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_insertion_point(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.insertion_point = Some(value.into());
self
}
#[must_use = "with_* setters return `self` by value; assign or chain the result"]
#[inline]
pub fn with_content(
mut self,
value: impl Into<::buffa::alloc::string::String>,
) -> Self {
self.content = Some(value.into());
self
}
}
impl ::buffa::DefaultInstance for File {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<File> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for File {
const PACKAGE: &'static str = "google.protobuf.compiler";
const NAME: &'static str = "CodeGeneratorResponse.File";
const FULL_NAME: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File";
}
impl ::buffa::Message for File {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if let Some(ref v) = self.name {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if let Some(ref v) = self.insertion_point {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if let Some(ref v) = self.content {
size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
}
if self.generated_code_info.is_set() {
let __slot = __cache.reserve();
let inner_size = self.generated_code_info.compute_size(__cache);
__cache.set(__slot, inner_size);
size
+= 2u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let Some(ref v) = self.name {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if let Some(ref v) = self.insertion_point {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if let Some(ref v) = self.content {
::buffa::encoding::Tag::new(
15u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
if self.generated_code_info.is_set() {
::buffa::encoding::Tag::new(
16u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
self.generated_code_info.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,
depth: u32,
) -> ::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 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self
.name
.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
2u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 2u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self
.insertion_point
.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
15u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 15u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(
self
.content
.get_or_insert_with(::buffa::alloc::string::String::new),
buf,
)?;
}
16u32 => {
if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 16u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::Message::merge_length_delimited(
self.generated_code_info.get_or_insert_default(),
buf,
depth,
)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.name = ::core::option::Option::None;
self.insertion_point = ::core::option::Option::None;
self.content = ::core::option::Option::None;
self.generated_code_info = ::buffa::MessageField::none();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for File {
const PROTO_FQN: &'static str = "google.protobuf.compiler.CodeGeneratorResponse.File";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
#[cfg(feature = "text")]
impl ::buffa::text::TextFormat for File {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let ::core::option::Option::Some(ref __v) = self.name {
enc.write_field_name("name")?;
enc.write_string(__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.insertion_point {
enc.write_field_name("insertion_point")?;
enc.write_string(__v)?;
}
if let ::core::option::Option::Some(ref __v) = self.content {
enc.write_field_name("content")?;
enc.write_string(__v)?;
}
if self.generated_code_info.is_set() {
enc.write_field_name("generated_code_info")?;
enc.write_message(&*self.generated_code_info)?;
}
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 = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
"insertion_point" => {
self.insertion_point = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
"content" => {
self.content = ::core::option::Option::Some(
dec.read_string()?.into_owned(),
);
}
"generated_code_info" => {
dec.merge_message(
self.generated_code_info.get_or_insert_default(),
)?
}
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[cfg(feature = "json")]
impl ::buffa::json_helpers::ProtoElemJson for File {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[cfg(feature = "json")]
#[doc(hidden)]
pub const __FILE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
to_json: ::buffa::type_registry::any_to_json::<File>,
from_json: ::buffa::type_registry::any_from_json::<File>,
is_wkt: false,
};
#[cfg(feature = "text")]
#[doc(hidden)]
pub const __FILE_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.compiler.CodeGeneratorResponse.File",
text_encode: ::buffa::type_registry::any_encode_text::<File>,
text_merge: ::buffa::type_registry::any_merge_text::<File>,
};
#[cfg(feature = "views")]
#[doc(inline)]
pub use super::__buffa::view::code_generator_response::FileView;
}