[][src]Trait ffi_helpers::task::Task

pub trait Task: Send + Sync + Clone {
    type Output: Send + Sync;
    fn run(&self, cancel_tok: &CancellationToken) -> Result<Self::Output, Error>;
}

A cancellable task which is meant to be run in a background thread.

For more information on the Task API, refer to the module documentation.

Associated Types

type Output: Send + Sync

Loading content...

Required methods

fn run(&self, cancel_tok: &CancellationToken) -> Result<Self::Output, Error>

Run this task to completion synchronously, exiting early if the provided CancellationToken is triggered.

You probably shouldn't call this function directly. Instead prefer higher level abstractions like TaskHandle::spawn() or bindings generated by the export_task!() macro.

Loading content...

Implementors

Loading content...