nominal_api/conjure/objects/scout/chartdefinition/api/
trace.rs1#[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 Trace {
16 #[builder(into)]
17 #[serde(rename = "plotlyTrace")]
18 plotly_trace: String,
19 #[builder(
20 default,
21 custom(
22 type = impl
23 Into<Option<super::TraceCompute>>,
24 convert = |v|v.into().map(Box::new)
25 )
26 )]
27 #[serde(rename = "compute", skip_serializing_if = "Option::is_none", default)]
28 compute: Option<Box<super::TraceCompute>>,
29}
30impl Trace {
31 #[inline]
33 pub fn new(plotly_trace: impl Into<String>) -> Self {
34 Self::builder().plotly_trace(plotly_trace).build()
35 }
36 #[inline]
39 pub fn plotly_trace(&self) -> &str {
40 &*self.plotly_trace
41 }
42 #[inline]
44 pub fn compute(&self) -> Option<&super::TraceCompute> {
45 self.compute.as_ref().map(|o| &**o)
46 }
47}