# tcontract-exec
Execution resources of the tcontract stack: scratch memory and contraction
policy. It starts no task and exposes no scheduler type. Where tasks run, and how
many at once, belongs to [`threadteam`](https://crates.io/crates/threadteam)
(formerly `strided-exec`); this crate adds what is specific to contraction.
| `Pool<'p>` | A `threadteam::Pool` (borrowed with `Pool::borrow`, owned with `Pool::owned`, or shared by several wrappers with `Pool::shared`) plus the retained scratch arena. One wrapper is one workspace owner: keep it across calls. |
| `Exec<'a>` | The per-call resource bundle: one `threadteam::Exec` token, an optional workspace, and the `BatchPolicy`. Not `Clone`, not `Copy`; operations take `&mut Exec`. |
| `ArenaProvider`, `Workspace`, `WorkspaceReq`, `TeamLease` | Reusable scratch, owned by a `Pool` or lent by a serial caller. |
| `BatchPolicy`, `BatchQuery`, `BatchDecision`, `batch_decision`, `batch_decision_within`, `WorkModel` | The one lane decision (`lanes * item_threads <= budget`) every batch-owning operation shares; its widths are the token's. |
| `Exec::width_for(ns, sections)`, `Exec::width_for_within`, `Exec::pays(ns, sections, width)` | The partition width, and the gate, for work estimated at `serial_ns` that performs `sections` dispatches: the token's rule (`threadteam`'s dispatch cost of the token's kind, times `PAYS`). |
## `Exec`
```rust
use tcontract_exec::{Exec, Pool};
let sp = threadteam::Pool::builder().threads(4).build()?; // the host owns the pool
let pool = Pool::borrow(&sp); // wrapper: pool + scratch arena
let mut exec = Exec::new(&pool, 4)?; // the only budget clamp