pub trait TaskExecutor:
Sync
+ Send
+ 'static {
// Required methods
fn execute_task(&self, task: Task) -> BoxFuture<'static, Result<()>>;
fn can_execute(&self, task: &Task) -> bool;
}
Expand description
Interface to a task executor
Required Methods§
Sourcefn execute_task(&self, task: Task) -> BoxFuture<'static, Result<()>>
fn execute_task(&self, task: Task) -> BoxFuture<'static, Result<()>>
Execute the given task. The function is expected to block until the execution is completed. It will be called from an async context by the default executor.
Sourcefn can_execute(&self, task: &Task) -> bool
fn can_execute(&self, task: &Task) -> bool
Check if the given executor can execute the task