#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("an execution budget must be at least one slot")]
ZeroBudget,
#[error("a pool needs at least one worker thread")]
ZeroThreads,
#[error("failed to start the pool workers: {0}")]
PoolBuild(String),
#[error("child team sizes must be non-empty, non-zero and sum to at most the team size")]
InvalidSplit,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Refused {
#[error("the token is a child produced by fork; its slots may share workers with siblings")]
ForkChild,
#[error("the caller is a worker of the token's pool and would occupy a participant slot")]
CallerInPool,
#[error("the team members could not all be reserved without waiting for a running Rayon job")]
Unavailable,
#[error("another thread is the leader of this team")]
Busy,
}