pub struct LeanLibraryBundle<'lean> { /* private fields */ }Expand description
A primary Lean capability plus its dependent Lean dylibs.
The primary library is dropped before dependency libraries so imported symbols remain available for as long as capability code can run.
Implementations§
Source§impl<'lean> LeanLibraryBundle<'lean>
impl<'lean> LeanLibraryBundle<'lean>
Sourcepub fn open(
runtime: &'lean LeanRuntime,
primary_path: impl AsRef<Path>,
dependencies: impl IntoIterator<Item = LeanLibraryDependency>,
) -> LeanResult<Self>
pub fn open( runtime: &'lean LeanRuntime, primary_path: impl AsRef<Path>, dependencies: impl IntoIterator<Item = LeanLibraryDependency>, ) -> LeanResult<Self>
Open a primary capability dylib and every dependency it needs.
Dependencies are opened and optionally initialized in iterator order. The primary dylib is opened last. Every dependency handle is stored inside the bundle, so helper functions can return a bundle without leaking handles or relying on platform loader state that outlives Rust’s RAII values.
§Errors
Returns crate::LeanError if any dependency or primary dylib cannot
be opened, or if any requested dependency initializer fails.
Sourcepub fn initialize_module<'bundle>(
&'bundle self,
package: &str,
module: &str,
) -> LeanResult<LeanModule<'lean, 'bundle>>
pub fn initialize_module<'bundle>( &'bundle self, package: &str, module: &str, ) -> LeanResult<LeanModule<'lean, 'bundle>>
Initialize a module from the primary capability library.
This delegates to LeanLibrary::initialize_module while preserving the
bundle lifetime that keeps dependent dylibs anchored.
§Errors
Returns crate::LeanError if the requested module name cannot be
mapped to an initializer symbol, if that symbol is missing from the
primary library, or if the Lean initializer returns IO.error.
Sourcepub fn library(&self) -> &LeanLibrary<'lean>
pub fn library(&self) -> &LeanLibrary<'lean>
Borrow the primary capability library.
Sourcepub fn dependency_count(&self) -> usize
pub fn dependency_count(&self) -> usize
Number of dependency dylibs anchored by this bundle.