nominal_api/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::FrameReferenceName), value(type = super::DataFrame))
35 )]
36 #[serde(
37 rename = "frameReferences",
38 skip_serializing_if = "std::collections::BTreeMap::is_empty",
39 default
40 )]
41 frame_references: std::collections::BTreeMap<
42 super::FrameReferenceName,
43 super::DataFrame,
44 >,
45}
46impl Context {
47 #[inline]
49 pub fn new() -> Self {
50 Self::builder().build()
51 }
52 #[inline]
53 pub fn variables(
54 &self,
55 ) -> &std::collections::BTreeMap<super::VariableName, super::VariableValue> {
56 &self.variables
57 }
58 #[deprecated(
59 note = "This field is deprecated and will be removed in a future version.\n"
60 )]
61 #[inline]
62 pub fn function_variables(
63 &self,
64 ) -> Option<
65 &std::collections::BTreeMap<super::FunctionReference, super::FunctionVariables>,
66 > {
67 self.function_variables.as_ref().map(|o| &*o)
68 }
69 #[inline]
71 pub fn frame_references(
72 &self,
73 ) -> &std::collections::BTreeMap<super::FrameReferenceName, super::DataFrame> {
74 &self.frame_references
75 }
76}