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        fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
100            ::buffa_descriptor::reflect::ValueRef::Message(
101                ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
102            )
103        }
104    }
105    impl Empty {
106        /// Memoized `MessageIndex` for this message type, resolved once
107        /// against the package's embedded descriptor pool.
108        #[doc(hidden)]
109        fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
110            static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
111            *IDX
112                .get_or_init(|| {
113                    __buffa::reflect::descriptor_pool()
114                        .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
115                        .expect(
116                            "generated message is registered in the embedded descriptor pool",
117                        )
118                })
119        }
120    }
121    impl ::buffa_descriptor::reflect::Reflectable for Empty {
122        /// Vtable-mode reflective handle: borrows `self` directly. No
123        /// encode/decode round-trip and no allocation — the reflective
124        /// accessors read this message's fields in place.
125        fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
126            ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
127        }
128    }
129};
130impl ::buffa::MessageName for Empty {
131    const PACKAGE: &'static str = "google.protobuf";
132    const NAME: &'static str = "Empty";
133    const FULL_NAME: &'static str = "google.protobuf.Empty";
134    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
135}
136impl ::buffa::Message for Empty {
137    /// Returns the total encoded size in bytes.
138    ///
139    /// The result is a `u32`; the protobuf specification requires all
140    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
141    /// compliant message will never overflow this type.
142    #[allow(clippy::let_and_return)]
143    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
144        #[allow(unused_imports)]
145        use ::buffa::Enumeration as _;
146        let mut size = 0u32;
147        size += self.__buffa_unknown_fields.encoded_len() as u32;
148        size
149    }
150    fn write_to(
151        &self,
152        _cache: &mut ::buffa::SizeCache,
153        buf: &mut impl ::buffa::bytes::BufMut,
154    ) {
155        #[allow(unused_imports)]
156        use ::buffa::Enumeration as _;
157        self.__buffa_unknown_fields.write_to(buf);
158    }
159    fn merge_field(
160        &mut self,
161        tag: ::buffa::encoding::Tag,
162        buf: &mut impl ::buffa::bytes::Buf,
163        depth: u32,
164    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
165        #[allow(unused_imports)]
166        use ::buffa::bytes::Buf as _;
167        #[allow(unused_imports)]
168        use ::buffa::Enumeration as _;
169        match tag.field_number() {
170            _ => {
171                self.__buffa_unknown_fields
172                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
173            }
174        }
175        ::core::result::Result::Ok(())
176    }
177    fn clear(&mut self) {
178        self.__buffa_unknown_fields.clear();
179    }
180}
181impl ::buffa::ExtensionSet for Empty {
182    const PROTO_FQN: &'static str = "google.protobuf.Empty";
183    fn unknown_fields(&self) -> &::buffa::UnknownFields {
184        &self.__buffa_unknown_fields
185    }
186    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
187        &mut self.__buffa_unknown_fields
188    }
189}
190impl ::buffa::text::TextFormat for Empty {
191    fn encode_text(
192        &self,
193        enc: &mut ::buffa::text::TextEncoder<'_>,
194    ) -> ::core::fmt::Result {
195        #[allow(unused_imports)]
196        use ::buffa::Enumeration as _;
197        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
198        ::core::result::Result::Ok(())
199    }
200    fn merge_text(
201        &mut self,
202        dec: &mut ::buffa::text::TextDecoder<'_>,
203    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
204        #[allow(unused_imports)]
205        use ::buffa::Enumeration as _;
206        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
207            match __name {
208                _ => dec.skip_value()?,
209            }
210        }
211        ::core::result::Result::Ok(())
212    }
213}
214#[doc(hidden)]
215pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
216    type_url: "type.googleapis.com/google.protobuf.Empty",
217    text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
218    text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
219};