Skip to content

Commit 09a48b1

Browse files
committed
minor
1 parent 71cb649 commit 09a48b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/shared/src/main/scala/fs2/Stream.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,10 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
15281528
s"State(os = $size, os = $os supplyEnded = $supplyEnded, streamExhausted = $streamExhausted)"
15291529
}
15301530

1531+
object State {
1532+
def add[A](a: A)(s: State[A]): State[A] = s.copy(os = s.os ++ Chunk.singleton(a))
1533+
}
1534+
15311535
if (timeout.toNanos == 0) chunkN(chunkSize)
15321536
else
15331537
Stream.force {
@@ -1539,7 +1543,7 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
15391543
val groupSize = chunkSize.toLong
15401544

15411545
val enqueue: F2[Unit] =
1542-
evalTap(o => state.update(s => s.copy(os = s.os ++ Chunk.singleton(o))) *> supply.release)
1546+
evalTap(o => state.update(State.add[O](o)) *> supply.release)
15431547
.covary[F2]
15441548
.compile
15451549
.drain

0 commit comments

Comments
 (0)