1use crate::MemoryError;
2use crate::{Memory, Table};
3use crate::{MemoryStyle, TableStyle};
4use crate::{VMMemoryDefinition, VMTableDefinition};
5use std::ptr::NonNull;
6use std::sync::Arc;
7use wasmer_types::{MemoryType, TableType};
8
9pub trait Tunables {
12 fn memory_style(&self, memory: &MemoryType) -> MemoryStyle;
14
15 fn table_style(&self, table: &TableType) -> TableStyle;
17
18 fn create_host_memory(
20 &self,
21 ty: &MemoryType,
22 style: &MemoryStyle,
23 ) -> Result<Arc<dyn Memory>, MemoryError>;
24
25 unsafe fn create_vm_memory(
30 &self,
31 ty: &MemoryType,
32 style: &MemoryStyle,
33 vm_definition_location: NonNull<VMMemoryDefinition>,
34 ) -> Result<Arc<dyn Memory>, MemoryError>;
35
36 fn create_host_table(
38 &self,
39 ty: &TableType,
40 style: &TableStyle,
41 ) -> Result<Arc<dyn Table>, String>;
42
43 unsafe fn create_vm_table(
48 &self,
49 ty: &TableType,
50 style: &TableStyle,
51 vm_definition_location: NonNull<VMTableDefinition>,
52 ) -> Result<Arc<dyn Table>, String>;
53}