Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
event_time_shift.rs

1/// Shift by the start timestamp of the event at the configured zero-based index from this query whose event
2/// time lies in the anchor window [start, end), or [start, +infinity) when the end is absent. The window is the
3/// tagging interval for tagByIntervals and the run bounds for a run anchor. The query may differ from the query
4/// that produced a tagging interval.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    PartialEq,
11    Eq,
12    PartialOrd,
13    Ord,
14    Hash
15)]
16#[serde(crate = "conjure_object::serde")]
17#[conjure_object::private::staged_builder::staged_builder]
18#[builder(crate = conjure_object::private::staged_builder, update, inline)]
19pub struct EventTimeShift {
20    #[builder(
21        custom(
22            type = super::super::super::rids::api::ComputeEventQuery,
23            convert = Box::new
24        )
25    )]
26    #[serde(rename = "query")]
27    query: Box<super::super::super::rids::api::ComputeEventQuery>,
28    #[builder(
29        default,
30        custom(
31            type = impl
32            Into<Option<super::IntegerConstant>>,
33            convert = |v|v.into().map(Box::new)
34        )
35    )]
36    #[serde(rename = "index", skip_serializing_if = "Option::is_none", default)]
37    index: Option<Box<super::IntegerConstant>>,
38    #[builder(default, into)]
39    #[serde(rename = "sortOrder", skip_serializing_if = "Option::is_none", default)]
40    sort_order: Option<super::EventSortOrder>,
41}
42impl EventTimeShift {
43    /// Constructs a new instance of the type.
44    #[inline]
45    pub fn new(query: super::super::super::rids::api::ComputeEventQuery) -> Self {
46        Self::builder().query(query).build()
47    }
48    #[inline]
49    pub fn query(&self) -> &super::super::super::rids::api::ComputeEventQuery {
50        &*self.query
51    }
52    /// Zero-based event index after sorting. Defaults to zero and must be non-negative.
53    #[inline]
54    pub fn index(&self) -> Option<&super::IntegerConstant> {
55        self.index.as_ref().map(|o| &**o)
56    }
57    /// Ordering by event start timestamp before selecting the index. Defaults to ASC.
58    #[inline]
59    pub fn sort_order(&self) -> Option<&super::EventSortOrder> {
60        self.sort_order.as_ref().map(|o| &*o)
61    }
62}