pub trait InitContext<F: Factor> {
type StoreData: Send + 'static;
// Required methods
fn linker(&mut self) -> &mut Linker<Self::StoreData>;
fn get_data_with_table(
store: &mut Self::StoreData,
) -> (&mut FactorInstanceState<F>, &mut ResourceTable);
// Provided methods
fn get_data(store: &mut Self::StoreData) -> &mut FactorInstanceState<F> { ... }
fn link_bindings(
&mut self,
add_to_linker: impl Fn(&mut Linker<Self::StoreData>, fn(&mut Self::StoreData) -> &mut FactorInstanceState<F>) -> Result<()>,
) -> Result<()> { ... }
}
Expand description
An InitContext is passed to Factor::init
, giving access to the global
common wasmtime::component::Linker
.
Required Associated Types§
Required Methods§
Sourcefn linker(&mut self) -> &mut Linker<Self::StoreData>
fn linker(&mut self) -> &mut Linker<Self::StoreData>
Returns a mutable reference to the wasmtime::component::Linker
.
Sourcefn get_data_with_table(
store: &mut Self::StoreData,
) -> (&mut FactorInstanceState<F>, &mut ResourceTable)
fn get_data_with_table( store: &mut Self::StoreData, ) -> (&mut FactorInstanceState<F>, &mut ResourceTable)
Get the instance state for this factor from the store’s state, with the resource table as well.
Provided Methods§
Sourcefn get_data(store: &mut Self::StoreData) -> &mut FactorInstanceState<F>
fn get_data(store: &mut Self::StoreData) -> &mut FactorInstanceState<F>
Get the instance state for this factor from the store’s state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.