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::MessageName for Empty {
38    const PACKAGE: &'static str = "google.protobuf";
39    const NAME: &'static str = "Empty";
40    const FULL_NAME: &'static str = "google.protobuf.Empty";
41    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
42}
43impl ::buffa::Message for Empty {
44    /// Returns the total encoded size in bytes.
45    ///
46    /// The result is a `u32`; the protobuf specification requires all
47    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
48    /// compliant message will never overflow this type.
49    #[allow(clippy::let_and_return)]
50    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
51        #[allow(unused_imports)]
52        use ::buffa::Enumeration as _;
53        let mut size = 0u32;
54        size += self.__buffa_unknown_fields.encoded_len() as u32;
55        size
56    }
57    fn write_to(
58        &self,
59        _cache: &mut ::buffa::SizeCache,
60        buf: &mut impl ::buffa::bytes::BufMut,
61    ) {
62        #[allow(unused_imports)]
63        use ::buffa::Enumeration as _;
64        self.__buffa_unknown_fields.write_to(buf);
65    }
66    fn merge_field(
67        &mut self,
68        tag: ::buffa::encoding::Tag,
69        buf: &mut impl ::buffa::bytes::Buf,
70        depth: u32,
71    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
72        #[allow(unused_imports)]
73        use ::buffa::bytes::Buf as _;
74        #[allow(unused_imports)]
75        use ::buffa::Enumeration as _;
76        match tag.field_number() {
77            _ => {
78                self.__buffa_unknown_fields
79                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
80            }
81        }
82        ::core::result::Result::Ok(())
83    }
84    fn clear(&mut self) {
85        self.__buffa_unknown_fields.clear();
86    }
87}
88impl ::buffa::ExtensionSet for Empty {
89    const PROTO_FQN: &'static str = "google.protobuf.Empty";
90    fn unknown_fields(&self) -> &::buffa::UnknownFields {
91        &self.__buffa_unknown_fields
92    }
93    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
94        &mut self.__buffa_unknown_fields
95    }
96}
97impl ::buffa::text::TextFormat for Empty {
98    fn encode_text(
99        &self,
100        enc: &mut ::buffa::text::TextEncoder<'_>,
101    ) -> ::core::fmt::Result {
102        #[allow(unused_imports)]
103        use ::buffa::Enumeration as _;
104        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
105        ::core::result::Result::Ok(())
106    }
107    fn merge_text(
108        &mut self,
109        dec: &mut ::buffa::text::TextDecoder<'_>,
110    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
111        #[allow(unused_imports)]
112        use ::buffa::Enumeration as _;
113        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
114            match __name {
115                _ => dec.skip_value()?,
116            }
117        }
118        ::core::result::Result::Ok(())
119    }
120}
121#[doc(hidden)]
122pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
123    type_url: "type.googleapis.com/google.protobuf.Empty",
124    text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
125    text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
126};