#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct SpatialTimeBinding {
#[serde(rename = "enabled")]
enabled: bool,
#[builder(into)]
#[serde(rename = "attribute")]
attribute: String,
#[serde(rename = "unit")]
unit: super::SpatialTimeUnit,
#[builder(default, into)]
#[serde(
rename = "relativeStartUs",
skip_serializing_if = "Option::is_none",
default
)]
relative_start_us: Option<conjure_object::SafeLong>,
#[builder(default, into)]
#[serde(rename = "relativeEndUs", skip_serializing_if = "Option::is_none", default)]
relative_end_us: Option<conjure_object::SafeLong>,
#[builder(
default,
custom(
type = impl
Into<Option<super::SpatialTimeWindow>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "timeWindow", skip_serializing_if = "Option::is_none", default)]
time_window: Option<Box<super::SpatialTimeWindow>>,
}
impl SpatialTimeBinding {
#[inline]
pub fn new(
enabled: bool,
attribute: impl Into<String>,
unit: super::SpatialTimeUnit,
) -> Self {
Self::builder().enabled(enabled).attribute(attribute).unit(unit).build()
}
#[inline]
pub fn enabled(&self) -> bool {
self.enabled
}
#[inline]
pub fn attribute(&self) -> &str {
&*self.attribute
}
#[inline]
pub fn unit(&self) -> &super::SpatialTimeUnit {
&self.unit
}
#[inline]
pub fn relative_start_us(&self) -> Option<conjure_object::SafeLong> {
self.relative_start_us.as_ref().map(|o| *o)
}
#[inline]
pub fn relative_end_us(&self) -> Option<conjure_object::SafeLong> {
self.relative_end_us.as_ref().map(|o| *o)
}
#[inline]
pub fn time_window(&self) -> Option<&super::SpatialTimeWindow> {
self.time_window.as_ref().map(|o| &**o)
}
}