Skip to main content

nominal_api/conjure/objects/scout/compute/api/
time_shifted_frame.rs

1/// Transforms a frame by adding a time offset to all its data.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct TimeShiftedFrame {
14    #[builder(custom(type = super::DataFrame, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::DataFrame>,
17    #[builder(custom(type = super::Duration, convert = Box::new))]
18    #[serde(rename = "offset")]
19    offset: Box<super::Duration>,
20}
21impl TimeShiftedFrame {
22    /// Constructs a new instance of the type.
23    #[inline]
24    pub fn new(input: super::DataFrame, offset: super::Duration) -> Self {
25        Self::builder().input(input).offset(offset).build()
26    }
27    /// The underlying frame to time-shift.
28    #[inline]
29    pub fn input(&self) -> &super::DataFrame {
30        &*self.input
31    }
32    /// The time shift to apply. Positive values shift data forward in time,
33    /// negative values shift backward.
34    #[inline]
35    pub fn offset(&self) -> &super::Duration {
36        &*self.offset
37    }
38}