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
impl LeanWorkerChild
Sourcepub fn sibling(executable_name: impl Into<String>) -> Self
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.
Sourcepub fn for_toolchain(
path: impl Into<PathBuf>,
sysroot: impl Into<PathBuf>,
) -> Self
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.
Sourcepub fn lean_sysroot(self, sysroot: impl Into<PathBuf>) -> Self
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.
Sourcepub fn env_override(self, env_var: impl Into<String>) -> Self
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
impl Clone for LeanWorkerChild
Source§fn clone(&self) -> LeanWorkerChild
fn clone(&self) -> LeanWorkerChild
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LeanWorkerChild
impl Debug for LeanWorkerChild
Source§impl Default for LeanWorkerChild
impl Default for LeanWorkerChild
Source§impl PartialEq for LeanWorkerChild
impl PartialEq for LeanWorkerChild
Source§fn eq(&self, other: &LeanWorkerChild) -> bool
fn eq(&self, other: &LeanWorkerChild) -> bool
self and other values to be equal, and is used by ==.