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}
31::buffa::impl_default_instance!(Empty);
32#[cfg(feature = "reflect")]
33const _: () = {
34    impl ::buffa_descriptor::reflect::ReflectMessage for Empty {
35        fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
36            __buffa::reflect::descriptor_pool()
37                .message(Self::__buffa_reflect_message_index())
38        }
39        fn pool(
40            &self,
41        ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
42            __buffa::reflect::descriptor_pool()
43        }
44        fn unknown_fields(&self) -> &::buffa::UnknownFields {
45            &self.__buffa_unknown_fields
46        }
47        fn get(
48            &self,
49            field: &::buffa_descriptor::FieldDescriptor,
50        ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
51            #[allow(unused_imports)]
52            use ::buffa::Enumeration as _;
53            match field.number() {
54                _ => {
55                    ::core::debug_assert!(
56                        false,
57                        "field number {} is not a member of this message's reflect get()",
58                        field.number(),
59                    );
60                    ::buffa_descriptor::reflect::ValueRef::Bool(false)
61                }
62            }
63        }
64        fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
65            match field.number() {
66                _ => false,
67            }
68        }
69        fn for_each_set(
70            &self,
71            f: &mut dyn ::core::ops::FnMut(
72                &::buffa_descriptor::FieldDescriptor,
73                ::buffa_descriptor::reflect::ValueRef<'_>,
74            ),
75        ) {
76            let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
77                self,
78            );
79            for fd in md.fields() {
80                if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
81                    f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
82                }
83            }
84        }
85        fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
86            ::buffa_descriptor::reflect::DynamicMessage::from_message(
87                self,
88                ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
89                Self::__buffa_reflect_message_index(),
90            )
91        }
92    }
93    impl ::buffa_descriptor::reflect::ReflectElement for Empty {
94        #[inline]
95        fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
96            ::buffa_descriptor::reflect::ValueRef::Message(
97                ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
98            )
99        }
100    }
101    impl Empty {
102        /// Memoized `MessageIndex` for this message type, resolved once
103        /// against the package's embedded descriptor pool.
104        #[doc(hidden)]
105        fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
106            static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
107            *IDX
108                .get_or_init(|| {
109                    __buffa::reflect::descriptor_pool()
110                        .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
111                        .expect(
112                            "generated message is registered in the embedded descriptor pool",
113                        )
114                })
115        }
116    }
117    impl ::buffa_descriptor::reflect::Reflectable for Empty {
118        /// Vtable-mode reflective handle: borrows `self` directly. No
119        /// encode/decode round-trip and no allocation — the reflective
120        /// accessors read this message's fields in place.
121        #[inline]
122        fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
123            ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
124        }
125    }
126};
127impl ::buffa::MessageName for Empty {
128    const PACKAGE: &'static str = "google.protobuf";
129    const NAME: &'static str = "Empty";
130    const FULL_NAME: &'static str = "google.protobuf.Empty";
131    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
132}
133impl ::buffa::Message for Empty {
134    /// Returns the total encoded size in bytes.
135    ///
136    /// Accumulates in `u64` (which cannot overflow for in-memory
137    /// data) and saturates to `u32` at return, so a message whose
138    /// encoded size exceeds the 2 GiB protobuf limit yields a value
139    /// above [`::buffa::MAX_MESSAGE_BYTES`] that the encode entry
140    /// points reject, never a silently wrapped size.
141    #[allow(clippy::let_and_return)]
142    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
143        #[allow(unused_imports)]
144        use ::buffa::Enumeration as _;
145        let mut size = 0u64;
146        size += self.__buffa_unknown_fields.encoded_len() as u64;
147        ::buffa::saturate_size(size)
148    }
149    fn write_to(
150        &self,
151        _cache: &mut ::buffa::SizeCache,
152        buf: &mut impl ::buffa::EncodeSink,
153    ) {
154        #[allow(unused_imports)]
155        use ::buffa::Enumeration as _;
156        self.__buffa_unknown_fields.write_to(buf);
157    }
158    fn merge_field(
159        &mut self,
160        tag: ::buffa::encoding::Tag,
161        buf: &mut impl ::buffa::bytes::Buf,
162        ctx: ::buffa::DecodeContext<'_>,
163    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
164        #[allow(unused_imports)]
165        use ::buffa::bytes::Buf as _;
166        #[allow(unused_imports)]
167        use ::buffa::Enumeration as _;
168        match tag.field_number() {
169            _ => {
170                self.__buffa_unknown_fields
171                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
172            }
173        }
174        ::core::result::Result::Ok(())
175    }
176    fn clear(&mut self) {
177        self.__buffa_unknown_fields.clear();
178    }
179}
180impl ::buffa::ExtensionSet for Empty {
181    const PROTO_FQN: &'static str = "google.protobuf.Empty";
182    fn unknown_fields(&self) -> &::buffa::UnknownFields {
183        &self.__buffa_unknown_fields
184    }
185    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
186        &mut self.__buffa_unknown_fields
187    }
188}
189impl ::buffa::text::TextFormat for Empty {
190    fn encode_text(
191        &self,
192        enc: &mut ::buffa::text::TextEncoder<'_>,
193    ) -> ::core::fmt::Result {
194        #[allow(unused_imports)]
195        use ::buffa::Enumeration as _;
196        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
197        ::core::result::Result::Ok(())
198    }
199    fn merge_text(
200        &mut self,
201        dec: &mut ::buffa::text::TextDecoder<'_>,
202    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
203        #[allow(unused_imports)]
204        use ::buffa::Enumeration as _;
205        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
206            match __name {
207                _ => dec.skip_value()?,
208            }
209        }
210        ::core::result::Result::Ok(())
211    }
212}
213#[doc(hidden)]
214pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
215    type_url: "type.googleapis.com/google.protobuf.Empty",
216    text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
217    text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
218};