Struct wasmer::UniversalArtifact
source · [−]pub struct UniversalArtifact { /* private fields */ }
Expand description
A compiled wasm module, ready to be instantiated.
Implementations
sourceimpl UniversalArtifact
impl UniversalArtifact
sourcepub fn is_deserializable(bytes: &[u8]) -> bool
pub fn is_deserializable(bytes: &[u8]) -> bool
Check if the provided bytes look like a serialized UniversalArtifact
.
sourcepub fn new(
engine: &UniversalEngine,
data: &[u8],
tunables: &dyn Tunables
) -> Result<UniversalArtifact, CompileError>
pub fn new(
engine: &UniversalEngine,
data: &[u8],
tunables: &dyn Tunables
) -> Result<UniversalArtifact, CompileError>
Compile a data buffer into a UniversalArtifact
, which may then be instantiated.
sourcepub unsafe fn deserialize(
universal: &UniversalEngine,
bytes: &[u8]
) -> Result<UniversalArtifact, DeserializeError>
pub unsafe fn deserialize(
universal: &UniversalEngine,
bytes: &[u8]
) -> Result<UniversalArtifact, DeserializeError>
Deserialize a UniversalArtifact
Safety
This function is unsafe because rkyv reads directly without validating the data.
sourcepub fn from_parts(
inner_engine: &mut UniversalEngineInner,
serializable: SerializableModule
) -> Result<UniversalArtifact, CompileError>
pub fn from_parts(
inner_engine: &mut UniversalEngineInner,
serializable: SerializableModule
) -> Result<UniversalArtifact, CompileError>
Construct a UniversalArtifact
from component parts.
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
Trait Implementations
sourceimpl Artifact for UniversalArtifact
impl Artifact for UniversalArtifact
sourcepub fn module(&self) -> Arc<ModuleInfo>
pub fn module(&self) -> Arc<ModuleInfo>
Return a reference-counted pointer to the module
sourcepub fn module_ref(&self) -> &ModuleInfo
pub fn module_ref(&self) -> &ModuleInfo
Return a pointer to a module.
sourcepub fn module_mut(&mut self) -> Option<&mut ModuleInfo>
pub fn module_mut(&mut self) -> Option<&mut ModuleInfo>
Gets a mutable reference to the info. Read more
sourcepub fn register_frame_info(&self)
pub fn register_frame_info(&self)
Register thie Artifact
stack frame information into the global scope. Read more
sourcepub fn cpu_features(&self) -> EnumSet<CpuFeature>
pub fn cpu_features(&self) -> EnumSet<CpuFeature>
Returns the CPU features for this Artifact
sourcepub fn data_initializers(&self) -> &[OwnedDataInitializer]
pub fn data_initializers(&self) -> &[OwnedDataInitializer]
Returns data initializers to pass to InstanceHandle::initialize
sourcepub fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
pub fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
Returns the memory styles associated with this Artifact
.
sourcepub fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
pub fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
Returns the table plans associated with this Artifact
.
sourcepub fn finished_functions(
&self
) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>
pub fn finished_functions(
&self
) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>
Returns the functions allocated in memory or this Artifact
ready to be run. Read more
sourcepub fn finished_function_call_trampolines(
&self
) -> &BoxedSlice<SignatureIndex, unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
pub fn finished_function_call_trampolines(
&self
) -> &BoxedSlice<SignatureIndex, unsafe extern "C" fn(*mut VMContext, *const VMFunctionBody, *mut u128)>
Returns the function call trampolines allocated in memory of this
Artifact
, ready to be run. Read more
sourcepub fn finished_dynamic_function_trampolines(
&self
) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>
pub fn finished_dynamic_function_trampolines(
&self
) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>
Returns the dynamic function trampolines allocated in memory
of this Artifact
, ready to be run. Read more
sourcepub fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>
pub fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>
Returns the associated VM signatures for this Artifact
.
sourcepub fn func_data_registry(&self) -> &FuncDataRegistry
pub fn func_data_registry(&self) -> &FuncDataRegistry
Get the func data registry
sourcepub fn serialize(&self) -> Result<Vec<u8, Global>, SerializeError>
pub fn serialize(&self) -> Result<Vec<u8, Global>, SerializeError>
Serializes an artifact into bytes
sourcefn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError>
fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError>
Serializes an artifact into a file path
sourcefn preinstantiate(&self) -> Result<(), InstantiationError>
fn preinstantiate(&self) -> Result<(), InstantiationError>
Do preinstantiation logic that is executed before instantiating
sourceunsafe fn instantiate(
&self,
tunables: &dyn Tunables,
resolver: &dyn Resolver,
host_state: Box<dyn Any + 'static, Global>
) -> Result<InstanceHandle, InstantiationError>
unsafe fn instantiate(
&self,
tunables: &dyn Tunables,
resolver: &dyn Resolver,
host_state: Box<dyn Any + 'static, Global>
) -> Result<InstanceHandle, InstantiationError>
Crate an Instance
from this Artifact
. Read more
sourceunsafe fn finish_instantiation(
&self,
trap_handler: &dyn TrapHandler,
handle: &InstanceHandle
) -> Result<(), InstantiationError>
unsafe fn finish_instantiation(
&self,
trap_handler: &dyn TrapHandler,
handle: &InstanceHandle
) -> Result<(), InstantiationError>
Finishes the instantiation of a just created InstanceHandle
. Read more
sourceimpl MemoryUsage for UniversalArtifact
impl MemoryUsage for UniversalArtifact
sourcepub fn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
pub fn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
Returns the size of the referenced value in bytes. Read more
Auto Trait Implementations
impl RefUnwindSafe for UniversalArtifact
impl Send for UniversalArtifact
impl Sync for UniversalArtifact
impl Unpin for UniversalArtifact
impl UnwindSafe for UniversalArtifact
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcepub 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.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more