#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct ErrorInfo {
#[serde(
rename = "reason",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub reason: ::buffa::alloc::string::String,
#[serde(
rename = "domain",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub domain: ::buffa::alloc::string::String,
#[serde(
rename = "metadata",
skip_serializing_if = "::buffa::__private::HashMap::is_empty",
deserialize_with = "::buffa::json_helpers::null_as_default"
)]
pub metadata: ::buffa::__private::HashMap<
::buffa::alloc::string::String,
::buffa::alloc::string::String,
>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for ErrorInfo {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("ErrorInfo")
.field("reason", &self.reason)
.field("domain", &self.domain)
.field("metadata", &self.metadata)
.finish()
}
}
impl ErrorInfo {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.ErrorInfo";
}
impl ::buffa::DefaultInstance for ErrorInfo {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<ErrorInfo> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for ErrorInfo {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "ErrorInfo";
const FULL_NAME: &'static str = "google.rpc.ErrorInfo";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.ErrorInfo";
}
impl ::buffa::Message for ErrorInfo {
#[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 !self.reason.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.reason) as u32;
}
if !self.domain.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.domain) as u32;
}
#[allow(clippy::for_kv_map)]
for (k, v) in &self.metadata {
let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
+ 1u32 + ::buffa::types::string_encoded_len(v) as u32;
size
+= 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
+ entry_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 !self.reason.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.reason, buf);
}
if !self.domain.is_empty() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.domain, buf);
}
for (k, v) in &self.metadata {
let entry_size: u32 = 1u32 + ::buffa::types::string_encoded_len(k) as u32
+ 1u32 + ::buffa::types::string_encoded_len(v) as u32;
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(entry_size as u64, buf);
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(k, buf);
::buffa::encoding::Tag::new(
2u32,
::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::LengthDelimited {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
::buffa::types::merge_string(&mut self.reason, 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(&mut self.domain, 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,
});
}
let entry_len = ::buffa::encoding::decode_varint(buf)?;
let entry_len = usize::try_from(entry_len)
.map_err(|_| ::buffa::DecodeError::MessageTooLarge)?;
if buf.remaining() < entry_len {
return ::core::result::Result::Err(
::buffa::DecodeError::UnexpectedEof,
);
}
let entry_limit = buf.remaining() - entry_len;
let mut key = ::core::default::Default::default();
let mut val = ::core::default::Default::default();
while buf.remaining() > entry_limit {
let entry_tag = ::buffa::encoding::Tag::decode(buf)?;
match entry_tag.field_number() {
1 => {
if entry_tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: entry_tag.field_number(),
expected: 2u8,
actual: entry_tag.wire_type() as u8,
});
}
key = ::buffa::types::decode_string(buf)?;
}
2 => {
if entry_tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: entry_tag.field_number(),
expected: 2u8,
actual: entry_tag.wire_type() as u8,
});
}
val = ::buffa::types::decode_string(buf)?;
}
_ => {
::buffa::encoding::skip_field_depth(entry_tag, buf, depth)?;
}
}
}
if buf.remaining() != entry_limit {
let remaining = buf.remaining();
if remaining > entry_limit {
buf.advance(remaining - entry_limit);
} else {
return ::core::result::Result::Err(
::buffa::DecodeError::UnexpectedEof,
);
}
}
self.metadata.insert(key, val);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.reason.clear();
self.domain.clear();
self.metadata.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for ErrorInfo {
const PROTO_FQN: &'static str = "google.rpc.ErrorInfo";
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::json_helpers::ProtoElemJson for ErrorInfo {
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)
}
}
#[doc(hidden)]
pub const __ERROR_INFO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.rpc.ErrorInfo",
to_json: ::buffa::type_registry::any_to_json::<ErrorInfo>,
from_json: ::buffa::type_registry::any_from_json::<ErrorInfo>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RetryInfo {
#[serde(
rename = "retryDelay",
alias = "retry_delay",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub retry_delay: ::buffa::MessageField<::buffa_types::google::protobuf::Duration>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for RetryInfo {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("RetryInfo").field("retry_delay", &self.retry_delay).finish()
}
}
impl RetryInfo {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.RetryInfo";
}
impl ::buffa::DefaultInstance for RetryInfo {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetryInfo> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for RetryInfo {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "RetryInfo";
const FULL_NAME: &'static str = "google.rpc.RetryInfo";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.RetryInfo";
}
impl ::buffa::Message for RetryInfo {
#[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 self.retry_delay.is_set() {
let __slot = __cache.reserve();
let inner_size = self.retry_delay.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 self.retry_delay.is_set() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
self.retry_delay.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::Message::merge_length_delimited(
self.retry_delay.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.retry_delay = ::buffa::MessageField::none();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for RetryInfo {
const PROTO_FQN: &'static str = "google.rpc.RetryInfo";
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::json_helpers::ProtoElemJson for RetryInfo {
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)
}
}
#[doc(hidden)]
pub const __RETRY_INFO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.rpc.RetryInfo",
to_json: ::buffa::type_registry::any_to_json::<RetryInfo>,
from_json: ::buffa::type_registry::any_from_json::<RetryInfo>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct BadRequest {
#[serde(
rename = "fieldViolations",
alias = "field_violations",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)]
pub field_violations: ::buffa::alloc::vec::Vec<bad_request::FieldViolation>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for BadRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("BadRequest")
.field("field_violations", &self.field_violations)
.finish()
}
}
impl BadRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest";
}
impl ::buffa::DefaultInstance for BadRequest {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<BadRequest> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for BadRequest {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "BadRequest";
const FULL_NAME: &'static str = "google.rpc.BadRequest";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest";
}
impl ::buffa::Message for BadRequest {
#[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.field_violations {
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 _;
for v in &self.field_violations {
::buffa::encoding::Tag::new(
1u32,
::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,
});
}
let mut elem = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
self.field_violations.push(elem);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.field_violations.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for BadRequest {
const PROTO_FQN: &'static str = "google.rpc.BadRequest";
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::json_helpers::ProtoElemJson for BadRequest {
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)
}
}
#[doc(hidden)]
pub const __BAD_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.rpc.BadRequest",
to_json: ::buffa::type_registry::any_to_json::<BadRequest>,
from_json: ::buffa::type_registry::any_from_json::<BadRequest>,
is_wkt: false,
};
pub mod bad_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct FieldViolation {
#[serde(
rename = "field",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub field: ::buffa::alloc::string::String,
#[serde(
rename = "description",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub description: ::buffa::alloc::string::String,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for FieldViolation {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("FieldViolation")
.field("field", &self.field)
.field("description", &self.description)
.finish()
}
}
impl FieldViolation {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest.FieldViolation";
}
impl ::buffa::DefaultInstance for FieldViolation {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<FieldViolation> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::MessageName for FieldViolation {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "BadRequest.FieldViolation";
const FULL_NAME: &'static str = "google.rpc.BadRequest.FieldViolation";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest.FieldViolation";
}
impl ::buffa::Message for FieldViolation {
#[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 !self.field.is_empty() {
size += 1u32 + ::buffa::types::string_encoded_len(&self.field) as u32;
}
if !self.description.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.description) 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 !self.field.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.field, buf);
}
if !self.description.is_empty() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.description, 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(&mut self.field, 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(&mut self.description, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.field.clear();
self.description.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for FieldViolation {
const PROTO_FQN: &'static str = "google.rpc.BadRequest.FieldViolation";
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::json_helpers::ProtoElemJson for FieldViolation {
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)
}
}
#[doc(hidden)]
pub const __FIELD_VIOLATION_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/google.rpc.BadRequest.FieldViolation",
to_json: ::buffa::type_registry::any_to_json::<FieldViolation>,
from_json: ::buffa::type_registry::any_from_json::<FieldViolation>,
is_wkt: false,
};
#[doc(inline)]
pub use super::__buffa::view::bad_request::FieldViolationView;
}
#[allow(
non_camel_case_types,
dead_code,
unused_imports,
unused_qualifications,
clippy::derivable_impls,
clippy::match_single_binding,
clippy::uninlined_format_args,
clippy::doc_lazy_continuation,
clippy::module_inception
)]
pub mod __buffa {
#[allow(unused_imports)]
use super::*;
pub mod view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, Default)]
pub struct ErrorInfoView<'a> {
pub reason: &'a str,
pub domain: &'a str,
pub metadata: ::buffa::MapView<'a, &'a str, &'a str>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> ErrorInfoView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
view.reason = ::buffa::types::borrow_str(&mut cur)?;
}
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,
});
}
view.domain = ::buffa::types::borrow_str(&mut cur)?;
}
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,
});
}
let entry_bytes = ::buffa::types::borrow_bytes(&mut cur)?;
let mut entry_cur: &'a [u8] = entry_bytes;
let mut key = "";
let mut val = "";
while !entry_cur.is_empty() {
let entry_tag = ::buffa::encoding::Tag::decode(
&mut entry_cur,
)?;
match entry_tag.field_number() {
1 => {
if entry_tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: entry_tag.field_number(),
expected: 2u8,
actual: entry_tag.wire_type() as u8,
});
}
key = ::buffa::types::borrow_str(&mut entry_cur)?;
}
2 => {
if entry_tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: entry_tag.field_number(),
expected: 2u8,
actual: entry_tag.wire_type() as u8,
});
}
val = ::buffa::types::borrow_str(&mut entry_cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(
entry_tag,
&mut entry_cur,
depth,
)?;
}
}
}
view.metadata.push(key, val);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for ErrorInfoView<'a> {
type Owned = super::super::ErrorInfo;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
fn to_owned_message(&self) -> super::super::ErrorInfo {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> super::super::ErrorInfo {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
super::super::ErrorInfo {
reason: self.reason.to_string(),
domain: self.domain.to_string(),
metadata: self
.metadata
.iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for ErrorInfoView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.reason.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.reason) as u32;
}
if !self.domain.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.domain) as u32;
}
#[allow(clippy::for_kv_map)]
for (k, v) in &self.metadata {
let entry_size: u32 = 1u32
+ ::buffa::types::string_encoded_len(k) as u32 + 1u32
+ ::buffa::types::string_encoded_len(v) as u32;
size
+= 1u32 + ::buffa::encoding::varint_len(entry_size as u64) as u32
+ entry_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.reason.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.reason, buf);
}
if !self.domain.is_empty() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.domain, buf);
}
for (k, v) in &self.metadata {
let entry_size: u32 = 1u32
+ ::buffa::types::string_encoded_len(k) as u32 + 1u32
+ ::buffa::types::string_encoded_len(v) as u32;
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(entry_size as u64, buf);
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(k, buf);
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(v, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for ErrorInfoView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_empty_str(self.reason) {
__map.serialize_entry("reason", self.reason)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(self.domain) {
__map.serialize_entry("domain", self.domain)?;
}
if !self.metadata.is_empty() {
struct _WM<'__a, '__x>(
&'__x ::buffa::MapView<'__x, &'__a str, &'__a str>,
);
impl<'__a> ::serde::Serialize for _WM<'__a, '_> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __m = __s
.serialize_map(::core::option::Option::Some(self.0.len()))?;
for (k, v) in self.0.iter_unique() {
__m.serialize_entry(k, v)?;
}
__m.end()
}
}
__map.serialize_entry("metadata", &_WM(&self.metadata))?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for ErrorInfoView<'a> {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "ErrorInfo";
const FULL_NAME: &'static str = "google.rpc.ErrorInfo";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.ErrorInfo";
}
impl<'v> ::buffa::DefaultViewInstance for ErrorInfoView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<ErrorInfoView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<ErrorInfoView<'static>>::default(),
))
}
}
impl ::buffa::ViewReborrow for ErrorInfoView<'static> {
type Reborrowed<'b> = ErrorInfoView<'b>;
fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
this
}
}
#[derive(Clone, Debug, Default)]
pub struct RetryInfoView<'a> {
pub retry_delay: ::buffa::MessageFieldView<
::buffa_types::google::protobuf::__buffa::view::DurationView<'a>,
>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RetryInfoView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.retry_delay.as_mut() {
Some(existing) => existing._merge_into_view(sub, depth - 1)?,
None => {
view.retry_delay = ::buffa::MessageFieldView::set(
::buffa_types::google::protobuf::__buffa::view::DurationView::_decode_depth(
sub,
depth - 1,
)?,
);
}
}
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for RetryInfoView<'a> {
type Owned = super::super::RetryInfo;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
fn to_owned_message(&self) -> super::super::RetryInfo {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> super::super::RetryInfo {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
super::super::RetryInfo {
retry_delay: match self.retry_delay.as_option() {
Some(v) => {
::buffa::MessageField::<
::buffa_types::google::protobuf::Duration,
>::some(v.to_owned_from_source(__buffa_src))
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for RetryInfoView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.retry_delay.is_set() {
let __slot = __cache.reserve();
let inner_size = self.retry_delay.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
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if self.retry_delay.is_set() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
self.retry_delay.write_to(__cache, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for RetryInfoView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
{
if let ::core::option::Option::Some(__v) = self
.retry_delay
.as_option()
{
__map.serialize_entry("retryDelay", __v)?;
}
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for RetryInfoView<'a> {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "RetryInfo";
const FULL_NAME: &'static str = "google.rpc.RetryInfo";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.RetryInfo";
}
impl<'v> ::buffa::DefaultViewInstance for RetryInfoView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<RetryInfoView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<RetryInfoView<'static>>::default(),
))
}
}
impl ::buffa::ViewReborrow for RetryInfoView<'static> {
type Reborrowed<'b> = RetryInfoView<'b>;
fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
this
}
}
#[derive(Clone, Debug, Default)]
pub struct BadRequestView<'a> {
pub field_violations: ::buffa::RepeatedView<
'a,
super::super::__buffa::view::bad_request::FieldViolationView<'a>,
>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> BadRequestView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
view.field_violations
.push(
super::super::__buffa::view::bad_request::FieldViolationView::_decode_depth(
sub,
depth - 1,
)?,
);
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for BadRequestView<'a> {
type Owned = super::super::BadRequest;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
fn to_owned_message(&self) -> super::super::BadRequest {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> super::super::BadRequest {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
super::super::BadRequest {
field_violations: self
.field_violations
.iter()
.map(|v| v.to_owned_from_source(__buffa_src))
.collect(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for BadRequestView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
for v in &self.field_violations {
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
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
for v in &self.field_violations {
::buffa::encoding::Tag::new(
1u32,
::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);
}
}
impl<'__a> ::serde::Serialize for BadRequestView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !self.field_violations.is_empty() {
__map.serialize_entry("fieldViolations", &*self.field_violations)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for BadRequestView<'a> {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "BadRequest";
const FULL_NAME: &'static str = "google.rpc.BadRequest";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest";
}
impl<'v> ::buffa::DefaultViewInstance for BadRequestView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<BadRequestView<'static>> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<BadRequestView<'static>>::default(),
))
}
}
impl ::buffa::ViewReborrow for BadRequestView<'static> {
type Reborrowed<'b> = BadRequestView<'b>;
fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
this
}
}
pub mod bad_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, Default)]
pub struct FieldViolationView<'a> {
pub field: &'a str,
pub description: &'a str,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> FieldViolationView<'a> {
#[doc(hidden)]
pub fn _decode_depth(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
let mut view = Self::default();
view._merge_into_view(buf, depth)?;
::core::result::Result::Ok(view)
}
#[doc(hidden)]
pub fn _merge_into_view(
&mut self,
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
let _ = depth;
#[allow(unused_variables)]
let view = self;
let mut cur: &'a [u8] = buf;
while !cur.is_empty() {
let before_tag = cur;
let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
match tag.field_number() {
1u32 => {
if tag.wire_type()
!= ::buffa::encoding::WireType::LengthDelimited
{
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 2u8,
actual: tag.wire_type() as u8,
});
}
view.field = ::buffa::types::borrow_str(&mut cur)?;
}
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,
});
}
view.description = ::buffa::types::borrow_str(&mut cur)?;
}
_ => {
::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
let span_len = before_tag.len() - cur.len();
view.__buffa_unknown_fields
.push_raw(&before_tag[..span_len]);
}
}
}
::core::result::Result::Ok(())
}
}
impl<'a> ::buffa::MessageView<'a> for FieldViolationView<'a> {
type Owned = super::super::super::bad_request::FieldViolation;
fn decode_view(
buf: &'a [u8],
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
}
fn decode_view_with_limit(
buf: &'a [u8],
depth: u32,
) -> ::core::result::Result<Self, ::buffa::DecodeError> {
Self::_decode_depth(buf, depth)
}
fn to_owned_message(
&self,
) -> super::super::super::bad_request::FieldViolation {
self.to_owned_from_source(None)
}
#[allow(clippy::useless_conversion, clippy::needless_update)]
fn to_owned_from_source(
&self,
__buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
) -> super::super::super::bad_request::FieldViolation {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
let _ = __buffa_src;
super::super::super::bad_request::FieldViolation {
field: self.field.to_string(),
description: self.description.to_string(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
impl<'a> ::buffa::ViewEncode<'a> for FieldViolationView<'a> {
#[allow(clippy::needless_borrow, clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.field.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.field) as u32;
}
if !self.description.is_empty() {
size
+= 1u32
+ ::buffa::types::string_encoded_len(&self.description)
as u32;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
#[allow(clippy::needless_borrow)]
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.field.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.field, buf);
}
if !self.description.is_empty() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.description, buf);
}
self.__buffa_unknown_fields.write_to(buf);
}
}
impl<'__a> ::serde::Serialize for FieldViolationView<'__a> {
fn serialize<__S: ::serde::Serializer>(
&self,
__s: __S,
) -> ::core::result::Result<__S::Ok, __S::Error> {
use ::serde::ser::SerializeMap as _;
let mut __map = __s.serialize_map(::core::option::Option::None)?;
if !::buffa::json_helpers::skip_if::is_empty_str(self.field) {
__map.serialize_entry("field", self.field)?;
}
if !::buffa::json_helpers::skip_if::is_empty_str(self.description) {
__map.serialize_entry("description", self.description)?;
}
__map.end()
}
}
impl<'a> ::buffa::MessageName for FieldViolationView<'a> {
const PACKAGE: &'static str = "google.rpc";
const NAME: &'static str = "BadRequest.FieldViolation";
const FULL_NAME: &'static str = "google.rpc.BadRequest.FieldViolation";
const TYPE_URL: &'static str = "type.googleapis.com/google.rpc.BadRequest.FieldViolation";
}
impl<'v> ::buffa::DefaultViewInstance for FieldViolationView<'v> {
fn default_view_instance<'a>() -> &'a Self
where
Self: 'a,
{
static VALUE: ::buffa::__private::OnceBox<
FieldViolationView<'static>,
> = ::buffa::__private::OnceBox::new();
VALUE
.get_or_init(|| ::buffa::alloc::boxed::Box::new(
<FieldViolationView<'static>>::default(),
))
}
}
impl ::buffa::ViewReborrow for FieldViolationView<'static> {
type Reborrowed<'b> = FieldViolationView<'b>;
fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
this
}
}
}
}
}
#[doc(inline)]
pub use self::__buffa::view::ErrorInfoView;
#[doc(inline)]
pub use self::__buffa::view::RetryInfoView;
#[doc(inline)]
pub use self::__buffa::view::BadRequestView;