Skip to main content

nominal_api/conjure/objects/scout/workbookcommon/api/
input_offset.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct InputOffset {
13    #[builder(
14        default,
15        custom(
16            type = impl
17            Into<Option<super::Offset>>,
18            convert = |v|v.into().map(Box::new)
19        )
20    )]
21    #[serde(rename = "offset", skip_serializing_if = "Option::is_none", default)]
22    offset: Option<Box<super::Offset>>,
23    #[builder(default, into)]
24    #[serde(rename = "assets", skip_serializing_if = "Option::is_none", default)]
25    assets: Option<
26        std::collections::BTreeMap<
27            super::super::super::rids::api::AssetRid,
28            super::AssetOffset,
29        >,
30    >,
31    #[builder(default, into)]
32    #[serde(rename = "runs", skip_serializing_if = "Option::is_none", default)]
33    runs: Option<
34        std::collections::BTreeMap<
35            super::super::super::run::api::RunRid,
36            super::RunOffset,
37        >,
38    >,
39}
40impl InputOffset {
41    /// Constructs a new instance of the type.
42    #[inline]
43    pub fn new() -> Self {
44        Self::builder().build()
45    }
46    /// An offset applied to every child of a dataScope input.
47    #[inline]
48    pub fn offset(&self) -> Option<&super::Offset> {
49        self.offset.as_ref().map(|o| &**o)
50    }
51    /// Additive offsets to specific assets
52    #[inline]
53    pub fn assets(
54        &self,
55    ) -> Option<
56        &std::collections::BTreeMap<
57            super::super::super::rids::api::AssetRid,
58            super::AssetOffset,
59        >,
60    > {
61        self.assets.as_ref().map(|o| &*o)
62    }
63    /// Additive offsets to specific runs
64    #[inline]
65    pub fn runs(
66        &self,
67    ) -> Option<
68        &std::collections::BTreeMap<
69            super::super::super::run::api::RunRid,
70            super::RunOffset,
71        >,
72    > {
73        self.runs.as_ref().map(|o| &*o)
74    }
75}