lasprs 0.9.1

Library for Acoustic Signal Processing (Rust edition, with optional Python bindings via pyo3)
Documentation
use crate::config::*;
use strum::IntoEnumIterator;
use strum_macros::{Display, EnumIter, EnumMessage};
/// Sound level frequency weighting type (A, C, Z)
#[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
#[derive(Copy, Display, Debug, EnumMessage, Default, Clone, PartialEq, EnumIter)]
pub enum FreqWeighting {
    /// A-weighting
    A,
    /// C-weighting
    C,
    /// Z-weighting, or no weighting
    #[default]
    Z,
}

#[cfg(feature = "python-bindings")]
#[cfg_attr(feature = "python-bindings", pymethods)]
impl FreqWeighting {
    #[staticmethod]
    fn all() -> Vec<Self> {
        Self::iter().collect()
    }
    fn __str__(&self) -> String {
        format!("{self}-weighting")
    }
    fn letter(&self) -> String {
        format!("{self}")
    }
    #[staticmethod]
    #[pyo3(name = "default")]
    fn default_py() -> Self {
        Self::default()
    }
}

#[cfg(test)]
mod test {
    use super::*;
    #[test]
    fn test() {
        let a = FreqWeighting::A;
        let c = FreqWeighting::C;
        let z = FreqWeighting::Z;
        println!("A-weighting: {a}");
        println!("C-weighting: {c}");
        println!("Z-weighting: {z}");
    }
}