pub trait Task<CONTEXT: Send + Sync, ERROR: Error + Send + Sync, RESOURCE: Clone + Debug + DeserializeOwned + Resource<DynamicType = ()> + Send + Sync>: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn run(
&self,
res: Arc<RESOURCE>,
ctx: Arc<CONTEXT>,
) -> impl Future<Output = Result<TaskStatus, ERROR>> + Send;
}
Expand description
A task.
Required Methods§
Sourcefn run(
&self,
res: Arc<RESOURCE>,
ctx: Arc<CONTEXT>,
) -> impl Future<Output = Result<TaskStatus, ERROR>> + Send
fn run( &self, res: Arc<RESOURCE>, ctx: Arc<CONTEXT>, ) -> impl Future<Output = Result<TaskStatus, ERROR>> + Send
Run the task. Arguments:
res
: the resourcectx
: the context of the application
It should return TaskStatus::Completed
if the task is done and TaskStatus::InProgress
if it is not.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.