[][src]Trait jlrs::traits::multitask::JuliaTask

pub trait JuliaTask: Send + Sync + 'static {
    type T: 'static + Send + Sync;
    type R: ReturnChannel<T = Self::T>;
#[must_use]    fn run<'base, 'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        global: Global<'base>,
        frame: &'life1 mut AsyncFrame<'base>
    ) -> Pin<Box<dyn Future<Output = JlrsResult<Self::T>> + 'async_trait>>
    where
        'base: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn return_channel(&self) -> Option<&Self::R> { ... } }

The JuliaTask trait is used to create tasks that the async runtime can execute. Implementations of this trait take the place of the closures used with the sync runtime.

Associated Types

type T: 'static + Send + Sync

The type of the result of this task. Must be the same across all implementations.

type R: ReturnChannel<T = Self::T>

The type of the sender that is used to send the result of this task back to the original caller. Must be the same across all implementations.

Loading content...

Required methods

#[must_use]fn run<'base, 'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    global: Global<'base>,
    frame: &'life1 mut AsyncFrame<'base>
) -> Pin<Box<dyn Future<Output = JlrsResult<Self::T>> + 'async_trait>> where
    'base: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

The entrypoint of a task. You can use the Global and AsyncFrame to call arbitrary functions from Julia. Additionally, Value::call_async can be used to call a function on another thread and allow other tasks to progress while awaiting the result. Implementations that don't use Value::call_async will block the runtime during execution.

Loading content...

Provided methods

fn return_channel(&self) -> Option<&Self::R>

The return channel for this task, or None if the result doesn't need to be returned. Returns None by default.

Loading content...

Implementors

Loading content...