nominal_api/conjure/objects/scout/catalog/
custom_timestamp.rs1#[derive(
2 Debug,
3 Clone,
4 conjure_object::serde::Serialize,
5 conjure_object::serde::Deserialize,
6 PartialEq,
7 Eq,
8 PartialOrd,
9 Ord,
10 Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct CustomTimestamp {
16 #[builder(into)]
17 #[serde(rename = "format")]
18 format: String,
19 #[builder(default, into)]
20 #[serde(rename = "defaultYear", skip_serializing_if = "Option::is_none", default)]
21 default_year: Option<i32>,
22 #[builder(default, into)]
23 #[serde(
24 rename = "defaultDayOfYear",
25 skip_serializing_if = "Option::is_none",
26 default
27 )]
28 default_day_of_year: Option<i32>,
29}
30impl CustomTimestamp {
31 #[inline]
33 pub fn new(format: impl Into<String>) -> Self {
34 Self::builder().format(format).build()
35 }
36 #[inline]
38 pub fn format(&self) -> &str {
39 &*self.format
40 }
41 #[inline]
43 pub fn default_year(&self) -> Option<i32> {
44 self.default_year.as_ref().map(|o| *o)
45 }
46 #[inline]
48 pub fn default_day_of_year(&self) -> Option<i32> {
49 self.default_day_of_year.as_ref().map(|o| *o)
50 }
51}