Skip to main content

LoadOptions

Struct LoadOptions 

Source
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>

Source§

fn clone(&self) -> LoadOptions<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for LoadOptions<'a>

Source§

impl<'a> Debug for LoadOptions<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for LoadOptions<'a>

Source§

fn default() -> LoadOptions<'a>

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ParallelSend for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.