final case class Countdown[T](i: Long, n: Long) extends Endo[T, Nothing]
An endomorphic stage that passes its input through for exactly n invocations and then signals pipeline completion.
On each of the first n − 1 calls the stage yields h8io.stages.Status.Success and decrements its counter. On the n-th call it yields h8io.stages.Status.Complete and resets to n. After any h8io.stages.Status.Complete the stage also resets to n, ready for reuse — whether it was applied in that run or skipped.
Countdown is fully immutable: each state transition creates a new instance rather than mutating the current one.
Preconditions (checked at construction via require, which throws an IllegalArgumentException):
n > 0
1 ≤ i ≤ n
Type parameters
T
the value type passed through unchanged
Value parameters
i
the remaining number of successful yields before completion (1 ≤ i ≤ n)
Composes this stage with that, feeding this stage's output into it. See the ''Composition'' section above for what happens when there is no output to feed.
Composes this stage with that, feeding this stage's output into it. See the ''Composition'' section above for what happens when there is no output to feed.