Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
trace_compute.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct TraceCompute {
16    #[builder(
17        default,
18        map(
19            key(type = String, into),
20            value(type = super::super::super::channelvariables::api::ChannelVariableName)
21        )
22    )]
23    #[serde(
24        rename = "traceChannelVariables",
25        skip_serializing_if = "std::collections::BTreeMap::is_empty",
26        default
27    )]
28    trace_channel_variables: std::collections::BTreeMap<
29        String,
30        super::super::super::channelvariables::api::ChannelVariableName,
31    >,
32    #[builder(
33        default,
34        custom(
35            type = impl
36            Into<Option<super::TraceComputeConfig>>,
37            convert = |v|v.into().map(Box::new)
38        )
39    )]
40    #[serde(rename = "config", skip_serializing_if = "Option::is_none", default)]
41    config: Option<Box<super::TraceComputeConfig>>,
42}
43impl TraceCompute {
44    /// Constructs a new instance of the type.
45    #[inline]
46    pub fn new() -> Self {
47        Self::builder().build()
48    }
49    /// A map of plotly trace variables to the channel variables that should load into them
50    #[inline]
51    pub fn trace_channel_variables(
52        &self,
53    ) -> &std::collections::BTreeMap<
54        String,
55        super::super::super::channelvariables::api::ChannelVariableName,
56    > {
57        &self.trace_channel_variables
58    }
59    #[inline]
60    pub fn config(&self) -> Option<&super::TraceComputeConfig> {
61        self.config.as_ref().map(|o| &**o)
62    }
63}