Creates a new StreamChannel that communicates over
This specifically enforces the second guarantee: closing the sink causes the stream to close before it emits any more events. This guarantee is invalidated when an asynchronous gap is added between the original stream's event dispatch and the returned stream's, for example by transforming it with a StreamTransformer. This is a lighter-weight way of preserving that guarantee in particular than StreamChannel.withGuarantees.
factory StreamChannel.withCloseGuarantee( Stream<T> stream, StreamSink<T> sink) => CloseGuaranteeChannel(stream, sink);