Skip to main content

nominal_api_conjure/conjure/errors/persistent/compute/api/
invalid_computation.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash,
11    conjure_object::log_safety::derive::LogSafe
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct InvalidComputation {
17    #[builder(
18        default,
19        set(
20            item(
21                type = super::super::super::super::super::objects::persistent::compute::api::InvalidComputationType
22            )
23        )
24    )]
25    #[serde(
26        rename = "invalidTypes",
27        skip_serializing_if = "std::collections::BTreeSet::is_empty",
28        default
29    )]
30    invalid_types: std::collections::BTreeSet<
31        super::super::super::super::super::objects::persistent::compute::api::InvalidComputationType,
32    >,
33}
34impl InvalidComputation {
35    /// Constructs a new instance of the type.
36    #[inline]
37    pub fn new() -> Self {
38        Self::builder().build()
39    }
40    #[inline]
41    pub fn invalid_types(
42        &self,
43    ) -> &std::collections::BTreeSet<
44        super::super::super::super::super::objects::persistent::compute::api::InvalidComputationType,
45    > {
46        &self.invalid_types
47    }
48}
49impl conjure_error::ErrorType for InvalidComputation {
50    #[inline]
51    fn code() -> conjure_error::ErrorCode {
52        conjure_error::ErrorCode::InvalidArgument
53    }
54    #[inline]
55    fn name() -> &'static str {
56        "PersistentCompute:InvalidComputation"
57    }
58    #[inline]
59    fn safe_args() -> &'static [&'static str] {
60        &["invalidTypes"]
61    }
62}