Skip to main content

nominal_api/conjure/errors/scout/compute/api/
non_positive_duration.rs

1/// Duration must be strictly positive.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
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 NonPositiveDuration {
17    #[builder(
18        custom(
19            type = super::super::super::super::super::objects::scout::run::api::Duration,
20            convert = Box::new
21        )
22    )]
23    #[serde(rename = "duration")]
24    duration: Box<super::super::super::super::super::objects::scout::run::api::Duration>,
25}
26impl NonPositiveDuration {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(
30        duration: super::super::super::super::super::objects::scout::run::api::Duration,
31    ) -> Self {
32        Self::builder().duration(duration).build()
33    }
34    #[inline]
35    pub fn duration(
36        &self,
37    ) -> &super::super::super::super::super::objects::scout::run::api::Duration {
38        &*self.duration
39    }
40}
41impl conjure_error::ErrorType for NonPositiveDuration {
42    #[inline]
43    fn code() -> conjure_error::ErrorCode {
44        conjure_error::ErrorCode::InvalidArgument
45    }
46    #[inline]
47    fn name() -> &'static str {
48        "Compute:NonPositiveDuration"
49    }
50    #[inline]
51    fn safe_args() -> &'static [&'static str] {
52        &["duration"]
53    }
54}