#[derive(Debug, Copy, Clone)]
pub enum FrequencyLimit {
All,
Min(f32),
Max(f32),
Range(f32, f32),
}
impl FrequencyLimit {
#[inline(always)]
pub fn maybe_min(&self) -> Option<f32> {
match self {
FrequencyLimit::Min(min) => Some(*min),
FrequencyLimit::Range(min, _) => Some(*min),
_ => None,
}
}
#[inline(always)]
pub fn maybe_max(&self) -> Option<f32> {
match self {
FrequencyLimit::Max(max) => Some(*max),
FrequencyLimit::Range(_, max) => Some(*max),
_ => None,
}
}
#[inline(always)]
pub fn min(&self) -> f32 {
self.maybe_min().expect("Must contain a value!")
}
#[inline(always)]
pub fn max(&self) -> f32 {
self.maybe_max().expect("Must contain a value!")
}
}