mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-26 23:21:35 +00:00
Remove generated spectest codes from repo.
This commit is contained in:
@ -5,17 +5,6 @@ pub trait Namespace {
|
||||
fn get_export(&self, name: &str) -> Option<Export>;
|
||||
}
|
||||
|
||||
impl Namespace for HashMap<String, Export> {
|
||||
fn get_export(&self, name: &str) -> Option<Export> {
|
||||
self.get(name).cloned()
|
||||
}
|
||||
}
|
||||
impl<'a> Namespace for HashMap<&'a str, Export> {
|
||||
fn get_export(&self, name: &str) -> Option<Export> {
|
||||
self.get(name).cloned()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Imports {
|
||||
map: HashMap<String, Box<dyn Namespace>>,
|
||||
}
|
||||
@ -45,3 +34,25 @@ impl Imports {
|
||||
self.map.get(namespace).map(|namespace| &**namespace)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NamespaceMap {
|
||||
map: HashMap<String, Export>
|
||||
}
|
||||
|
||||
impl NamespaceMap {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
map: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(&mut self, name: impl Into<String>, export: Export) -> Option<Export> {
|
||||
self.map.insert(name.into(), export)
|
||||
}
|
||||
}
|
||||
|
||||
impl Namespace for NamespaceMap {
|
||||
fn get_export(&self, name: &str) -> Option<Export> {
|
||||
self.map.get(name).cloned()
|
||||
}
|
||||
}
|
@ -42,7 +42,8 @@ impl Module {
|
||||
}
|
||||
|
||||
/// Instantiate a webassembly module with the provided imports.
|
||||
pub fn instantiate(&self, imports: &Imports) -> Result<Instance, String> {
|
||||
pub fn instantiate(&self, imports: &Imports) -> Result<Instance, String>
|
||||
{
|
||||
Instance::new(Rc::clone(&self.0), imports)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user