pub trait Task: Serialize + DeserializeOwned + Send + Sync + 'static {
    type Output: Serialize + DeserializeOwned + Send + Sync + 'static;
    // Provided methods
    fn worker_selector() -> WorkerSelector { ... }
    fn format() -> TaskDataFormat { ... }
    fn timeout() -> TimeoutPolicy { ... }
    fn task(&self) -> TaskDefinition<Self>
       where Self: Serialize { ... }
}Expand description
A strongly-typed serializable task type.
Required Associated Types§
Provided Methods§
sourcefn worker_selector() -> WorkerSelector
 
fn worker_selector() -> WorkerSelector
The worker selector of the given type, defaults to the type’s name without the module path and any generics.
sourcefn format() -> TaskDataFormat
 
fn format() -> TaskDataFormat
Input and output data format to be used for serialization.
Defaults to TaskDataFormat::Json.
sourcefn timeout() -> TimeoutPolicy
 
fn timeout() -> TimeoutPolicy
Return the default timeout policy.
Defaults to no timeout.
sourcefn task(&self) -> TaskDefinition<Self>where
    Self: Serialize,
 
fn task(&self) -> TaskDefinition<Self>where Self: Serialize,
Create a task definition that contains the worker
selector returned by Task::worker_selector and self
serialized as the task data.
Panics
Panics if Task::format is TaskDataFormat::Unknown,
or serialization fails.
Object Safety§
This trait is not object safe.