use super::*;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct Config {
pub strategy: Mode,
pub move_expensive_tasks: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
strategy: Mode::default(),
move_expensive_tasks: true,
}
}
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum Mode {
MaxPerThread(NonZeroUsize),
}
impl Mode {
pub(crate) fn prealloc_size(&self) -> usize {
match self {
Self::MaxPerThread(n) => n.get(),
}
}
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn task_limit(&self) -> Option<usize> {
match self {
Self::MaxPerThread(n) => Some(n.get()),
}
}
}
impl Default for Mode {
fn default() -> Self {
Self::MaxPerThread(DEFAULT_MIXERS_PER_THREAD)
}
}