Skip to main content

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

1/// An offset that can be applied to an asset.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct AssetOffset {
14    #[builder(
15        default,
16        custom(
17            type = impl
18            Into<Option<super::Offset>>,
19            convert = |v|v.into().map(Box::new)
20        )
21    )]
22    #[serde(rename = "offset", skip_serializing_if = "Option::is_none", default)]
23    offset: Option<Box<super::Offset>>,
24    #[builder(default, into)]
25    #[serde(rename = "dataSources", skip_serializing_if = "Option::is_none", default)]
26    data_sources: Option<
27        std::collections::BTreeMap<
28            super::super::super::api::DataSourceRefName,
29            super::Offset,
30        >,
31    >,
32}
33impl AssetOffset {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new() -> Self {
37        Self::builder().build()
38    }
39    #[inline]
40    pub fn offset(&self) -> Option<&super::Offset> {
41        self.offset.as_ref().map(|o| &**o)
42    }
43    #[inline]
44    pub fn data_sources(
45        &self,
46    ) -> Option<
47        &std::collections::BTreeMap<
48            super::super::super::api::DataSourceRefName,
49            super::Offset,
50        >,
51    > {
52        self.data_sources.as_ref().map(|o| &*o)
53    }
54}