Skip to main content

nominal_api/conjure/objects/scout/datasource/connection/api/
duration.rs

1#[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 Duration {
16    #[serde(rename = "unit")]
17    unit: super::TemporalUnit,
18    #[serde(rename = "count")]
19    count: i32,
20}
21impl Duration {
22    /// Constructs a new instance of the type.
23    #[inline]
24    pub fn new(unit: super::TemporalUnit, count: i32) -> Self {
25        Self::builder().unit(unit).count(count).build()
26    }
27    #[inline]
28    pub fn unit(&self) -> &super::TemporalUnit {
29        &self.unit
30    }
31    #[inline]
32    pub fn count(&self) -> i32 {
33        self.count
34    }
35}