pub trait RunAccountant: Send + Sync {
// Provided methods
fn before_task_dispatch(
&self,
kind: DispatchKind<'_>,
) -> Result<OccupancyGuard<'_>> { ... }
fn on_expr_evaluated(&self, ops: u64) { ... }
fn charge_custom(&self, kind: &str, units: u64) -> Result<()> { ... }
}Expand description
Host-owned accounting and admission hook for a single run.
Implementations must be thread-safe (Send + Sync) because for_each
branches may invoke hooks concurrently across tasks.
Provided Methods§
Sourcefn before_task_dispatch(
&self,
kind: DispatchKind<'_>,
) -> Result<OccupancyGuard<'_>>
fn before_task_dispatch( &self, kind: DispatchKind<'_>, ) -> Result<OccupancyGuard<'_>>
Called immediately before dispatching an inline built-in, host task,
loop sweep, or for_each element.
Returning Err(e) aborts the dispatch before any side effects occur;
the error is propagated as the step failure (typically ErrorKind::Budget).
§Errors
Returns an Error if the accountant rejects the dispatch.
Sourcefn on_expr_evaluated(&self, ops: u64)
fn on_expr_evaluated(&self, ops: u64)
Called after each metered expression evaluation (both Ok and Err)
with the number of datalogic operations consumed.
Sourcefn charge_custom(&self, kind: &str, units: u64) -> Result<()>
fn charge_custom(&self, kind: &str, units: u64) -> Result<()>
Called when a host function charges domain-specific work units via
Ctx::accountant.
§Errors
Returns an Error if the custom charge exceeds host limits.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".