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 #[builder(default, into)]
83 #[serde(
84 rename = "applyDataScopeOffsets",
85 skip_serializing_if = "Option::is_none",
86 default
87 )]
88 apply_data_scope_offsets: Option<bool>,
89}
90impl Context {
91 #[inline]
93 pub fn new() -> Self {
94 Self::builder().build()
95 }
96 #[inline]
97 pub fn variables(
98 &self,
99 ) -> &std::collections::BTreeMap<super::VariableName, super::VariableValue> {
100 &self.variables
101 }
102 #[deprecated(
103 note = "This field is deprecated and will be removed in a future version.\n"
104 )]
105 #[inline]
106 pub fn function_variables(
107 &self,
108 ) -> Option<
109 &std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
110 > {
111 self.function_variables.as_ref().map(|o| &*o)
112 }
113 #[inline]
115 pub fn dataset_references(
116 &self,
117 ) -> &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset> {
118 &self.dataset_references
119 }
120 #[deprecated(note = "use datasetReferences instead.")]
122 #[inline]
123 pub fn frame_references(
124 &self,
125 ) -> Option<
126 &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset>,
127 > {
128 self.frame_references.as_ref().map(|o| &*o)
129 }
130 #[inline]
134 pub fn default_fill_strategy(&self) -> Option<&super::FillStrategy> {
135 self.default_fill_strategy.as_ref().map(|o| &**o)
136 }
137 #[inline]
141 pub fn default_alignment_strategy(&self) -> Option<&super::Alignment> {
142 self.default_alignment_strategy.as_ref().map(|o| &**o)
143 }
144 #[inline]
150 pub fn apply_data_scope_offsets(&self) -> Option<bool> {
151 self.apply_data_scope_offsets.as_ref().map(|o| *o)
152 }
153}