Trait jlrs::extensions::multitask::async_task::AsyncTask [−][src]
pub trait AsyncTask: 'static + Send + Sync {
type Output: 'static + Send + Sync;
const RUN_SLOTS: usize;
const REGISTER_SLOTS: usize;
fn run<'base, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
global: Global<'base>,
frame: &'life1 mut AsyncGcFrame<'base>
) -> Pin<Box<dyn Future<Output = JlrsResult<Self::Output>> + 'async_trait>>
where
'base: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn register<'frame, 'life0, 'async_trait>(
_global: Global<'frame>,
_frame: &'life0 mut AsyncGcFrame<'frame>
) -> Pin<Box<dyn Future<Output = JlrsResult<()>> + 'async_trait>>
where
'frame: 'async_trait,
'life0: 'async_trait,
{ ... }
}
Expand description
A task that returns once. In order to schedule the task you must use AsyncJulia::task
or
AsyncJulia::try_task
.
Associated Types
Associated Constants
const REGISTER_SLOTS: usize
const REGISTER_SLOTS: usize
The number of slots preallocated for the AsyncGcFrame
provided to register
.
Required methods
fn run<'base, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
global: Global<'base>,
frame: &'life1 mut AsyncGcFrame<'base>
) -> Pin<Box<dyn Future<Output = JlrsResult<Self::Output>> + 'async_trait>> where
'base: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn run<'base, 'life0, 'life1, 'async_trait>(
&'life0 mut self,
global: Global<'base>,
frame: &'life1 mut AsyncGcFrame<'base>
) -> Pin<Box<dyn Future<Output = JlrsResult<Self::Output>> + 'async_trait>> where
'base: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Run this task. This method takes a Global
and a mutable reference to an AsyncGcFrame
,
which lets you interact with Julia.
Provided methods
fn register<'frame, 'life0, 'async_trait>(
_global: Global<'frame>,
_frame: &'life0 mut AsyncGcFrame<'frame>
) -> Pin<Box<dyn Future<Output = JlrsResult<()>> + 'async_trait>> where
'frame: 'async_trait,
'life0: 'async_trait,
fn register<'frame, 'life0, 'async_trait>(
_global: Global<'frame>,
_frame: &'life0 mut AsyncGcFrame<'frame>
) -> Pin<Box<dyn Future<Output = JlrsResult<()>> + 'async_trait>> where
'frame: 'async_trait,
'life0: 'async_trait,
Register the task. Note that this method is not called automatically, but only if
AsyncJulia::register_task
or AsyncJulia::try_register_task
is used. This method
can be implemented to take care of everything required to execute the task successfully,
like loading packages.