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(
46 default,
47 custom(
48 type = impl
49 Into<Option<super::FillStrategy>>,
50 convert = |v|v.into().map(Box::new)
51 )
52 )]
53 #[serde(
54 rename = "defaultFillStrategy",
55 skip_serializing_if = "Option::is_none",
56 default
57 )]
58 default_fill_strategy: Option<Box<super::FillStrategy>>,
59 #[builder(
60 default,
61 custom(
62 type = impl
63 Into<Option<super::Alignment>>,
64 convert = |v|v.into().map(Box::new)
65 )
66 )]
67 #[serde(
68 rename = "defaultAlignmentStrategy",
69 skip_serializing_if = "Option::is_none",
70 default
71 )]
72 default_alignment_strategy: Option<Box<super::Alignment>>,
73 #[builder(default, into)]
74 #[serde(
75 rename = "applyDataScopeOffsets",
76 skip_serializing_if = "Option::is_none",
77 default
78 )]
79 apply_data_scope_offsets: Option<bool>,
80 #[builder(default, into)]
81 #[serde(
82 rename = "resolveAssetsThroughDatasets",
83 skip_serializing_if = "Option::is_none",
84 default
85 )]
86 resolve_assets_through_datasets: Option<bool>,
87}
88impl Context {
89 #[inline]
91 pub fn new() -> Self {
92 Self::builder().build()
93 }
94 #[inline]
95 pub fn variables(
96 &self,
97 ) -> &std::collections::BTreeMap<super::VariableName, super::VariableValue> {
98 &self.variables
99 }
100 #[deprecated(
101 note = "This field is deprecated and will be removed in a future version.\n"
102 )]
103 #[inline]
104 pub fn function_variables(
105 &self,
106 ) -> Option<
107 &std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
108 > {
109 self.function_variables.as_ref().map(|o| &*o)
110 }
111 #[inline]
113 pub fn dataset_references(
114 &self,
115 ) -> &std::collections::BTreeMap<super::DatasetReferenceName, super::Dataset> {
116 &self.dataset_references
117 }
118 #[inline]
122 pub fn default_fill_strategy(&self) -> Option<&super::FillStrategy> {
123 self.default_fill_strategy.as_ref().map(|o| &**o)
124 }
125 #[inline]
129 pub fn default_alignment_strategy(&self) -> Option<&super::Alignment> {
130 self.default_alignment_strategy.as_ref().map(|o| &**o)
131 }
132 #[inline]
138 pub fn apply_data_scope_offsets(&self) -> Option<bool> {
139 self.apply_data_scope_offsets.as_ref().map(|o| *o)
140 }
141 #[inline]
149 pub fn resolve_assets_through_datasets(&self) -> Option<bool> {
150 self.resolve_assets_through_datasets.as_ref().map(|o| *o)
151 }
152}