Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith,
7    Copy
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 FrequencyDecimateWithBuckets {
14    #[serde(rename = "buckets")]
15    buckets: i32,
16    #[builder(default, into)]
17    #[serde(rename = "minFrequency", skip_serializing_if = "Option::is_none", default)]
18    #[derive_with(with = conjure_object::private::DoubleWrapper)]
19    min_frequency: Option<f64>,
20    #[builder(default, into)]
21    #[serde(rename = "maxFrequency", skip_serializing_if = "Option::is_none", default)]
22    #[derive_with(with = conjure_object::private::DoubleWrapper)]
23    max_frequency: Option<f64>,
24}
25impl FrequencyDecimateWithBuckets {
26    /// Constructs a new instance of the type.
27    #[inline]
28    pub fn new(buckets: i32) -> Self {
29        Self::builder().buckets(buckets).build()
30    }
31    /// Target number of frequency bins/buckets.
32    #[inline]
33    pub fn buckets(&self) -> i32 {
34        self.buckets
35    }
36    /// Optional minimum frequency bound (Hz). When set, frequencies below this value are excluded
37    /// before bucketing, increasing resolution within the requested range. This bound is inclusive.
38    #[inline]
39    pub fn min_frequency(&self) -> Option<f64> {
40        self.min_frequency.as_ref().map(|o| *o)
41    }
42    /// Optional maximum frequency bound (Hz). When set, frequencies above this value are excluded
43    /// before bucketing, increasing resolution within the requested range. This bound is exclusive.
44    #[inline]
45    pub fn max_frequency(&self) -> Option<f64> {
46        self.max_frequency.as_ref().map(|o| *o)
47    }
48}