Skip to main content

LeanWorkerChild

Struct LeanWorkerChild 

Source
pub struct LeanWorkerChild { /* private fields */ }
Expand description

Locator for an app-owned worker child executable.

Dependency binaries are not automatically installed with downstream applications. Production apps should ship a tiny binary that calls lean_rs_worker_child::run_worker_child_stdio and point the capability builder at it through this locator.

§Toolchain binding

A worker child binary is built against one Lean toolchain: its rpath points at one libleanshared, and LEAN_SYSROOT at spawn time must point at the matching stdlib oleans (<sysroot>/lib/lean/Init.olean). Mismatched rpath and sysroot abort with incompatible header before the handshake.

The locator carries both: the binary path (via Self::path or Self::sibling) and, optionally, the matching sysroot (via Self::for_toolchain or Self::lean_sysroot). When the supervisor spawns the child, it sets LEAN_SYSROOT from the locator (or from lean_toolchain::discover_toolchain as a fallback) so callers never have to thread the env var manually.

§Design note: no generic env(key, value) passthrough

LeanWorkerCapabilityBuilder and LeanWorkerChild deliberately do not expose a general env(key, value) builder. Every environment variable the worker child cares about has a typed method whose name describes the invariant it enforces (e.g. Self::lean_sysroot enforces the rpath/sysroot match). If a future env var needs to be plumbed through, add a typed builder for it — do not add a generic env(...). Generic passthroughs leak implementation knowledge (env var names, framing invariants) into every caller and erode the structural guarantee that supported configurations cannot be misconstructed.

Implementations§

Source§

impl LeanWorkerChild

Source

pub fn sibling(executable_name: impl Into<String>) -> Self

Locate a worker child beside the current executable, or beside the Cargo profile directory during tests and cargo run.

Source

pub fn path(path: impl Into<PathBuf>) -> Self

Use an explicit worker child path.

Source

pub fn for_toolchain( path: impl Into<PathBuf>, sysroot: impl Into<PathBuf>, ) -> Self

Locate a worker child and declare the Lean toolchain its rpath was built against.

sysroot is the Lean prefix containing lib/lean/Init.olean. The supervisor sets LEAN_SYSROOT to this value when spawning the child, so a single parent process can host multiple workers each pinned to a different toolchain.

Source

pub fn lean_sysroot(self, sysroot: impl Into<PathBuf>) -> Self

Set or override the Lean sysroot the spawned child uses.

When unset, the supervisor falls back to lean_toolchain::discover_toolchain at spawn time.

Source

pub fn env_override(self, env_var: impl Into<String>) -> Self

Add an environment-variable override for launchers and tests.

Trait Implementations§

Source§

impl Clone for LeanWorkerChild

Source§

fn clone(&self) -> LeanWorkerChild

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 Debug for LeanWorkerChild

Source§

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

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

impl Default for LeanWorkerChild

Source§

fn default() -> Self

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

impl PartialEq for LeanWorkerChild

Source§

fn eq(&self, other: &LeanWorkerChild) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for LeanWorkerChild

Source§

impl StructuralPartialEq for LeanWorkerChild

Auto Trait Implementations§

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> 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 = Infallible

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.