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).
Sourcepub fn invoke_bytes(
&self,
method: &str,
payload: &[u8],
) -> Result<Vec<u8>, ComponentError>
pub fn invoke_bytes( &self, method: &str, payload: &[u8], ) -> Result<Vec<u8>, ComponentError>
Invoke a named bytes-only method on this contract’s stdio component.
Native typed function tables require their generated bindings and do not implement this operation. Stdio components likewise cannot expose typed C function tables.
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.