Struct wasmer_runtime_fl::cache::FileSystemCache[][src]

pub struct FileSystemCache { /* fields omitted */ }
Expand description

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)
}

Implementations

Construct a new FileSystemCache around the specified directory. The contents of the cache are stored in sub-versioned directories.

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

Error type to return when load error occurs

Error type to return when store error occurs

loads a module using the default Backend

loads a cached module using a specific Backend

Store a module into the cache with the given key

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.