pub struct ExecutionOptions { /* private fields */ }Expand description
Operation policy with explicit tolerance, precision, and cancellation.
Deliberately not Copy: it carries a shared CancellationToken, and an
implicitly copied cancellation handle is a footgun. Callers clone when they
mean to share the token and construct fresh options when they do not.
Implementations§
Source§impl ExecutionOptions
impl ExecutionOptions
Sourcepub const fn new(tolerance: Tolerance) -> ExecutionOptions
pub const fn new(tolerance: Tolerance) -> ExecutionOptions
Start from the required model-aware tolerance.
Sourcepub fn with_tolerance(self, tolerance: Tolerance) -> ExecutionOptions
pub fn with_tolerance(self, tolerance: Tolerance) -> ExecutionOptions
Replace the tolerance while preserving every other execution policy.
Compilers use this when evaluating geometry in a transformed local coordinate system. Cloning first keeps cancellation, budgets, determinism, residency, and provider preferences intact.
Sourcepub fn with_cancellation(self, token: CancellationToken) -> ExecutionOptions
pub fn with_cancellation(self, token: CancellationToken) -> ExecutionOptions
Attach a cooperative cancellation token.
Absent a token, an operation runs to completion; there is no ambient
cancellation source. Providers declare how finely they poll via
crate::CancellationGranularity, so a caller can see the real latency.
Sourcepub fn cancellation(&self) -> Option<&CancellationToken>
pub fn cancellation(&self) -> Option<&CancellationToken>
The attached cancellation token, if any.
Sourcepub fn check_cancelled(&self) -> Result<(), GeomError>
pub fn check_cancelled(&self) -> Result<(), GeomError>
Err(GeomError::Cancelled) if a token is attached and cancelled.
The call providers make at each poll point: options.check_cancelled()?.
Cheap (one relaxed load) and a no-op when no token is attached.
Sourcepub fn with_precision(self, precision: Precision) -> ExecutionOptions
pub fn with_precision(self, precision: Precision) -> ExecutionOptions
Set required precision.
Sourcepub fn with_determinism(self, value: Determinism) -> ExecutionOptions
pub fn with_determinism(self, value: Determinism) -> ExecutionOptions
Set determinism requirement.
Sourcepub fn with_parallelism(self, value: Parallelism) -> Option<ExecutionOptions>
pub fn with_parallelism(self, value: Parallelism) -> Option<ExecutionOptions>
Set scheduling preference. Returns None for zero explicit threads.
Sourcepub fn with_device(self, value: DevicePreference) -> ExecutionOptions
pub fn with_device(self, value: DevicePreference) -> ExecutionOptions
Set device preference.
Sourcepub fn with_residency(self, value: DataResidency) -> ExecutionOptions
pub fn with_residency(self, value: DataResidency) -> ExecutionOptions
Declare where inputs live and where outputs are wanted.
Sourcepub fn with_chord_error(self, value: f64) -> Option<ExecutionOptions>
pub fn with_chord_error(self, value: f64) -> Option<ExecutionOptions>
Bound how far flattened curves may deviate from the exact curve.
Curved geometry that a provider approximates with straight chords
(profile arcs, sweep directrices, curved B-rep faces) stays within this
distance of the exact curve. Without it the chord budget is the linear
tolerance, which is a coincidence tolerance and coarse for small radii:
at Tolerance::MILLIMETRE a 5 mm arc gets four chords per half turn.
Quantity take-off wants a tighter budget than display.
Returns None for a non-finite or non-positive value. A provider may
still refuse a budget too fine to meet within its own work limits.
Sourcepub fn chord_error(&self) -> Option<f64>
pub fn chord_error(&self) -> Option<f64>
The explicit chord budget, if one was set.
None means the provider uses its default, the linear tolerance.
Sourcepub fn with_memory_budget(self, bytes: usize) -> ExecutionOptions
pub fn with_memory_budget(self, bytes: usize) -> ExecutionOptions
Bound temporary allocation.
Sourcepub fn determinism(&self) -> Determinism
pub fn determinism(&self) -> Determinism
Determinism requirement.
Sourcepub fn parallelism(&self) -> Parallelism
pub fn parallelism(&self) -> Parallelism
Scheduling preference.
Sourcepub fn device(&self) -> DevicePreference
pub fn device(&self) -> DevicePreference
Device preference.
Sourcepub fn memory_budget_bytes(&self) -> Option<usize>
pub fn memory_budget_bytes(&self) -> Option<usize>
Optional temporary-memory budget.
Sourcepub fn residency(&self) -> DataResidency
pub fn residency(&self) -> DataResidency
Where inputs live and where outputs are wanted.
Sourcepub fn charge_scratch(&self, bytes: usize) -> Result<(), GeomError>
pub fn charge_scratch(&self, bytes: usize) -> Result<(), GeomError>
Charge bytes of scratch against the budget before allocating it.
The budget is only real if something checks it, so this is the single enforcement point every hot path routes through. Backends must call it before the allocation, not after: reporting an overrun once the allocation already succeeded defeats the purpose of a budget.
Trait Implementations§
Source§impl Clone for ExecutionOptions
impl Clone for ExecutionOptions
Source§fn clone(&self) -> ExecutionOptions
fn clone(&self) -> ExecutionOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more