Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
numeric_output_percentile.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 NumericOutputPercentile {
13    #[builder(custom(type = super::DoubleConstant, convert = Box::new))]
14    #[serde(rename = "percentile")]
15    percentile: Box<super::DoubleConstant>,
16    #[builder(default, into)]
17    #[serde(rename = "outputName", skip_serializing_if = "Option::is_none", default)]
18    output_name: Option<String>,
19}
20impl NumericOutputPercentile {
21    /// Constructs a new instance of the type.
22    #[inline]
23    pub fn new(percentile: super::DoubleConstant) -> Self {
24        Self::builder().percentile(percentile).build()
25    }
26    /// Percentile to compute, in range [0, 1].
27    #[inline]
28    pub fn percentile(&self) -> &super::DoubleConstant {
29        &*self.percentile
30    }
31    /// Optional output column name. Defaults to pXX, e.g. p95 for 0.95.
32    #[inline]
33    pub fn output_name(&self) -> Option<&str> {
34        self.output_name.as_ref().map(|o| &**o)
35    }
36}