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, ::serde::Serialize, ::serde::Deserialize)]
#[non_exhaustive]
pub struct BaseNode {
    pub attributes: ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
    pub host: crate::Host,
    pub ip: crate::Ip,
    pub name: crate::Name,
    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
    pub roles: ::core::option::Option<crate::NodeRoles>,
    pub transport_address: crate::TransportAddress,
}

impl BaseNode {
    /// A `BaseNode` with its required properties set.
    pub fn new(
        attributes: impl ::core::convert::Into<
            ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
        >,
        host: impl ::core::convert::Into<crate::Host>,
        ip: impl ::core::convert::Into<crate::Ip>,
        name: impl ::core::convert::Into<crate::Name>,
        transport_address: impl ::core::convert::Into<crate::TransportAddress>,
    ) -> Self {
        Self {
            attributes: attributes.into(),
            host: host.into(),
            ip: ip.into(),
            name: name.into(),
            roles: ::core::option::Option::None,
            transport_address: transport_address.into(),
        }
    }
}

impl BaseNode {
    /// Sets `roles`.
    pub fn roles(mut self, value: impl ::core::convert::Into<crate::NodeRoles>) -> Self {
        self.roles = ::core::option::Option::Some(value.into());
        self
    }
}