use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Scroll {
#[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),
}
}
}