use std::num::NonZeroUsize;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Priority {
High,
Normal,
Background,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PriorityWeights {
high: NonZeroUsize,
normal: NonZeroUsize,
background: NonZeroUsize,
}
impl PriorityWeights {
pub const fn new(high: NonZeroUsize, normal: NonZeroUsize, background: NonZeroUsize) -> Self {
Self {
high,
normal,
background,
}
}
pub const fn high(self) -> NonZeroUsize {
self.high
}
pub const fn normal(self) -> NonZeroUsize {
self.normal
}
pub const fn background(self) -> NonZeroUsize {
self.background
}
}
impl Default for PriorityWeights {
fn default() -> Self {
Self::new(
NonZeroUsize::new(8).expect("8 is non-zero"),
NonZeroUsize::new(4).expect("4 is non-zero"),
NonZeroUsize::new(1).expect("1 is non-zero"),
)
}
}