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 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
212 ::buffa_descriptor::reflect::ValueRef::Message(
213 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
214 )
215 }
216 }
217 impl Timestamp {
218 #[doc(hidden)]
221 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
222 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
223 *IDX
224 .get_or_init(|| {
225 __buffa::reflect::descriptor_pool()
226 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
227 .expect(
228 "generated message is registered in the embedded descriptor pool",
229 )
230 })
231 }
232 }
233 impl ::buffa_descriptor::reflect::Reflectable for Timestamp {
234 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
238 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
239 }
240 }
241};
242impl ::buffa::MessageName for Timestamp {
243 const PACKAGE: &'static str = "google.protobuf";
244 const NAME: &'static str = "Timestamp";
245 const FULL_NAME: &'static str = "google.protobuf.Timestamp";
246 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Timestamp";
247}
248impl ::buffa::Message for Timestamp {
249 #[allow(clippy::let_and_return)]
255 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
256 #[allow(unused_imports)]
257 use ::buffa::Enumeration as _;
258 let mut size = 0u32;
259 if self.seconds != 0i64 {
260 size += 1u32 + ::buffa::types::int64_encoded_len(self.seconds) as u32;
261 }
262 if self.nanos != 0i32 {
263 size += 1u32 + ::buffa::types::int32_encoded_len(self.nanos) as u32;
264 }
265 size += self.__buffa_unknown_fields.encoded_len() as u32;
266 size
267 }
268 fn write_to(
269 &self,
270 _cache: &mut ::buffa::SizeCache,
271 buf: &mut impl ::buffa::bytes::BufMut,
272 ) {
273 #[allow(unused_imports)]
274 use ::buffa::Enumeration as _;
275 if self.seconds != 0i64 {
276 ::buffa::encoding::Tag::new(1u32, ::buffa::encoding::WireType::Varint)
277 .encode(buf);
278 ::buffa::types::encode_int64(self.seconds, buf);
279 }
280 if self.nanos != 0i32 {
281 ::buffa::encoding::Tag::new(2u32, ::buffa::encoding::WireType::Varint)
282 .encode(buf);
283 ::buffa::types::encode_int32(self.nanos, buf);
284 }
285 self.__buffa_unknown_fields.write_to(buf);
286 }
287 fn merge_field(
288 &mut self,
289 tag: ::buffa::encoding::Tag,
290 buf: &mut impl ::buffa::bytes::Buf,
291 depth: u32,
292 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
293 #[allow(unused_imports)]
294 use ::buffa::bytes::Buf as _;
295 #[allow(unused_imports)]
296 use ::buffa::Enumeration as _;
297 match tag.field_number() {
298 1u32 => {
299 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
300 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
301 field_number: 1u32,
302 expected: 0u8,
303 actual: tag.wire_type() as u8,
304 });
305 }
306 self.seconds = ::buffa::types::decode_int64(buf)?;
307 }
308 2u32 => {
309 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
310 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
311 field_number: 2u32,
312 expected: 0u8,
313 actual: tag.wire_type() as u8,
314 });
315 }
316 self.nanos = ::buffa::types::decode_int32(buf)?;
317 }
318 _ => {
319 self.__buffa_unknown_fields
320 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
321 }
322 }
323 ::core::result::Result::Ok(())
324 }
325 fn clear(&mut self) {
326 self.seconds = 0i64;
327 self.nanos = 0i32;
328 self.__buffa_unknown_fields.clear();
329 }
330}
331impl ::buffa::ExtensionSet for Timestamp {
332 const PROTO_FQN: &'static str = "google.protobuf.Timestamp";
333 fn unknown_fields(&self) -> &::buffa::UnknownFields {
334 &self.__buffa_unknown_fields
335 }
336 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
337 &mut self.__buffa_unknown_fields
338 }
339}
340impl ::buffa::text::TextFormat for Timestamp {
341 fn encode_text(
342 &self,
343 enc: &mut ::buffa::text::TextEncoder<'_>,
344 ) -> ::core::fmt::Result {
345 #[allow(unused_imports)]
346 use ::buffa::Enumeration as _;
347 if self.seconds != 0i64 {
348 enc.write_field_name("seconds")?;
349 enc.write_i64(self.seconds)?;
350 }
351 if self.nanos != 0i32 {
352 enc.write_field_name("nanos")?;
353 enc.write_i32(self.nanos)?;
354 }
355 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
356 ::core::result::Result::Ok(())
357 }
358 fn merge_text(
359 &mut self,
360 dec: &mut ::buffa::text::TextDecoder<'_>,
361 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
362 #[allow(unused_imports)]
363 use ::buffa::Enumeration as _;
364 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
365 match __name {
366 "seconds" => self.seconds = dec.read_i64()?,
367 "nanos" => self.nanos = dec.read_i32()?,
368 _ => dec.skip_value()?,
369 }
370 }
371 ::core::result::Result::Ok(())
372 }
373}
374#[doc(hidden)]
375pub const __TIMESTAMP_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
376 type_url: "type.googleapis.com/google.protobuf.Timestamp",
377 text_encode: ::buffa::type_registry::any_encode_text::<Timestamp>,
378 text_merge: ::buffa::type_registry::any_merge_text::<Timestamp>,
379};