diff --git a/lib/api/src/sys/module.rs b/lib/api/src/sys/module.rs index 8eda10b2811..ea96c7fe681 100644 --- a/lib/api/src/sys/module.rs +++ b/lib/api/src/sys/module.rs @@ -307,11 +307,11 @@ impl Module { /// # } /// ``` pub unsafe fn deserialize( - store: &impl AsStoreRef, + engine: &impl AsEngineRef, bytes: impl IntoBytes, ) -> Result { let bytes = bytes.into_bytes(); - let artifact = store.as_store_ref().engine().deserialize(&bytes)?; + let artifact = engine.as_engine_ref().engine().deserialize(&bytes)?; Ok(Self::from_artifact(artifact)) } @@ -334,11 +334,11 @@ impl Module { /// # } /// ``` pub unsafe fn deserialize_from_file( - store: &impl AsStoreRef, + engine: &impl AsEngineRef, path: impl AsRef, ) -> Result { - let artifact = store - .as_store_ref() + let artifact = engine + .as_engine_ref() .engine() .deserialize_from_file(path.as_ref())?; Ok(Self::from_artifact(artifact)) diff --git a/lib/cache/src/cache.rs b/lib/cache/src/cache.rs index 057238dabaf..a2b4f5ec58a 100644 --- a/lib/cache/src/cache.rs +++ b/lib/cache/src/cache.rs @@ -4,7 +4,7 @@ use crate::hash::Hash; use std::error::Error; -use wasmer::{Module, Store}; +use wasmer::{Module, AsEngineRef}; /// A generic cache for storing and loading compiled wasm modules. pub trait Cache { @@ -17,7 +17,7 @@ pub trait Cache { /// /// # Safety /// This function is unsafe as the cache store could be tampered with. - unsafe fn load(&self, store: &Store, key: Hash) -> Result; + unsafe fn load(&self, engine: &impl AsEngineRef, key: Hash) -> Result; /// Store a [`Module`] into the cache with the given [`Hash`]. fn store(&mut self, key: Hash, module: &Module) -> Result<(), Self::SerializeError>; diff --git a/lib/cache/src/filesystem.rs b/lib/cache/src/filesystem.rs index b16e4601a86..ed592d392b5 100644 --- a/lib/cache/src/filesystem.rs +++ b/lib/cache/src/filesystem.rs @@ -4,7 +4,7 @@ use crate::hash::Hash; use std::fs::{create_dir_all, File}; use std::io::{self, Write}; use std::path::PathBuf; -use wasmer::{DeserializeError, Module, SerializeError, Store}; +use wasmer::{DeserializeError, Module, SerializeError, AsEngineRef}; /// Representation of a directory that contains compiled wasm artifacts. /// @@ -91,14 +91,14 @@ impl Cache for FileSystemCache { type DeserializeError = DeserializeError; type SerializeError = SerializeError; - unsafe fn load(&self, store: &Store, key: Hash) -> Result { + unsafe fn load(&self, engine: &impl AsEngineRef, key: Hash) -> Result { let filename = if let Some(ref ext) = self.ext { format!("{}.{}", key.to_string(), ext) } else { key.to_string() }; let path = self.path.join(filename); - Module::deserialize_from_file(store, path) + Module::deserialize_from_file(engine, path) } fn store(&mut self, key: Hash, module: &Module) -> Result<(), Self::SerializeError> {