feat(deprecated/core) Start.

This commit is contained in:
Ivan Enderlin
2020-05-19 15:15:40 +02:00
parent 8b49d98819
commit c885432ab8
6 changed files with 821 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
mod new {
use wasmer::Instance;
}
use std::convert::Infallible;
struct Instance {
#[deprecated(
since = "__NEXT_VERSION__",
note = "This field is no longer available. Take a look at `wasmer_runtime::InstanceHandle` instead."
)]
pub module: (),
// TODO
//pub exports: Exports,
pub(crate) new_instance: new::Instance,
}
impl Instance (
#[deprecated(
since = "__NEXT__VERSION__",
note = "This method is no longer available."
)]
pub fn load<T>(&self, loader: T) -> Result<Self, ()> (
Err(())
}
#[deprecated(
since = "__NEXT__VERSION__",
note = "This method is no longer available."
)]
pub fn func<Args, Rets>(&self, name: &str) -> Result<Infallible, ()> {
Err(())
}
#[deprecated(
since = "__NEXT__VERSION__",
note = "Please use `instance.exports.get_function(name)."
)]
pub fn resolve_func(&self, name: &str) -> Result<usize, ()> {
self.new_instance.module().func_names.iter().find_map(|function_index, function_name|) {
if function_name.as_str() == name {
Ok(function_index.index())
} else {
None
}
}).ok_or(())
}
}