buffa_types/generated/
google.protobuf.empty.rs1#[derive(Clone, PartialEq, Default)]
14#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
15pub struct Empty {
16 #[doc(hidden)]
17 pub __buffa_unknown_fields: ::buffa::UnknownFields,
18 #[doc(hidden)]
19 pub __buffa_cached_size: ::buffa::__private::CachedSize,
20}
21impl ::core::fmt::Debug for Empty {
22 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
23 f.debug_struct("Empty").finish()
24 }
25}
26impl Empty {
27 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
32}
33unsafe impl ::buffa::DefaultInstance for Empty {
34 fn default_instance() -> &'static Self {
35 static VALUE: ::buffa::__private::OnceBox<Empty> = ::buffa::__private::OnceBox::new();
36 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
37 }
38}
39impl ::buffa::Message for Empty {
40 fn compute_size(&self) -> u32 {
46 #[allow(unused_imports)]
47 use ::buffa::Enumeration as _;
48 let mut size = 0u32;
49 size += self.__buffa_unknown_fields.encoded_len() as u32;
50 self.__buffa_cached_size.set(size);
51 size
52 }
53 fn write_to(&self, buf: &mut impl ::buffa::bytes::BufMut) {
54 #[allow(unused_imports)]
55 use ::buffa::Enumeration as _;
56 self.__buffa_unknown_fields.write_to(buf);
57 }
58 fn merge_field(
59 &mut self,
60 tag: ::buffa::encoding::Tag,
61 buf: &mut impl ::buffa::bytes::Buf,
62 depth: u32,
63 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
64 #[allow(unused_imports)]
65 use ::buffa::bytes::Buf as _;
66 #[allow(unused_imports)]
67 use ::buffa::Enumeration as _;
68 match tag.field_number() {
69 _ => {
70 self.__buffa_unknown_fields
71 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
72 }
73 }
74 ::core::result::Result::Ok(())
75 }
76 fn cached_size(&self) -> u32 {
77 self.__buffa_cached_size.get()
78 }
79 fn clear(&mut self) {
80 self.__buffa_unknown_fields.clear();
81 self.__buffa_cached_size.set(0);
82 }
83}
84impl ::buffa::ExtensionSet for Empty {
85 const PROTO_FQN: &'static str = "google.protobuf.Empty";
86 fn unknown_fields(&self) -> &::buffa::UnknownFields {
87 &self.__buffa_unknown_fields
88 }
89 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
90 &mut self.__buffa_unknown_fields
91 }
92}
93impl ::buffa::text::TextFormat for Empty {
94 fn encode_text(
95 &self,
96 enc: &mut ::buffa::text::TextEncoder<'_>,
97 ) -> ::core::fmt::Result {
98 #[allow(unused_imports)]
99 use ::buffa::Enumeration as _;
100 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
101 ::core::result::Result::Ok(())
102 }
103 fn merge_text(
104 &mut self,
105 dec: &mut ::buffa::text::TextDecoder<'_>,
106 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
107 #[allow(unused_imports)]
108 use ::buffa::Enumeration as _;
109 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
110 match __name {
111 _ => dec.skip_value()?,
112 }
113 }
114 ::core::result::Result::Ok(())
115 }
116}
117#[doc(hidden)]
118pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
119 type_url: "type.googleapis.com/google.protobuf.Empty",
120 text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
121 text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
122};
123#[derive(Clone, Debug, Default)]
133pub struct EmptyView<'a> {
134 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
135}
136impl<'a> EmptyView<'a> {
137 #[doc(hidden)]
145 pub fn _decode_depth(
146 buf: &'a [u8],
147 depth: u32,
148 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
149 let mut view = Self::default();
150 view._merge_into_view(buf, depth)?;
151 ::core::result::Result::Ok(view)
152 }
153 #[doc(hidden)]
161 pub fn _merge_into_view(
162 &mut self,
163 buf: &'a [u8],
164 depth: u32,
165 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
166 let _ = depth;
167 #[allow(unused_variables)]
168 let view = self;
169 let mut cur: &'a [u8] = buf;
170 while !cur.is_empty() {
171 let before_tag = cur;
172 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
173 match tag.field_number() {
174 _ => {
175 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
176 let span_len = before_tag.len() - cur.len();
177 view.__buffa_unknown_fields.push_raw(&before_tag[..span_len]);
178 }
179 }
180 }
181 ::core::result::Result::Ok(())
182 }
183}
184impl<'a> ::buffa::MessageView<'a> for EmptyView<'a> {
185 type Owned = Empty;
186 fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
187 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
188 }
189 fn decode_view_with_limit(
190 buf: &'a [u8],
191 depth: u32,
192 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
193 Self::_decode_depth(buf, depth)
194 }
195 #[allow(clippy::redundant_closure, clippy::useless_conversion)]
197 fn to_owned_message(&self) -> Empty {
198 #[allow(unused_imports)]
199 use ::buffa::alloc::string::ToString as _;
200 Empty {
201 __buffa_unknown_fields: self
202 .__buffa_unknown_fields
203 .to_owned()
204 .unwrap_or_default()
205 .into(),
206 ..::core::default::Default::default()
207 }
208 }
209}
210unsafe impl ::buffa::DefaultViewInstance for EmptyView<'static> {
211 fn default_view_instance() -> &'static Self {
212 static VALUE: ::buffa::__private::OnceBox<EmptyView<'static>> = ::buffa::__private::OnceBox::new();
213 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
214 }
215}
216unsafe impl<'a> ::buffa::HasDefaultViewInstance for EmptyView<'a> {
217 type Static = EmptyView<'static>;
218}