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: conjure_object::ResourceIdentifier,
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(data_source_rid: conjure_object::ResourceIdentifier) -> Self {
44        Self::builder().data_source_rid(data_source_rid).build()
45    }
46    #[inline]
47    pub fn asset_rid(&self) -> Option<&super::super::super::rids::api::AssetRid> {
48        self.asset_rid.as_ref().map(|o| &*o)
49    }
50    #[inline]
51    pub fn run_rid(&self) -> Option<&super::super::super::run::api::RunRid> {
52        self.run_rid.as_ref().map(|o| &*o)
53    }
54    #[inline]
55    pub fn data_scope(&self) -> Option<&str> {
56        self.data_scope.as_ref().map(|o| &**o)
57    }
58    #[inline]
59    pub fn data_source_rid(&self) -> &conjure_object::ResourceIdentifier {
60        &self.data_source_rid
61    }
62    /// Effective source time range used for this expanded locator. This can differ from the request time range
63    /// when the frame includes transforms such as `DataFrame.timeShift`.
64    #[inline]
65    pub fn time_range(&self) -> Option<&super::super::super::super::api::Range> {
66        self.time_range.as_ref().map(|o| &**o)
67    }
68}