oxsearch-core 0.2.0

The core of oxsearch: the transport and endpoint traits, errors, and the common types, query DSL, retrievers and kNN generated from the Elasticsearch specification
Documentation
// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum FailureStoreStatus {
    /// `not_applicable_or_unknown`
    NotApplicableOrUnknown,
    /// `used`
    Used,
    /// `not_enabled`
    NotEnabled,
    /// `failed`
    Failed,
    /// A value this version of the specification doesn't list.
    Raw(::std::string::String),
}

impl FailureStoreStatus {
    /// The value as Elasticsearch writes it.
    pub fn as_str(&self) -> &str {
        match self {
            Self::NotApplicableOrUnknown => "not_applicable_or_unknown",
            Self::Used => "used",
            Self::NotEnabled => "not_enabled",
            Self::Failed => "failed",
            Self::Raw(value) => value,
        }
    }

    /// The listed value with this name, if there is one.
    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
        match value {
            "not_applicable_or_unknown" => {
                ::core::option::Option::Some(Self::NotApplicableOrUnknown)
            }
            "used" => ::core::option::Option::Some(Self::Used),
            "not_enabled" => ::core::option::Option::Some(Self::NotEnabled),
            "failed" => ::core::option::Option::Some(Self::Failed),
            _ => ::core::option::Option::None,
        }
    }
}

impl ::serde::Serialize for FailureStoreStatus {
    fn serialize<S__: ::serde::Serializer>(
        &self,
        serializer: S__,
    ) -> ::core::result::Result<S__::Ok, S__::Error> {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de> ::serde::Deserialize<'de> for FailureStoreStatus {
    fn deserialize<D__: ::serde::Deserializer<'de>>(
        deserializer: D__,
    ) -> ::core::result::Result<Self, D__::Error> {
        ::oxsearch_core::__private::deserialize_string_enum(
            deserializer,
            "FailureStoreStatus",
            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
        )
    }
}