Expand description
Loading and initializing compiled Lean modules.
The normal shipped-capability path is LeanCapability, which stores a
LeanLibraryBundle internally. The lower-level surface has three RAII
types:
LeanLibrary—a Lake-built native shared object opened through the platform dynamic loader.LeanLibraryBundle—a primary shared object plus dependent Lean dylibs anchored for the same lifetime.LeanModule—proof that a named Lean module hosted by aLeanLibraryhas been initialized toIO.ok(()).LeanCapabilityPreflight—manifest and artifact checks that turn package/loader failures into stable repair hints before opening.
Construction of either type requires a crate::LeanRuntime
borrow, so use-before-init is structurally impossible. The
'lean lifetime cascade keeps every derived handle bound to the
runtime witness; the secondary 'lib lifetime on LeanModule
keeps initialized modules from outliving the dylib that hosts them.
let runtime = lean_rs::LeanRuntime::init()?;
let library = lean_rs::module::LeanLibrary::open(runtime, "path/to/libfoo.dylib")?;
let module = library.initialize_module("foo_pkg", "Foo.Bar")?;Callers do not name raw initializer symbols, choose the Lean
builtin flag, decode IO results, or maintain idempotency state;
all of that lives in the pub(crate) module::initializer
infrastructure. Typed exported-function handles cross the public
boundary as LeanExported and LeanIo; see exported for
the call shape.
Re-exports§
pub use crate::abi::traits::LeanAbi;pub use crate::abi::traits::LeanCReprAbi;
Structs§
- Lean
Built Capability - Runtime descriptor for a Lean capability built by a downstream
build.rs. - Lean
Capability - Opened Lean capability whose dylib path and initializer names came from the build-script pairing.
- Lean
Export ArgAbi - ABI shape of one exported function argument.
- Lean
Export Return Abi - ABI shape of an exported result.
- Lean
Export Signature - Trusted manifest signature for one Lean export.
- Lean
Exported - A typed handle for an exported Lean symbol.
- LeanIo
- Return-type marker for Lean exports declared
IO α. - Lean
Library - A loaded native Lean shared object.
- Lean
Library Bundle - A primary Lean capability plus its dependent Lean dylibs.
- Lean
Library Dependency - Dependency dylib that must stay alive while a capability is loaded.
- Lean
Loader Check - One bounded preflight finding.
- Lean
Loader Report - Structured result of loader preflight for one capability manifest.
- Lean
Module - A Lean module that has been linked and initialized successfully.
- Lean
Module Initializer - Initializer for a Lean module hosted by a loaded dylib.
- Lean
Runtime Preflight - Runtime preflight runner for manifest-backed Lean capabilities.
Enums§
- Built
Capability Artifact - Which artifact a
LeanBuiltCapabilityresolution was looking for. - Lean
Built Capability Error - Errors returned when resolving a
LeanBuiltCapabilitydescriptor. - Lean
Checked Export Error - Typed failure from manifest-backed checked export lookup.
- Lean
Export AbiRepr - C ABI representation for one exported argument or result slot.
- Lean
Export Ownership - Ownership convention for one ABI slot.
- Lean
Export Result Convention - How an exported result is decoded.
- Lean
Export Symbol Kind - Whether an exported symbol is callable code or a Lean persistent global.
- Lean
Loader Diagnostic Code - Stable preflight diagnostic codes for manifest-backed capability loading.
- Lean
Loader Severity - Severity of one loader preflight finding.
Traits§
- Decode
Call Result - How to decode an owned Lean call result into a Rust value.
- Lean
Args - Per-arity marker for
LeanExported’s argument tuple.
Type Aliases§
- Lean
Capability Preflight - Backwards-compatible alias for
LeanRuntimePreflight.