pub async fn stream_file<W: Write, S: IntoIterator<Item = Piece>>(
statements: S,
run: &mut Run<'_>,
sink: Sink<'_, W>,
pipeline: &Pipeline,
token: &CancellationToken,
) -> Result<u64>Expand description
Runs a file of statements, writing each record as its statement finishes.
This is the second clause of Proof 5: a long command file holds no more at its last statement than at its first. The statements arrive one at a time from the cut and each record leaves as it is made, so nothing here grows with the count of statements.
§Why a cut answer does not cut the run
The output operations decide records, not statements. A ceiling reached part way through stops the records leaving; it must never stop the file being applied, because a statement not run is a different thing from a row not printed, and a script half applied is exactly what FR-028 forbids. The run therefore carries on to the end, and the answer that was cut simply closes without the record that would declare it whole.
sink carries the channel, the shape and the tail the closing record
declares besides the count: the command that produced the records and the
destination they came from, which a flow has no envelope of its own to carry
(FR-143).
§Errors
Returns the failure of the first statement that produced one, and a limit failure when the reader closed the output channel.