NPRPC docs

struct WindowedIterator

Swift

struct WindowedIterator

Custom iterator that sends the window update after consuming a chunk, i.e. after base.next() returns the value. This is the correct backpressure pattern: credit for chunk N is granted once Swift has received it, not speculatively before requesting N+1. Calling windowUpdateFn before the await on base.next() — even when the buffer already holds data — created a suspension-point race on single-core hosts that caused the iterator to miss the final chunk.

nprpc_swift/Sources/NPRPC/StreamReader.swift:144

Methods