Skip to main content

Task

Trait Task 

Source
pub trait Task<'t> {
    // Required method
    fn poll(&mut self, ctx: &mut TaskCtx) -> TaskStep<'t>;

    // Provided methods
    fn priority(&self) -> u8 { ... }
    fn take_output(&mut self) -> Vec<String> { ... }
}
Expand description

A schedulable unit of work. 't ties any spawned children to the lifetime of borrowed data the task closes over (e.g. the interpreter’s borrowed AST).

Required Methods§

Source

fn poll(&mut self, ctx: &mut TaskCtx) -> TaskStep<'t>

Advance the task until its next scheduling point.

Provided Methods§

Source

fn priority(&self) -> u8

Scheduling priority — higher runs first under crate::SchedulePolicy::Priority. Defaults to 0 (all tasks equal).

Source

fn take_output(&mut self) -> Vec<String>

Output lines the task produced during the just-finished poll slice, in order. The work-stealing driver collects these per slice and flushes them in the deterministic pick-order apply, so concurrent output matches the cooperative interleaving byte-for-byte. Cooperative tasks write straight to their sink and leave this empty (the default).

Implementors§