#[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,
#[doc(hidden)]
#[serde(skip)]
pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
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";
}
unsafe 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::Message for ErrorInfo {
fn compute_size(&self) -> 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;
}
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;
self.__buffa_cached_size.set(size);
size
}
fn write_to(&self, 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 cached_size(&self) -> u32 {
self.__buffa_cached_size.get()
}
fn clear(&mut self) {
self.reason.clear();
self.domain.clear();
self.metadata.clear();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
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, 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 = 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)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
fn to_owned_message(&self) -> ErrorInfo {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
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()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for ErrorInfoView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<ErrorInfoView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for ErrorInfoView<'a> {
type Static = ErrorInfoView<'static>;
}
#[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,
#[doc(hidden)]
#[serde(skip)]
pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
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";
}
unsafe 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::Message for RetryInfo {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.retry_delay.is_set() {
let inner_size = self.retry_delay.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
self.__buffa_cached_size.set(size);
size
}
fn write_to(&self, 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(self.retry_delay.cached_size() as u64, buf);
self.retry_delay.write_to(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 cached_size(&self) -> u32 {
self.__buffa_cached_size.get()
}
fn clear(&mut self) {
self.retry_delay = ::buffa::MessageField::none();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
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, Debug, Default)]
pub struct RetryInfoView<'a> {
pub retry_delay: ::buffa::MessageFieldView<
::buffa_types::google::protobuf::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::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 = 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)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
fn to_owned_message(&self) -> RetryInfo {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
RetryInfo {
retry_delay: match self.retry_delay.as_option() {
Some(v) => {
::buffa::MessageField::<
::buffa_types::google::protobuf::Duration,
>::some(v.to_owned_message())
}
None => ::buffa::MessageField::none(),
},
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for RetryInfoView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetryInfoView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RetryInfoView<'a> {
type Static = RetryInfoView<'static>;
}
#[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,
#[doc(hidden)]
#[serde(skip)]
pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
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";
}
unsafe 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::Message for BadRequest {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
for v in &self.field_violations {
let inner_size = v.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
self.__buffa_cached_size.set(size);
size
}
fn write_to(&self, 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(v.cached_size() as u64, buf);
v.write_to(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 cached_size(&self) -> u32 {
self.__buffa_cached_size.get()
}
fn clear(&mut self) {
self.field_violations.clear();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
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,
};
#[derive(Clone, Debug, Default)]
pub struct BadRequestView<'a> {
pub field_violations: ::buffa::RepeatedView<'a, 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(
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 = 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)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
fn to_owned_message(&self) -> BadRequest {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
BadRequest {
field_violations: self
.field_violations
.iter()
.map(|v| v.to_owned_message())
.collect(),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for BadRequestView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<BadRequestView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for BadRequestView<'a> {
type Static = BadRequestView<'static>;
}
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,
#[doc(hidden)]
#[serde(skip)]
pub __buffa_cached_size: ::buffa::__private::CachedSize,
}
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";
}
unsafe 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::Message for FieldViolation {
fn compute_size(&self) -> 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;
self.__buffa_cached_size.set(size);
size
}
fn write_to(&self, 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 cached_size(&self) -> u32 {
self.__buffa_cached_size.get()
}
fn clear(&mut self) {
self.field.clear();
self.description.clear();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
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,
};
#[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 = 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)
}
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
fn to_owned_message(&self) -> FieldViolation {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
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()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for FieldViolationView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<FieldViolationView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for FieldViolationView<'a> {
type Static = FieldViolationView<'static>;
}
}