pub struct LoadedComponent { /* private fields */ }Implementations§
Source§impl LoadedComponent
impl LoadedComponent
Sourcepub fn load(
path: impl Into<PathBuf>,
entry_symbol: &[u8],
requirements: &ComponentRequirements,
host: AlefHostApiV1,
) -> Result<Self, ComponentError>
pub fn load( path: impl Into<PathBuf>, entry_symbol: &[u8], requirements: &ComponentRequirements, host: AlefHostApiV1, ) -> Result<Self, ComponentError>
Load one contract’s descriptor from a component’s shared library.
A component that provides several contracts exports one entry point
per contract (alef_component_entry_v1_<contract>, see
alef::codegen::component::entry_point_symbol); entry_symbol is that
NUL-terminated symbol name, so this loads exactly one contract’s
descriptor per call even when the underlying .so/.dylib/.dll is
shared across several LoadedComponents.
Sourcepub fn load_with_services(
path: impl Into<PathBuf>,
entry_symbol: &[u8],
requirements: &ComponentRequirements,
host: AlefHostApiV1,
services: Option<Arc<dyn HostServices>>,
) -> Result<Self, ComponentError>
pub fn load_with_services( path: impl Into<PathBuf>, entry_symbol: &[u8], requirements: &ComponentRequirements, host: AlefHostApiV1, services: Option<Arc<dyn HostServices>>, ) -> Result<Self, ComponentError>
Like Self::load, additionally publishing services through the host table’s
service_call / service_notify callbacks. With None the service fields of host
are passed through unchanged (null by default, so components see no service table).
pub fn component_id(&self) -> &str
pub fn component_version(&self) -> &str
pub fn descriptor(&self) -> &AlefComponentV1
pub fn contract(&self) -> *const c_void
pub fn contract_size(&self) -> usize
pub fn contract_table<T: AlefContract>(&self) -> Result<&T, ComponentError>
Sourcepub fn instantiate<T: AlefContract>(
self: &Arc<Self>,
) -> Result<ComponentInstance<T>, ComponentError>
pub fn instantiate<T: AlefContract>( self: &Arc<Self>, ) -> Result<ComponentInstance<T>, ComponentError>
Create an instance and bind it to a generated contract-table type.
pub fn host_api(&self) -> &AlefHostApiV1
pub fn strong_library_references(&self) -> usize
Trait Implementations§
impl Send for LoadedComponent
impl Sync for LoadedComponent
Auto Trait Implementations§
impl !RefUnwindSafe for LoadedComponent
impl !UnwindSafe for LoadedComponent
impl Freeze for LoadedComponent
impl Unpin for LoadedComponent
impl UnsafeUnpin for LoadedComponent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more