Struct wasmer_cache::FileSystemCache [−][src]
Representation of a directory that contains compiled wasm artifacts.
The FileSystemCache
type implements the Cache
trait, which allows it to be used
generically when some sort of cache is required.
Usage
use wasmer::{DeserializeError, SerializeError}; use wasmer_cache::{Cache, FileSystemCache, Hash}; fn store_module(module: &Module, bytes: &[u8]) -> Result<(), SerializeError> { // Create a new file system cache. let mut fs_cache = FileSystemCache::new("some/directory/goes/here")?; // Compute a key for a given WebAssembly binary let key = Hash::generate(bytes); // Store a module into the cache given a key fs_cache.store(key, module)?; Ok(()) }
Implementations
impl FileSystemCache
[src]
pub fn new<P: Into<PathBuf>>(path: P) -> Result<Self>
[src]
Construct a new FileSystemCache
around the specified directory.
pub fn set_cache_extension(&mut self, ext: Option<impl ToString>)
[src]
Set the extension for this cached file.
This is needed for loading native files from Windows, as otherwise
loading the library will fail (it requires a .dll
extension)
Trait Implementations
impl Cache for FileSystemCache
[src]
type DeserializeError = DeserializeError
The deserialization error for the implementation
type SerializeError = SerializeError
The serialization error for the implementation
unsafe fn load(
&self,
store: &Store,
key: Hash
) -> Result<Module, Self::DeserializeError>
[src]
&self,
store: &Store,
key: Hash
) -> Result<Module, Self::DeserializeError>
fn store(
&mut self,
key: Hash,
module: &Module
) -> Result<(), Self::SerializeError>
[src]
&mut self,
key: Hash,
module: &Module
) -> Result<(), Self::SerializeError>
Auto Trait Implementations
impl RefUnwindSafe for FileSystemCache
[src]
impl Send for FileSystemCache
[src]
impl Sync for FileSystemCache
[src]
impl Unpin for FileSystemCache
[src]
impl UnwindSafe for FileSystemCache
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,