nominal_api_conjure/conjure/objects/scout/compute/api/
context.rs1#[derive(
2 Debug,
3 Clone,
4 conjure_object::serde::Serialize,
5 conjure_object::serde::Deserialize,
6 conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct Context {
13 #[builder(
14 default,
15 map(key(type = super::VariableName), value(type = super::VariableValue))
16 )]
17 #[serde(
18 rename = "variables",
19 skip_serializing_if = "std::collections::BTreeMap::is_empty",
20 default
21 )]
22 variables: std::collections::BTreeMap<super::VariableName, super::VariableValue>,
23 #[builder(default, into)]
24 #[serde(
25 rename = "functionVariables",
26 skip_serializing_if = "Option::is_none",
27 default
28 )]
29 function_variables: Option<
30 std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
31 >,
32 #[builder(
33 default,
34 map(key(type = super::DatasetReferenceName), value(type = super::Dataset))
35 )]
36 #[serde(
37 rename = "datasetReferences",
38 skip_serializing_if = "std::collections::BTreeMap::is_empty",
39 default
40 )]
41 dataset_references: std::collections::BTreeMap<
42 super::DatasetReferenceName,
43 super::Dataset,
44 >,
45 #[builder(default, into)]
46 #[serde(
47 rename = "frameReferences",
48 skip_serializing_if = "Option::is_none",
49 default
50 )]
51 frame_references: Option<
52 std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset>,
53 >,
54 #[builder(
55 default,
56 custom(
57 type = impl
58 Into<Option<super::FillStrategy>>,
59 convert = |v|v.into().map(Box::new)
60 )
61 )]
62 #[serde(
63 rename = "defaultFillStrategy",
64 skip_serializing_if = "Option::is_none",
65 default
66 )]
67 default_fill_strategy: Option<Box<super::FillStrategy>>,
68 #[builder(
69 default,
70 custom(
71 type = impl
72 Into<Option<super::Alignment>>,
73 convert = |v|v.into().map(Box::new)
74 )
75 )]
76 #[serde(
77 rename = "defaultAlignmentStrategy",
78 skip_serializing_if = "Option::is_none",
79 default
80 )]
81 default_alignment_strategy: Option<Box<super::Alignment>>,
82}
83impl Context {
84 #[inline]
86 pub fn new() -> Self {
87 Self::builder().build()
88 }
89 #[inline]
90 pub fn variables(
91 &self,
92 ) -> &std::collections::BTreeMap<super::VariableName, super::VariableValue> {
93 &self.variables
94 }
95 #[deprecated(
96 note = "This field is deprecated and will be removed in a future version.\n"
97 )]
98 #[inline]
99 pub fn function_variables(
100 &self,
101 ) -> Option<
102 &std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
103 > {
104 self.function_variables.as_ref().map(|o| &*o)
105 }
106 #[inline]
108 pub fn dataset_references(
109 &self,
110 ) -> &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset> {
111 &self.dataset_references
112 }
113 #[deprecated(note = "use datasetReferences instead.")]
115 #[inline]
116 pub fn frame_references(
117 &self,
118 ) -> Option<
119 &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset>,
120 > {
121 self.frame_references.as_ref().map(|o| &*o)
122 }
123 #[inline]
127 pub fn default_fill_strategy(&self) -> Option<&super::FillStrategy> {
128 self.default_fill_strategy.as_ref().map(|o| &**o)
129 }
130 #[inline]
134 pub fn default_alignment_strategy(&self) -> Option<&super::Alignment> {
135 self.default_alignment_strategy.as_ref().map(|o| &**o)
136 }
137}