Skip to main content

Module options

Module options 

Source
Expand description

Per-call options for Engine::lint_with_options and Engine::fix_with_options (spec 005).

These types are the durable surface for runtime budgets and per-call overrides. Phase 1 lands the type surface with no observable behavior change — the deadline field is plumbed but not yet honored. Phase 2 wires cooperative cancellation against LintOptions::deadline / FixOptions::deadline per spec §R3.

Both structs are #[non_exhaustive] so future fields (cancellation tokens, memory budgets, per-rule deadlines) can land without a semver-breaking change. From outside the engine crate, construct via Default::default() + public field assignment:

Use marque_engine::Instant (a web_time re-export) rather than std::time::Instant so the example works on every supported target. On native the two are the same type (literal pub use), so this is also drop-in for native-only callers; on wasm32-unknown-unknown, std::time::Instant::now() panics with “time not implemented on this platform” while web_time polyfills via Performance.now().

use marque_engine::{Instant, LintOptions, FixOptions};
use std::time::Duration;

let mut lint = LintOptions::default();
lint.deadline = Some(Instant::now() + Duration::from_secs(1));

let mut fix = FixOptions::default();
fix.deadline = Some(Instant::now() + Duration::from_secs(1));
fix.threshold_override = Some(0.85);

In-crate code (engine internals, this crate’s tests) may still use struct-update syntax — #[non_exhaustive] only restricts construction across crate boundaries.

Structs§

FixOptions
Per-call options for Engine::fix_with_options.
LintOptions
Per-call options for Engine::lint_with_options.