A sink consumes the items of a Feed, driving the pipe that feeds it and computing the final result; one able
to decide its outcome early may stop consuming before the source runs dry.
Stating the item type alone, as Sink<V>, names any sink drawing V items whatever it resolves to, so sinks are
held together under a common type or handed over as arguments with no result to agree on. A pipe closed by a sink
declared that way resolves to unknown: state the result type wherever it is meant to be read.
The sink draws from a feed, so it may either iterate it with for await or compose it with further tasks and sinks,
delegating the whole computation or part of it to operations already available.
Caution
The feed handed over must be assumed to be drained by a single pass.
Type Parameters
V
The type of items drawn from the feed
R = unknown
The type of result computed over the items, defaulting to unknown for sinks whose result is of no
interest
Terminal operation applied to a feed.
A sink consumes the items of a Feed, driving the pipe that feeds it and computing the final result; one able to decide its outcome early may stop consuming before the source runs dry.
Stating the item type alone, as
Sink<V>, names any sink drawingVitems whatever it resolves to, so sinks are held together under a common type or handed over as arguments with no result to agree on. A pipe closed by a sink declared that way resolves tounknown: state the result type wherever it is meant to be read.The sink draws from a feed, so it may either iterate it with
for awaitor compose it with further tasks and sinks, delegating the whole computation or part of it to operations already available.The feed handed over must be assumed to be drained by a single pass.