Implement Send for everything except Memory

This commit is contained in:
Mark McCaskey
2019-09-17 11:45:13 -07:00
parent 17a0e78cef
commit 9e9343878d
6 changed files with 41 additions and 21 deletions

View File

@ -207,11 +207,9 @@ impl Extend<(String, String, Export)> for ImportObject {
}
pub struct Namespace {
map: HashMap<String, Box<dyn IsExport>>,
map: HashMap<String, Box<dyn IsExport + Send>>,
}
unsafe impl Send for Namespace {}
impl Namespace {
pub fn new() -> Self {
Self {
@ -219,10 +217,10 @@ impl Namespace {
}
}
pub fn insert<S, E>(&mut self, name: S, export: E) -> Option<Box<dyn IsExport>>
pub fn insert<S, E>(&mut self, name: S, export: E) -> Option<Box<dyn IsExport + Send>>
where
S: Into<String>,
E: IsExport + 'static,
E: IsExport + Send + 'static,
{
self.map.insert(name.into(), Box::new(export))
}