pub fn from_source(source: &[u8]) -> errors::Result<Self> {
        let store = Store::default();
        let module = Module::new(&store, source)?;
        let mut env = wasmer::Exports::new();
        let garbage: Arc<Mutex<Vec<FatPointer>>> = Default::default();
        env.insert(
            "abort",
            Function::new_native(&store, |_: u32, _: u32, _: i32, _: i32| {}),
        );
        #[cfg(feature = "inject_getrandom")]
        {
            env.insert(
                "__getrandom",
                Function::new_native_with_env(
                    &store,
                    Env::new(garbage.clone(), ()),
                    getrandom_shim,
                ),
            );
        }

        Ok(Self {
            module,
            store,
            env,
            garbage,
        })
    }
/// Load a plugin from WASM source and prepare it for use.
Load a plugin from WASM source and prepare it for use.
Load a plugin from WASM source and prepare it for use .
pub fn from_source(source: &[u8]) -> errors::Result<Self> {
        let store = Store::default();
        let module = Module::new(&store, source)?;
        let mut env = wasmer::Exports::new();
        let garbage: Arc<Mutex<Vec<FatPointer>>> = Default::default();
        env.insert(
            "abort",
            Function::new_native(&store, |_: u32, _: u32, _: i32, _: i32| {}),
        );
        #[cfg(feature = "inject_getrandom")]
        {
            env.insert(
                "__getrandom",
                Function::new_native_with_env(
                    &store,
                    Env::new(garbage.clone(), ()),
                    getrandom_shim,
                ),
            );
        }
        Ok(Self {
            module,
            store,
            env,
            garbage,
        })
    }
pub fn from_source ( source : & [ u8 ] ) -> errors :: Result < Self > { let store = Store :: default ( ) ; let module = Module :: new ( & store , source ) ? ; let mut env = wasmer :: Exports :: new ( ) ; let garbage : Arc < Mutex < Vec < FatPointer > > > = Default :: default ( ) ; env . insert ( " " , Function :: new_native ( & store , | _ : u32 , _ : u32 , _ : i32 , _ : i32 | { } ) , ) ; # [ cfg ( feature " " ) ] { env . insert ( " " , Function :: new_native_with_env ( & store , Env :: new ( garbage . clone ( ) , ( ) ) , getrandom_shim , ) , ) ; } Ok ( Self { module , store , env , garbage , } ) }
Load a plugin from WASM source and prepare it for use.
Load a plugin from WASM source and prepare it for use .
source
&[u8]