pub struct DukContextGuard<'a> { /* private fields */ }Implementations§
Source§impl<'a> DukContextGuard<'a>
impl<'a> DukContextGuard<'a>
pub fn new(ctx: DukContext) -> Self
Methods from Deref<Target = DukContext>§
pub fn normalize_index(&self, index: i32) -> i32
pub fn get_top(&self) -> i32
pub fn dup(&self, index: i32)
pub fn remove(&self, index: i32)
pub fn pop(&self)
pub fn pop_n(&self, n: i32)
pub fn swap(&self, idx1: i32, idx2: i32)
pub fn push_this(&self)
pub fn push_thread(&self) -> i32
pub fn push_thread_new_globalenv(&self) -> i32
pub fn push_global_object(&self)
pub fn push_boolean(&self, value: bool)
pub fn push_null(&self)
pub fn push_undefined(&self)
pub fn push_i32(&self, value: i32)
pub fn push_u32(&self, value: u32)
pub fn push_number(&self, value: f64)
pub fn push_string(&self, value: &str)
pub fn push_object(&self) -> i32
pub fn push_ext_buffer(&self, data: &[u8])
pub fn push_array(&self) -> i32
pub fn push_function(&self, func_name: &str, nargs: i32)
pub fn put_prop_function(&self, obj_index: i32, func_name: &str, nargs: i32)
pub fn put_global_function(&self, func_name: &str, nargs: i32)
pub fn get_type(&self, index: i32) -> DukType
pub fn is_string(&self, index: i32) -> bool
pub fn is_number(&self, index: i32) -> bool
pub fn is_object(&self, index: i32) -> bool
pub fn is_array(&self, index: i32) -> bool
pub fn is_pure_object(&self, index: i32) -> bool
pub fn get_string(&self, index: i32) -> &str
pub fn get_buffer(&self, index: i32) -> &[u8] ⓘ
pub fn get_number(&self, index: i32) -> f64
pub fn get_boolean(&self, index: i32) -> bool
pub fn get_context(&self, index: i32) -> Result<DukContextGuard<'_>, JsError>
pub fn get_prop(&self, obj_index: i32) -> bool
pub fn put_prop(&self, obj_index: i32)
pub fn get_prop_string(&self, obj_index: i32, key: &str) -> bool
pub fn put_prop_string(&self, obj_index: i32, key: &str)
pub fn get_prop_index(&self, obj_index: i32, index: u32) -> bool
pub fn put_prop_index(&self, obj_index: i32, index: u32)
pub fn get_global_string(&self, key: &str) -> bool
pub fn put_global_string(&self, key: &str)
pub fn get_length(&self, obj_index: i32) -> usize
pub fn enum_indices(&self, obj_index: i32)
pub fn enum_keys(&self, obj_index: i32)
pub fn next(&self, obj_index: i32) -> bool
pub fn call_prop(&self, obj_index: i32, nargs: usize)
pub fn pcall(&self, nargs: usize) -> Result<(), i32>
pub fn pcall_method(&self, nargs: usize) -> Result<(), i32>
pub fn pcall_prop(&self, obj_index: i32, nargs: usize) -> Result<(), i32>
pub fn safe_to_lstring(&self, obj_index: i32) -> String
pub fn throw(&self)
pub fn push_context_dump(&self)
pub fn get_stack_dump(&self) -> String
Sourcepub fn propagate_js_error<T>(
&self,
js_res: Result<T, i32>,
) -> Result<T, JsError>
pub fn propagate_js_error<T>( &self, js_res: Result<T, i32>, ) -> Result<T, JsError>
Propagate JS error to Rust, popping the error from the stack. js_res: Result<(), i32> - JS result returned by protected call functions. If it is an error, it will be converted to JsError. This method should be called immediately after a protected call to handle the error.
pub fn eval(&self, code: &str) -> Result<(), JsError>
pub fn eval_file(&self, filename: &str, code: &str) -> Result<(), JsError>
pub fn compile(&self, code: &str) -> Result<(), JsError>
pub fn compile_file(&self, filename: &str, code: &str) -> Result<(), JsError>
pub fn write<O: WriteJs>(&self, obj: &O) -> Result<(), JsError>
pub fn read<O: ReadJs>(&self, obj_index: i32) -> Result<O, JsError>
pub fn read_top<O: ReadJs>(&self) -> Result<O, JsError>
Sourcepub fn init_console(&self)
pub fn init_console(&self)
Initialize console functions.
pub fn xcopy_top(&self, from: &DukContext, count: i32)
pub fn xmove_top(&self, from: &mut DukContext, count: i32)
pub fn check_stack(&self, extra: i32) -> Result<(), JsError>
pub fn check_stack_top(&self, top: i32) -> Result<(), JsError>
pub fn set_global_object(&self)
pub fn gc(&self)
Trait Implementations§
Source§impl Debug for DukContextGuard<'_>
impl Debug for DukContextGuard<'_>
Source§impl Deref for DukContextGuard<'_>
impl Deref for DukContextGuard<'_>
Auto Trait Implementations§
impl<'a> Freeze for DukContextGuard<'a>
impl<'a> !RefUnwindSafe for DukContextGuard<'a>
impl<'a> !Send for DukContextGuard<'a>
impl<'a> !Sync for DukContextGuard<'a>
impl<'a> Unpin for DukContextGuard<'a>
impl<'a> !UnwindSafe for DukContextGuard<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more