feat(api) Rename Extern::from_export to …::from_vm_export.

I hope this little change will clarify a little bit that the `Export`
passed to `Extern::from_vm_export` is not a `wasmer::Export` but a
`wasmer_vm::Export`.
This commit is contained in:
Ivan Enderlin
2020-11-19 11:01:56 +01:00
parent 8e7d7efb40
commit ca89bd5d75
9 changed files with 15 additions and 15 deletions

View File

@@ -431,7 +431,7 @@ impl Function {
Ok(results.into_boxed_slice()) Ok(results.into_boxed_slice())
} }
pub(crate) fn from_export(store: &Store, wasmer_export: ExportFunction) -> Self { pub(crate) fn from_vm_export(store: &Store, wasmer_export: ExportFunction) -> Self {
if let Some(trampoline) = wasmer_export.call_trampoline { if let Some(trampoline) = wasmer_export.call_trampoline {
Self { Self {
store: store.clone(), store: store.clone(),

View File

@@ -180,7 +180,7 @@ impl Global {
Ok(()) Ok(())
} }
pub(crate) fn from_export(store: &Store, wasmer_export: ExportGlobal) -> Self { pub(crate) fn from_vm_export(store: &Store, wasmer_export: ExportGlobal) -> Self {
Self { Self {
store: store.clone(), store: store.clone(),
global: wasmer_export.from, global: wasmer_export.from,

View File

@@ -220,7 +220,7 @@ impl Memory {
unsafe { MemoryView::new(base as _, length as u32) } unsafe { MemoryView::new(base as _, length as u32) }
} }
pub(crate) fn from_export(store: &Store, wasmer_export: ExportMemory) -> Self { pub(crate) fn from_vm_export(store: &Store, wasmer_export: ExportMemory) -> Self {
Self { Self {
store: store.clone(), store: store.clone(),
memory: wasmer_export.from, memory: wasmer_export.from,

View File

@@ -43,13 +43,13 @@ impl Extern {
} }
} }
/// Create an `Extern` from an `Export`. /// Create an `Extern` from an `wasmer_vm::Export`.
pub fn from_export(store: &Store, export: Export) -> Self { pub fn from_vm_export(store: &Store, export: Export) -> Self {
match export { match export {
Export::Function(f) => Self::Function(Function::from_export(store, f)), Export::Function(f) => Self::Function(Function::from_vm_export(store, f)),
Export::Memory(m) => Self::Memory(Memory::from_export(store, m)), Export::Memory(m) => Self::Memory(Memory::from_vm_export(store, m)),
Export::Global(g) => Self::Global(Global::from_export(store, g)), Export::Global(g) => Self::Global(Global::from_vm_export(store, g)),
Export::Table(t) => Self::Table(Table::from_export(store, t)), Export::Table(t) => Self::Table(Table::from_vm_export(store, t)),
} }
} }
} }

View File

@@ -139,7 +139,7 @@ impl Table {
Ok(()) Ok(())
} }
pub(crate) fn from_export(store: &Store, wasmer_export: ExportTable) -> Self { pub(crate) fn from_vm_export(store: &Store, wasmer_export: ExportTable) -> Self {
Self { Self {
store: store.clone(), store: store.clone(),
table: wasmer_export.from, table: wasmer_export.from,

View File

@@ -80,7 +80,7 @@ impl Instance {
.map(|export| { .map(|export| {
let name = export.name().to_string(); let name = export.name().to_string();
let export = handle.lookup(&name).expect("export"); let export = handle.lookup(&name).expect("export");
let extern_ = Extern::from_export(store, export); let extern_ = Extern::from_vm_export(store, export);
(name, extern_) (name, extern_)
}) })
.collect::<Exports>(); .collect::<Exports>();

View File

@@ -82,7 +82,7 @@ impl ValFuncRef for Val {
vmctx: item.vmctx, vmctx: item.vmctx,
call_trampoline: None, call_trampoline: None,
}; };
let f = Function::from_export(store, export); let f = Function::from_vm_export(store, export);
Self::FuncRef(f) Self::FuncRef(f)
} }
} }

View File

@@ -335,7 +335,7 @@ unsafe fn wasi_get_imports_inner(
import_type.name() import_type.name()
), ),
})); }));
let inner = Extern::from_export(store, export); let inner = Extern::from_vm_export(store, export);
Some(Box::new(wasm_extern_t { Some(Box::new(wasm_extern_t {
instance: None, instance: None,

View File

@@ -159,12 +159,12 @@ impl Module {
( (
(namespace, name), (namespace, name),
new::wasmer::Extern::from_export(store, Export::Function(function)), new::wasmer::Extern::from_vm_export(store, Export::Function(function)),
) )
} }
export => ( export => (
(namespace, name), (namespace, name),
new::wasmer::Extern::from_export(store, export), new::wasmer::Extern::from_vm_export(store, export),
), ),
}) })
.for_each(|((namespace, name), extern_)| { .for_each(|((namespace, name), extern_)| {