Struct quickjs_runtime::quickjscontext::QuickJsContext[][src]

pub struct QuickJsContext {
    pub id: String,
    pub context: *mut JSContext,
    // some fields omitted
}

Fields

id: Stringcontext: *mut JSContext

Implementations

impl QuickJsContext[src]

pub unsafe fn get_id(context: *mut JSContext) -> &'static str[src]

get the id of a QuickJsContext from a JSContext

Safety

when passing a context ptr please be sure that the corresponding QuickJsContext is still active

pub fn call_function(
    &self,
    namespace: Vec<&str>,
    func_name: &str,
    arguments: Vec<JSValueRef>
) -> Result<JSValueRef, EsError>
[src]

call a function by namespace and name

pub fn eval(&self, script: EsScript) -> Result<JSValueRef, EsError>[src]

evaluate a script

pub unsafe fn eval_ctx(
    context: *mut JSContext,
    script: EsScript
) -> Result<JSValueRef, EsError>
[src]

Safety

when passing a context ptr please be sure that the corresponding QuickJsContext is still active

pub fn eval_module(&self, script: EsScript) -> Result<JSValueRef, EsError>[src]

evaluate a Module

pub unsafe fn eval_module_ctx(
    context: *mut JSContext,
    script: EsScript
) -> Result<JSValueRef, EsError>
[src]

Safety

when passing a context ptr please be sure that the corresponding QuickJsContext is still active

pub fn report_ex(&self, err: &str) -> JSValue[src]

throw an internal error to quickjs and create a new ex obj

pub unsafe fn report_ex_ctx(context: *mut JSContext, err: &str) -> JSValue[src]

throw an Error in the runtime and init an Exception JSValue to return

Safety

when passing a context ptr please be sure that the corresponding QuickJsContext is still active

pub fn get_exception_ctx(&self) -> Option<EsError>[src]

Get the last exception from the runtime, and if present, convert it to a EsError.

pub unsafe fn get_exception(context: *mut JSContext) -> Option<EsError>[src]

Get the last exception from the runtime, and if present, convert it to a EsError.

Safety

When passing a context pointer please make sure the corresponding QuickJsContext is still valid

pub fn cache_object(&self, obj: JSValueRef) -> i32[src]

pub fn remove_cached_obj_if_present(&self, id: i32)[src]

pub fn consume_cached_obj(&self, id: i32) -> JSValueRef[src]

pub fn with_cached_obj<C, R>(&self, id: i32, consumer: C) -> R where
    C: FnOnce(JSValueRef) -> R, 
[src]

pub unsafe fn with_context<C, R>(context: *mut JSContext, consumer: C) -> R where
    C: FnOnce(&QuickJsContext) -> R, 
[src]

Safety

When passing a context pointer please make sure the corresponding QuickJsContext is still valid

Trait Implementations

impl Drop for QuickJsContext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,