pub fn new(
        name: &str,
        value: T,
        warning: Option<T>,
        critical: Option<T>,
        min: Option<T>,
        max: Option<T>,
        lower_is_critical: bool,
    ) -> Self {
        #[cfg(debug_assertions)]
        {
            if warning.is_some() && critical.is_some() {
                let warning = warning.clone().unwrap();
                let critical = critical.clone().unwrap();

                if lower_is_critical && warning < critical {
                    panic!("lower_is_critical is set to true while warning is lower than critical, this is not correct");
                } else if !lower_is_critical && warning > critical {
                    panic!("lower_is_critical is set to false while warning is lower than critical, this is not correct");
                }
            }

            if min.is_some() && max.is_some() {
                let min = min.clone().unwrap();
                let max = max.clone().unwrap();

                assert!(min < max, "minimum value is not smaller than maximum value")
            }
        }

        PartialOrdMetric {
            name: name.to_owned(),
            value: value.clone(),
            warning: warning.map(|w| w.clone()),
            critical: critical.map(|c| c.clone()),
            min: min.map(|m| m.clone()),
            max: max.map(|m| m.clone()),
            lower_is_critical,
        }
    }
/// Creates a new PartialOrdMetric from the given values.
///
/// *In debug builds this will panic if you pass incorrect values for warning and critical.*
Creates a new PartialOrdMetric from the given values.
In debug builds this will panic if you pass incorrect values for warning and critical.
Creates a new PartialOrdMetric from the given values . In debug builds this will panic if you pass incorrect values for warning and critical .
pub fn new(
        name: &str,
        value: T,
        warning: Option<T>,
        critical: Option<T>,
        min: Option<T>,
        max: Option<T>,
        lower_is_critical: bool,
    ) -> Self {
        #[cfg(debug_assertions)]
        {
            if warning.is_some() && critical.is_some() {
                let warning = warning.clone().unwrap();
                let critical = critical.clone().unwrap();
                if lower_is_critical && warning < critical {
                    panic!("lower_is_critical is set to true while warning is lower than critical, this is not correct");
                } else if !lower_is_critical && warning > critical {
                    panic!("lower_is_critical is set to false while warning is lower than critical, this is not correct");
                }
            }
            if min.is_some() && max.is_some() {
                let min = min.clone().unwrap();
                let max = max.clone().unwrap();
                assert!(min < max, "minimum value is not smaller than maximum value")
            }
        }
        PartialOrdMetric {
            name: name.to_owned(),
            value: value.clone(),
            warning: warning.map(|w| w.clone()),
            critical: critical.map(|c| c.clone()),
            min: min.map(|m| m.clone()),
            max: max.map(|m| m.clone()),
            lower_is_critical,
        }
    }
pub fn new ( name : & str , value : T , warning : Option < T > , critical : Option < T > , min : Option < T > , max : Option < T > , lower_is_critical : bool , ) -> Self { # [ cfg ( debug_assertions ) ] { if warning . is_some ( ) && critical . is_some ( ) { let warning = warning . clone ( ) . unwrap ( ) ; let critical = critical . clone ( ) . unwrap ( ) ; if lower_is_critical && warning < critical { panic ! ( " " ) ; } else if ! lower_is_critical && warning > critical { panic ! ( " " ) ; } } if min . is_some ( ) && max . is_some ( ) { let min = min . clone ( ) . unwrap ( ) ; let max = max . clone ( ) . unwrap ( ) ; assert ! ( min max " " ) } } PartialOrdMetric { name : name . to_owned ( ) , value : value . clone ( ) , warning : warning . map ( | w | w . clone ( ) ) , critical : critical . map ( | c | c . clone ( ) ) , min : min . map ( | m | m . clone ( ) ) , max : max . map ( | m | m . clone ( ) ) , lower_is_critical , } }
Creates a new PartialOrdMetric from the given values.
Creates a new PartialOrdMetric from the given values .
name
&str
value
T
warning
Option<T>
critical
Option<T>
min
Option<T>
max
Option<T>
lower_is_critical
bool
name
&str
value
T
warning
Option<T>
critical
Option<T>
min
Option<T>
max
Option<T>
lower_is_critical
bool