#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum PolicyOrderEncoding {
POLICY_ORDER_ENCODING_BYTES_ASC = 0i32,
POLICY_ORDER_ENCODING_U64_BE = 1i32,
POLICY_ORDER_ENCODING_I64_BE = 2i32,
}
impl ::core::default::Default for PolicyOrderEncoding {
fn default() -> Self {
Self::POLICY_ORDER_ENCODING_BYTES_ASC
}
}
impl ::serde::Serialize for PolicyOrderEncoding {
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 PolicyOrderEncoding {
fn deserialize<D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl ::serde::de::Visitor<'_> for _V {
type Value = PolicyOrderEncoding;
fn expecting(
&self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::fmt::Result {
f.write_str(
concat!(
"a string, integer, or null for ",
stringify!(PolicyOrderEncoding)
),
)
}
fn visit_str<E: ::serde::de::Error>(
self,
v: &str,
) -> ::core::result::Result<PolicyOrderEncoding, E> {
<PolicyOrderEncoding 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<PolicyOrderEncoding, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {} out of i32 range", v),
)
})?;
<PolicyOrderEncoding 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<PolicyOrderEncoding, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {} out of i32 range", v),
)
})?;
<PolicyOrderEncoding 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<PolicyOrderEncoding, E> {
::core::result::Result::Ok(::core::default::Default::default())
}
}
d.deserialize_any(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for PolicyOrderEncoding {
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 PolicyOrderEncoding {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_BYTES_ASC),
1i32 => ::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_U64_BE),
2i32 => ::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_I64_BE),
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::POLICY_ORDER_ENCODING_BYTES_ASC => "POLICY_ORDER_ENCODING_BYTES_ASC",
Self::POLICY_ORDER_ENCODING_U64_BE => "POLICY_ORDER_ENCODING_U64_BE",
Self::POLICY_ORDER_ENCODING_I64_BE => "POLICY_ORDER_ENCODING_I64_BE",
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"POLICY_ORDER_ENCODING_BYTES_ASC" => {
::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_BYTES_ASC)
}
"POLICY_ORDER_ENCODING_U64_BE" => {
::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_U64_BE)
}
"POLICY_ORDER_ENCODING_I64_BE" => {
::core::option::Option::Some(Self::POLICY_ORDER_ENCODING_I64_BE)
}
_ => ::core::option::Option::None,
}
}
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct PolicyGroupBy {
#[serde(
rename = "captureGroups",
alias = "capture_groups",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)]
pub capture_groups: ::buffa::alloc::vec::Vec<::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 PolicyGroupBy {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("PolicyGroupBy")
.field("capture_groups", &self.capture_groups)
.finish()
}
}
impl PolicyGroupBy {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.PolicyGroupBy";
}
unsafe impl ::buffa::DefaultInstance for PolicyGroupBy {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyGroupBy> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for PolicyGroupBy {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
for v in &self.capture_groups {
size += 1u32 + ::buffa::types::string_encoded_len(v) 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 _;
for v in &self.capture_groups {
::buffa::encoding::Tag::new(
1u32,
::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,
});
}
self.capture_groups.push(::buffa::types::decode_string(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.capture_groups.clear();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for PolicyGroupBy {
const PROTO_FQN: &'static str = "store.compact.v1.PolicyGroupBy";
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 PolicyGroupBy {
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 __POLICY_GROUP_BY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.PolicyGroupBy",
to_json: ::buffa::type_registry::any_to_json::<PolicyGroupBy>,
from_json: ::buffa::type_registry::any_from_json::<PolicyGroupBy>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PolicyGroupByView<'a> {
pub capture_groups: ::buffa::RepeatedView<'a, &'a str>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PolicyGroupByView<'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.capture_groups.push(::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 PolicyGroupByView<'a> {
type Owned = PolicyGroupBy;
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) -> PolicyGroupBy {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
PolicyGroupBy {
capture_groups: self.capture_groups.iter().map(|s| s.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 PolicyGroupByView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyGroupByView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PolicyGroupByView<'a> {
type Static = PolicyGroupByView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct PolicyOrderBy {
#[serde(
rename = "captureGroup",
alias = "capture_group",
with = "::buffa::json_helpers::proto_string",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
)]
pub capture_group: ::buffa::alloc::string::String,
#[serde(
rename = "encoding",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub encoding: ::buffa::EnumValue<PolicyOrderEncoding>,
#[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 PolicyOrderBy {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("PolicyOrderBy")
.field("capture_group", &self.capture_group)
.field("encoding", &self.encoding)
.finish()
}
}
impl PolicyOrderBy {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.PolicyOrderBy";
}
unsafe impl ::buffa::DefaultInstance for PolicyOrderBy {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyOrderBy> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for PolicyOrderBy {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if !self.capture_group.is_empty() {
size
+= 1u32 + ::buffa::types::string_encoded_len(&self.capture_group) as u32;
}
{
let val = self.encoding.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) 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.capture_group.is_empty() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::types::encode_string(&self.capture_group, buf);
}
{
let val = self.encoding.to_i32();
if val != 0 {
::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_int32(val, 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.capture_group, 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.encoding = ::buffa::EnumValue::from(
::buffa::types::decode_int32(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.capture_group.clear();
self.encoding = ::buffa::EnumValue::from(0);
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for PolicyOrderBy {
const PROTO_FQN: &'static str = "store.compact.v1.PolicyOrderBy";
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 PolicyOrderBy {
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 __POLICY_ORDER_BY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.PolicyOrderBy",
to_json: ::buffa::type_registry::any_to_json::<PolicyOrderBy>,
from_json: ::buffa::type_registry::any_from_json::<PolicyOrderBy>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PolicyOrderByView<'a> {
pub capture_group: &'a str,
pub encoding: ::buffa::EnumValue<PolicyOrderEncoding>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PolicyOrderByView<'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.capture_group = ::buffa::types::borrow_str(&mut cur)?;
}
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,
});
}
view.encoding = ::buffa::EnumValue::from(
::buffa::types::decode_int32(&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 PolicyOrderByView<'a> {
type Owned = PolicyOrderBy;
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) -> PolicyOrderBy {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
PolicyOrderBy {
capture_group: self.capture_group.to_string(),
encoding: self.encoding,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for PolicyOrderByView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyOrderByView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PolicyOrderByView<'a> {
type Static = PolicyOrderByView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RetainKeepLatest {
#[serde(
rename = "count",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub count: u64,
#[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 RetainKeepLatest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("RetainKeepLatest").field("count", &self.count).finish()
}
}
impl RetainKeepLatest {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.RetainKeepLatest";
}
unsafe impl ::buffa::DefaultInstance for RetainKeepLatest {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainKeepLatest> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for RetainKeepLatest {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.count != 0u64 {
size += 1u32 + ::buffa::types::uint64_encoded_len(self.count) 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.count != 0u64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint64(self.count, 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.count = ::buffa::types::decode_uint64(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.count = 0u64;
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for RetainKeepLatest {
const PROTO_FQN: &'static str = "store.compact.v1.RetainKeepLatest";
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 RetainKeepLatest {
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 __RETAIN_KEEP_LATEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.RetainKeepLatest",
to_json: ::buffa::type_registry::any_to_json::<RetainKeepLatest>,
from_json: ::buffa::type_registry::any_from_json::<RetainKeepLatest>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct RetainKeepLatestView<'a> {
pub count: u64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RetainKeepLatestView<'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::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.count = ::buffa::types::decode_uint64(&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 RetainKeepLatestView<'a> {
type Owned = RetainKeepLatest;
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) -> RetainKeepLatest {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
RetainKeepLatest {
count: self.count,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for RetainKeepLatestView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainKeepLatestView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RetainKeepLatestView<'a> {
type Static = RetainKeepLatestView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RetainGreaterThan {
#[serde(
rename = "threshold",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub threshold: u64,
#[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 RetainGreaterThan {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("RetainGreaterThan").field("threshold", &self.threshold).finish()
}
}
impl RetainGreaterThan {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.RetainGreaterThan";
}
unsafe impl ::buffa::DefaultInstance for RetainGreaterThan {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainGreaterThan> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for RetainGreaterThan {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.threshold != 0u64 {
size += 1u32 + ::buffa::types::uint64_encoded_len(self.threshold) 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.threshold != 0u64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint64(self.threshold, 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.threshold = ::buffa::types::decode_uint64(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.threshold = 0u64;
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for RetainGreaterThan {
const PROTO_FQN: &'static str = "store.compact.v1.RetainGreaterThan";
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 RetainGreaterThan {
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 __RETAIN_GREATER_THAN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.RetainGreaterThan",
to_json: ::buffa::type_registry::any_to_json::<RetainGreaterThan>,
from_json: ::buffa::type_registry::any_from_json::<RetainGreaterThan>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct RetainGreaterThanView<'a> {
pub threshold: u64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RetainGreaterThanView<'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::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.threshold = ::buffa::types::decode_uint64(&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 RetainGreaterThanView<'a> {
type Owned = RetainGreaterThan;
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) -> RetainGreaterThan {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
RetainGreaterThan {
threshold: self.threshold,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for RetainGreaterThanView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainGreaterThanView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RetainGreaterThanView<'a> {
type Static = RetainGreaterThanView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RetainGreaterThanOrEqual {
#[serde(
rename = "threshold",
with = "::buffa::json_helpers::uint64",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
)]
pub threshold: u64,
#[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 RetainGreaterThanOrEqual {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("RetainGreaterThanOrEqual")
.field("threshold", &self.threshold)
.finish()
}
}
impl RetainGreaterThanOrEqual {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.RetainGreaterThanOrEqual";
}
unsafe impl ::buffa::DefaultInstance for RetainGreaterThanOrEqual {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainGreaterThanOrEqual> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for RetainGreaterThanOrEqual {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.threshold != 0u64 {
size += 1u32 + ::buffa::types::uint64_encoded_len(self.threshold) 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.threshold != 0u64 {
::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
.encode(buf);
::buffa::types::encode_uint64(self.threshold, 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.threshold = ::buffa::types::decode_uint64(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.threshold = 0u64;
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for RetainGreaterThanOrEqual {
const PROTO_FQN: &'static str = "store.compact.v1.RetainGreaterThanOrEqual";
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 RetainGreaterThanOrEqual {
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 __RETAIN_GREATER_THAN_OR_EQUAL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.RetainGreaterThanOrEqual",
to_json: ::buffa::type_registry::any_to_json::<RetainGreaterThanOrEqual>,
from_json: ::buffa::type_registry::any_from_json::<RetainGreaterThanOrEqual>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct RetainGreaterThanOrEqualView<'a> {
pub threshold: u64,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RetainGreaterThanOrEqualView<'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::Varint {
return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
field_number: 1u32,
expected: 0u8,
actual: tag.wire_type() as u8,
});
}
view.threshold = ::buffa::types::decode_uint64(&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 RetainGreaterThanOrEqualView<'a> {
type Owned = RetainGreaterThanOrEqual;
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) -> RetainGreaterThanOrEqual {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
RetainGreaterThanOrEqual {
threshold: self.threshold,
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for RetainGreaterThanOrEqualView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<
RetainGreaterThanOrEqualView<'static>,
> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RetainGreaterThanOrEqualView<'a> {
type Static = RetainGreaterThanOrEqualView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct RetainDropAll {
#[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 RetainDropAll {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("RetainDropAll").finish()
}
}
impl RetainDropAll {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.RetainDropAll";
}
unsafe impl ::buffa::DefaultInstance for RetainDropAll {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainDropAll> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for RetainDropAll {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
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 _;
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() {
_ => {
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.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for RetainDropAll {
const PROTO_FQN: &'static str = "store.compact.v1.RetainDropAll";
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 RetainDropAll {
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 __RETAIN_DROP_ALL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.RetainDropAll",
to_json: ::buffa::type_registry::any_to_json::<RetainDropAll>,
from_json: ::buffa::type_registry::any_from_json::<RetainDropAll>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct RetainDropAllView<'a> {
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> RetainDropAllView<'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() {
_ => {
::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 RetainDropAllView<'a> {
type Owned = RetainDropAll;
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) -> RetainDropAll {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
RetainDropAll {
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for RetainDropAllView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<RetainDropAllView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for RetainDropAllView<'a> {
type Static = RetainDropAllView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct PolicyRetain {
#[serde(flatten)]
pub kind: Option<policy_retain::Kind>,
#[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 PolicyRetain {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("PolicyRetain").field("kind", &self.kind).finish()
}
}
impl PolicyRetain {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.PolicyRetain";
}
unsafe impl ::buffa::DefaultInstance for PolicyRetain {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyRetain> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for PolicyRetain {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if let ::core::option::Option::Some(ref v) = self.kind {
match v {
policy_retain::Kind::KeepLatest(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
policy_retain::Kind::GreaterThan(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
policy_retain::Kind::GreaterThanOrEqual(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
policy_retain::Kind::DropAll(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
}
}
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 let ::core::option::Option::Some(ref v) = self.kind {
match v {
policy_retain::Kind::KeepLatest(x) => {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.write_to(buf);
}
policy_retain::Kind::GreaterThan(x) => {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.write_to(buf);
}
policy_retain::Kind::GreaterThanOrEqual(x) => {
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.write_to(buf);
}
policy_retain::Kind::DropAll(x) => {
::buffa::encoding::Tag::new(
4u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.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,
});
}
if let ::core::option::Option::Some(
policy_retain::Kind::KeepLatest(ref mut existing),
) = self.kind
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.kind = ::core::option::Option::Some(
policy_retain::Kind::KeepLatest(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
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,
});
}
if let ::core::option::Option::Some(
policy_retain::Kind::GreaterThan(ref mut existing),
) = self.kind
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.kind = ::core::option::Option::Some(
policy_retain::Kind::GreaterThan(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
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,
});
}
if let ::core::option::Option::Some(
policy_retain::Kind::GreaterThanOrEqual(ref mut existing),
) = self.kind
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.kind = ::core::option::Option::Some(
policy_retain::Kind::GreaterThanOrEqual(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
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,
});
}
if let ::core::option::Option::Some(
policy_retain::Kind::DropAll(ref mut existing),
) = self.kind
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.kind = ::core::option::Option::Some(
policy_retain::Kind::DropAll(
::buffa::alloc::boxed::Box::new(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.kind = ::core::option::Option::None;
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for PolicyRetain {
const PROTO_FQN: &'static str = "store.compact.v1.PolicyRetain";
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<'de> serde::Deserialize<'de> for PolicyRetain {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct _V;
impl<'de> serde::de::Visitor<'de> for _V {
type Value = PolicyRetain;
fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("struct PolicyRetain")
}
#[allow(clippy::field_reassign_with_default)]
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
mut map: A,
) -> Result<PolicyRetain, A::Error> {
let mut __oneof_kind: Option<policy_retain::Kind> = None;
while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
match key.as_str() {
"keepLatest" | "keep_latest" => {
let v: Option<RetainKeepLatest> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
RetainKeepLatest,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_kind.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'kind'",
),
);
}
__oneof_kind = Some(
policy_retain::Kind::KeepLatest(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"greaterThan" | "greater_than" => {
let v: Option<RetainGreaterThan> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
RetainGreaterThan,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_kind.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'kind'",
),
);
}
__oneof_kind = Some(
policy_retain::Kind::GreaterThan(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"greaterThanOrEqual" | "greater_than_or_equal" => {
let v: Option<RetainGreaterThanOrEqual> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
RetainGreaterThanOrEqual,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_kind.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'kind'",
),
);
}
__oneof_kind = Some(
policy_retain::Kind::GreaterThanOrEqual(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"dropAll" | "drop_all" => {
let v: Option<RetainDropAll> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
RetainDropAll,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_kind.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'kind'",
),
);
}
__oneof_kind = Some(
policy_retain::Kind::DropAll(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
_ => {
map.next_value::<serde::de::IgnoredAny>()?;
}
}
}
let mut __r = <PolicyRetain as ::core::default::Default>::default();
__r.kind = __oneof_kind;
Ok(__r)
}
}
d.deserialize_map(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for PolicyRetain {
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 __POLICY_RETAIN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.PolicyRetain",
to_json: ::buffa::type_registry::any_to_json::<PolicyRetain>,
from_json: ::buffa::type_registry::any_from_json::<PolicyRetain>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PolicyRetainView<'a> {
pub kind: ::core::option::Option<policy_retain::KindView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PolicyRetainView<'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)?;
if let Some(policy_retain::KindView::KeepLatest(ref mut existing)) = view
.kind
{
existing._merge_into_view(sub, depth - 1)?;
} else {
view.kind = Some(
policy_retain::KindView::KeepLatest(
::buffa::alloc::boxed::Box::new(
RetainKeepLatestView::_decode_depth(sub, depth - 1)?,
),
),
);
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
if let Some(
policy_retain::KindView::GreaterThan(ref mut existing),
) = view.kind
{
existing._merge_into_view(sub, depth - 1)?;
} else {
view.kind = Some(
policy_retain::KindView::GreaterThan(
::buffa::alloc::boxed::Box::new(
RetainGreaterThanView::_decode_depth(sub, depth - 1)?,
),
),
);
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
if let Some(
policy_retain::KindView::GreaterThanOrEqual(ref mut existing),
) = view.kind
{
existing._merge_into_view(sub, depth - 1)?;
} else {
view.kind = Some(
policy_retain::KindView::GreaterThanOrEqual(
::buffa::alloc::boxed::Box::new(
RetainGreaterThanOrEqualView::_decode_depth(sub, depth - 1)?,
),
),
);
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
if let Some(policy_retain::KindView::DropAll(ref mut existing)) = view
.kind
{
existing._merge_into_view(sub, depth - 1)?;
} else {
view.kind = Some(
policy_retain::KindView::DropAll(
::buffa::alloc::boxed::Box::new(
RetainDropAllView::_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 PolicyRetainView<'a> {
type Owned = PolicyRetain;
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) -> PolicyRetain {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
PolicyRetain {
kind: self
.kind
.as_ref()
.map(|v| match v {
policy_retain::KindView::KeepLatest(v) => {
policy_retain::Kind::KeepLatest(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
policy_retain::KindView::GreaterThan(v) => {
policy_retain::Kind::GreaterThan(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
policy_retain::KindView::GreaterThanOrEqual(v) => {
policy_retain::Kind::GreaterThanOrEqual(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
policy_retain::KindView::DropAll(v) => {
policy_retain::Kind::DropAll(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
}),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for PolicyRetainView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyRetainView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PolicyRetainView<'a> {
type Static = PolicyRetainView<'static>;
}
pub mod policy_retain {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, PartialEq, Debug)]
pub enum Kind {
KeepLatest(::buffa::alloc::boxed::Box<super::RetainKeepLatest>),
GreaterThan(::buffa::alloc::boxed::Box<super::RetainGreaterThan>),
GreaterThanOrEqual(::buffa::alloc::boxed::Box<super::RetainGreaterThanOrEqual>),
DropAll(::buffa::alloc::boxed::Box<super::RetainDropAll>),
}
impl ::buffa::Oneof for Kind {}
impl From<super::RetainKeepLatest> for Kind {
fn from(v: super::RetainKeepLatest) -> Self {
Self::KeepLatest(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::RetainKeepLatest> for ::core::option::Option<Kind> {
fn from(v: super::RetainKeepLatest) -> Self {
Self::Some(Kind::from(v))
}
}
impl From<super::RetainGreaterThan> for Kind {
fn from(v: super::RetainGreaterThan) -> Self {
Self::GreaterThan(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::RetainGreaterThan> for ::core::option::Option<Kind> {
fn from(v: super::RetainGreaterThan) -> Self {
Self::Some(Kind::from(v))
}
}
impl From<super::RetainGreaterThanOrEqual> for Kind {
fn from(v: super::RetainGreaterThanOrEqual) -> Self {
Self::GreaterThanOrEqual(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::RetainGreaterThanOrEqual> for ::core::option::Option<Kind> {
fn from(v: super::RetainGreaterThanOrEqual) -> Self {
Self::Some(Kind::from(v))
}
}
impl From<super::RetainDropAll> for Kind {
fn from(v: super::RetainDropAll) -> Self {
Self::DropAll(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::RetainDropAll> for ::core::option::Option<Kind> {
fn from(v: super::RetainDropAll) -> Self {
Self::Some(Kind::from(v))
}
}
impl serde::Serialize for Kind {
fn serialize<S: serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
use serde::ser::SerializeMap;
let mut map = s.serialize_map(Some(1))?;
match self {
Kind::KeepLatest(v) => {
map.serialize_entry("keepLatest", v)?;
}
Kind::GreaterThan(v) => {
map.serialize_entry("greaterThan", v)?;
}
Kind::GreaterThanOrEqual(v) => {
map.serialize_entry("greaterThanOrEqual", v)?;
}
Kind::DropAll(v) => {
map.serialize_entry("dropAll", v)?;
}
}
map.end()
}
}
#[derive(Clone, Debug)]
pub enum KindView<'a> {
KeepLatest(::buffa::alloc::boxed::Box<super::RetainKeepLatestView<'a>>),
GreaterThan(::buffa::alloc::boxed::Box<super::RetainGreaterThanView<'a>>),
GreaterThanOrEqual(
::buffa::alloc::boxed::Box<super::RetainGreaterThanOrEqualView<'a>>,
),
DropAll(::buffa::alloc::boxed::Box<super::RetainDropAllView<'a>>),
}
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct KeysScope {
#[serde(
rename = "matchKey",
alias = "match_key",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub match_key: ::buffa::MessageField<super::super::common::v1::MatchKey>,
#[serde(
rename = "groupBy",
alias = "group_by",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub group_by: ::buffa::MessageField<PolicyGroupBy>,
#[serde(
rename = "orderBy",
alias = "order_by",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub order_by: ::buffa::MessageField<PolicyOrderBy>,
#[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 KeysScope {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("KeysScope")
.field("match_key", &self.match_key)
.field("group_by", &self.group_by)
.field("order_by", &self.order_by)
.finish()
}
}
impl KeysScope {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.KeysScope";
}
unsafe impl ::buffa::DefaultInstance for KeysScope {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<KeysScope> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for KeysScope {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.match_key.is_set() {
let inner_size = self.match_key.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.group_by.is_set() {
let inner_size = self.group_by.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if self.order_by.is_set() {
let inner_size = self.order_by.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.match_key.is_set() {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(self.match_key.cached_size() as u64, buf);
self.match_key.write_to(buf);
}
if self.group_by.is_set() {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(self.group_by.cached_size() as u64, buf);
self.group_by.write_to(buf);
}
if self.order_by.is_set() {
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(self.order_by.cached_size() as u64, buf);
self.order_by.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.match_key.get_or_insert_default(),
buf,
depth,
)?;
}
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::Message::merge_length_delimited(
self.group_by.get_or_insert_default(),
buf,
depth,
)?;
}
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.order_by.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.match_key = ::buffa::MessageField::none();
self.group_by = ::buffa::MessageField::none();
self.order_by = ::buffa::MessageField::none();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for KeysScope {
const PROTO_FQN: &'static str = "store.compact.v1.KeysScope";
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 KeysScope {
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 __KEYS_SCOPE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.KeysScope",
to_json: ::buffa::type_registry::any_to_json::<KeysScope>,
from_json: ::buffa::type_registry::any_from_json::<KeysScope>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct KeysScopeView<'a> {
pub match_key: ::buffa::MessageFieldView<super::super::common::v1::MatchKeyView<'a>>,
pub group_by: ::buffa::MessageFieldView<PolicyGroupByView<'a>>,
pub order_by: ::buffa::MessageFieldView<PolicyOrderByView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> KeysScopeView<'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.match_key.as_mut() {
Some(existing) => existing._merge_into_view(sub, depth - 1)?,
None => {
view.match_key = ::buffa::MessageFieldView::set(
super::super::common::v1::MatchKeyView::_decode_depth(
sub,
depth - 1,
)?,
);
}
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.group_by.as_mut() {
Some(existing) => existing._merge_into_view(sub, depth - 1)?,
None => {
view.group_by = ::buffa::MessageFieldView::set(
PolicyGroupByView::_decode_depth(sub, depth - 1)?,
);
}
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.order_by.as_mut() {
Some(existing) => existing._merge_into_view(sub, depth - 1)?,
None => {
view.order_by = ::buffa::MessageFieldView::set(
PolicyOrderByView::_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 KeysScopeView<'a> {
type Owned = KeysScope;
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) -> KeysScope {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
KeysScope {
match_key: match self.match_key.as_option() {
Some(v) => {
::buffa::MessageField::<
super::super::common::v1::MatchKey,
>::some(v.to_owned_message())
}
None => ::buffa::MessageField::none(),
},
group_by: match self.group_by.as_option() {
Some(v) => {
::buffa::MessageField::<PolicyGroupBy>::some(v.to_owned_message())
}
None => ::buffa::MessageField::none(),
},
order_by: match self.order_by.as_option() {
Some(v) => {
::buffa::MessageField::<PolicyOrderBy>::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 KeysScopeView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<KeysScopeView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for KeysScopeView<'a> {
type Static = KeysScopeView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct SequenceScope {
#[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 SequenceScope {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("SequenceScope").finish()
}
}
impl SequenceScope {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.SequenceScope";
}
unsafe impl ::buffa::DefaultInstance for SequenceScope {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<SequenceScope> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for SequenceScope {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
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 _;
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() {
_ => {
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.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for SequenceScope {
const PROTO_FQN: &'static str = "store.compact.v1.SequenceScope";
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 SequenceScope {
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 __SEQUENCE_SCOPE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.SequenceScope",
to_json: ::buffa::type_registry::any_to_json::<SequenceScope>,
from_json: ::buffa::type_registry::any_from_json::<SequenceScope>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct SequenceScopeView<'a> {
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> SequenceScopeView<'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() {
_ => {
::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 SequenceScopeView<'a> {
type Owned = SequenceScope;
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) -> SequenceScope {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
SequenceScope {
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for SequenceScopeView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<SequenceScopeView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for SequenceScopeView<'a> {
type Static = SequenceScopeView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct Policy {
#[serde(
rename = "retain",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
)]
pub retain: ::buffa::MessageField<PolicyRetain>,
#[serde(flatten)]
pub scope: Option<policy::Scope>,
#[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 Policy {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("Policy")
.field("retain", &self.retain)
.field("scope", &self.scope)
.finish()
}
}
impl Policy {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.Policy";
}
unsafe impl ::buffa::DefaultInstance for Policy {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<Policy> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for Policy {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if self.retain.is_set() {
let inner_size = self.retain.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
+ inner_size;
}
if let ::core::option::Option::Some(ref v) = self.scope {
match v {
policy::Scope::Keys(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
policy::Scope::Sequence(x) => {
let inner = x.compute_size();
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
}
}
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.retain.is_set() {
::buffa::encoding::Tag::new(
3u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(self.retain.cached_size() as u64, buf);
self.retain.write_to(buf);
}
if let ::core::option::Option::Some(ref v) = self.scope {
match v {
policy::Scope::Keys(x) => {
::buffa::encoding::Tag::new(
1u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.write_to(buf);
}
policy::Scope::Sequence(x) => {
::buffa::encoding::Tag::new(
2u32,
::buffa::encoding::WireType::LengthDelimited,
)
.encode(buf);
::buffa::encoding::encode_varint(x.cached_size() as u64, buf);
x.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() {
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.retain.get_or_insert_default(),
buf,
depth,
)?;
}
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 let ::core::option::Option::Some(
policy::Scope::Keys(ref mut existing),
) = self.scope
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.scope = ::core::option::Option::Some(
policy::Scope::Keys(::buffa::alloc::boxed::Box::new(val)),
);
}
}
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,
});
}
if let ::core::option::Option::Some(
policy::Scope::Sequence(ref mut existing),
) = self.scope
{
::buffa::Message::merge_length_delimited(
&mut **existing,
buf,
depth,
)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
self.scope = ::core::option::Option::Some(
policy::Scope::Sequence(::buffa::alloc::boxed::Box::new(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.retain = ::buffa::MessageField::none();
self.scope = ::core::option::Option::None;
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for Policy {
const PROTO_FQN: &'static str = "store.compact.v1.Policy";
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<'de> serde::Deserialize<'de> for Policy {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
struct _V;
impl<'de> serde::de::Visitor<'de> for _V {
type Value = Policy;
fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("struct Policy")
}
#[allow(clippy::field_reassign_with_default)]
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
mut map: A,
) -> Result<Policy, A::Error> {
let mut __f_retain: Option<::buffa::MessageField<PolicyRetain>> = None;
let mut __oneof_scope: Option<policy::Scope> = None;
while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
match key.as_str() {
"retain" => {
__f_retain = Some(
map.next_value::<::buffa::MessageField<PolicyRetain>>()?,
);
}
"keys" => {
let v: Option<KeysScope> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
KeysScope,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_scope.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'scope'",
),
);
}
__oneof_scope = Some(
policy::Scope::Keys(::buffa::alloc::boxed::Box::new(v)),
);
}
}
"sequence" => {
let v: Option<SequenceScope> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
SequenceScope,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_scope.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'scope'",
),
);
}
__oneof_scope = Some(
policy::Scope::Sequence(::buffa::alloc::boxed::Box::new(v)),
);
}
}
_ => {
map.next_value::<serde::de::IgnoredAny>()?;
}
}
}
let mut __r = <Policy as ::core::default::Default>::default();
if let ::core::option::Option::Some(v) = __f_retain {
__r.retain = v;
}
__r.scope = __oneof_scope;
Ok(__r)
}
}
d.deserialize_map(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for Policy {
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 __POLICY_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.Policy",
to_json: ::buffa::type_registry::any_to_json::<Policy>,
from_json: ::buffa::type_registry::any_from_json::<Policy>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PolicyView<'a> {
pub retain: ::buffa::MessageFieldView<PolicyRetainView<'a>>,
pub scope: ::core::option::Option<policy::ScopeView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PolicyView<'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() {
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
match view.retain.as_mut() {
Some(existing) => existing._merge_into_view(sub, depth - 1)?,
None => {
view.retain = ::buffa::MessageFieldView::set(
PolicyRetainView::_decode_depth(sub, depth - 1)?,
);
}
}
}
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)?;
if let Some(policy::ScopeView::Keys(ref mut existing)) = view.scope {
existing._merge_into_view(sub, depth - 1)?;
} else {
view.scope = Some(
policy::ScopeView::Keys(
::buffa::alloc::boxed::Box::new(
KeysScopeView::_decode_depth(sub, depth - 1)?,
),
),
);
}
}
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,
});
}
if depth == 0 {
return Err(::buffa::DecodeError::RecursionLimitExceeded);
}
let sub = ::buffa::types::borrow_bytes(&mut cur)?;
if let Some(policy::ScopeView::Sequence(ref mut existing)) = view
.scope
{
existing._merge_into_view(sub, depth - 1)?;
} else {
view.scope = Some(
policy::ScopeView::Sequence(
::buffa::alloc::boxed::Box::new(
SequenceScopeView::_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 PolicyView<'a> {
type Owned = Policy;
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) -> Policy {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
Policy {
retain: match self.retain.as_option() {
Some(v) => {
::buffa::MessageField::<PolicyRetain>::some(v.to_owned_message())
}
None => ::buffa::MessageField::none(),
},
scope: self
.scope
.as_ref()
.map(|v| match v {
policy::ScopeView::Keys(v) => {
policy::Scope::Keys(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
policy::ScopeView::Sequence(v) => {
policy::Scope::Sequence(
::buffa::alloc::boxed::Box::new(v.to_owned_message()),
)
}
}),
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for PolicyView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PolicyView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PolicyView<'a> {
type Static = PolicyView<'static>;
}
pub mod policy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, PartialEq, Debug)]
pub enum Scope {
Keys(::buffa::alloc::boxed::Box<super::KeysScope>),
Sequence(::buffa::alloc::boxed::Box<super::SequenceScope>),
}
impl ::buffa::Oneof for Scope {}
impl From<super::KeysScope> for Scope {
fn from(v: super::KeysScope) -> Self {
Self::Keys(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::KeysScope> for ::core::option::Option<Scope> {
fn from(v: super::KeysScope) -> Self {
Self::Some(Scope::from(v))
}
}
impl From<super::SequenceScope> for Scope {
fn from(v: super::SequenceScope) -> Self {
Self::Sequence(::buffa::alloc::boxed::Box::new(v))
}
}
impl From<super::SequenceScope> for ::core::option::Option<Scope> {
fn from(v: super::SequenceScope) -> Self {
Self::Some(Scope::from(v))
}
}
impl serde::Serialize for Scope {
fn serialize<S: serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
use serde::ser::SerializeMap;
let mut map = s.serialize_map(Some(1))?;
match self {
Scope::Keys(v) => {
map.serialize_entry("keys", v)?;
}
Scope::Sequence(v) => {
map.serialize_entry("sequence", v)?;
}
}
map.end()
}
}
#[derive(Clone, Debug)]
pub enum ScopeView<'a> {
Keys(::buffa::alloc::boxed::Box<super::KeysScopeView<'a>>),
Sequence(::buffa::alloc::boxed::Box<super::SequenceScopeView<'a>>),
}
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct PruneRequest {
#[serde(
rename = "policies",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
deserialize_with = "::buffa::json_helpers::null_as_default"
)]
pub policies: ::buffa::alloc::vec::Vec<Policy>,
#[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 PruneRequest {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("PruneRequest").field("policies", &self.policies).finish()
}
}
impl PruneRequest {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.PruneRequest";
}
unsafe impl ::buffa::DefaultInstance for PruneRequest {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PruneRequest> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for PruneRequest {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
for v in &self.policies {
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.policies {
::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.policies.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.policies.clear();
self.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for PruneRequest {
const PROTO_FQN: &'static str = "store.compact.v1.PruneRequest";
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 PruneRequest {
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 __PRUNE_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.PruneRequest",
to_json: ::buffa::type_registry::any_to_json::<PruneRequest>,
from_json: ::buffa::type_registry::any_from_json::<PruneRequest>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PruneRequestView<'a> {
pub policies: ::buffa::RepeatedView<'a, PolicyView<'a>>,
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PruneRequestView<'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.policies.push(PolicyView::_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 PruneRequestView<'a> {
type Owned = PruneRequest;
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) -> PruneRequest {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
PruneRequest {
policies: self.policies.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 PruneRequestView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PruneRequestView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PruneRequestView<'a> {
type Static = PruneRequestView<'static>;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct PruneResponse {
#[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 PruneResponse {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("PruneResponse").finish()
}
}
impl PruneResponse {
pub const TYPE_URL: &'static str = "type.googleapis.com/store.compact.v1.PruneResponse";
}
unsafe impl ::buffa::DefaultInstance for PruneResponse {
fn default_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PruneResponse> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
impl ::buffa::Message for PruneResponse {
fn compute_size(&self) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
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 _;
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() {
_ => {
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.__buffa_unknown_fields.clear();
self.__buffa_cached_size.set(0);
}
}
impl ::buffa::ExtensionSet for PruneResponse {
const PROTO_FQN: &'static str = "store.compact.v1.PruneResponse";
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 PruneResponse {
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 __PRUNE_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/store.compact.v1.PruneResponse",
to_json: ::buffa::type_registry::any_to_json::<PruneResponse>,
from_json: ::buffa::type_registry::any_from_json::<PruneResponse>,
is_wkt: false,
};
#[derive(Clone, Debug, Default)]
pub struct PruneResponseView<'a> {
pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
}
impl<'a> PruneResponseView<'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() {
_ => {
::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 PruneResponseView<'a> {
type Owned = PruneResponse;
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) -> PruneResponse {
#[allow(unused_imports)]
use ::buffa::alloc::string::ToString as _;
PruneResponse {
__buffa_unknown_fields: self
.__buffa_unknown_fields
.to_owned()
.unwrap_or_default()
.into(),
..::core::default::Default::default()
}
}
}
unsafe impl ::buffa::DefaultViewInstance for PruneResponseView<'static> {
fn default_view_instance() -> &'static Self {
static VALUE: ::buffa::__private::OnceBox<PruneResponseView<'static>> = ::buffa::__private::OnceBox::new();
VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
}
}
unsafe impl<'a> ::buffa::HasDefaultViewInstance for PruneResponseView<'a> {
type Static = PruneResponseView<'static>;
}
pub const SERVICE_SERVICE_NAME: &str = "store.compact.v1.Service";
#[allow(clippy::type_complexity)]
pub trait Service: Send + Sync + 'static {
fn prune(
&self,
ctx: ::connectrpc::Context,
request: ::buffa::view::OwnedView<PruneRequestView<'static>>,
) -> impl ::std::future::Future<
Output = Result<
(PruneResponse, ::connectrpc::Context),
::connectrpc::ConnectError,
>,
> + Send;
}
pub trait ServiceExt: Service {
fn register(
self: ::std::sync::Arc<Self>,
router: ::connectrpc::Router,
) -> ::connectrpc::Router;
}
impl<S: Service> ServiceExt for S {
fn register(
self: ::std::sync::Arc<Self>,
router: ::connectrpc::Router,
) -> ::connectrpc::Router {
router
.route_view(
SERVICE_SERVICE_NAME,
"Prune",
{
let svc = ::std::sync::Arc::clone(&self);
::connectrpc::view_handler_fn(move |ctx, req| {
let svc = ::std::sync::Arc::clone(&svc);
async move { svc.prune(ctx, req).await }
})
},
)
}
}
pub struct ServiceServer<T> {
inner: ::std::sync::Arc<T>,
}
impl<T: Service> ServiceServer<T> {
pub fn new(service: T) -> Self {
Self {
inner: ::std::sync::Arc::new(service),
}
}
pub fn from_arc(inner: ::std::sync::Arc<T>) -> Self {
Self { inner }
}
}
impl<T> Clone for ServiceServer<T> {
fn clone(&self) -> Self {
Self {
inner: ::std::sync::Arc::clone(&self.inner),
}
}
}
impl<T: Service> ::connectrpc::Dispatcher for ServiceServer<T> {
#[inline]
fn lookup(
&self,
path: &str,
) -> Option<::connectrpc::dispatcher::codegen::MethodDescriptor> {
let method = path.strip_prefix("store.compact.v1.Service/")?;
match method {
"Prune" => {
Some(::connectrpc::dispatcher::codegen::MethodDescriptor::unary(false))
}
_ => None,
}
}
fn call_unary(
&self,
path: &str,
ctx: ::connectrpc::Context,
request: ::buffa::bytes::Bytes,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::UnaryResult {
let Some(method) = path.strip_prefix("store.compact.v1.Service/") else {
return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
};
let _ = (&ctx, &request, &format);
match method {
"Prune" => {
let svc = ::std::sync::Arc::clone(&self.inner);
Box::pin(async move {
let req = ::connectrpc::dispatcher::codegen::decode_request_view::<
PruneRequestView,
>(request, format)?;
let (res, ctx) = svc.prune(ctx, req).await?;
let bytes = ::connectrpc::dispatcher::codegen::encode_response(
&res,
format,
)?;
Ok((bytes, ctx))
})
}
_ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
}
}
fn call_server_streaming(
&self,
path: &str,
ctx: ::connectrpc::Context,
request: ::buffa::bytes::Bytes,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::StreamingResult {
let Some(method) = path.strip_prefix("store.compact.v1.Service/") else {
return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
};
let _ = (&ctx, &request, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
}
}
fn call_client_streaming(
&self,
path: &str,
ctx: ::connectrpc::Context,
requests: ::connectrpc::dispatcher::codegen::RequestStream,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::UnaryResult {
let Some(method) = path.strip_prefix("store.compact.v1.Service/") else {
return ::connectrpc::dispatcher::codegen::unimplemented_unary(path);
};
let _ = (&ctx, &requests, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_unary(path),
}
}
fn call_bidi_streaming(
&self,
path: &str,
ctx: ::connectrpc::Context,
requests: ::connectrpc::dispatcher::codegen::RequestStream,
format: ::connectrpc::CodecFormat,
) -> ::connectrpc::dispatcher::codegen::StreamingResult {
let Some(method) = path.strip_prefix("store.compact.v1.Service/") else {
return ::connectrpc::dispatcher::codegen::unimplemented_streaming(path);
};
let _ = (&ctx, &requests, &format);
match method {
_ => ::connectrpc::dispatcher::codegen::unimplemented_streaming(path),
}
}
}
#[derive(Clone)]
pub struct ServiceClient<T> {
transport: T,
config: ::connectrpc::client::ClientConfig,
}
impl<T> ServiceClient<T>
where
T: ::connectrpc::client::ClientTransport,
<T::ResponseBody as ::http_body::Body>::Error: ::std::fmt::Display,
{
pub fn new(transport: T, config: ::connectrpc::client::ClientConfig) -> Self {
Self { transport, config }
}
pub fn config(&self) -> &::connectrpc::client::ClientConfig {
&self.config
}
pub fn config_mut(&mut self) -> &mut ::connectrpc::client::ClientConfig {
&mut self.config
}
pub async fn prune(
&self,
request: PruneRequest,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<PruneResponseView<'static>>,
>,
::connectrpc::ConnectError,
> {
self.prune_with_options(request, ::connectrpc::client::CallOptions::default())
.await
}
pub async fn prune_with_options(
&self,
request: PruneRequest,
options: ::connectrpc::client::CallOptions,
) -> Result<
::connectrpc::client::UnaryResponse<
::buffa::view::OwnedView<PruneResponseView<'static>>,
>,
::connectrpc::ConnectError,
> {
::connectrpc::client::call_unary(
&self.transport,
&self.config,
SERVICE_SERVICE_NAME,
"Prune",
request,
options,
)
.await
}
}