Skip to main content

asana/model/
time_period_base.rs

1use serde::{Serialize, Deserialize};
2use super::TimePeriodCompact;
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct TimePeriodBase {
5    #[serde(flatten)]
6    pub time_period_compact: TimePeriodCompact,
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub parent: Option<serde_json::Value>,
9}
10impl std::fmt::Display for TimePeriodBase {
11    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
12        write!(f, "{}", serde_json::to_string(self).unwrap())
13    }
14}
15impl std::ops::Deref for TimePeriodBase {
16    type Target = TimePeriodCompact;
17    fn deref(&self) -> &Self::Target {
18        &self.time_period_compact
19    }
20}
21impl std::ops::DerefMut for TimePeriodBase {
22    fn deref_mut(&mut self) -> &mut Self::Target {
23        &mut self.time_period_compact
24    }
25}