tcontract_exec/error.rs
1/// Errors from building or using an [`Exec`](crate::Exec).
2#[derive(Clone, Copy, Debug, thiserror::Error, PartialEq, Eq)]
3#[non_exhaustive]
4pub enum ExecError {
5 /// A thread budget of zero was requested.
6 #[error("thread budget must be at least 1")]
7 ZeroBudget,
8 /// An SPMD width larger than the pool was requested.
9 #[error("SPMD width {width} exceeds pool size {pool}")]
10 WidthExceedsPool {
11 /// Requested width.
12 width: usize,
13 /// Workers in the pool.
14 pool: usize,
15 },
16 /// An SPMD width larger than the context's thread budget was requested.
17 #[error("SPMD width {width} exceeds thread budget {budget}")]
18 WidthExceedsBudget {
19 /// Requested width.
20 width: usize,
21 /// The context's budget.
22 budget: usize,
23 },
24 /// Co-scheduled execution cannot be guaranteed here (serial context, or
25 /// the caller is already a worker of the pool).
26 #[error("co-scheduled execution unavailable in this context")]
27 Unavailable,
28}