Skip to main content

nominal_api/conjure/errors/scout/compute/api/
missing_module_variable.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 MissingModuleVariable {
13    #[serde(rename = "variableName")]
14    variable_name: super::super::super::super::super::objects::scout::compute::api::VariableName,
15    #[builder(
16        default,
17        custom(
18            type = impl
19            Into<Option<super::super::super::super::super::objects::scout::compute::api::Context>>,
20            convert = |v|v.into().map(Box::new)
21        )
22    )]
23    #[serde(rename = "context", skip_serializing_if = "Option::is_none", default)]
24    context: Option<
25        Box<super::super::super::super::super::objects::scout::compute::api::Context>,
26    >,
27}
28impl MissingModuleVariable {
29    /// Constructs a new instance of the type.
30    #[inline]
31    pub fn new(
32        variable_name: super::super::super::super::super::objects::scout::compute::api::VariableName,
33    ) -> Self {
34        Self::builder().variable_name(variable_name).build()
35    }
36    #[inline]
37    pub fn variable_name(
38        &self,
39    ) -> &super::super::super::super::super::objects::scout::compute::api::VariableName {
40        &self.variable_name
41    }
42    #[inline]
43    pub fn context(
44        &self,
45    ) -> Option<
46        &super::super::super::super::super::objects::scout::compute::api::Context,
47    > {
48        self.context.as_ref().map(|o| &**o)
49    }
50}
51impl conjure_error::ErrorType for MissingModuleVariable {
52    #[inline]
53    fn code() -> conjure_error::ErrorCode {
54        conjure_error::ErrorCode::InvalidArgument
55    }
56    #[inline]
57    fn name() -> &'static str {
58        "Compute:MissingModuleVariable"
59    }
60    #[inline]
61    fn safe_args() -> &'static [&'static str] {
62        &[]
63    }
64}