#[stream_task]Expand description
Apply to the StreamTask trait definition, an impl StreamTask<S [, K]> for T
block, or an inherent impl T { ... } block.
Use as #[cano::task::stream]. StreamTask is a genuine stream-processing model:
consume an impl Stream continuously, flush per [StreamWindow] window, run until
the workflow’s CancellationToken fires, and persist a resumable cursor (via
[Workflow::register_stream]). Per-item errors are governed by [StreamErrorPolicy].
Two surface forms on impl blocks:
- Trait-impl form:
#[task::stream] impl StreamTask<S> for T { type Item = ..; .. }. - Inherent-impl form:
#[task::stream(state = S [, key = K])] impl T { async fn open(..) .. }— the macro inferstype Itemfromprocess_item’s owneditemparameter andtype Output/type Cursorfrom theOk2-tuple ofprocess_item’s return, requiresopen/process_item/flush_window/on_close, and emits a companionimpl Task<S [, K]> for Twhoserunforwards toStreamTask::run_in_memory.
On a trait definition the macro just performs the async-fn-in-trait rewrite.
The default config() injected by the inherent form is [TaskConfig::minimal()]
(no outer retry — like PollTask; an outer retry would re-invoke open()).