Skip to main content

nominal_api/conjure/objects/scout/compute/resolved/api/
range_map.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct RangeMap {
13    #[builder(default, into)]
14    #[serde(rename = "start", skip_serializing_if = "Option::is_none", default)]
15    #[derive_with(with = conjure_object::private::DoubleWrapper)]
16    start: Option<f64>,
17    #[builder(default, into)]
18    #[serde(rename = "end", skip_serializing_if = "Option::is_none", default)]
19    #[derive_with(with = conjure_object::private::DoubleWrapper)]
20    end: Option<f64>,
21    #[builder(into)]
22    #[serde(rename = "output")]
23    output: String,
24}
25impl RangeMap {
26    /// Constructs a new instance of the type.
27    #[inline]
28    pub fn new(output: impl Into<String>) -> Self {
29        Self::builder().output(output).build()
30    }
31    #[inline]
32    pub fn start(&self) -> Option<f64> {
33        self.start.as_ref().map(|o| *o)
34    }
35    #[inline]
36    pub fn end(&self) -> Option<f64> {
37        self.end.as_ref().map(|o| *o)
38    }
39    #[inline]
40    pub fn output(&self) -> &str {
41        &*self.output
42    }
43}