pub struct LoadOptions<'a> {
pub artifacts: Option<&'a Path>,
pub global_timeout: Option<Duration>,
}Expand description
What a load needs beyond the config file, for a caller that has more to say than load
can carry.
A struct rather than two more parameters, for the reason lanekeep-cli’s CheckOptions
gives: artifacts and the config path are both &Path, and adjacent parameters of one
type are the shape that gets silently transposed at a call site.
Fields§
§artifacts: Option<&'a Path>A project root under which compiled components may be cached, or None for a load with
nowhere to write.
This is the difference between a component costing something per config load and
costing nothing. With None, describe_components compiles every component from
scratch to ask it what it is, throws the compilation away, and the engine compiles the
same bytes again at prepare time. Measured on the release binary, one 26 KB Rust
component added ~58 ms to a lanekeep rules that checks no files at all, and two added
~116 ms — against a §15 warm-run budget of 25 ms for the whole invocation. Config load
runs per LSP request, per MCP tool call and per --watch iteration, so this is paid on
every one of them.
Those figures are for a component of a few tens of kilobytes and do not generalize.
The shared TypeScript built-ins are one 12.4 MiB artifact, and compiling it is about six
seconds — a hundredfold, not a factor. docs/architecture.md §15 has the table. So the
choice between Some and None is a question about seconds rather than milliseconds for
any caller whose config names one of those four rules, which is why
RuleTester::for_built_in would be unusable without a root and why lanekeep-testkit
names one.
Given a root, both loads write and map artifacts under the same COMPONENT_CACHE_PATH,
keyed on the specifier and the bytes — so the first run compiles once instead of twice and
every later run maps what that run wrote. The two loaders agree because both build their
wasmtime::Engine with WasmEngine::new; an artifact a different build wrote fails to
deserialize and is discarded rather than trusted.
Named by the caller rather than inferred, because a rules root is the project root only by
the CLI’s choice, and guessing would make loading a config write somewhere nobody asked
for. lanekeep-testkit anchors a rules root at a temporary fixture directory and names
that — which is the shape this field is for: the caller knows it owns the directory and
removes it, and this function could not have known either.
global_timeout: Option<Duration>Overrides timeouts.global from the config file, for a caller holding a more specific
statement — --timeout, which a user typed on this run.
It has to arrive here rather than be applied to the returned Config, because config
load is itself a phase that runs guest code. describe_components instantiates,
configures and calls metadata on every component under a clock of its own, and that
clock is built before this function returns. A caller that loaded first and assigned to
Config::limits afterwards would leave that phase governed by the config file’s number
while the message a breach prints tells the user to raise it with --timeout — advice
that could not work. AGENTS.md records the original instance of exactly this shape.
Trait Implementations§
Source§impl<'a> Clone for LoadOptions<'a>
impl<'a> Clone for LoadOptions<'a>
Source§fn clone(&self) -> LoadOptions<'a>
fn clone(&self) -> LoadOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for LoadOptions<'a>
Source§impl<'a> Debug for LoadOptions<'a>
impl<'a> Debug for LoadOptions<'a>
Source§impl<'a> Default for LoadOptions<'a>
impl<'a> Default for LoadOptions<'a>
Source§fn default() -> LoadOptions<'a>
fn default() -> LoadOptions<'a>
Auto Trait Implementations§
impl<'a> Freeze for LoadOptions<'a>
impl<'a> RefUnwindSafe for LoadOptions<'a>
impl<'a> Send for LoadOptions<'a>
impl<'a> Sync for LoadOptions<'a>
impl<'a> Unpin for LoadOptions<'a>
impl<'a> UnsafeUnpin for LoadOptions<'a>
impl<'a> UnwindSafe for LoadOptions<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more