Struct kg_js::JsEngine

source ·
pub struct JsEngine { /* private fields */ }

Implementations§

source§

impl JsEngine

source

pub fn new() -> Self

source

pub fn with_interop<I: JsInterop>(interop: I) -> Self

source

pub fn version() -> u32

source

pub fn version_info() -> &'static str

source

pub fn interop(&self) -> Pin<&dyn JsInterop>

source

pub fn interop_as<I: JsInterop>(&self) -> Pin<&I>

source

pub fn interop_mut(&mut self) -> Pin<&mut dyn JsInterop>

source

pub fn interop_as_mut<I: JsInterop>(&mut self) -> Pin<&mut I>

source

pub fn normalize_index(&self, index: i32) -> i32

source

pub fn get_top(&self) -> i32

source

pub fn dup(&mut self, index: i32)

source

pub fn remove(&mut self, index: i32)

source

pub fn pop(&mut self)

source

pub fn pop_n(&mut self, n: i32)

source

pub fn swap(&mut self, idx1: i32, idx2: i32)

source

pub fn push_this(&mut self)

source

pub fn push_global_object(&mut self)

source

pub fn push_boolean(&mut self, value: bool)

source

pub fn push_null(&mut self)

source

pub fn push_undefined(&mut self)

source

pub fn push_i32(&mut self, value: i32)

source

pub fn push_u32(&mut self, value: u32)

source

pub fn push_number(&mut self, value: f64)

source

pub fn push_string(&mut self, value: &str)

source

pub fn push_object(&mut self) -> i32

source

pub fn push_ext_buffer(&mut self, data: &[u8])

source

pub fn push_array(&mut self) -> i32

source

pub fn push_function(&mut self, func_name: &str, nargs: i32)

source

pub fn put_prop_function(&mut self, obj_index: i32, func_name: &str, nargs: i32)

source

pub fn put_global_function(&mut self, func_name: &str, nargs: i32)

source

pub fn get_type(&self, index: i32) -> DukType

source

pub fn is_string(&self, index: i32) -> bool

source

pub fn is_number(&self, index: i32) -> bool

source

pub fn is_object(&self, index: i32) -> bool

source

pub fn is_array(&self, index: i32) -> bool

source

pub fn is_pure_object(&self, index: i32) -> bool

source

pub fn get_string(&mut self, index: i32) -> &str

source

pub fn get_buffer(&mut self, index: i32) -> &[u8]

source

pub fn get_number(&mut self, index: i32) -> f64

source

pub fn get_boolean(&mut self, index: i32) -> bool

source

pub fn get_prop(&mut self, obj_index: i32) -> bool

source

pub fn put_prop(&mut self, obj_index: i32)

source

pub fn get_prop_string(&mut self, obj_index: i32, key: &str) -> bool

source

pub fn put_prop_string(&mut self, obj_index: i32, key: &str)

source

pub fn get_prop_index(&mut self, obj_index: i32, index: u32) -> bool

source

pub fn put_prop_index(&mut self, obj_index: i32, index: u32)

source

pub fn get_global_string(&mut self, key: &str) -> bool

source

pub fn put_global_string(&mut self, key: &str)

source

pub fn get_length(&mut self, obj_index: i32) -> usize

source

pub fn call_prop(&mut self, obj_index: i32, nargs: usize)

source

pub fn pcall(&mut self, nargs: usize) -> Result<(), i32>

source

pub fn pcall_method(&mut self, nargs: usize) -> Result<(), i32>

source

pub fn pcall_prop(&mut self, obj_index: i32, nargs: usize) -> Result<(), i32>

source

pub fn safe_to_lstring(&mut self, obj_index: i32) -> String

source

pub fn throw(&mut self)

source

pub fn push_context_dump(&mut self)

source

pub fn get_stack_dump(&mut self) -> String

source

pub fn eval(&mut self, code: &str) -> Result<(), JsError>

source

pub fn eval_file(&mut self, filename: &str, code: &str) -> Result<(), JsError>

source

pub fn compile(&mut self, code: &str) -> Result<(), JsError>

source

pub fn compile_file( &mut self, filename: &str, code: &str ) -> Result<(), JsError>

source

pub fn write<O: WriteJs>(&mut self, obj: &O) -> Result<(), JsError>

source

pub fn read<O: ReadJs>(&mut self, obj_index: i32) -> Result<O, JsError>

source

pub fn read_top<O: ReadJs>(&mut self) -> Result<O, JsError>

Trait Implementations§

source§

impl Debug for JsEngine

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for JsEngine

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.