pub trait ArtifactCreate:
Send
+ Sync
+ Upcastable
+ MemoryUsage {
// Required methods
fn module(&self) -> Arc<ModuleInfo>;
fn module_ref(&self) -> &ModuleInfo;
fn module_mut(&mut self) -> Option<&mut ModuleInfo>;
fn features(&self) -> &Features;
fn cpu_features(&self) -> EnumSet<CpuFeature>;
fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>;
fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>;
fn data_initializers(&self) -> &[OwnedDataInitializer];
fn serialize(&self) -> Result<Vec<u8>, SerializeError>;
// Provided method
fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError> { ... }
}
Expand description
An Artifact
is the product that the Engine
implementation produce and use.
The Artifact
contains the compiled data for a given
module as well as extra information needed to run the
module at runtime, such as ModuleInfo
and Features
.
Required Methods§
Sourcefn module(&self) -> Arc<ModuleInfo>
fn module(&self) -> Arc<ModuleInfo>
Return a reference-counted pointer to the module
Sourcefn module_ref(&self) -> &ModuleInfo
fn module_ref(&self) -> &ModuleInfo
Return a pointer to a module.
Sourcefn module_mut(&mut self) -> Option<&mut ModuleInfo>
fn module_mut(&mut self) -> Option<&mut ModuleInfo>
Gets a mutable reference to the info.
Note: this will return None
if the module is already instantiated.
Sourcefn cpu_features(&self) -> EnumSet<CpuFeature>
fn cpu_features(&self) -> EnumSet<CpuFeature>
Returns the CPU features for this Artifact
Sourcefn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>
Returns the memory styles associated with this Artifact
.
Sourcefn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>
Returns the table plans associated with this Artifact
.
Sourcefn data_initializers(&self) -> &[OwnedDataInitializer]
fn data_initializers(&self) -> &[OwnedDataInitializer]
Returns data initializers to pass to InstanceHandle::initialize
Provided Methods§
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
Implementations§
Source§impl dyn ArtifactCreate
impl dyn ArtifactCreate
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: 'static,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: 'static,
Try to downcast the artifact into a given type.
Sourcepub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: 'static,
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: 'static,
Try to downcast the artifact into a given type mutably.