Timed
fs2.Pull$.Timed
An abstraction for writing Pull
computations that can timeout while reading from a Stream
.
A Pull.Timed
is not created or intepreted directly, but by calling Stream.ToPull.timed.
yourStream.pull.timed(tp => ...).stream
The argument to timed
is a Pull.Timed[F, O] => Pull[F, O2, R]
function, which describes the pulling logic and is often recursive, with shape:
def go(timedPull: Pull.Timed[F, A]): Pull[F, B, Unit] =
timedPull.uncons.flatMap {
case Some((Right(chunk), next)) => doSomething >> go(next)
case Some((Left(_), next)) => doSomethingElse >> go(next)
case None => Pull.done
}
Where doSomething
and doSomethingElse
are Pull
computations such as Pull.output
, in addition to Pull.Timed.timeout
.
See below for detailed descriptions of timeout
and uncons
, and look at the Stream.ToPull.timed scaladoc for an example of usage.
Attributes
- Source
- Pull.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article