1#[derive(Clone, PartialEq, Default)]
11#[derive(::serde::Serialize, ::serde::Deserialize)]
12#[serde(default)]
13pub struct U128 {
14 #[serde(
18 rename = "hi",
19 with = "::buffa::json_helpers::uint64",
20 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
21 )]
22 pub hi: u64,
23 #[serde(
27 rename = "lo",
28 with = "::buffa::json_helpers::uint64",
29 skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
30 )]
31 pub lo: u64,
32 #[serde(skip)]
33 #[doc(hidden)]
34 pub __buffa_unknown_fields: ::buffa::UnknownFields,
35}
36impl ::core::fmt::Debug for U128 {
37 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
38 f.debug_struct("U128").field("hi", &self.hi).field("lo", &self.lo).finish()
39 }
40}
41impl U128 {
42 pub const TYPE_URL: &'static str = "type.googleapis.com/polyester.type.v1.U128";
47}
48::buffa::impl_default_instance!(U128);
49impl ::buffa::MessageName for U128 {
50 const PACKAGE: &'static str = "polyester.type.v1";
51 const NAME: &'static str = "U128";
52 const FULL_NAME: &'static str = "polyester.type.v1.U128";
53 const TYPE_URL: &'static str = "type.googleapis.com/polyester.type.v1.U128";
54}
55impl ::buffa::Message for U128 {
56 #[allow(clippy::let_and_return)]
62 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
63 #[allow(unused_imports)]
64 use ::buffa::Enumeration as _;
65 let mut size = 0u32;
66 if self.hi != 0u64 {
67 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
68 }
69 if self.lo != 0u64 {
70 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
71 }
72 size += self.__buffa_unknown_fields.encoded_len() as u32;
73 size
74 }
75 fn write_to(
76 &self,
77 _cache: &mut ::buffa::SizeCache,
78 buf: &mut impl ::buffa::bytes::BufMut,
79 ) {
80 #[allow(unused_imports)]
81 use ::buffa::Enumeration as _;
82 if self.hi != 0u64 {
83 ::buffa::types::put_fixed64_field(1u32, self.hi, buf);
84 }
85 if self.lo != 0u64 {
86 ::buffa::types::put_fixed64_field(2u32, self.lo, buf);
87 }
88 self.__buffa_unknown_fields.write_to(buf);
89 }
90 fn merge_field(
91 &mut self,
92 tag: ::buffa::encoding::Tag,
93 buf: &mut impl ::buffa::bytes::Buf,
94 ctx: ::buffa::DecodeContext<'_>,
95 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
96 #[allow(unused_imports)]
97 use ::buffa::bytes::Buf as _;
98 #[allow(unused_imports)]
99 use ::buffa::Enumeration as _;
100 match tag.field_number() {
101 1u32 => {
102 ::buffa::encoding::check_wire_type(
103 tag,
104 ::buffa::encoding::WireType::Fixed64,
105 )?;
106 self.hi = ::buffa::types::decode_fixed64(buf)?;
107 }
108 2u32 => {
109 ::buffa::encoding::check_wire_type(
110 tag,
111 ::buffa::encoding::WireType::Fixed64,
112 )?;
113 self.lo = ::buffa::types::decode_fixed64(buf)?;
114 }
115 _ => {
116 self.__buffa_unknown_fields
117 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
118 }
119 }
120 ::core::result::Result::Ok(())
121 }
122 fn clear(&mut self) {
123 self.hi = 0u64;
124 self.lo = 0u64;
125 self.__buffa_unknown_fields.clear();
126 }
127}
128impl ::buffa::ExtensionSet for U128 {
129 const PROTO_FQN: &'static str = "polyester.type.v1.U128";
130 fn unknown_fields(&self) -> &::buffa::UnknownFields {
131 &self.__buffa_unknown_fields
132 }
133 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
134 &mut self.__buffa_unknown_fields
135 }
136}
137impl ::buffa::json_helpers::ProtoElemJson for U128 {
138 fn serialize_proto_json<S: ::serde::Serializer>(
139 v: &Self,
140 s: S,
141 ) -> ::core::result::Result<S::Ok, S::Error> {
142 ::serde::Serialize::serialize(v, s)
143 }
144 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
145 d: D,
146 ) -> ::core::result::Result<Self, D::Error> {
147 <Self as ::serde::Deserialize>::deserialize(d)
148 }
149}
150#[doc(hidden)]
151pub const __U128_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
152 type_url: "type.googleapis.com/polyester.type.v1.U128",
153 to_json: ::buffa::type_registry::any_to_json::<U128>,
154 from_json: ::buffa::type_registry::any_from_json::<U128>,
155 is_wkt: false,
156};
157#[allow(
158 non_camel_case_types,
159 dead_code,
160 unused_imports,
161 unused_qualifications,
162 clippy::derivable_impls,
163 clippy::match_single_binding,
164 clippy::uninlined_format_args,
165 clippy::doc_lazy_continuation,
166 clippy::module_inception
167)]
168pub mod __buffa {
169 #[allow(unused_imports)]
170 use super::*;
171 pub mod view {
172 #[allow(unused_imports)]
173 use super::*;
174 #[derive(Clone, Debug, Default)]
182 pub struct U128View<'a> {
183 pub hi: u64,
187 pub lo: u64,
191 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
192 }
193 impl<'a> ::buffa::MessageView<'a> for U128View<'a> {
194 type Owned = super::super::U128;
195 fn decode_view(
196 buf: &'a [u8],
197 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
198 let __limit = ::core::cell::Cell::new(
199 ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
200 );
201 <Self as ::buffa::MessageView>::decode_view_ctx(
202 buf,
203 ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
204 )
205 }
206 fn decode_view_with_ctx(
207 buf: &'a [u8],
208 ctx: ::buffa::DecodeContext<'_>,
209 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
210 <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
211 }
212 fn merge_view_field(
213 &mut self,
214 tag: ::buffa::encoding::Tag,
215 cur: &'a [u8],
216 before_tag: &'a [u8],
217 ctx: ::buffa::DecodeContext<'_>,
218 ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
219 let _ = ctx;
220 #[allow(unused_variables)]
221 let view = self;
222 let mut cur = cur;
223 match tag.field_number() {
224 1u32 => {
225 ::buffa::encoding::check_wire_type(
226 tag,
227 ::buffa::encoding::WireType::Fixed64,
228 )?;
229 view.hi = ::buffa::types::decode_fixed64(&mut cur)?;
230 }
231 2u32 => {
232 ::buffa::encoding::check_wire_type(
233 tag,
234 ::buffa::encoding::WireType::Fixed64,
235 )?;
236 view.lo = ::buffa::types::decode_fixed64(&mut cur)?;
237 }
238 _ => {
239 ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
240 let span_len = before_tag.len() - cur.len();
241 view.__buffa_unknown_fields
242 .push_record(before_tag, span_len, ctx)?;
243 }
244 }
245 ::core::result::Result::Ok(cur)
246 }
247 fn to_owned_message(
248 &self,
249 ) -> ::core::result::Result<super::super::U128, ::buffa::DecodeError> {
250 self.to_owned_from_source(None)
251 }
252 #[allow(clippy::useless_conversion, clippy::needless_update)]
253 fn to_owned_from_source(
254 &self,
255 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
256 ) -> ::core::result::Result<super::super::U128, ::buffa::DecodeError> {
257 #[allow(unused_imports)]
258 use ::buffa::alloc::string::ToString as _;
259 let _ = __buffa_src;
260 ::core::result::Result::Ok(super::super::U128 {
261 hi: self.hi,
262 lo: self.lo,
263 __buffa_unknown_fields: self
264 .__buffa_unknown_fields
265 .to_owned()?
266 .into(),
267 ..::core::default::Default::default()
268 })
269 }
270 }
271 impl<'a> ::buffa::ViewEncode<'a> for U128View<'a> {
272 #[allow(clippy::needless_borrow, clippy::let_and_return)]
273 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
274 #[allow(unused_imports)]
275 use ::buffa::Enumeration as _;
276 let mut size = 0u32;
277 if self.hi != 0u64 {
278 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
279 }
280 if self.lo != 0u64 {
281 size += 1u32 + ::buffa::types::FIXED64_ENCODED_LEN as u32;
282 }
283 size += self.__buffa_unknown_fields.encoded_len() as u32;
284 size
285 }
286 #[allow(clippy::needless_borrow)]
287 fn write_to(
288 &self,
289 _cache: &mut ::buffa::SizeCache,
290 buf: &mut impl ::buffa::bytes::BufMut,
291 ) {
292 #[allow(unused_imports)]
293 use ::buffa::Enumeration as _;
294 if self.hi != 0u64 {
295 ::buffa::types::put_fixed64_field(1u32, self.hi, buf);
296 }
297 if self.lo != 0u64 {
298 ::buffa::types::put_fixed64_field(2u32, self.lo, buf);
299 }
300 self.__buffa_unknown_fields.write_to(buf);
301 }
302 }
303 impl<'__a> ::serde::Serialize for U128View<'__a> {
315 fn serialize<__S: ::serde::Serializer>(
316 &self,
317 __s: __S,
318 ) -> ::core::result::Result<__S::Ok, __S::Error> {
319 use ::serde::ser::SerializeMap as _;
320 let mut __map = __s.serialize_map(::core::option::Option::None)?;
321 if !::buffa::json_helpers::skip_if::is_zero_u64(&self.hi) {
322 __map
323 .serialize_entry(
324 "hi",
325 &::buffa::json_helpers::ProtoJson(&self.hi),
326 )?;
327 }
328 if !::buffa::json_helpers::skip_if::is_zero_u64(&self.lo) {
329 __map
330 .serialize_entry(
331 "lo",
332 &::buffa::json_helpers::ProtoJson(&self.lo),
333 )?;
334 }
335 __map.end()
336 }
337 }
338 impl<'a> ::buffa::MessageName for U128View<'a> {
339 const PACKAGE: &'static str = "polyester.type.v1";
340 const NAME: &'static str = "U128";
341 const FULL_NAME: &'static str = "polyester.type.v1.U128";
342 const TYPE_URL: &'static str = "type.googleapis.com/polyester.type.v1.U128";
343 }
344 ::buffa::impl_default_view_instance!(U128View);
345 ::buffa::impl_view_reborrow!(U128View);
346 #[derive(Clone, Debug)]
352 pub struct U128OwnedView(::buffa::OwnedView<U128View<'static>>);
353 impl U128OwnedView {
354 pub fn decode(
364 bytes: ::buffa::bytes::Bytes,
365 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
366 ::core::result::Result::Ok(
367 U128OwnedView(::buffa::OwnedView::decode(bytes)?),
368 )
369 }
370 pub fn decode_with_options(
378 bytes: ::buffa::bytes::Bytes,
379 opts: &::buffa::DecodeOptions,
380 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
381 ::core::result::Result::Ok(
382 U128OwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
383 )
384 }
385 pub fn from_owned(
392 msg: &super::super::U128,
393 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
394 ::core::result::Result::Ok(
395 U128OwnedView(::buffa::OwnedView::from_owned(msg)?),
396 )
397 }
398 #[must_use]
400 pub fn view(&self) -> &U128View<'_> {
401 self.0.reborrow()
402 }
403 pub fn to_owned_message(
410 &self,
411 ) -> ::core::result::Result<super::super::U128, ::buffa::DecodeError> {
412 self.0.to_owned_message()
413 }
414 #[must_use]
416 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
417 self.0.bytes()
418 }
419 #[must_use]
421 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
422 self.0.into_bytes()
423 }
424 #[must_use]
428 pub fn hi(&self) -> u64 {
429 self.0.reborrow().hi
430 }
431 #[must_use]
435 pub fn lo(&self) -> u64 {
436 self.0.reborrow().lo
437 }
438 }
439 impl ::core::convert::From<::buffa::OwnedView<U128View<'static>>>
440 for U128OwnedView {
441 fn from(inner: ::buffa::OwnedView<U128View<'static>>) -> Self {
442 U128OwnedView(inner)
443 }
444 }
445 impl ::core::convert::From<U128OwnedView>
446 for ::buffa::OwnedView<U128View<'static>> {
447 fn from(wrapper: U128OwnedView) -> Self {
448 wrapper.0
449 }
450 }
451 impl ::core::convert::AsRef<::buffa::OwnedView<U128View<'static>>>
452 for U128OwnedView {
453 fn as_ref(&self) -> &::buffa::OwnedView<U128View<'static>> {
454 &self.0
455 }
456 }
457 impl ::buffa::HasMessageView for super::super::U128 {
458 type View<'a> = U128View<'a>;
459 type ViewHandle = U128OwnedView;
460 }
461 impl ::serde::Serialize for U128OwnedView {
462 fn serialize<__S: ::serde::Serializer>(
463 &self,
464 __s: __S,
465 ) -> ::core::result::Result<__S::Ok, __S::Error> {
466 ::serde::Serialize::serialize(&self.0, __s)
467 }
468 }
469 }
470 pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
472 reg.register_json_any(super::__U128_JSON_ANY);
473 }
474}
475#[doc(inline)]
476pub use self::__buffa::view::U128View;
477#[doc(inline)]
478pub use self::__buffa::view::U128OwnedView;
479#[doc(inline)]
480pub use self::__buffa::register_types;