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 serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Scroll {
    /// A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
    /// `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
    #[serde(rename = "scroll", default, skip_serializing_if = "Option::is_none")]
    pub scroll: Option<String>,
    #[serde(rename = "scroll_id", default, skip_serializing_if = "Option::is_none")]
    pub scroll_id: Option<String>,
}

impl Scroll {
    pub fn new() -> Scroll {
        Scroll {
            scroll: None,
            scroll_id: None,
        }
    }
}

impl std::fmt::Display for Scroll {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Scroll {
                scroll: None,
                scroll_id: None,
            } => write!(f, "No scroll parameters set"),
            Scroll {
                scroll: Some(scroll_value),
                scroll_id: _,
            } => write!(f, "{}", scroll_value),
            Scroll {
                scroll: _,
                scroll_id: Some(scroll_value),
            } => write!(f, "{}", scroll_value),
        }
    }
}