Skip to main content

buffa_types/generated/
google.protobuf.empty.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2// source: google/protobuf/empty.proto
3
4/// A generic empty message that you can re-use to avoid defining duplicated
5/// empty messages in your APIs.
6///
7/// Example usage: gRPC uses google.protobuf.Empty as the input and output
8/// type for RPCs defined as returning or accepting "nothing":
9///
10/// ```text
11/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
12/// ```
13#[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}
19impl ::core::fmt::Debug for Empty {
20    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
21        f.debug_struct("Empty").finish()
22    }
23}
24impl Empty {
25    /// Protobuf type URL for this message, for use with `Any::pack` and
26    /// `Any::unpack_if`.
27    ///
28    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
29    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
30}
31impl ::buffa::DefaultInstance for Empty {
32    fn default_instance() -> &'static Self {
33        static VALUE: ::buffa::__private::OnceBox<Empty> = ::buffa::__private::OnceBox::new();
34        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
35    }
36}
37impl ::buffa::Message for Empty {
38    /// Returns the total encoded size in bytes.
39    ///
40    /// The result is a `u32`; the protobuf specification requires all
41    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
42    /// compliant message will never overflow this type.
43    #[allow(clippy::let_and_return)]
44    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
45        #[allow(unused_imports)]
46        use ::buffa::Enumeration as _;
47        let mut size = 0u32;
48        size += self.__buffa_unknown_fields.encoded_len() as u32;
49        size
50    }
51    fn write_to(
52        &self,
53        _cache: &mut ::buffa::SizeCache,
54        buf: &mut impl ::buffa::bytes::BufMut,
55    ) {
56        #[allow(unused_imports)]
57        use ::buffa::Enumeration as _;
58        self.__buffa_unknown_fields.write_to(buf);
59    }
60    fn merge_field(
61        &mut self,
62        tag: ::buffa::encoding::Tag,
63        buf: &mut impl ::buffa::bytes::Buf,
64        depth: u32,
65    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
66        #[allow(unused_imports)]
67        use ::buffa::bytes::Buf as _;
68        #[allow(unused_imports)]
69        use ::buffa::Enumeration as _;
70        match tag.field_number() {
71            _ => {
72                self.__buffa_unknown_fields
73                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
74            }
75        }
76        ::core::result::Result::Ok(())
77    }
78    fn clear(&mut self) {
79        self.__buffa_unknown_fields.clear();
80    }
81}
82impl ::buffa::ExtensionSet for Empty {
83    const PROTO_FQN: &'static str = "google.protobuf.Empty";
84    fn unknown_fields(&self) -> &::buffa::UnknownFields {
85        &self.__buffa_unknown_fields
86    }
87    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
88        &mut self.__buffa_unknown_fields
89    }
90}
91impl ::buffa::text::TextFormat for Empty {
92    fn encode_text(
93        &self,
94        enc: &mut ::buffa::text::TextEncoder<'_>,
95    ) -> ::core::fmt::Result {
96        #[allow(unused_imports)]
97        use ::buffa::Enumeration as _;
98        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
99        ::core::result::Result::Ok(())
100    }
101    fn merge_text(
102        &mut self,
103        dec: &mut ::buffa::text::TextDecoder<'_>,
104    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
105        #[allow(unused_imports)]
106        use ::buffa::Enumeration as _;
107        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
108            match __name {
109                _ => dec.skip_value()?,
110            }
111        }
112        ::core::result::Result::Ok(())
113    }
114}
115#[doc(hidden)]
116pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
117    type_url: "type.googleapis.com/google.protobuf.Empty",
118    text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
119    text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
120};