Skip to main content

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

1/// The starting timestamp of a range cannot be greater than or equal to the end timestamp.
2/// At least one of start and end timestamps must be present.
3/// Only the first range when sorted may omit the start, and only the last may omit the end.
4#[derive(
5    Debug,
6    Clone,
7    conjure_object::serde::Serialize,
8    conjure_object::serde::Deserialize,
9    PartialEq,
10    Eq,
11    PartialOrd,
12    Ord,
13    Hash
14)]
15#[serde(crate = "conjure_object::serde")]
16#[conjure_object::private::staged_builder::staged_builder]
17#[builder(crate = conjure_object::private::staged_builder, update, inline)]
18pub struct InvalidLiteralRange {
19    #[builder(
20        default,
21        custom(
22            type = impl
23            Into<Option<super::super::super::super::super::objects::api::Timestamp>>,
24            convert = |v|v.into().map(Box::new)
25        )
26    )]
27    #[serde(rename = "start", skip_serializing_if = "Option::is_none", default)]
28    start: Option<Box<super::super::super::super::super::objects::api::Timestamp>>,
29    #[builder(
30        default,
31        custom(
32            type = impl
33            Into<Option<super::super::super::super::super::objects::api::Timestamp>>,
34            convert = |v|v.into().map(Box::new)
35        )
36    )]
37    #[serde(rename = "end", skip_serializing_if = "Option::is_none", default)]
38    end: Option<Box<super::super::super::super::super::objects::api::Timestamp>>,
39}
40impl InvalidLiteralRange {
41    /// Constructs a new instance of the type.
42    #[inline]
43    pub fn new() -> Self {
44        Self::builder().build()
45    }
46    #[inline]
47    pub fn start(
48        &self,
49    ) -> Option<&super::super::super::super::super::objects::api::Timestamp> {
50        self.start.as_ref().map(|o| &**o)
51    }
52    #[inline]
53    pub fn end(
54        &self,
55    ) -> Option<&super::super::super::super::super::objects::api::Timestamp> {
56        self.end.as_ref().map(|o| &**o)
57    }
58}
59impl conjure_error::ErrorType for InvalidLiteralRange {
60    #[inline]
61    fn code() -> conjure_error::ErrorCode {
62        conjure_error::ErrorCode::InvalidArgument
63    }
64    #[inline]
65    fn name() -> &'static str {
66        "Compute:InvalidLiteralRange"
67    }
68    #[inline]
69    fn safe_args() -> &'static [&'static str] {
70        &["end", "start"]
71    }
72}