pub struct NativeArtifact { /* private fields */ }Expand description
A compiled wasm module, ready to be instantiated.
Implementations§
Source§impl NativeArtifact
impl NativeArtifact
Sourcepub fn is_deserializable(bytes: &[u8]) -> bool
pub fn is_deserializable(bytes: &[u8]) -> bool
Check if the provided bytes look like NativeArtifact.
This means, if the bytes look like a shared object file in the target system.
Sourcepub fn get_default_extension(triple: &Triple) -> &'static str
pub fn get_default_extension(triple: &Triple) -> &'static str
Get the default extension when serializing this artifact
Sourcepub fn from_parts_crosscompiled(
metadata: ModuleMetadata,
sharedobject_path: PathBuf,
) -> Result<Self, CompileError>
pub fn from_parts_crosscompiled( metadata: ModuleMetadata, sharedobject_path: PathBuf, ) -> Result<Self, CompileError>
Construct a NativeArtifact from component parts.
Sourcepub fn from_parts(
engine_inner: &mut NativeEngineInner,
metadata: ModuleMetadata,
sharedobject_path: PathBuf,
lib: Library,
) -> Result<Self, CompileError>
pub fn from_parts( engine_inner: &mut NativeEngineInner, metadata: ModuleMetadata, sharedobject_path: PathBuf, lib: Library, ) -> Result<Self, CompileError>
Construct a NativeArtifact from component parts.
Sourcepub fn new(_engine: &NativeEngine, _data: &[u8]) -> Result<Self, CompileError>
pub fn new(_engine: &NativeEngine, _data: &[u8]) -> Result<Self, CompileError>
Compile a data buffer into a NativeArtifact, which may then be instantiated.
Sourcepub unsafe fn deserialize(
engine: &NativeEngine,
bytes: &[u8],
) -> Result<Self, DeserializeError>
pub unsafe fn deserialize( engine: &NativeEngine, bytes: &[u8], ) -> Result<Self, DeserializeError>
Deserialize a NativeArtifact from bytes.
§Safety
The bytes must represent a serialized WebAssembly module.
Sourcepub unsafe fn deserialize_from_file(
engine: &NativeEngine,
path: &Path,
) -> Result<Self, DeserializeError>
pub unsafe fn deserialize_from_file( engine: &NativeEngine, path: &Path, ) -> Result<Self, DeserializeError>
Deserialize a NativeArtifact from a file path.
§Safety
The file’s content must represent a serialized WebAssembly module.
Sourcepub unsafe fn deserialize_from_file_unchecked(
engine: &NativeEngine,
path: &Path,
) -> Result<Self, DeserializeError>
pub unsafe fn deserialize_from_file_unchecked( engine: &NativeEngine, path: &Path, ) -> Result<Self, DeserializeError>
Deserialize a NativeArtifact from a file path (unchecked).
§Safety
The file’s content must represent a serialized WebAssembly module.
Trait Implementations§
Source§impl Artifact for NativeArtifact
impl Artifact for NativeArtifact
Source§fn module(&self) -> Arc<ModuleInfo>
fn module(&self) -> Arc<ModuleInfo>
Return a reference-counted pointer to the module
Source§fn module_ref(&self) -> &ModuleInfo
fn module_ref(&self) -> &ModuleInfo
Return a pointer to a module.
Source§fn module_mut(&mut self) -> Option<&mut ModuleInfo>
fn module_mut(&mut self) -> Option<&mut ModuleInfo>
Gets a mutable reference to the info. Read more
Source§fn register_frame_info(&self)
fn register_frame_info(&self)
Register thie
Artifact stack frame information into the global scope. Read moreSource§fn data_initializers(&self) -> &[OwnedDataInitializer]
fn data_initializers(&self) -> &[OwnedDataInitializer]
Returns data initializers to pass to
InstanceHandle::initializeSource§fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
Returns the memory styles associated with this
Artifact.Source§fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
Returns the table plans associated with this
Artifact.Source§fn finished_functions(&self) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>
fn finished_functions(&self) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>
Returns the functions allocated in memory or this
Artifact
ready to be run.Source§fn finished_function_call_trampolines(
&self,
) -> &BoxedSlice<SignatureIndex, VMTrampoline>
fn finished_function_call_trampolines( &self, ) -> &BoxedSlice<SignatureIndex, VMTrampoline>
Returns the function call trampolines allocated in memory of this
Artifact, ready to be run.Source§fn finished_dynamic_function_trampolines(
&self,
) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>
fn finished_dynamic_function_trampolines( &self, ) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>
Returns the dynamic function trampolines allocated in memory
of this
Artifact, ready to be run.Source§fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>
fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>
Returns the associated VM signatures for this
Artifact.Source§fn preinstantiate(&self) -> Result<(), InstantiationError>
fn preinstantiate(&self) -> Result<(), InstantiationError>
Do preinstantiation logic that is executed before instantiating
Source§fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError>
fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError>
Serializes an artifact into a file path
Source§unsafe fn instantiate(
&self,
tunables: &dyn Tunables,
resolver: &dyn Resolver,
host_state: Box<dyn Any>,
) -> Result<InstanceHandle, InstantiationError>
unsafe fn instantiate( &self, tunables: &dyn Tunables, resolver: &dyn Resolver, host_state: Box<dyn Any>, ) -> Result<InstanceHandle, InstantiationError>
Source§unsafe fn finish_instantiation(
&self,
handle: &InstanceHandle,
) -> Result<(), InstantiationError>
unsafe fn finish_instantiation( &self, handle: &InstanceHandle, ) -> Result<(), InstantiationError>
Finishes the instantiation of a just created
InstanceHandle. Read moreAuto Trait Implementations§
impl Freeze for NativeArtifact
impl RefUnwindSafe for NativeArtifact
impl Send for NativeArtifact
impl Sync for NativeArtifact
impl Unpin for NativeArtifact
impl UnwindSafe for NativeArtifact
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more