// @generated by buffa-codegen. DO NOT EDIT.
// source: google/protobuf/empty.proto

/// A generic empty message that you can re-use to avoid defining duplicated
/// empty messages in your APIs.
///
/// Example usage: gRPC uses google.protobuf.Empty as the input and output
/// type for RPCs defined as returning or accepting "nothing":
///
/// ```text
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
/// ```
#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct Empty {
    #[doc(hidden)]
    pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for Empty {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.debug_struct("Empty").finish()
    }
}
impl Empty {
    /// Protobuf type URL for this message, for use with `Any::pack` and
    /// `Any::unpack_if`.
    ///
    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
    pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
}
impl ::buffa::DefaultInstance for Empty {
    fn default_instance() -> &'static Self {
        static VALUE: ::buffa::__private::OnceBox<Empty> = ::buffa::__private::OnceBox::new();
        VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
    }
}
#[cfg(feature = "reflect")]
const _: () = {
    impl ::buffa_descriptor::reflect::ReflectMessage for Empty {
        fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
            __buffa::reflect::descriptor_pool()
                .message(Self::__buffa_reflect_message_index())
        }
        fn pool(
            &self,
        ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
            __buffa::reflect::descriptor_pool()
        }
        fn unknown_fields(&self) -> &::buffa::UnknownFields {
            &self.__buffa_unknown_fields
        }
        fn get(
            &self,
            field: &::buffa_descriptor::FieldDescriptor,
        ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
            #[allow(unused_imports)]
            use ::buffa::Enumeration as _;
            match field.number() {
                _ => {
                    ::core::debug_assert!(
                        false,
                        "field number {} is not a member of this message's reflect get()",
                        field.number(),
                    );
                    ::buffa_descriptor::reflect::ValueRef::Bool(false)
                }
            }
        }
        fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
            match field.number() {
                _ => false,
            }
        }
        fn for_each_set(
            &self,
            f: &mut dyn ::core::ops::FnMut(
                &::buffa_descriptor::FieldDescriptor,
                ::buffa_descriptor::reflect::ValueRef<'_>,
            ),
        ) {
            let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
                self,
            );
            for fd in md.fields() {
                if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
                    f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
                }
            }
        }
        fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
            ::buffa_descriptor::reflect::DynamicMessage::from_message(
                self,
                ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
                Self::__buffa_reflect_message_index(),
            )
        }
    }
    impl ::buffa_descriptor::reflect::ReflectElement for Empty {
        #[inline]
        fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
            ::buffa_descriptor::reflect::ValueRef::Message(
                ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
            )
        }
    }
    impl Empty {
        /// Memoized `MessageIndex` for this message type, resolved once
        /// against the package's embedded descriptor pool.
        #[doc(hidden)]
        fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
            static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
            *IDX
                .get_or_init(|| {
                    __buffa::reflect::descriptor_pool()
                        .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
                        .expect(
                            "generated message is registered in the embedded descriptor pool",
                        )
                })
        }
    }
    impl ::buffa_descriptor::reflect::Reflectable for Empty {
        /// Vtable-mode reflective handle: borrows `self` directly. No
        /// encode/decode round-trip and no allocation — the reflective
        /// accessors read this message's fields in place.
        #[inline]
        fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
            ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
        }
    }
};
impl ::buffa::MessageName for Empty {
    const PACKAGE: &'static str = "google.protobuf";
    const NAME: &'static str = "Empty";
    const FULL_NAME: &'static str = "google.protobuf.Empty";
    const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.Empty";
}
impl ::buffa::Message for Empty {
    /// Returns the total encoded size in bytes.
    ///
    /// The result is a `u32`; the protobuf specification requires all
    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
    /// compliant message will never overflow this type.
    #[allow(clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u32;
        size += self.__buffa_unknown_fields.encoded_len() as u32;
        size
    }
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::bytes::BufMut,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        self.__buffa_unknown_fields.write_to(buf);
    }
    fn merge_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        buf: &mut impl ::buffa::bytes::Buf,
        depth: u32,
    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::bytes::Buf as _;
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        match tag.field_number() {
            _ => {
                self.__buffa_unknown_fields
                    .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
            }
        }
        ::core::result::Result::Ok(())
    }
    fn clear(&mut self) {
        self.__buffa_unknown_fields.clear();
    }
}
impl ::buffa::ExtensionSet for Empty {
    const PROTO_FQN: &'static str = "google.protobuf.Empty";
    fn unknown_fields(&self) -> &::buffa::UnknownFields {
        &self.__buffa_unknown_fields
    }
    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
        &mut self.__buffa_unknown_fields
    }
}
impl ::buffa::text::TextFormat for Empty {
    fn encode_text(
        &self,
        enc: &mut ::buffa::text::TextEncoder<'_>,
    ) -> ::core::fmt::Result {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
        ::core::result::Result::Ok(())
    }
    fn merge_text(
        &mut self,
        dec: &mut ::buffa::text::TextDecoder<'_>,
    ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
            match __name {
                _ => dec.skip_value()?,
            }
        }
        ::core::result::Result::Ok(())
    }
}
#[doc(hidden)]
pub const __EMPTY_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
    type_url: "type.googleapis.com/google.protobuf.Empty",
    text_encode: ::buffa::type_registry::any_encode_text::<Empty>,
    text_merge: ::buffa::type_registry::any_merge_text::<Empty>,
};
