Skip to main content

opensearch_client/common/
scroll.rs

1/*
2 * opensearch-client
3 *
4 * Rust Client for OpenSearch
5 *
6 * The version of the OpenAPI document: 3.1.0
7 * Contact: alberto.paro@gmail.com
8 * Generated by Paro OpenAPI Generator
9 */
10
11use serde::{Deserialize, Serialize};
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct Scroll {
15    /// A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
16    /// `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
17    #[serde(rename = "scroll", default, skip_serializing_if = "Option::is_none")]
18    pub scroll: Option<String>,
19    #[serde(rename = "scroll_id", default, skip_serializing_if = "Option::is_none")]
20    pub scroll_id: Option<String>,
21}
22
23impl Scroll {
24    pub fn new() -> Scroll {
25        Scroll {
26            scroll: None,
27            scroll_id: None,
28        }
29    }
30}
31
32impl std::fmt::Display for Scroll {
33    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34        match self {
35            Scroll {
36                scroll: None,
37                scroll_id: None,
38            } => write!(f, "No scroll parameters set"),
39            Scroll {
40                scroll: Some(scroll_value),
41                scroll_id: _,
42            } => write!(f, "{}", scroll_value),
43            Scroll {
44                scroll: _,
45                scroll_id: Some(scroll_value),
46            } => write!(f, "{}", scroll_value),
47        }
48    }
49}