[−][src]Struct wasmer_runtime::cache::FileSystemCache
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_runtime::cache::{Cache, FileSystemCache, WasmHash}; fn store_module(module: Module) -> Result<Module, CacheError> { // Create a new file system cache. // This is unsafe because we can't ensure that the artifact wasn't // corrupted or tampered with. let mut fs_cache = unsafe { FileSystemCache::new("some/directory/goes/here")? }; // Compute a key for a given WebAssembly binary let key = WasmHash::generate(&[]); // Store a module into the cache given a key fs_cache.store(key, module.clone())?; Ok(module) }
Methods
impl FileSystemCache[src]
pub unsafe fn new<P: Into<PathBuf>>(path: P) -> Result<Self>[src]
Construct a new FileSystemCache around the specified directory.
Note:
This method is unsafe because there's no way to ensure the artifacts stored in this cache haven't been corrupted or tampered with.
Trait Implementations
impl Cache for FileSystemCache[src]
type LoadError = CacheError
type StoreError = CacheError
fn load(&self, key: WasmHash) -> Result<Module, CacheError>[src]
fn store(&mut self, key: WasmHash, module: Module) -> Result<(), CacheError>[src]
Auto Trait Implementations
impl Send for FileSystemCache
impl Sync for FileSystemCache
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.