pub trait Task: Send + 'static {
type Output: Send + 'static;
// Required methods
fn execute(self) -> Self::Output;
fn context(&self) -> &TaskContext;
// Provided methods
fn is_stealable(&self) -> bool { ... }
fn estimated_cost(&self) -> u32 { ... }
}Expand description
The core trait for executable tasks in the Moirai runtime.
Required Associated Types§
Required Methods§
Sourcefn context(&self) -> &TaskContext
fn context(&self) -> &TaskContext
Get the task context for scheduling and debugging.
Provided Methods§
Sourcefn is_stealable(&self) -> bool
fn is_stealable(&self) -> bool
Check if this task can be stolen by another thread.
Sourcefn estimated_cost(&self) -> u32
fn estimated_cost(&self) -> u32
Estimate the computational cost of this task (for load balancing).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".