Skip to main content

nominal_api/conjure/objects/scout/checks/api/
check_context.rs

1#[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 CheckContext {
13    #[builder(
14        default,
15        map(
16            key(type = super::super::super::compute::api::VariableName),
17            value(type = super::VariableLocator)
18        )
19    )]
20    #[serde(
21        rename = "variables",
22        skip_serializing_if = "std::collections::BTreeMap::is_empty",
23        default
24    )]
25    variables: std::collections::BTreeMap<
26        super::super::super::compute::api::VariableName,
27        super::VariableLocator,
28    >,
29    #[builder(default, into)]
30    #[serde(
31        rename = "subFunctionVariables",
32        skip_serializing_if = "Option::is_none",
33        default
34    )]
35    sub_function_variables: Option<
36        std::collections::BTreeMap<
37            super::super::super::compute::api::FunctionReference,
38            super::CheckContext,
39        >,
40    >,
41}
42impl CheckContext {
43    /// Constructs a new instance of the type.
44    #[inline]
45    pub fn new() -> Self {
46        Self::builder().build()
47    }
48    #[inline]
49    pub fn variables(
50        &self,
51    ) -> &std::collections::BTreeMap<
52        super::super::super::compute::api::VariableName,
53        super::VariableLocator,
54    > {
55        &self.variables
56    }
57    #[deprecated(
58        note = "This field is deprecated and will be removed in a future version.\n"
59    )]
60    #[inline]
61    pub fn sub_function_variables(
62        &self,
63    ) -> Option<
64        &std::collections::BTreeMap<
65            super::super::super::compute::api::FunctionReference,
66            super::CheckContext,
67        >,
68    > {
69        self.sub_function_variables.as_ref().map(|o| &*o)
70    }
71}