Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
select_property.rs

1/// Selects a typed property value from every asset or run branch resolved from `dataset`. Inside a
2/// `WithSeriesDataset` definition, `dataset` may be omitted to use that node's wrapping input; it is required
3/// everywhere else. Asset branches read properties directly from their asset. Run branches read properties
4/// directly from their run, never from a backing asset or dataset. Direct saved-dataset branches are unsupported.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    conjure_object::private::DeriveWith
11)]
12#[serde(crate = "conjure_object::serde")]
13#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct SelectProperty {
17    #[serde(rename = "propertyName")]
18    property_name: super::super::super::super::api::PropertyName,
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::Dataset>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "dataset", skip_serializing_if = "Option::is_none", default)]
28    dataset: Option<Box<super::Dataset>>,
29}
30impl SelectProperty {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(property_name: super::super::super::super::api::PropertyName) -> Self {
34        Self::builder().property_name(property_name).build()
35    }
36    #[inline]
37    pub fn property_name(&self) -> &super::super::super::super::api::PropertyName {
38        &self.property_name
39    }
40    #[inline]
41    pub fn dataset(&self) -> Option<&super::Dataset> {
42        self.dataset.as_ref().map(|o| &**o)
43    }
44}