Implement it for memory and make Instance Send

This commit is contained in:
Mark McCaskey
2019-09-17 14:58:26 -07:00
parent 9e9343878d
commit 83c3909b00
7 changed files with 37 additions and 24 deletions

View File

@ -46,7 +46,8 @@ impl IsExport for Export {
/// ```
pub struct ImportObject {
map: Arc<Mutex<HashMap<String, Box<dyn LikeNamespace + Send>>>>,
pub(crate) state_creator: Option<Arc<dyn Fn() -> (*mut c_void, fn(*mut c_void)) + Send>>,
pub(crate) state_creator:
Option<Arc<dyn Fn() -> (*mut c_void, fn(*mut c_void)) + Send + Sync + 'static>>,
pub allow_missing_functions: bool,
}
@ -62,7 +63,7 @@ impl ImportObject {
pub fn new_with_data<F>(state_creator: F) -> Self
where
F: Fn() -> (*mut c_void, fn(*mut c_void)) + 'static + Send,
F: Fn() -> (*mut c_void, fn(*mut c_void)) + 'static + Send + Sync,
{
Self {
map: Arc::new(Mutex::new(HashMap::new())),