Skip to main content

LeanLibraryBundle

Struct LeanLibraryBundle 

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

Source

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.

Source

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.

Source

pub fn library(&self) -> &LeanLibrary<'lean>

Borrow the primary capability library.

Source

pub fn dependency_count(&self) -> usize

Number of dependency dylibs anchored by this bundle.

Trait Implementations§

Source§

impl Debug for LeanLibraryBundle<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'lean> Freeze for LeanLibraryBundle<'lean>

§

impl<'lean> RefUnwindSafe for LeanLibraryBundle<'lean>

§

impl<'lean> !Send for LeanLibraryBundle<'lean>

§

impl<'lean> !Sync for LeanLibraryBundle<'lean>

§

impl<'lean> Unpin for LeanLibraryBundle<'lean>

§

impl<'lean> UnsafeUnpin for LeanLibraryBundle<'lean>

§

impl<'lean> UnwindSafe for LeanLibraryBundle<'lean>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more