Protocolswift-nio 2.72.0NIOCore
NIOAsyncSequenceProducerBackPressureStrategy
A protocol for the back-pressure strategy of the NIOAsyncSequenceProducer
.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
protocol NIOAsyncSequenceProducerBackPressureStrategy : Sendable
A back-pressure strategy is invoked when new elements are yielded to the sequence or when a AsyncIterator
requested the next value. The responsibility of the strategy is to determine whether more elements need to be produced .
If more elements need to be produced, either the produceMore
method will be called or a YieldResult
will be returned that indicates to produce more.
Supertypes
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
Requirements
Instance members
func didConsume(bufferDepth: Int
) -> Bool This method is called after the consumer consumed an element. More specifically this method is called after
next
was called on an iterator of theNIOAsyncSequenceProducer
.func didYield(bufferDepth: Int
) -> Bool This method is called after new elements were yielded by the producer to the source.
See also
struct NIOAsyncSequenceProducer<Element, Strategy, Delegate>
This is an
AsyncSequence
that supports a unicastAsyncIterator
.struct NIOThrowingAsyncSequenceProducer<Element, Failure, Strategy, Delegate>
This is an
AsyncSequence
that supports a unicastAsyncIterator
.enum NIOAsyncSequenceProducerBackPressureStrategies
protocol NIOAsyncSequenceProducerDelegate
The delegate of
NIOAsyncSequenceProducer
.struct NIOAsyncWriter<Element, Delegate>
A
NIOAsyncWriter
is a type used to bridge elements from the Swift Concurrency domain into a synchronous world. TheTask
s that are yielding to theNIOAsyncWriter
are the producers. Whereas theNIOAsyncWriterSinkDelegate
is the consumer.protocol NIOAsyncWriterSinkDelegate
The delegate of the
NIOAsyncWriter
. It is the consumer of the yielded writes to theNIOAsyncWriter
. Furthermore, the delegate gets informed when theNIOAsyncWriter
terminated.