Module std.pipeline
Bounded concurrent adapters for owned iterators.
Adapters own their source and start work when iterated. Closing an adapter, leaving its loop early, or cancelling its consumer cancels and joins its child tasks before releasing the source and buffered values.
Contents
Functions
Function prefetch
pub gen fn prefetch<I, T>(consume source: I, capacity: i64 = 8) -> T where I: Iterator<Item = T> + Send, T: Send
Read ahead into a bounded channel using one producer task.
capacity must be positive. The source and its items must be
Send. The
channel holds at most capacity items, with one further item in the producer.
Function map
pub gen fn map<I, T, U>(consume source: I, transform: fn(consume T) -> U, concurrency: i64 = 4, order: Order = …) -> U where I: Iterator<Item = T> + Send, T: Send, U: Send
Transform items with at most concurrency workers.
Input order is the default; Completion emits each available result. A
shared admission limit bounds active jobs and results waiting for emission.
Each worker receives its own copy of the cloneable transform, whose captures
must be Send. Failures propagate through
the owning scope; items are not retried.
The transform owns each input. It may return that same resource to forward
ownership downstream, or return a new value. Inputs left in the transform
receive ordinary cleanup on return, fault or cancellation.
concurrency must be positive.
Types
Enum Order
Whether map emits source order or the order in which workers finish.
Variants
InputCompletion