Struct quickjs_runtime::facades::QuickjsRuntimeFacadeInner
source · [−]pub struct QuickjsRuntimeFacadeInner { /* private fields */ }
Implementations
sourceimpl QuickjsRuntimeFacadeInner
impl QuickjsRuntimeFacadeInner
sourcepub fn add_task_to_event_loop_void<C>(&self, task: C) where
C: FnOnce() + Send + 'static,
pub fn add_task_to_event_loop_void<C>(&self, task: C) where
C: FnOnce() + Send + 'static,
this can be used to run a function in the event_queue thread for the QuickJSRuntime without borrowing the q_js_rt
pub fn exe_task_in_event_loop<C, R: Send + 'static>(&self, task: C) -> R where
C: FnOnce() -> R + Send + 'static,
pub fn add_task_to_event_loop<C, R: Send + 'static>(
&self,
task: C
) -> impl Future<Output = R> where
C: FnOnce() -> R + Send + 'static,
sourcepub fn add_rt_task_to_event_loop<C, R: Send + 'static>(
&self,
consumer: C
) -> impl Future<Output = R> where
C: FnOnce(&QuickJsRuntimeAdapter) -> R + Send + 'static,
pub fn add_rt_task_to_event_loop<C, R: Send + 'static>(
&self,
consumer: C
) -> impl Future<Output = R> where
C: FnOnce(&QuickJsRuntimeAdapter) -> R + Send + 'static,
this is how you add a closure to the worker thread which has an instance of the QuickJsRuntime this will run asynchronously
example
use quickjs_runtime::builder::QuickJsRuntimeBuilder;
let rt = QuickJsRuntimeBuilder::new().build();
rt.add_rt_task_to_event_loop(|q_js_rt| {
// here you are in the worker thread and you can use the quickjs_utils
q_js_rt.gc();
});
pub fn add_rt_task_to_event_loop_void<C>(&self, consumer: C) where
C: FnOnce(&QuickJsRuntimeAdapter) + Send + 'static,
pub fn exe_rt_task_in_event_loop<C, R: Send + 'static>(&self, consumer: C) -> R where
C: FnOnce(&QuickJsRuntimeAdapter) -> R + Send + 'static,
Trait Implementations
sourceimpl JsRuntimeFacadeInner for QuickjsRuntimeFacadeInner
impl JsRuntimeFacadeInner for QuickjsRuntimeFacadeInner
type JsRuntimeFacadeType = QuickJsRuntimeFacade
sourcefn js_exe_rt_task_in_event_loop<R: Send + 'static, J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) -> R + Send + 'static>(
&self,
task: J
) -> R
fn js_exe_rt_task_in_event_loop<R: Send + 'static, J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) -> R + Send + 'static>(
&self,
task: J
) -> R
run a closure in the EventLoop with a &JsRuntimeAdapter as only param and await the result blocking
sourcefn js_add_rt_task_to_event_loop<R: Send + 'static, J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) -> R + Send + 'static>(
&self,
task: J
) -> Pin<Box<dyn Future<Output = R> + Send>>
fn js_add_rt_task_to_event_loop<R: Send + 'static, J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) -> R + Send + 'static>(
&self,
task: J
) -> Pin<Box<dyn Future<Output = R> + Send>>
run a closure in the EventLoop with a &JsRuntimeAdapter as only param and return a future which will fulfill after the closure has been called
sourcefn js_add_rt_task_to_event_loop_void<J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) + Send + 'static>(
&self,
task: J
)
fn js_add_rt_task_to_event_loop_void<J: FnOnce(&<<Self as JsRuntimeFacadeInner>::JsRuntimeFacadeType as JsRuntimeFacade>::JsRuntimeAdapterType) + Send + 'static>(
&self,
task: J
)
run a closure in the EventLoop with a &JsRuntimeAdapter as only param
Auto Trait Implementations
impl !RefUnwindSafe for QuickjsRuntimeFacadeInner
impl Send for QuickjsRuntimeFacadeInner
impl Sync for QuickjsRuntimeFacadeInner
impl Unpin for QuickjsRuntimeFacadeInner
impl !UnwindSafe for QuickjsRuntimeFacadeInner
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more