buffa_types/generated/
google.protobuf.timestamp.rs1#[derive(Clone, PartialEq, Default)]
106#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
107pub struct Timestamp {
108 pub seconds: i64,
114 pub nanos: i32,
121 #[doc(hidden)]
122 pub __buffa_unknown_fields: ::buffa::UnknownFields,
123}
124impl ::core::fmt::Debug for Timestamp {
125 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
126 f.debug_struct("Timestamp")
127 .field("seconds", &self.seconds)
128 .field("nanos", &self.nanos)
129 .finish()
130 }
131}
132impl Timestamp {
133 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Timestamp";
138}
139impl ::buffa::DefaultInstance for Timestamp {
140 fn default_instance() -> &'static Self {
141 static VALUE: ::buffa::__private::OnceBox<Timestamp> = ::buffa::__private::OnceBox::new();
142 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
143 }
144}
145#[cfg(feature = "reflect")]
146const _: () = {
147 impl ::buffa_descriptor::reflect::ReflectMessage for Timestamp {
148 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
149 __buffa::reflect::descriptor_pool()
150 .message(Self::__buffa_reflect_message_index())
151 }
152 fn pool(
153 &self,
154 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
155 __buffa::reflect::descriptor_pool()
156 }
157 fn unknown_fields(&self) -> &::buffa::UnknownFields {
158 &self.__buffa_unknown_fields
159 }
160 fn get(
161 &self,
162 field: &::buffa_descriptor::FieldDescriptor,
163 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
164 #[allow(unused_imports)]
165 use ::buffa::Enumeration as _;
166 match field.number() {
167 1u32 => ::buffa_descriptor::reflect::ValueRef::I64(self.seconds),
168 2u32 => ::buffa_descriptor::reflect::ValueRef::I32(self.nanos),
169 _ => {
170 ::core::debug_assert!(
171 false,
172 "field number {} is not a member of this message's reflect get()",
173 field.number(),
174 );
175 ::buffa_descriptor::reflect::ValueRef::Bool(false)
176 }
177 }
178 }
179 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
180 match field.number() {
181 1u32 => self.seconds != 0,
182 2u32 => self.nanos != 0,
183 _ => false,
184 }
185 }
186 fn for_each_set(
187 &self,
188 f: &mut dyn ::core::ops::FnMut(
189 &::buffa_descriptor::FieldDescriptor,
190 ::buffa_descriptor::reflect::ValueRef<'_>,
191 ),
192 ) {
193 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
194 self,
195 );
196 for fd in md.fields() {
197 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
198 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
199 }
200 }
201 }
202 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
203 ::buffa_descriptor::reflect::DynamicMessage::from_message(
204 self,
205 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
206 Self::__buffa_reflect_message_index(),
207 )
208 }
209 }
210 impl ::buffa_descriptor::reflect::ReflectElement for Timestamp {
211 #[inline]
212 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
213 ::buffa_descriptor::reflect::ValueRef::Message(
214 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
215 )
216 }
217 }
218 impl Timestamp {
219 #[doc(hidden)]
222 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
223 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
224 *IDX
225 .get_or_init(|| {
226 __buffa::reflect::descriptor_pool()
227 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
228 .expect(
229 "generated message is registered in the embedded descriptor pool",
230 )
231 })
232 }
233 }
234 impl ::buffa_descriptor::reflect::Reflectable for Timestamp {
235 #[inline]
239 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
240 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
241 }
242 }
243};
244impl ::buffa::MessageName for Timestamp {
245 const PACKAGE: &'static str = "google.protobuf";
246 const NAME: &'static str = "Timestamp";
247 const FULL_NAME: &'static str = "google.protobuf.Timestamp";
248 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Timestamp";
249}
250impl ::buffa::Message for Timestamp {
251 #[allow(clippy::let_and_return)]
257 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
258 #[allow(unused_imports)]
259 use ::buffa::Enumeration as _;
260 let mut size = 0u32;
261 if self.seconds != 0i64 {
262 size += 1u32 + ::buffa::types::int64_encoded_len(self.seconds) as u32;
263 }
264 if self.nanos != 0i32 {
265 size += 1u32 + ::buffa::types::int32_encoded_len(self.nanos) as u32;
266 }
267 size += self.__buffa_unknown_fields.encoded_len() as u32;
268 size
269 }
270 fn write_to(
271 &self,
272 _cache: &mut ::buffa::SizeCache,
273 buf: &mut impl ::buffa::bytes::BufMut,
274 ) {
275 #[allow(unused_imports)]
276 use ::buffa::Enumeration as _;
277 if self.seconds != 0i64 {
278 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
279 .encode(buf);
280 ::buffa::types::encode_int64(self.seconds, buf);
281 }
282 if self.nanos != 0i32 {
283 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
284 .encode(buf);
285 ::buffa::types::encode_int32(self.nanos, buf);
286 }
287 self.__buffa_unknown_fields.write_to(buf);
288 }
289 fn merge_field(
290 &mut self,
291 tag: ::buffa::encoding::Tag,
292 buf: &mut impl ::buffa::bytes::Buf,
293 depth: u32,
294 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
295 #[allow(unused_imports)]
296 use ::buffa::bytes::Buf as _;
297 #[allow(unused_imports)]
298 use ::buffa::Enumeration as _;
299 match tag.field_number() {
300 1u32 => {
301 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
302 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
303 field_number: 1u32,
304 expected: 0u8,
305 actual: tag.wire_type() as u8,
306 });
307 }
308 self.seconds = ::buffa::types::decode_int64(buf)?;
309 }
310 2u32 => {
311 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
312 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
313 field_number: 2u32,
314 expected: 0u8,
315 actual: tag.wire_type() as u8,
316 });
317 }
318 self.nanos = ::buffa::types::decode_int32(buf)?;
319 }
320 _ => {
321 self.__buffa_unknown_fields
322 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
323 }
324 }
325 ::core::result::Result::Ok(())
326 }
327 fn clear(&mut self) {
328 self.seconds = 0i64;
329 self.nanos = 0i32;
330 self.__buffa_unknown_fields.clear();
331 }
332}
333impl ::buffa::ExtensionSet for Timestamp {
334 const PROTO_FQN: &'static str = "google.protobuf.Timestamp";
335 fn unknown_fields(&self) -> &::buffa::UnknownFields {
336 &self.__buffa_unknown_fields
337 }
338 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
339 &mut self.__buffa_unknown_fields
340 }
341}
342impl ::buffa::text::TextFormat for Timestamp {
343 fn encode_text(
344 &self,
345 enc: &mut ::buffa::text::TextEncoder<'_>,
346 ) -> ::core::fmt::Result {
347 #[allow(unused_imports)]
348 use ::buffa::Enumeration as _;
349 if self.seconds != 0i64 {
350 enc.write_field_name("seconds")?;
351 enc.write_i64(self.seconds)?;
352 }
353 if self.nanos != 0i32 {
354 enc.write_field_name("nanos")?;
355 enc.write_i32(self.nanos)?;
356 }
357 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
358 ::core::result::Result::Ok(())
359 }
360 fn merge_text(
361 &mut self,
362 dec: &mut ::buffa::text::TextDecoder<'_>,
363 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
364 #[allow(unused_imports)]
365 use ::buffa::Enumeration as _;
366 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
367 match __name {
368 "seconds" => self.seconds = dec.read_i64()?,
369 "nanos" => self.nanos = dec.read_i32()?,
370 _ => dec.skip_value()?,
371 }
372 }
373 ::core::result::Result::Ok(())
374 }
375}
376#[doc(hidden)]
377pub const __TIMESTAMP_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
378 type_url: "type.googleapis.com/google.protobuf.Timestamp",
379 text_encode: ::buffa::type_registry::any_encode_text::<Timestamp>,
380 text_merge: ::buffa::type_registry::any_merge_text::<Timestamp>,
381};