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