pub struct LeanBuiltCapability { /* private fields */ }Expand description
Runtime descriptor for a Lean capability built by a downstream build.rs.
Implementations§
Source§impl LeanBuiltCapability
impl LeanBuiltCapability
Sourcepub fn path(path: impl Into<PathBuf>) -> Self
pub fn path(path: impl Into<PathBuf>) -> Self
Build a descriptor from an embedded dylib path.
This remains supported for simple or compatibility cases. Prefer
Self::manifest_path for shipped binaries because the manifest also
carries dependency and loader-order facts:
let spec = lean_rs::LeanBuiltCapability::path(env!("LEAN_RS_CAPABILITY_MY_CAPABILITY_DYLIB"))
.package("my_app")
.module("MyCapability");Sourcepub fn env(env_var: impl Into<String>) -> Self
pub fn env(env_var: impl Into<String>) -> Self
Build a descriptor that resolves the dylib path from a runtime environment variable.
Prefer Self::path with Rust’s env! macro for redistributable
binaries. Runtime environment lookup is useful for tests, local
overrides, and launcher-managed deployments.
Sourcepub fn manifest_path(path: impl Into<PathBuf>) -> Self
pub fn manifest_path(path: impl Into<PathBuf>) -> Self
Build a descriptor from an embedded artifact manifest path.
This is the canonical form for shipped binaries using
CargoLeanCapability’s manifest output:
let spec = lean_rs::LeanBuiltCapability::manifest_path(
env!("LEAN_RS_CAPABILITY_MY_CAPABILITY_MANIFEST"),
);Sourcepub fn manifest_env(env_var: impl Into<String>) -> Self
pub fn manifest_env(env_var: impl Into<String>) -> Self
Build a descriptor that resolves the artifact manifest path from a runtime environment variable.
Prefer Self::manifest_path with Rust’s env! macro for
redistributable binaries. Runtime environment lookup is useful for
tests, local overrides, and launcher-managed deployments.
Sourcepub fn env_var(self, env_var: impl Into<String>) -> Self
pub fn env_var(self, env_var: impl Into<String>) -> Self
Preserve the Cargo environment variable name for diagnostics.
Sourcepub fn manifest_env_var(self, env_var: impl Into<String>) -> Self
pub fn manifest_env_var(self, env_var: impl Into<String>) -> Self
Preserve the Cargo manifest environment variable name for diagnostics.
Sourcepub fn package(self, package: impl Into<String>) -> Self
pub fn package(self, package: impl Into<String>) -> Self
Set the Lake package name used by the Lean initializer.
Sourcepub fn module(self, module: impl Into<String>) -> Self
pub fn module(self, module: impl Into<String>) -> Self
Set the root Lean module name initialized by Rust.
Sourcepub fn dependency(self, dependency: LeanLibraryDependency) -> Self
pub fn dependency(self, dependency: LeanLibraryDependency) -> Self
Add a dependent Lean dylib that must stay alive with this capability.
This is primarily a bridge until lean-toolchain emits artifact
manifests. Manifest-backed opening will feed the same dependency
descriptors into the bundle loader.
Sourcepub fn dependencies(
self,
dependencies: impl IntoIterator<Item = LeanLibraryDependency>,
) -> Self
pub fn dependencies( self, dependencies: impl IntoIterator<Item = LeanLibraryDependency>, ) -> Self
Add multiple dependent Lean dylibs that must stay alive with this capability.
Sourcepub fn package_name(&self) -> Option<&str>
pub fn package_name(&self) -> Option<&str>
Return the configured package name.
Sourcepub fn module_name(&self) -> Option<&str>
pub fn module_name(&self) -> Option<&str>
Return the configured module name.
Sourcepub fn dependency_descriptors(&self) -> &[LeanLibraryDependency]
pub fn dependency_descriptors(&self) -> &[LeanLibraryDependency]
Dependency dylibs that will be opened before the primary capability.
Sourcepub fn dylib_path(&self) -> LeanResult<PathBuf>
pub fn dylib_path(&self) -> LeanResult<PathBuf>
Resolve the capability dylib path.
§Errors
Returns a host module-initialization error if neither a path nor a readable environment variable is configured.
Sourcepub fn resolved_manifest_path(&self) -> LeanResult<PathBuf>
pub fn resolved_manifest_path(&self) -> LeanResult<PathBuf>
Resolve the build artifact manifest path.
§Errors
Returns a host module-initialization error if neither a path nor a readable manifest environment variable is configured.
Trait Implementations§
Source§impl Clone for LeanBuiltCapability
impl Clone for LeanBuiltCapability
Source§fn clone(&self) -> LeanBuiltCapability
fn clone(&self) -> LeanBuiltCapability
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 LeanBuiltCapability
impl Debug for LeanBuiltCapability
Source§impl From<&BuiltLeanCapability> for LeanBuiltCapability
impl From<&BuiltLeanCapability> for LeanBuiltCapability
Source§fn from(value: &BuiltLeanCapability) -> Self
fn from(value: &BuiltLeanCapability) -> Self
Source§impl PartialEq for LeanBuiltCapability
impl PartialEq for LeanBuiltCapability
Source§fn eq(&self, other: &LeanBuiltCapability) -> bool
fn eq(&self, other: &LeanBuiltCapability) -> bool
self and other values to be equal, and is used by ==.