JsInterop

Trait JsInterop 

Source
pub trait JsInterop:
    Any
    + Debug
    + 'static {
    // Required method
    fn call(
        &mut self,
        engine: &mut DukContext,
        func_name: &str,
    ) -> Result<Return, JsError>;

    // Provided methods
    unsafe fn alloc(&mut self, size: usize) -> *mut u8 { ... }
    unsafe fn realloc(&mut self, ptr: *mut u8, size: usize) -> *mut u8 { ... }
    unsafe fn free(&mut self, ptr: *mut u8) { ... }
    fn fatal(&mut self, msg: &str) -> ! { ... }
    fn console(&mut self, func: ConsoleFunc, msg: &str) { ... }
}

Required Methods§

Source

fn call( &mut self, engine: &mut DukContext, func_name: &str, ) -> Result<Return, JsError>

Provided Methods§

Source

unsafe fn alloc(&mut self, size: usize) -> *mut u8

Source

unsafe fn realloc(&mut self, ptr: *mut u8, size: usize) -> *mut u8

Source

unsafe fn free(&mut self, ptr: *mut u8)

Source

fn fatal(&mut self, msg: &str) -> !

Source

fn console(&mut self, func: ConsoleFunc, msg: &str)

Implementations§

Source§

impl dyn JsInterop

Source

pub fn downcast_ref<T: JsInterop>(&self) -> Option<&T>

Source

pub fn downcast_mut<T: JsInterop>(&mut self) -> Option<&mut T>

Implementors§