Trait UtilsExt

Source
pub trait UtilsExt {
    // Required methods
    fn console_log<V>(&self, args: &[V]) -> Result<()>
       where V: NapiValue;
    fn create_promise<Res>(
        &self,
        executor: Box<dyn FnOnce(Env, Box<dyn Fn(Res)>, Box<dyn Fn(Error)>) -> Result<()>>,
    ) -> Result<JsObject>
       where Res: NapiValue + 'static;
}

Required Methods§

Source

fn console_log<V>(&self, args: &[V]) -> Result<()>
where V: NapiValue,

Runs console.log() in the JavaScript context. useful for debugging NapiValue types

Source

fn create_promise<Res>( &self, executor: Box<dyn FnOnce(Env, Box<dyn Fn(Res)>, Box<dyn Fn(Error)>) -> Result<()>>, ) -> Result<JsObject>
where Res: NapiValue + 'static,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UtilsExt for Env

Source§

fn console_log<V>(&self, args: &[V]) -> Result<()>
where V: NapiValue,

Source§

fn create_promise<Res>( &self, executor: Box<dyn FnOnce(Env, Box<dyn Fn(Res)>, Box<dyn Fn(Error)>) -> Result<()>>, ) -> Result<JsObject>
where Res: NapiValue + 'static,

Implementors§