diff --git a/Cargo.lock b/Cargo.lock index 273dd754..9def2e02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "wrpc-runtime-wasmtime" -version = "0.17.5" +version = "0.17.6" dependencies = [ "anyhow", "bytes", diff --git a/crates/runtime-wasmtime/Cargo.toml b/crates/runtime-wasmtime/Cargo.toml index ac576d53..349865c1 100644 --- a/crates/runtime-wasmtime/Cargo.toml +++ b/crates/runtime-wasmtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wrpc-runtime-wasmtime" -version = "0.17.5" +version = "0.17.6" description = "wRPC wasmtime integration" authors.workspace = true diff --git a/crates/runtime-wasmtime/src/lib.rs b/crates/runtime-wasmtime/src/lib.rs index 2014bd99..9777a9a4 100644 --- a/crates/runtime-wasmtime/src/lib.rs +++ b/crates/runtime-wasmtime/src/lib.rs @@ -1067,7 +1067,6 @@ pub trait ServeExt: wrpc_transport::Serve { /// Serve [`types::ComponentItem`] fn serve_item( &self, - engine: &Engine, instance: &Instance, ty: types::ComponentItem, store: impl Into>>>, @@ -1116,6 +1115,7 @@ pub trait ServeExt: wrpc_transport::Serve { } types::ComponentItem::ComponentInstance(ty) => { let mut instance_store = store.lock().await; + let engine = instance_store.engine().clone(); let mut instance = instance.exports(&mut *instance_store); let mut instance = instance .instance(name) @@ -1123,7 +1123,7 @@ pub trait ServeExt: wrpc_transport::Serve { let instance_name = name; let mut invocations: SelectAll + Send>>> = SelectAll::new(); - for (name, ty) in ty.exports(engine) { + for (name, ty) in ty.exports(&engine) { match ty { types::ComponentItem::ComponentFunc(_) => { debug!(name, "serving instance function export"); @@ -1170,7 +1170,6 @@ pub trait ServeExt: wrpc_transport::Serve { /// Serve all exports of this [`InstancePre`] fn serve_exports( &self, - engine: &Engine, instance: InstancePre, mut store: wasmtime::Store, ) -> impl Future< @@ -1180,8 +1179,9 @@ pub trait ServeExt: wrpc_transport::Serve { T: WasiView + 'static, { async move { + let engine = store.engine().clone(); let ty = instance.component().component_type(); - let exports = ty.exports(engine); + let exports = ty.exports(&engine); let instance = instance .instantiate_async(&mut store) .await @@ -1191,7 +1191,7 @@ pub trait ServeExt: wrpc_transport::Serve { SelectAll::new(); for (name, ty) in exports { let s = self - .serve_item(engine, &instance, ty, Arc::clone(&store), "", name) + .serve_item(&instance, ty, Arc::clone(&store), "", name) .await?; invocations.push(Box::pin(s)); }