buffa_types/generated/
google.protobuf.empty.rs1#[derive(Clone, PartialEq, Default)]
5#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
6pub struct Empty {
7 #[doc(hidden)]
8 pub __buffa_unknown_fields: ::buffa::UnknownFields,
9 #[doc(hidden)]
10 pub __buffa_cached_size: ::buffa::__private::CachedSize,
11}
12impl ::core::fmt::Debug for Empty {
13 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
14 f.debug_struct("Empty").finish()
15 }
16}
17impl Empty {
18 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
23}
24unsafe impl ::buffa::DefaultInstance for Empty {
25 fn default_instance() -> &'static Self {
26 static VALUE: ::buffa::__private::OnceBox<Empty> = ::buffa::__private::OnceBox::new();
27 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Empty::default()))
28 }
29}
30impl ::buffa::Message for Empty {
31 fn compute_size(&self) -> u32 {
37 #[allow(unused_imports)]
38 use ::buffa::Enumeration as _;
39 let mut size = 0u32;
40 size += self.__buffa_unknown_fields.encoded_len() as u32;
41 self.__buffa_cached_size.set(size);
42 size
43 }
44 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
45 #[allow(unused_imports)]
46 use ::buffa::Enumeration as _;
47 self.__buffa_unknown_fields.write_to(buf);
48 }
49 fn merge_field(
50 &mut self,
51 tag: ::buffa::encoding::Tag,
52 buf: &mut impl ::buffa::bytes::Buf,
53 depth: u32,
54 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
55 #[allow(unused_imports)]
56 use ::buffa::bytes::Buf as _;
57 #[allow(unused_imports)]
58 use ::buffa::Enumeration as _;
59 match tag.field_number() {
60 _ => {
61 self.__buffa_unknown_fields
62 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
63 }
64 }
65 ::core::result::Result::Ok(())
66 }
67 fn cached_size(&self) -> u32 {
68 self.__buffa_cached_size.get()
69 }
70 fn clear(&mut self) {
71 self.__buffa_unknown_fields.clear();
72 self.__buffa_cached_size.set(0);
73 }
74}
75#[derive(Clone, Debug, Default)]
76pub struct EmptyView<'a> {
77 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
78}
79impl<'a> EmptyView<'a> {
80 #[doc(hidden)]
88 pub fn _decode_depth(
89 buf: &'a [u8],
90 depth: u32,
91 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
92 let mut view = Self::default();
93 view._merge_into_view(buf, depth)?;
94 ::core::result::Result::Ok(view)
95 }
96 #[doc(hidden)]
104 pub fn _merge_into_view(
105 &mut self,
106 buf: &'a [u8],
107 depth: u32,
108 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
109 let _ = depth;
110 #[allow(unused_variables)]
111 let view = self;
112 let mut cur: &'a [u8] = buf;
113 while !cur.is_empty() {
114 let before_tag = cur;
115 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
116 match tag.field_number() {
117 _ => {
118 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
119 let span_len = before_tag.len() - cur.len();
120 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
121 }
122 }
123 }
124 ::core::result::Result::Ok(())
125 }
126}
127impl<'a> ::buffa::MessageView<'a> for EmptyView<'a> {
128 type Owned = Empty;
129 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
130 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
131 }
132 fn decode_view_with_limit(
133 buf: &'a [u8],
134 depth: u32,
135 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
136 Self::_decode_depth(buf, depth)
137 }
138 #[allow(clippy::redundant_closure)]
140 fn to_owned_message(&self) -> Empty {
141 #[allow(unused_imports)]
142 use ::buffa::alloc::string::ToString as _;
143 Empty {
144 __buffa_unknown_fields: self
145 .__buffa_unknown_fields
146 .to_owned()
147 .unwrap_or_default(),
148 ..::core::default::Default::default()
149 }
150 }
151}
152unsafe impl ::buffa::DefaultViewInstance for EmptyView<'static> {
153 fn default_view_instance() -> &'static Self {
154 static VALUE: ::buffa::__private::OnceBox<EmptyView<'static>> = ::buffa::__private::OnceBox::new();
155 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(EmptyView::default()))
156 }
157}
158unsafe impl<'a> ::buffa::HasDefaultViewInstance for EmptyView<'a> {
159 type Static = EmptyView<'static>;
160}