Skip to main content

nominal_api/conjure/objects/scout/compute/api/
duration_nanoseconds.rs

1/// Constructs a duration from a number of nanoseconds. Limited to values within the
2/// 32-bit integer range (~2.1 billion ns, or ~2.1 seconds). For larger durations,
3/// use DurationSeconds or DurationMilliseconds.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash
14)]
15#[serde(crate = "conjure_object::serde")]
16#[conjure_object::private::staged_builder::staged_builder]
17#[builder(crate = conjure_object::private::staged_builder, update, inline)]
18pub struct DurationNanoseconds {
19    #[builder(custom(type = super::IntegerConstant, convert = Box::new))]
20    #[serde(rename = "nanoseconds")]
21    nanoseconds: Box<super::IntegerConstant>,
22}
23impl DurationNanoseconds {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(nanoseconds: super::IntegerConstant) -> Self {
27        Self::builder().nanoseconds(nanoseconds).build()
28    }
29    /// The number of nanoseconds.
30    #[inline]
31    pub fn nanoseconds(&self) -> &super::IntegerConstant {
32        &*self.nanoseconds
33    }
34}