mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 14:48:27 +00:00
Make automatically the trait Into<Engine> conversions
This commit is contained in:
@@ -92,7 +92,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let global_count = data.g_counter.get(&mut storemut).unwrap_i32();
|
||||
data.g_counter
|
||||
.set(&mut storemut, Value::I32(global_count + add));
|
||||
.set(&mut storemut, Value::I32(global_count + add))
|
||||
.unwrap();
|
||||
|
||||
*counter_ref += add;
|
||||
*counter_ref
|
||||
|
||||
@@ -8,7 +8,7 @@ use wasmer::{
|
||||
};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
// This is to be able to set the tunables
|
||||
use wasmer::WasmerCompilerEngine;
|
||||
use wasmer::NativeEngineExt;
|
||||
|
||||
/// A custom tunables that allows you to set a memory limit.
|
||||
///
|
||||
|
||||
@@ -42,22 +42,12 @@ impl Default for Engine {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<engine_imp::Engine> for Engine {
|
||||
fn from(inner: engine_imp::Engine) -> Self {
|
||||
Self(inner)
|
||||
impl<T: Into<engine_imp::Engine>> From<T> for Engine {
|
||||
fn from(t: T) -> Self {
|
||||
Self(t.into())
|
||||
}
|
||||
}
|
||||
|
||||
// impl<P> Into<Engine> for P
|
||||
// where
|
||||
// P: Into<engine_imp::Engine>
|
||||
// {
|
||||
// fn into(self) -> Engine {
|
||||
// let inner_engine: engine_imp::Engine = self.into();
|
||||
// Engine(inner_engine)
|
||||
// }
|
||||
// }
|
||||
|
||||
/// A temporary handle to an [`Engine`]
|
||||
/// EngineRef can be used to build a [`Module`][wasmer::Module]
|
||||
/// It can be created directly with an [`Engine`]
|
||||
|
||||
@@ -51,18 +51,6 @@ pub(crate) fn default_engine() -> Engine {
|
||||
engine
|
||||
}
|
||||
|
||||
impl From<EngineBuilder> for crate::engine::Engine {
|
||||
fn from(builder: EngineBuilder) -> Self {
|
||||
Self(builder.into())
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<CompilerConfig> for crate::engine::Engine {
|
||||
// fn from(compiler: CompilerConfig) -> Self {
|
||||
// Self(compiler.into())
|
||||
// }
|
||||
// }
|
||||
|
||||
/// The custom trait to access to all the `sys` function in the common
|
||||
/// engine.
|
||||
pub trait NativeEngineExt {
|
||||
|
||||
Reference in New Issue
Block a user