Struct wasmer_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::{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
Construct a new FileSystemCache
around the specified directory.
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
type DeserializeError = DeserializeError
type DeserializeError = DeserializeError
The deserialization error for the implementation
type SerializeError = SerializeError
type SerializeError = SerializeError
The serialization error for the implementation
Auto Trait Implementations
impl RefUnwindSafe for FileSystemCache
impl Send for FileSystemCache
impl Sync for FileSystemCache
impl Unpin for FileSystemCache
impl UnwindSafe for FileSystemCache
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self