opensearch-client 0.3.1

Strongly typed OpenSearch Client
Documentation
/*
 * opensearch-client
 *
 * Rust Client for OpenSearch
 *
 * The version of the OpenAPI document: 3.1.0
 * Contact: alberto.paro@gmail.com
 * Generated by Paro OpenAPI Generator
 */

use crate::common;
use serde::{Deserialize, Serialize};

/// _source

/// Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
/// Use this setting with the `source_includes` and `source_excludes` parameters.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Source {
    Fields(common::Fields),
    FetchValue(bool),
}

impl std::fmt::Display for Source {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::Fields(v) => write!(f, "{}", v),
            Self::FetchValue(v) => write!(f, "{}", *v),
        }
    }
}

impl Default for Source {
    fn default() -> Source {
        Self::FetchValue(true)
    }
}