Skip to main content

nominal_api/conjure/objects/scout/channel/api/
locator.rs

1/// One expanded leaf of the data frame. Semantic fields (assetRid, runRid, dataScope)
2/// carry the branch context from frame expansion.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct Locator {
18    #[builder(default, into)]
19    #[serde(rename = "assetRid", skip_serializing_if = "Option::is_none", default)]
20    asset_rid: Option<super::super::super::rids::api::AssetRid>,
21    #[builder(default, into)]
22    #[serde(rename = "runRid", skip_serializing_if = "Option::is_none", default)]
23    run_rid: Option<super::super::super::run::api::RunRid>,
24    #[builder(default, into)]
25    #[serde(rename = "dataScope", skip_serializing_if = "Option::is_none", default)]
26    data_scope: Option<String>,
27    #[serde(rename = "dataSourceRid")]
28    data_source_rid: super::super::super::super::api::rids::DataSourceRid,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::super::super::super::api::Range>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(rename = "timeRange", skip_serializing_if = "Option::is_none", default)]
38    time_range: Option<Box<super::super::super::super::api::Range>>,
39}
40impl Locator {
41    /// Constructs a new instance of the type.
42    #[inline]
43    pub fn new(
44        data_source_rid: super::super::super::super::api::rids::DataSourceRid,
45    ) -> Self {
46        Self::builder().data_source_rid(data_source_rid).build()
47    }
48    #[inline]
49    pub fn asset_rid(&self) -> Option<&super::super::super::rids::api::AssetRid> {
50        self.asset_rid.as_ref().map(|o| &*o)
51    }
52    #[inline]
53    pub fn run_rid(&self) -> Option<&super::super::super::run::api::RunRid> {
54        self.run_rid.as_ref().map(|o| &*o)
55    }
56    #[inline]
57    pub fn data_scope(&self) -> Option<&str> {
58        self.data_scope.as_ref().map(|o| &**o)
59    }
60    #[inline]
61    pub fn data_source_rid(
62        &self,
63    ) -> &super::super::super::super::api::rids::DataSourceRid {
64        &self.data_source_rid
65    }
66    /// Effective source time range used for this expanded locator. This can differ from the request time range
67    /// when the frame includes transforms such as `DataFrame.timeShift`.
68    #[inline]
69    pub fn time_range(&self) -> Option<&super::super::super::super::api::Range> {
70        self.time_range.as_ref().map(|o| &**o)
71    }
72}