Struct quickjs_runtime::utils::single_threaded_event_queue::SingleThreadedEventQueue[][src]

pub struct SingleThreadedEventQueue { /* fields omitted */ }

the EsEventQueue is a single threaded thread pool which is used to act as the only thread using an instance of a script runtime besides being able to add tasks from any thread by add_task a running task can add jobs to the current thread by calling add_task_from_worker those tasks need not impl the Send trait and there is no locking happening to add the task to the queue

Implementations

impl SingleThreadedEventQueue[src]

pub fn new() -> Arc<Self>[src]

pub fn shutdown(&self)[src]

pub fn add_task<T: FnOnce() + Send + 'static>(&self, task: T)[src]

add a task which will run asynchronously

pub fn async_task<T: FnOnce() -> R + Send + 'static, R: Send + 'static>(
    &self,
    task: T
) -> impl Future<Output = R>
[src]

pub fn exe_task<R: Send + 'static, T: FnOnce() -> R + Send + 'static>(
    &self,
    task: T
) -> R
[src]

execute a task synchronously in the worker thread

pub fn add_task_from_worker<T: FnOnce() + 'static>(&self, task: T)[src]

method for adding tasks from worker, these do not need to impl Send also there is no locks we need to wait for

pub fn schedule_task_from_worker<T: Fn() + 'static>(
    &self,
    task: T,
    interval: Option<Duration>,
    delay: Duration
) -> i32
[src]

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

pub fn todo_count(&self) -> usize[src]

pub fn assert_is_worker_thread(&self)[src]

Trait Implementations

impl Drop for SingleThreadedEventQueue[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> Pointable for T

type Init = T

The type for initializers.

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>,